| GET,OPTIONS | /v1/book/{Slug} |
|---|
<?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 CourierTrackBusiness implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Phone=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
return empty($o) ? new class(){} : $o;
}
}
class CourierBookLevel implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Ready=null,
/** @var int */
public int $WithinMin=0,
/** @var string|null */
public ?string $InBy=null,
/** @var float */
public float $Surcharge=0.0,
/** @var array<int>|null */
public ?array $Days=null,
/** @var int|null */
public ?int $DeadlineMin=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Ready'])) $this->Ready = $o['Ready'];
if (isset($o['WithinMin'])) $this->WithinMin = $o['WithinMin'];
if (isset($o['InBy'])) $this->InBy = $o['InBy'];
if (isset($o['Surcharge'])) $this->Surcharge = $o['Surcharge'];
if (isset($o['Days'])) $this->Days = JsonConverters::fromArray('int', $o['Days']);
if (isset($o['DeadlineMin'])) $this->DeadlineMin = $o['DeadlineMin'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Ready)) $o['Ready'] = $this->Ready;
if (isset($this->WithinMin)) $o['WithinMin'] = $this->WithinMin;
if (isset($this->InBy)) $o['InBy'] = $this->InBy;
if (isset($this->Surcharge)) $o['Surcharge'] = $this->Surcharge;
if (isset($this->Days)) $o['Days'] = JsonConverters::toArray('int', $this->Days);
if (isset($this->DeadlineMin)) $o['DeadlineMin'] = $this->DeadlineMin;
return empty($o) ? new class(){} : $o;
}
}
class HandoffOptions implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Hand=null,
/** @var bool|null */
public ?bool $Porch=null,
/** @var bool|null */
public ?bool $Desk=null,
/** @var bool|null */
public ?bool $SigRequired=null,
/** @var bool|null */
public ?bool $IdRequired=null,
/** @var bool|null */
public ?bool $CodeRequired=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Hand'])) $this->Hand = $o['Hand'];
if (isset($o['Porch'])) $this->Porch = $o['Porch'];
if (isset($o['Desk'])) $this->Desk = $o['Desk'];
if (isset($o['SigRequired'])) $this->SigRequired = $o['SigRequired'];
if (isset($o['IdRequired'])) $this->IdRequired = $o['IdRequired'];
if (isset($o['CodeRequired'])) $this->CodeRequired = $o['CodeRequired'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Hand)) $o['Hand'] = $this->Hand;
if (isset($this->Porch)) $o['Porch'] = $this->Porch;
if (isset($this->Desk)) $o['Desk'] = $this->Desk;
if (isset($this->SigRequired)) $o['SigRequired'] = $this->SigRequired;
if (isset($this->IdRequired)) $o['IdRequired'] = $this->IdRequired;
if (isset($this->CodeRequired)) $o['CodeRequired'] = $this->CodeRequired;
return empty($o) ? new class(){} : $o;
}
}
class CourierBookProfile implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Shape=null,
/** @var string|null */
public ?string $Template=null,
/** @var string|null */
public ?string $UnitOne=null,
/** @var string|null */
public ?string $UnitMany=null,
/** @var string|null */
public ?string $UnitOneEs=null,
/** @var string|null */
public ?string $UnitManyEs=null,
/** @var string|null */
public ?string $FacilityNoun=null,
/** @var string|null */
public ?string $FacilityNounEs=null,
/** @var string|null */
public ?string $FacilityName=null,
/** @var array<CourierBookLevel>|null */
public ?array $Levels=null,
/** @var bool|null */
public ?bool $Asap=null,
/** @var bool|null */
public ?bool $Recurring=null,
/** @var string|null */
public ?string $PayTiming=null,
/** @var bool|null */
public ?bool $FinalAfterCount=null,
/** @var float */
public float $CancelFee=0.0,
/** @var float */
public float $MissedFee=0.0,
/** @var int */
public int $MissedWaitMin=0,
/** @var array<string>|null */
public ?array $ServiceArea=null,
/** @var array<string>|null */
public ?array $Zips=null,
/** @var HandoffOptions|null */
public ?HandoffOptions $Handoffs=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Shape'])) $this->Shape = $o['Shape'];
if (isset($o['Template'])) $this->Template = $o['Template'];
if (isset($o['UnitOne'])) $this->UnitOne = $o['UnitOne'];
if (isset($o['UnitMany'])) $this->UnitMany = $o['UnitMany'];
if (isset($o['UnitOneEs'])) $this->UnitOneEs = $o['UnitOneEs'];
if (isset($o['UnitManyEs'])) $this->UnitManyEs = $o['UnitManyEs'];
if (isset($o['FacilityNoun'])) $this->FacilityNoun = $o['FacilityNoun'];
if (isset($o['FacilityNounEs'])) $this->FacilityNounEs = $o['FacilityNounEs'];
if (isset($o['FacilityName'])) $this->FacilityName = $o['FacilityName'];
if (isset($o['Levels'])) $this->Levels = JsonConverters::fromArray('CourierBookLevel', $o['Levels']);
if (isset($o['Asap'])) $this->Asap = $o['Asap'];
if (isset($o['Recurring'])) $this->Recurring = $o['Recurring'];
if (isset($o['PayTiming'])) $this->PayTiming = $o['PayTiming'];
if (isset($o['FinalAfterCount'])) $this->FinalAfterCount = $o['FinalAfterCount'];
if (isset($o['CancelFee'])) $this->CancelFee = $o['CancelFee'];
if (isset($o['MissedFee'])) $this->MissedFee = $o['MissedFee'];
if (isset($o['MissedWaitMin'])) $this->MissedWaitMin = $o['MissedWaitMin'];
if (isset($o['ServiceArea'])) $this->ServiceArea = JsonConverters::fromArray('string', $o['ServiceArea']);
if (isset($o['Zips'])) $this->Zips = JsonConverters::fromArray('string', $o['Zips']);
if (isset($o['Handoffs'])) $this->Handoffs = JsonConverters::from('HandoffOptions', $o['Handoffs']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Shape)) $o['Shape'] = $this->Shape;
if (isset($this->Template)) $o['Template'] = $this->Template;
if (isset($this->UnitOne)) $o['UnitOne'] = $this->UnitOne;
if (isset($this->UnitMany)) $o['UnitMany'] = $this->UnitMany;
if (isset($this->UnitOneEs)) $o['UnitOneEs'] = $this->UnitOneEs;
if (isset($this->UnitManyEs)) $o['UnitManyEs'] = $this->UnitManyEs;
if (isset($this->FacilityNoun)) $o['FacilityNoun'] = $this->FacilityNoun;
if (isset($this->FacilityNounEs)) $o['FacilityNounEs'] = $this->FacilityNounEs;
if (isset($this->FacilityName)) $o['FacilityName'] = $this->FacilityName;
if (isset($this->Levels)) $o['Levels'] = JsonConverters::toArray('CourierBookLevel', $this->Levels);
if (isset($this->Asap)) $o['Asap'] = $this->Asap;
if (isset($this->Recurring)) $o['Recurring'] = $this->Recurring;
if (isset($this->PayTiming)) $o['PayTiming'] = $this->PayTiming;
if (isset($this->FinalAfterCount)) $o['FinalAfterCount'] = $this->FinalAfterCount;
if (isset($this->CancelFee)) $o['CancelFee'] = $this->CancelFee;
if (isset($this->MissedFee)) $o['MissedFee'] = $this->MissedFee;
if (isset($this->MissedWaitMin)) $o['MissedWaitMin'] = $this->MissedWaitMin;
if (isset($this->ServiceArea)) $o['ServiceArea'] = JsonConverters::toArray('string', $this->ServiceArea);
if (isset($this->Zips)) $o['Zips'] = JsonConverters::toArray('string', $this->Zips);
if (isset($this->Handoffs)) $o['Handoffs'] = JsonConverters::to('HandoffOptions', $this->Handoffs);
return empty($o) ? new class(){} : $o;
}
}
class CourierBookProfileLink implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Code=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Shape=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Code'])) $this->Code = $o['Code'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Shape'])) $this->Shape = $o['Shape'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Code)) $o['Code'] = $this->Code;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Shape)) $o['Shape'] = $this->Shape;
return empty($o) ? new class(){} : $o;
}
}
class CourierBookPageView implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Available=null,
/** @var bool|null */
public ?bool $BookingOn=null,
/** @var CourierTrackBusiness|null */
public ?CourierTrackBusiness $Business=null,
/** @var CourierBookProfile|null */
public ?CourierBookProfile $Profile=null,
/** @var array<CourierBookProfileLink>|null */
public ?array $Profiles=null,
/** @var bool|null */
public ?bool $CardEnabled=null,
/** @var string|null */
public ?string $PublishableKey=null,
/** @var string|null */
public ?string $AppUrl=null,
/** @var string|null */
public ?string $Today=null,
/** @var int */
public int $Weekday=0,
/** @var int */
public int $NowMin=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Available'])) $this->Available = $o['Available'];
if (isset($o['BookingOn'])) $this->BookingOn = $o['BookingOn'];
if (isset($o['Business'])) $this->Business = JsonConverters::from('CourierTrackBusiness', $o['Business']);
if (isset($o['Profile'])) $this->Profile = JsonConverters::from('CourierBookProfile', $o['Profile']);
if (isset($o['Profiles'])) $this->Profiles = JsonConverters::fromArray('CourierBookProfileLink', $o['Profiles']);
if (isset($o['CardEnabled'])) $this->CardEnabled = $o['CardEnabled'];
if (isset($o['PublishableKey'])) $this->PublishableKey = $o['PublishableKey'];
if (isset($o['AppUrl'])) $this->AppUrl = $o['AppUrl'];
if (isset($o['Today'])) $this->Today = $o['Today'];
if (isset($o['Weekday'])) $this->Weekday = $o['Weekday'];
if (isset($o['NowMin'])) $this->NowMin = $o['NowMin'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Available)) $o['Available'] = $this->Available;
if (isset($this->BookingOn)) $o['BookingOn'] = $this->BookingOn;
if (isset($this->Business)) $o['Business'] = JsonConverters::to('CourierTrackBusiness', $this->Business);
if (isset($this->Profile)) $o['Profile'] = JsonConverters::to('CourierBookProfile', $this->Profile);
if (isset($this->Profiles)) $o['Profiles'] = JsonConverters::toArray('CourierBookProfileLink', $this->Profiles);
if (isset($this->CardEnabled)) $o['CardEnabled'] = $this->CardEnabled;
if (isset($this->PublishableKey)) $o['PublishableKey'] = $this->PublishableKey;
if (isset($this->AppUrl)) $o['AppUrl'] = $this->AppUrl;
if (isset($this->Today)) $o['Today'] = $this->Today;
if (isset($this->Weekday)) $o['Weekday'] = $this->Weekday;
if (isset($this->NowMin)) $o['NowMin'] = $this->NowMin;
return empty($o) ? new class(){} : $o;
}
}
class CourierBookPageResponse implements JsonSerializable
{
public function __construct(
/** @var CourierBookPageView|null */
public ?CourierBookPageView $Page=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Page'])) $this->Page = JsonConverters::from('CourierBookPageView', $o['Page']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Page)) $o['Page'] = JsonConverters::to('CourierBookPageView', $this->Page);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class CourierBookPageRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Slug=null,
/** @var string|null */
public ?string $Profile=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Slug'])) $this->Slug = $o['Slug'];
if (isset($o['Profile'])) $this->Profile = $o['Profile'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Slug)) $o['Slug'] = $this->Slug;
if (isset($this->Profile)) $o['Profile'] = $this->Profile;
return empty($o) ? new class(){} : $o;
}
}
PHP CourierBookPageRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v1/book/{Slug} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Page:
{
Available: False,
BookingOn: False,
Business:
{
Name: String,
Phone: String
},
Profile:
{
Code: String,
Name: String,
Shape: String,
Template: String,
UnitOne: String,
UnitMany: String,
UnitOneEs: String,
UnitManyEs: String,
FacilityNoun: String,
FacilityNounEs: String,
FacilityName: String,
Levels:
[
{
Code: String,
Name: String,
Ready: String,
WithinMin: 0,
InBy: String,
Surcharge: 0,
Days:
[
0
],
DeadlineMin: 0
}
],
Asap: False,
Recurring: False,
PayTiming: String,
FinalAfterCount: False,
CancelFee: 0,
MissedFee: 0,
MissedWaitMin: 0,
ServiceArea:
[
String
],
Zips:
[
String
],
Handoffs:
{
Hand: False,
Porch: False,
Desk: False,
SigRequired: False,
IdRequired: False,
CodeRequired: False
}
},
Profiles:
[
{
Code: String,
Name: String,
Shape: String
}
],
CardEnabled: False,
PublishableKey: String,
AppUrl: String,
Today: String,
Weekday: 0,
NowMin: 0
},
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}