Trendsic Platform Service

<back to all web services

CoveragePtoCreateRequest

Requires Authentication
The following routes are available for this service:
POST/v1/coverage/pto
<?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 CoveragePtoCheck implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $Ok=null,
        /** @var string|null */
        public ?string $Text=null
    ) {
    }

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

class CoveragePlannedItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $WorkerTimeOffID=0,
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $WorkerName=null,
        /** @var string|null */
        public ?string $Initials=null,
        /** @var string|null */
        public ?string $Dates=null,
        /** @var string|null */
        public ?string $Reason=null,
        /** @var string|null */
        public ?string $Stage=null,
        /** @var string|null */
        public ?string $StageLabel=null,
        /** @var bool|null */
        public ?bool $NeedBook=null,
        /** @var int|null */
        public ?int $CoverageGapId=null,
        /** @var array<CoveragePtoCheck>|null */
        public ?array $Checks=null,
        /** @var string|null */
        public ?string $DenyReason=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['WorkerTimeOffID'])) $this->WorkerTimeOffID = $o['WorkerTimeOffID'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['WorkerName'])) $this->WorkerName = $o['WorkerName'];
        if (isset($o['Initials'])) $this->Initials = $o['Initials'];
        if (isset($o['Dates'])) $this->Dates = $o['Dates'];
        if (isset($o['Reason'])) $this->Reason = $o['Reason'];
        if (isset($o['Stage'])) $this->Stage = $o['Stage'];
        if (isset($o['StageLabel'])) $this->StageLabel = $o['StageLabel'];
        if (isset($o['NeedBook'])) $this->NeedBook = $o['NeedBook'];
        if (isset($o['CoverageGapId'])) $this->CoverageGapId = $o['CoverageGapId'];
        if (isset($o['Checks'])) $this->Checks = JsonConverters::fromArray('CoveragePtoCheck', $o['Checks']);
        if (isset($o['DenyReason'])) $this->DenyReason = $o['DenyReason'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->WorkerTimeOffID)) $o['WorkerTimeOffID'] = $this->WorkerTimeOffID;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->WorkerName)) $o['WorkerName'] = $this->WorkerName;
        if (isset($this->Initials)) $o['Initials'] = $this->Initials;
        if (isset($this->Dates)) $o['Dates'] = $this->Dates;
        if (isset($this->Reason)) $o['Reason'] = $this->Reason;
        if (isset($this->Stage)) $o['Stage'] = $this->Stage;
        if (isset($this->StageLabel)) $o['StageLabel'] = $this->StageLabel;
        if (isset($this->NeedBook)) $o['NeedBook'] = $this->NeedBook;
        if (isset($this->CoverageGapId)) $o['CoverageGapId'] = $this->CoverageGapId;
        if (isset($this->Checks)) $o['Checks'] = JsonConverters::toArray('CoveragePtoCheck', $this->Checks);
        if (isset($this->DenyReason)) $o['DenyReason'] = $this->DenyReason;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class CoveragePtoCreateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ContactID=0,
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $EndDate=new DateTime(),
        /** @var string|null */
        public ?string $Reason=null
    ) {
    }

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

PHP CoveragePtoCreateRequest DTOs

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

HTTP + XML

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

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

<CoveragePtoCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ContactID>0</ContactID>
  <EndDate>0001-01-01T00:00:00</EndDate>
  <Reason>String</Reason>
  <StartDate>0001-01-01T00:00:00</StartDate>
</CoveragePtoCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CoveragePlannedResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Items>
    <CoveragePlannedItem>
      <Checks>
        <CoveragePtoCheck>
          <Ok>false</Ok>
          <Text>String</Text>
        </CoveragePtoCheck>
      </Checks>
      <ContactId>0</ContactId>
      <CoverageGapId>0</CoverageGapId>
      <Dates>String</Dates>
      <DenyReason>String</DenyReason>
      <Initials>String</Initials>
      <NeedBook>false</NeedBook>
      <Reason>String</Reason>
      <Stage>String</Stage>
      <StageLabel>String</StageLabel>
      <WorkerName>String</WorkerName>
      <WorkerTimeOffID>0</WorkerTimeOffID>
    </CoveragePlannedItem>
  </Items>
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
</CoveragePlannedResponse>