Trendsic Platform Service

<back to all web services

CalendarRequest

The following routes are available for this service:
GET,OPTIONS/v1/Calendar/{CalendarId}
GET,OPTIONS/v1/Calendar/Project/{ProjectId}
GET,OPTIONS/v1/Calendar/Location/{LocationId}
GET,OPTIONS/v1/Calendar/Agent/{AgentId}
GET,OPTIONS/v1/Calendar/Project/{ProjectId}/{StartDate}/{EndDate}
GET,OPTIONS/v1/Calendar/Project/{ProjectId}/CalendarEventId/{CalendarEventId}
GET,OPTIONS/v1/Calendar/{CalendarId}/{StartDate}/{EndDate}
GET,OPTIONS/v1/Calendar/Project/{StartDate}/{EndDate}
GET,OPTIONS/v1/Calendar/Project/ExpandRecurring/{ProjectId}
GET,OPTIONS/v1/Calendar/CrewMember/Availability/{ContactId}/{StartDate}/{EndDate}
GET,OPTIONS/v1/Calendar/Project/ExpandRecurring/{ProjectId}/{StartDate}/{EndDate}
GET,OPTIONS/v1/Calendar/Project/ExpandRecurring/{ProjectId}/CalendarEventId/{CalendarEventId}
GET,OPTIONS/v1/Calendar/Project/ExpandRecurring/ExpandAll/{ProjectId}/{StartDate}/{EndDate}
<?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};


enum CalendarType : string
{
    case All = 'All';
    case Pera = 'Pera';
    case Google = 'Google';
}

enum CalendarFormat : string
{
    case Standard = 'Standard';
    case ICS = 'ICS';
}

class CalendarRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CalendarId='',
        /** @var int */
        public int $CalendarEventId=0,
        /** @var CalendarType|null */
        public ?CalendarType $CalendarType=null,
        /** @var CalendarFormat|null */
        public ?CalendarFormat $CalendarFormat=null,
        /** @var int */
        public int $ContactId=0,
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),
        /** @var DateTime */
        public DateTime $EndDate=new DateTime(),
        /** @var int */
        public int $ProjectId=0,
        /** @var string */
        public string $LocationId='',
        /** @var int */
        public int $AgentId=0,
        /** @var bool|null */
        public ?bool $ExpandRecurringEvents=null,
        /** @var bool|null */
        public ?bool $ExpandAll=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CalendarId'])) $this->CalendarId = $o['CalendarId'];
        if (isset($o['CalendarEventId'])) $this->CalendarEventId = $o['CalendarEventId'];
        if (isset($o['CalendarType'])) $this->CalendarType = JsonConverters::from('CalendarType', $o['CalendarType']);
        if (isset($o['CalendarFormat'])) $this->CalendarFormat = JsonConverters::from('CalendarFormat', $o['CalendarFormat']);
        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['ProjectId'])) $this->ProjectId = $o['ProjectId'];
        if (isset($o['LocationId'])) $this->LocationId = $o['LocationId'];
        if (isset($o['AgentId'])) $this->AgentId = $o['AgentId'];
        if (isset($o['ExpandRecurringEvents'])) $this->ExpandRecurringEvents = $o['ExpandRecurringEvents'];
        if (isset($o['ExpandAll'])) $this->ExpandAll = $o['ExpandAll'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CalendarId)) $o['CalendarId'] = $this->CalendarId;
        if (isset($this->CalendarEventId)) $o['CalendarEventId'] = $this->CalendarEventId;
        if (isset($this->CalendarType)) $o['CalendarType'] = JsonConverters::to('CalendarType', $this->CalendarType);
        if (isset($this->CalendarFormat)) $o['CalendarFormat'] = JsonConverters::to('CalendarFormat', $this->CalendarFormat);
        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->ProjectId)) $o['ProjectId'] = $this->ProjectId;
        if (isset($this->LocationId)) $o['LocationId'] = $this->LocationId;
        if (isset($this->AgentId)) $o['AgentId'] = $this->AgentId;
        if (isset($this->ExpandRecurringEvents)) $o['ExpandRecurringEvents'] = $this->ExpandRecurringEvents;
        if (isset($this->ExpandAll)) $o['ExpandAll'] = $this->ExpandAll;
        return empty($o) ? new class(){} : $o;
    }
}

PHP CalendarRequest 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.

GET /v1/Calendar/{CalendarId} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/json