digitaluapi

<back to all web services

CompaniesAdd

Requires Authentication
Requires any of the roles:Client, Admin, Partner
The following routes are available for this service:
POST/companies
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


class CompaniesAddResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $Name=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $RegNo=null,

        // @DataMember(Order=4)
        /** @var int|null */
        public ?int $CountriesId=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $State=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $City=null,

        // @DataMember(Order=7)
        /** @var string|null */
        public ?string $StreetAddress=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $Zip=null,

        // @DataMember(Order=9)
        /** @var string|null */
        public ?string $TaxNo=null,

        // @DataMember(Order=10)
        /** @var float|null */
        public ?float $SalesTaxPercentage=null,

        // @DataMember(Order=11)
        /** @var string|null */
        public ?string $Email=null,

        // @DataMember(Order=12)
        /** @var string|null */
        public ?string $Website=null,

        // @DataMember(Order=13)
        /** @var string|null */
        public ?string $PhoneNumber=null,

        // @DataMember(Order=14)
        /** @var string|null */
        public ?string $LogoUrl=null,

        // @DataMember(Order=15)
        /** @var int */
        public int $CurrenciesId=0,

        // @DataMember(Order=16)
        /** @var int */
        public int $StatusCodesId=0,

        // @DataMember(Order=17)
        /** @var float|null */
        public ?float $Lat=null,

        // @DataMember(Order=18)
        /** @var float|null */
        public ?float $Lng=null,

        // @DataMember(Order=20)
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RegNo'])) $this->RegNo = $o['RegNo'];
        if (isset($o['CountriesId'])) $this->CountriesId = $o['CountriesId'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['StreetAddress'])) $this->StreetAddress = $o['StreetAddress'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['TaxNo'])) $this->TaxNo = $o['TaxNo'];
        if (isset($o['SalesTaxPercentage'])) $this->SalesTaxPercentage = $o['SalesTaxPercentage'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Website'])) $this->Website = $o['Website'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['LogoUrl'])) $this->LogoUrl = $o['LogoUrl'];
        if (isset($o['CurrenciesId'])) $this->CurrenciesId = $o['CurrenciesId'];
        if (isset($o['StatusCodesId'])) $this->StatusCodesId = $o['StatusCodesId'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RegNo)) $o['RegNo'] = $this->RegNo;
        if (isset($this->CountriesId)) $o['CountriesId'] = $this->CountriesId;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->StreetAddress)) $o['StreetAddress'] = $this->StreetAddress;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->TaxNo)) $o['TaxNo'] = $this->TaxNo;
        if (isset($this->SalesTaxPercentage)) $o['SalesTaxPercentage'] = $this->SalesTaxPercentage;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Website)) $o['Website'] = $this->Website;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->LogoUrl)) $o['LogoUrl'] = $this->LogoUrl;
        if (isset($this->CurrenciesId)) $o['CurrenciesId'] = $this->CurrenciesId;
        if (isset($this->StatusCodesId)) $o['StatusCodesId'] = $this->StatusCodesId;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class CompaniesAdd implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=2)
        /** @var string|null */
        public ?string $Name=null,

        // @DataMember(Order=3)
        /** @var string|null */
        public ?string $RegNo=null,

        // @DataMember(Order=4)
        /** @var int|null */
        public ?int $CountriesId=null,

        // @DataMember(Order=5)
        /** @var string|null */
        public ?string $State=null,

        // @DataMember(Order=6)
        /** @var string|null */
        public ?string $City=null,

        // @DataMember(Order=7)
        /** @var string|null */
        public ?string $StreetAddress=null,

        // @DataMember(Order=8)
        /** @var string|null */
        public ?string $Zip=null,

        // @DataMember(Order=9)
        /** @var string|null */
        public ?string $TaxNo=null,

        // @DataMember(Order=10)
        /** @var float|null */
        public ?float $SalesTaxPercentage=null,

        // @DataMember(Order=11)
        /** @var string|null */
        public ?string $Email=null,

        // @DataMember(Order=12)
        /** @var string|null */
        public ?string $Website=null,

        // @DataMember(Order=13)
        /** @var string|null */
        public ?string $PhoneNumber=null,

        // @DataMember(Order=14)
        /** @var string|null */
        public ?string $LogoUrl=null,

        // @DataMember(Order=15)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $CurrenciesId=0,

        // @DataMember(Order=16)
        // @Validate(Validator="NotNull")
        /** @var int */
        public int $StatusCodesId=0,

        // @DataMember(Order=17)
        /** @var float|null */
        public ?float $Lat=null,

        // @DataMember(Order=18)
        /** @var float|null */
        public ?float $Lng=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['RegNo'])) $this->RegNo = $o['RegNo'];
        if (isset($o['CountriesId'])) $this->CountriesId = $o['CountriesId'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['StreetAddress'])) $this->StreetAddress = $o['StreetAddress'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['TaxNo'])) $this->TaxNo = $o['TaxNo'];
        if (isset($o['SalesTaxPercentage'])) $this->SalesTaxPercentage = $o['SalesTaxPercentage'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['Website'])) $this->Website = $o['Website'];
        if (isset($o['PhoneNumber'])) $this->PhoneNumber = $o['PhoneNumber'];
        if (isset($o['LogoUrl'])) $this->LogoUrl = $o['LogoUrl'];
        if (isset($o['CurrenciesId'])) $this->CurrenciesId = $o['CurrenciesId'];
        if (isset($o['StatusCodesId'])) $this->StatusCodesId = $o['StatusCodesId'];
        if (isset($o['Lat'])) $this->Lat = $o['Lat'];
        if (isset($o['Lng'])) $this->Lng = $o['Lng'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->RegNo)) $o['RegNo'] = $this->RegNo;
        if (isset($this->CountriesId)) $o['CountriesId'] = $this->CountriesId;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->StreetAddress)) $o['StreetAddress'] = $this->StreetAddress;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->TaxNo)) $o['TaxNo'] = $this->TaxNo;
        if (isset($this->SalesTaxPercentage)) $o['SalesTaxPercentage'] = $this->SalesTaxPercentage;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->Website)) $o['Website'] = $this->Website;
        if (isset($this->PhoneNumber)) $o['PhoneNumber'] = $this->PhoneNumber;
        if (isset($this->LogoUrl)) $o['LogoUrl'] = $this->LogoUrl;
        if (isset($this->CurrenciesId)) $o['CurrenciesId'] = $this->CurrenciesId;
        if (isset($this->StatusCodesId)) $o['StatusCodesId'] = $this->StatusCodesId;
        if (isset($this->Lat)) $o['Lat'] = $this->Lat;
        if (isset($this->Lng)) $o['Lng'] = $this->Lng;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CompaniesAdd DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other

HTTP + OTHER

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /companies HTTP/1.1 
Host: duengageapi.uat.scadsoftware.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"Name":"String","RegNo":"String","CountriesId":0,"State":"String","City":"String","StreetAddress":"String","Zip":"String","TaxNo":"String","SalesTaxPercentage":0,"Email":"String","Website":"String","PhoneNumber":"String","LogoUrl":"String","CurrenciesId":0,"StatusCodesId":0,"Lat":0,"Lng":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"Name":"String","RegNo":"String","CountriesId":0,"State":"String","City":"String","StreetAddress":"String","Zip":"String","TaxNo":"String","SalesTaxPercentage":0,"Email":"String","Website":"String","PhoneNumber":"String","LogoUrl":"String","CurrenciesId":0,"StatusCodesId":0,"Lat":0,"Lng":0,"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}