Trendsic Platform Service

<back to all web services

QueueCustomerRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/Customers/{Id}
GET,POST,PUT,DELETE,OPTIONS/v1/Customers
<?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 QueueCustomer implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $Id='',
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $Address1=null,
        /** @var string|null */
        public ?string $Address2=null,
        /** @var string|null */
        public ?string $City=null,
        /** @var string|null */
        public ?string $State=null,
        /** @var string|null */
        public ?string $Zip=null,
        /** @var string|null */
        public ?string $MobilePhone=null,
        /** @var string|null */
        public ?string $Email=null,
        /** @var DateTime */
        public DateTime $MarketingOptIn=new DateTime(),
        /** @var DateTime */
        public DateTime $DoNoContact=new DateTime(),
        /** @var DateTime */
        public DateTime $EntDate=new DateTime(),
        /** @var DateTime */
        public DateTime $ModDate=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Address1'])) $this->Address1 = $o['Address1'];
        if (isset($o['Address2'])) $this->Address2 = $o['Address2'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['State'])) $this->State = $o['State'];
        if (isset($o['Zip'])) $this->Zip = $o['Zip'];
        if (isset($o['MobilePhone'])) $this->MobilePhone = $o['MobilePhone'];
        if (isset($o['Email'])) $this->Email = $o['Email'];
        if (isset($o['MarketingOptIn'])) $this->MarketingOptIn = JsonConverters::from('DateTime', $o['MarketingOptIn']);
        if (isset($o['DoNoContact'])) $this->DoNoContact = JsonConverters::from('DateTime', $o['DoNoContact']);
        if (isset($o['EntDate'])) $this->EntDate = JsonConverters::from('DateTime', $o['EntDate']);
        if (isset($o['ModDate'])) $this->ModDate = JsonConverters::from('DateTime', $o['ModDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Address1)) $o['Address1'] = $this->Address1;
        if (isset($this->Address2)) $o['Address2'] = $this->Address2;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->State)) $o['State'] = $this->State;
        if (isset($this->Zip)) $o['Zip'] = $this->Zip;
        if (isset($this->MobilePhone)) $o['MobilePhone'] = $this->MobilePhone;
        if (isset($this->Email)) $o['Email'] = $this->Email;
        if (isset($this->MarketingOptIn)) $o['MarketingOptIn'] = JsonConverters::to('DateTime', $this->MarketingOptIn);
        if (isset($this->DoNoContact)) $o['DoNoContact'] = JsonConverters::to('DateTime', $this->DoNoContact);
        if (isset($this->EntDate)) $o['EntDate'] = JsonConverters::to('DateTime', $this->EntDate);
        if (isset($this->ModDate)) $o['ModDate'] = JsonConverters::to('DateTime', $this->ModDate);
        return empty($o) ? new class(){} : $o;
    }
}

class QueueCustomersResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<QueueCustomer>|null */
        public ?array $Customers=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('QueueCustomer', $o['Customers']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('QueueCustomer', $this->Customers);
        return empty($o) ? new class(){} : $o;
    }
}

class QueueCustomerRequest extends QueueCustomer implements JsonSerializable
{
    /**
     * @param string $Id
     * @param string|null $Name
     * @param string|null $Address1
     * @param string|null $Address2
     * @param string|null $City
     * @param string|null $State
     * @param string|null $Zip
     * @param string|null $MobilePhone
     * @param string|null $Email
     * @param DateTime $MarketingOptIn
     * @param DateTime $DoNoContact
     * @param DateTime $EntDate
     * @param DateTime $ModDate
     */
    public function __construct(
        string $Id='',
        ?string $Name=null,
        ?string $Address1=null,
        ?string $Address2=null,
        ?string $City=null,
        ?string $State=null,
        ?string $Zip=null,
        ?string $MobilePhone=null,
        ?string $Email=null,
        DateTime $MarketingOptIn=new DateTime(),
        DateTime $DoNoContact=new DateTime(),
        DateTime $EntDate=new DateTime(),
        DateTime $ModDate=new DateTime(),
        /** @var string */
        public string $ApiKey=''
    ) {
        parent::__construct($Id,$Name,$Address1,$Address2,$City,$State,$Zip,$MobilePhone,$Email,$MarketingOptIn,$DoNoContact,$EntDate,$ModDate);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
        return empty($o) ? new class(){} : $o;
    }
}

PHP QueueCustomerRequest 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 /v1/Customers/{Id} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"ApiKey":"00000000000000000000000000000000","Id":"00000000000000000000000000000000","Name":"String","Address1":"String","Address2":"String","City":"String","State":"String","Zip":"String","MobilePhone":"String","Email":"String","MarketingOptIn":"0001-01-01T00:00:00.0000000","DoNoContact":"0001-01-01T00:00:00.0000000","EntDate":"0001-01-01T00:00:00.0000000","ModDate":"0001-01-01T00:00:00.0000000"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"Customers":[{"Id":"00000000000000000000000000000000","Name":"String","Address1":"String","Address2":"String","City":"String","State":"String","Zip":"String","MobilePhone":"String","Email":"String","MarketingOptIn":"0001-01-01T00:00:00.0000000","DoNoContact":"0001-01-01T00:00:00.0000000","EntDate":"0001-01-01T00:00:00.0000000","ModDate":"0001-01-01T00:00:00.0000000"}]}