Trendsic Platform Service

<back to all web services

PolicyRequiredDocumentRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
PUT,DELETE,OPTIONS/v1/PolicyRequiredDocument/{Id}
POST,OPTIONS/v1/PolicyRequiredDocument
GET/v1/PolicyRequiredDocument/GetAllByPolicyAssociateId/{PolicyAssociateId}
<?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 PolicyDocumentStatus implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $Name=null,
        /** @var bool|null */
        public ?bool $IsNBCStatus=null,
        /** @var bool|null */
        public ?bool $IsAgentStatus=null
    ) {
    }

    /** @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['IsNBCStatus'])) $this->IsNBCStatus = $o['IsNBCStatus'];
        if (isset($o['IsAgentStatus'])) $this->IsAgentStatus = $o['IsAgentStatus'];
    }
    
    /** @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->IsNBCStatus)) $o['IsNBCStatus'] = $this->IsNBCStatus;
        if (isset($this->IsAgentStatus)) $o['IsAgentStatus'] = $this->IsAgentStatus;
        return empty($o) ? new class(){} : $o;
    }
}

class PolicyRequiredDocument implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string */
        public string $PolicyAssociateId='',
        /** @var int */
        public int $PolicyDocumentId=0,
        /** @var int */
        public int $NBCStatusId=0,
        /** @var int */
        public int $AgentStatusId=0,
        /** @var array<PolicyDocumentStatus>|null */
        public ?array $StatusOptions=null
    ) {
    }

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

class PolicyDocumentReminder implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var int */
        public int $PolicyDocumentId=0,
        /** @var string|null */
        public ?string $ReminderFor=null,
        /** @var int */
        public int $ReminderLeadTime=0,
        /** @var string|null */
        public ?string $ReminderMessage=null,
        /** @var int */
        public int $AdminAgentId=0,
        /** @var bool|null */
        public ?bool $NeedsPrompt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['PolicyDocumentId'])) $this->PolicyDocumentId = $o['PolicyDocumentId'];
        if (isset($o['ReminderFor'])) $this->ReminderFor = $o['ReminderFor'];
        if (isset($o['ReminderLeadTime'])) $this->ReminderLeadTime = $o['ReminderLeadTime'];
        if (isset($o['ReminderMessage'])) $this->ReminderMessage = $o['ReminderMessage'];
        if (isset($o['AdminAgentId'])) $this->AdminAgentId = $o['AdminAgentId'];
        if (isset($o['NeedsPrompt'])) $this->NeedsPrompt = $o['NeedsPrompt'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->PolicyDocumentId)) $o['PolicyDocumentId'] = $this->PolicyDocumentId;
        if (isset($this->ReminderFor)) $o['ReminderFor'] = $this->ReminderFor;
        if (isset($this->ReminderLeadTime)) $o['ReminderLeadTime'] = $this->ReminderLeadTime;
        if (isset($this->ReminderMessage)) $o['ReminderMessage'] = $this->ReminderMessage;
        if (isset($this->AdminAgentId)) $o['AdminAgentId'] = $this->AdminAgentId;
        if (isset($this->NeedsPrompt)) $o['NeedsPrompt'] = $this->NeedsPrompt;
        return empty($o) ? new class(){} : $o;
    }
}

class Reminder implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ReminderId='',
        /** @var string|null */
        public ?string $TableName=null,
        /** @var string|null */
        public ?string $FieldName=null,
        /** @var int */
        public int $RecordId=0,
        /** @var DateTime */
        public DateTime $ReminderDate=new DateTime(),
        /** @var string|null */
        public ?string $ReminderNote=null,
        /** @var DateTime */
        public DateTime $CreatedDate=new DateTime(),
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime */
        public DateTime $CompletedDate=new DateTime()
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ReminderId'])) $this->ReminderId = $o['ReminderId'];
        if (isset($o['TableName'])) $this->TableName = $o['TableName'];
        if (isset($o['FieldName'])) $this->FieldName = $o['FieldName'];
        if (isset($o['RecordId'])) $this->RecordId = $o['RecordId'];
        if (isset($o['ReminderDate'])) $this->ReminderDate = JsonConverters::from('DateTime', $o['ReminderDate']);
        if (isset($o['ReminderNote'])) $this->ReminderNote = $o['ReminderNote'];
        if (isset($o['CreatedDate'])) $this->CreatedDate = JsonConverters::from('DateTime', $o['CreatedDate']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CompletedDate'])) $this->CompletedDate = JsonConverters::from('DateTime', $o['CompletedDate']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ReminderId)) $o['ReminderId'] = $this->ReminderId;
        if (isset($this->TableName)) $o['TableName'] = $this->TableName;
        if (isset($this->FieldName)) $o['FieldName'] = $this->FieldName;
        if (isset($this->RecordId)) $o['RecordId'] = $this->RecordId;
        if (isset($this->ReminderDate)) $o['ReminderDate'] = JsonConverters::to('DateTime', $this->ReminderDate);
        if (isset($this->ReminderNote)) $o['ReminderNote'] = $this->ReminderNote;
        if (isset($this->CreatedDate)) $o['CreatedDate'] = JsonConverters::to('DateTime', $this->CreatedDate);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CompletedDate)) $o['CompletedDate'] = JsonConverters::to('DateTime', $this->CompletedDate);
        return empty($o) ? new class(){} : $o;
    }
}

