Trendsic Platform Service

<back to all web services

ContactHistoryRequest

Requires Authentication
Requires any of the roles:Worker, Agent, Administrator, Worker, Agent, Administrator, Worker, Agent, Administrator, Worker, Agent, Administrator
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/ContactHistory/{ContactHistoryId}
GET,POST,PUT,DELETE,OPTIONS/v1/ContactHistory
<?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 ContactHistory implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactHistoryId=0,
        /** @var int */
        public int $ContactId=0,
        /** @var int */
        public int $EventId=0,
        /** @var int */
        public int $AgentId=0,
        /** @var DateTime */
        public DateTime $EventDate=new DateTime(),
        /** @var DateTime */
        public DateTime $DateCreated=new DateTime(),
        /** @var string|null */
        public ?string $Note=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactHistoryId'])) $this->ContactHistoryId = $o['ContactHistoryId'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['EventId'])) $this->EventId = $o['EventId'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['EventDate'])) $this->EventDate = JsonConverters::from('DateTime', $o['EventDate']);
        if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
        if (isset($o['Note'])) $this->Note = $o['Note'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactHistoryId)) $o['ContactHistoryId'] = $this->ContactHistoryId;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->EventId)) $o['EventId'] = $this->EventId;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->EventDate)) $o['EventDate'] = JsonConverters::to('DateTime', $this->EventDate);
        if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
        if (isset($this->Note)) $o['Note'] = $this->Note;
        return empty($o) ? new class(){} : $o;
    }
}

class ActivityTracker_Application implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var string|null */
        public ?string $Carriers=null,
        /** @var int */
        public int $ApplicationId=0,
        /** @var int */
        public int $ContactId=0,
        /** @var float */
        public float $LifeAP=0.0,
        /** @var float */
        public float $AnnuityFlow=0.0,
        /** @var float */
        public float $AnnuityTransfer=0.0,
        /** @var DateTime */
        public DateTime $DateCreated=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
        if (isset($o['Carriers'])) $this->Carriers = $o['Carriers'];
        if (isset($o['ApplicationId'])) $this->ApplicationId = $o['ApplicationId'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['LifeAP'])) $this->LifeAP = $o['LifeAP'];
        if (isset($o['AnnuityFlow'])) $this->AnnuityFlow = $o['AnnuityFlow'];
        if (isset($o['AnnuityTransfer'])) $this->AnnuityTransfer = $o['AnnuityTransfer'];
        if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
        if (isset($this->Carriers)) $o['Carriers'] = $this->Carriers;
        if (isset($this->ApplicationId)) $o['ApplicationId'] = $this->ApplicationId;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->LifeAP)) $o['LifeAP'] = $this->LifeAP;
        if (isset($this->AnnuityFlow)) $o['AnnuityFlow'] = $this->AnnuityFlow;
        if (isset($this->AnnuityTransfer)) $o['AnnuityTransfer'] = $this->AnnuityTransfer;
        if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
        return empty($o) ? new class(){} : $o;
    }
}

class ContactHistoryExtended extends ContactHistory implements JsonSerializable
{
    /**
     * @param int $ContactHistoryId
     * @param int $ContactId
     * @param int $EventId
     * @param int $AgentId
     * @param DateTime $EventDate
     * @param DateTime $DateCreated
     * @param string|null $Note
     */
    public function __construct(
        int $ContactHistoryId=0,
        int $ContactId=0,
        int $EventId=0,
        int $AgentId=0,
        DateTime $EventDate=new DateTime(),
        DateTime $DateCreated=new DateTime(),
        ?string $Note=null,
        /** @var string|null */
        public ?string $EventTypeName=null,
        /** @var array<ActivityTracker_Application>|null */
        public ?array $Application=null
    ) {
        parent::__construct($ContactHistoryId,$ContactId,$EventId,$AgentId,$EventDate,$DateCreated,$Note);
    }

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

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

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

class ContactHistoryRequest implements JsonSerializable
{
    public function __construct(
        /** @var array<ContactHistory>|null */
        public ?array $ContactHistory=null
    ) {
    }

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

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

{"ContactHistory":[{"ContactHistoryId":0,"ContactId":0,"EventId":0,"AgentId":0,"EventDate":"0001-01-01T00:00:00.0000000","DateCreated":"0001-01-01T00:00:00.0000000","Note":"String"}]}
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"}},"ContactHistory":[{"EventTypeName":"String","Application":[{"ContactName":"String","Carriers":"String","ApplicationId":0,"ContactId":0,"LifeAP":0,"AnnuityFlow":0,"AnnuityTransfer":0,"DateCreated":"0001-01-01T00:00:00.0000000"}],"ContactHistoryId":0,"ContactId":0,"EventId":0,"AgentId":0,"EventDate":"0001-01-01T00:00:00.0000000","DateCreated":"0001-01-01T00:00:00.0000000","Note":"String"}]}