Trendsic Platform Service

<back to all web services

CalendarResourceViewRequest

The following routes are available for this service:
POST,OPTIONS/v1/Calendar/ResourceView
<?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 CalendarResourceViewRequest implements JsonSerializable
{
    public function __construct(
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $EndDate=new DateTime(),
        /** @var bool|null */
        public ?bool $Inverse=null,
        /** @var bool|null */
        public ?bool $ResourceOnly=null,
        /** @var bool|null */
        public ?bool $ShowEquipment=null,
        /** @var bool|null */
        public ?bool $ShowWorkers=null,
        /** @var int */
        public int $ContactId=0,
        /** @var string|null */
        public ?string $ContactName=null,
        /** @var string|null */
        public ?string $ContactTag=null,
        /** @var int */
        public int $EquipmentId=0,
        /** @var string|null */
        public ?string $EquipmentName=null,
        /** @var string|null */
        public ?string $EquipmentSN=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        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['Inverse'])) $this->Inverse = $o['Inverse'];
        if (isset($o['ResourceOnly'])) $this->ResourceOnly = $o['ResourceOnly'];
        if (isset($o['ShowEquipment'])) $this->ShowEquipment = $o['ShowEquipment'];
        if (isset($o['ShowWorkers'])) $this->ShowWorkers = $o['ShowWorkers'];
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['ContactName'])) $this->ContactName = $o['ContactName'];
        if (isset($o['ContactTag'])) $this->ContactTag = $o['ContactTag'];
        if (isset($o['EquipmentId'])) $this->EquipmentId = $o['EquipmentId'];
        if (isset($o['EquipmentName'])) $this->EquipmentName = $o['EquipmentName'];
        if (isset($o['EquipmentSN'])) $this->EquipmentSN = $o['EquipmentSN'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        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->Inverse)) $o['Inverse'] = $this->Inverse;
        if (isset($this->ResourceOnly)) $o['ResourceOnly'] = $this->ResourceOnly;
        if (isset($this->ShowEquipment)) $o['ShowEquipment'] = $this->ShowEquipment;
        if (isset($this->ShowWorkers)) $o['ShowWorkers'] = $this->ShowWorkers;
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->ContactName)) $o['ContactName'] = $this->ContactName;
        if (isset($this->ContactTag)) $o['ContactTag'] = $this->ContactTag;
        if (isset($this->EquipmentId)) $o['EquipmentId'] = $this->EquipmentId;
        if (isset($this->EquipmentName)) $o['EquipmentName'] = $this->EquipmentName;
        if (isset($this->EquipmentSN)) $o['EquipmentSN'] = $this->EquipmentSN;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CalendarResourceViewRequest DTOs

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

HTTP + CSV

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

POST /v1/Calendar/ResourceView HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"StartDate":"0001-01-01T00:00:00.0000000","EndDate":"0001-01-01T00:00:00.0000000","Inverse":false,"ResourceOnly":false,"ShowEquipment":false,"ShowWorkers":false,"ContactId":0,"ContactName":"String","ContactTag":"String","EquipmentId":0,"EquipmentName":"String","EquipmentSN":"String"}