class ReminderExtended extends Reminder implements JsonSerializable
{
    /**
     * @param string $ReminderId
     * @param string|null $TableName
     * @param string|null $FieldName
     * @param int $RecordId
     * @param DateTime $ReminderDate
     * @param string|null $ReminderNote
     * @param DateTime $CreatedDate
     * @param string|null $CreatedBy
     * @param DateTime $CompletedDate
     */
    public function __construct(
        string $ReminderId='',
        ?string $TableName=null,
        ?string $FieldName=null,
        int $RecordId=0,
        DateTime $ReminderDate=new DateTime(),
        ?string $ReminderNote=null,
        DateTime $CreatedDate=new DateTime(),
        ?string $CreatedBy=null,
        DateTime $CompletedDate=new DateTime(),
        /** @var string|null */
        public ?string $AgentName=null,
        /** @var string|null */
        public ?string $RecordAgentName=null,
        /** @var int */
        public int $RecordAgentID=0,
        /** @var bool|null */
        public ?bool $IsAdmin=null,
        /** @var int */
        public int $AgentID=0
    ) {
        parent::__construct($ReminderId,$TableName,$FieldName,$RecordId,$ReminderDate,$ReminderNote,$CreatedDate,$CreatedBy,$CompletedDate);
    }

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

class PolicyRequiredDocumentExtended extends PolicyRequiredDocument implements JsonSerializable
{
    /**
     * @param int $Id
     * @param string $PolicyAssociateId
     * @param int $PolicyDocumentId
     * @param int $NBCStatusId
     * @param int $AgentStatusId
     * @param array<PolicyDocumentStatus>|null $StatusOptions
     */
    public function __construct(
        int $Id=0,
        string $PolicyAssociateId='',
        int $PolicyDocumentId=0,
        int $NBCStatusId=0,
        int $AgentStatusId=0,
        ?array $StatusOptions=null,
        /** @var array<PolicyDocumentReminder>|null */
        public ?array $Reminders=null,
        /** @var array<ReminderExtended>|null */
        public ?array $AgentReminders=null
    ) {
        parent::__construct($Id,$PolicyAssociateId,$PolicyDocumentId,$NBCStatusId,$AgentStatusId,$StatusOptions);
    }

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

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

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

class PolicyRequiredDocumentRequest implements JsonSerializable
{
    public function __construct(
        /** @var PolicyRequiredDocumentExtended|null */
        public ?PolicyRequiredDocumentExtended $PolicyRequiredDocument=null,
        /** @var string|null */
        public ?string $PolicyAssociateId=null,
        /** @var int|null */
        public ?int $Id=null
    ) {
    }

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

PHP PolicyRequiredDocumentRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /v1/PolicyRequiredDocument HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"PolicyRequiredDocument":{"Reminders":[{"Id":0,"PolicyDocumentId":0,"ReminderFor":"String","ReminderLeadTime":0,"ReminderMessage":"String","AdminAgentId":0,"NeedsPrompt":false}],"AgentReminders":[{"AgentName":"String","RecordAgentName":"String","RecordAgentID":0,"IsAdmin":false,"AgentID":0,"ReminderId":"00000000000000000000000000000000","TableName":"String","FieldName":"String","RecordId":0,"ReminderDate":"0001-01-01T00:00:00.0000000","ReminderNote":"String","CreatedDate":"0001-01-01T00:00:00.0000000","CreatedBy":"String","CompletedDate":"0001-01-01T00:00:00.0000000"}],"Id":0,"PolicyAssociateId":"00000000000000000000000000000000","PolicyDocumentId":0,"NBCStatusId":0,"AgentStatusId":0,"StatusOptions":[{"Id":0,"Name":"String","IsNBCStatus":false,"IsAgentStatus":false}]},"PolicyAssociateId":"00000000000000000000000000000000","Id":0}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"PolicyRequiredDocuments":[{"Reminders":[{"Id":0,"PolicyDocumentId":0,"ReminderFor":"String","ReminderLeadTime":0,"ReminderMessage":"String","AdminAgentId":0,"NeedsPrompt":false}],"AgentReminders":[{"AgentName":"String","RecordAgentName":"String","RecordAgentID":0,"IsAdmin":false,"AgentID":0,"ReminderId":"00000000000000000000000000000000","TableName":"String","FieldName":"String","RecordId":0,"ReminderDate":"0001-01-01T00:00:00.0000000","ReminderNote":"String","CreatedDate":"0001-01-01T00:00:00.0000000","CreatedBy":"String","CompletedDate":"0001-01-01T00:00:00.0000000"}],"Id":0,"PolicyAssociateId":"00000000000000000000000000000000","PolicyDocumentId":0,"NBCStatusId":0,"AgentStatusId":0,"StatusOptions":[{"Id":0,"Name":"String","IsNBCStatus":false,"IsAgentStatus":false}]}]}