Reservation Station API

<back to all web services

FindBookingRate

Requires Authentication
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, JsonSerializable
{
    public function __construct(
        /** @description The API Key required for authentication */
        // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
        /** @var string */
        public string $apiKey='',

        /** @description Latitude of the user making this request */
        // @ApiMember(DataType="double", Description="Latitude of the user making this request")
        /** @var float */
        public float $latitude=0.0,

        /** @description Longitude of the user making this request */
        // @ApiMember(DataType="double", Description="Longitude of the user making this request")
        /** @var float */
        public float $longitude=0.0
    ) {
    }

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

class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $heading=null,
        /** @var bool|null */
        public ?bool $wasSuccessful=null,
        /** @var Object|null */
        public ?Object $modelState=null
    ) {
    }

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

enum SlotStatus : int
{
    case Available = 0;
    case Closed = 1;
    case Booked = 2;
    case UserBooked = 3;
    case GroupBooked = 4;
    case ToBook = 5;
}

class UserCustomFieldData implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string|null */
        public ?string $value=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var bool|null */
        public ?bool $optional=null
    ) {
    }

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

class GuestData implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $emailAddress=null,
        /** @var string|null */
        public ?string $mobileNumber=null,
        /** @var array<UserCustomFieldData>|null */
        public ?array $userCustomFields=null,
        /** @var bool|null */
        public ?bool $isAlreadyUser=null,
        /** @var int */
        public int $systemUserId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['emailAddress'])) $this->emailAddress = $o['emailAddress'];
        if (isset($o['mobileNumber'])) $this->mobileNumber = $o['mobileNumber'];
        if (isset($o['userCustomFields'])) $this->userCustomFields = JsonConverters::fromArray('UserCustomFieldData', $o['userCustomFields']);
        if (isset($o['isAlreadyUser'])) $this->isAlreadyUser = $o['isAlreadyUser'];
        if (isset($o['systemUserId'])) $this->systemUserId = $o['systemUserId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->emailAddress)) $o['emailAddress'] = $this->emailAddress;
        if (isset($this->mobileNumber)) $o['mobileNumber'] = $this->mobileNumber;
        if (isset($this->userCustomFields)) $o['userCustomFields'] = JsonConverters::toArray('UserCustomFieldData', $this->userCustomFields);
        if (isset($this->isAlreadyUser)) $o['isAlreadyUser'] = $this->isAlreadyUser;
        if (isset($this->systemUserId)) $o['systemUserId'] = $this->systemUserId;
        return empty($o) ? new class(){} : $o;
    }
}

class SlotData implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $start=null,
        /** @var string|null */
        public ?string $end=null,
        /** @var SlotStatus|null */
        public ?SlotStatus $status=null,
        /** @var int */
        public int $bookingId=0,
        /** @var bool|null */
        public ?bool $remindStart=null,
        /** @var bool|null */
        public ?bool $remind30Mins=null,
        /** @var bool|null */
        public ?bool $remind1Hour=null,
        /** @var bool|null */
        public ?bool $remind6Hours=null,
        /** @var bool|null */
        public ?bool $remind12Hours=null,
        /** @var bool|null */
        public ?bool $remind1Day=null,
        /** @var bool|null */
        public ?bool $remind1Week=null,
        /** @var float */
        public float $billableAmount=0.0,
        /** @var string|null */
        public ?string $bookedByName=null,
        /** @var float */
        public float $billableHours=0.0,
        /** @var float */
        public float $slotLength=0.0,
        /** @var GuestData|null */
        public ?GuestData $userData=null,
        /** @var string|null */
        public ?string $extraRequirements=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['start'])) $this->start = $o['start'];
        if (isset($o['end'])) $this->end = $o['end'];
        if (isset($o['status'])) $this->status = JsonConverters::from('SlotStatus', $o['status']);
        if (isset($o['bookingId'])) $this->bookingId = $o['bookingId'];
        if (isset($o['remindStart'])) $this->remindStart = $o['remindStart'];
        if (isset($o['remind30Mins'])) $this->remind30Mins = $o['remind30Mins'];
        if (isset($o['remind1Hour'])) $this->remind1Hour = $o['remind1Hour'];
        if (isset($o['remind6Hours'])) $this->remind6Hours = $o['remind6Hours'];
        if (isset($o['remind12Hours'])) $this->remind12Hours = $o['remind12Hours'];
        if (isset($o['remind1Day'])) $this->remind1Day = $o['remind1Day'];
        if (isset($o['remind1Week'])) $this->remind1Week = $o['remind1Week'];
        if (isset($o['billableAmount'])) $this->billableAmount = $o['billableAmount'];
        if (isset($o['bookedByName'])) $this->bookedByName = $o['bookedByName'];
        if (isset($o['billableHours'])) $this->billableHours = $o['billableHours'];
        if (isset($o['slotLength'])) $this->slotLength = $o['slotLength'];
        if (isset($o['userData'])) $this->userData = JsonConverters::from('GuestData', $o['userData']);
        if (isset($o['extraRequirements'])) $this->extraRequirements = $o['extraRequirements'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->start)) $o['start'] = $this->start;
        if (isset($this->end)) $o['end'] = $this->end;
        if (isset($this->status)) $o['status'] = JsonConverters::to('SlotStatus', $this->status);
        if (isset($this->bookingId)) $o['bookingId'] = $this->bookingId;
        if (isset($this->remindStart)) $o['remindStart'] = $this->remindStart;
        if (isset($this->remind30Mins)) $o['remind30Mins'] = $this->remind30Mins;
        if (isset($this->remind1Hour)) $o['remind1Hour'] = $this->remind1Hour;
        if (isset($this->remind6Hours)) $o['remind6Hours'] = $this->remind6Hours;
        if (isset($this->remind12Hours)) $o['remind12Hours'] = $this->remind12Hours;
        if (isset($this->remind1Day)) $o['remind1Day'] = $this->remind1Day;
        if (isset($this->remind1Week)) $o['remind1Week'] = $this->remind1Week;
        if (isset($this->billableAmount)) $o['billableAmount'] = $this->billableAmount;
        if (isset($this->bookedByName)) $o['bookedByName'] = $this->bookedByName;
        if (isset($this->billableHours)) $o['billableHours'] = $this->billableHours;
        if (isset($this->slotLength)) $o['slotLength'] = $this->slotLength;
        if (isset($this->userData)) $o['userData'] = JsonConverters::to('GuestData', $this->userData);
        if (isset($this->extraRequirements)) $o['extraRequirements'] = $this->extraRequirements;
        return empty($o) ? new class(){} : $o;
    }
}

class FindBookingRateResponse extends ApiServiceResponse implements JsonSerializable
{
    /**
     * @param string|null $description
     * @param string|null $heading
     * @param bool|null $wasSuccessful
     * @param Object|null $modelState
     */
    public function __construct(
        ?string $description=null,
        ?string $heading=null,
        ?bool $wasSuccessful=null,
        ?Object $modelState=null,
        /** @var array<SlotData>|null */
        public ?array $updatedSlot=null,
        /** @var array<float>|null */
        public ?array $rates=null,
        /** @var bool|null */
        public ?bool $wasMerge=null
    ) {
        parent::__construct($description,$heading,$wasSuccessful,$modelState);
    }

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

class FindBookingRate extends ApiServiceRequest implements JsonSerializable
{
    /**
     * @param string $apiKey
     * @param float $latitude
     * @param float $longitude
     */
    public function __construct(
        string $apiKey='',
        float $latitude=0.0,
        float $longitude=0.0,
        /** @var int */
        public int $facilityId=0,
        /** @var int */
        public int $bookingUserId=0,
        /** @var array<SlotData>|null */
        public ?array $requestedSlots=null,
        /** @var bool|null */
        public ?bool $isNew=null,
        /** @var bool|null */
        public ?bool $isGuest=null
    ) {
        parent::__construct($apiKey,$latitude,$longitude);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['facilityId'])) $this->facilityId = $o['facilityId'];
        if (isset($o['bookingUserId'])) $this->bookingUserId = $o['bookingUserId'];
        if (isset($o['requestedSlots'])) $this->requestedSlots = JsonConverters::fromArray('SlotData', $o['requestedSlots']);
        if (isset($o['isNew'])) $this->isNew = $o['isNew'];
        if (isset($o['isGuest'])) $this->isGuest = $o['isGuest'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->facilityId)) $o['facilityId'] = $this->facilityId;
        if (isset($this->bookingUserId)) $o['bookingUserId'] = $this->bookingUserId;
        if (isset($this->requestedSlots)) $o['requestedSlots'] = JsonConverters::toArray('SlotData', $this->requestedSlots);
        if (isset($this->isNew)) $o['isNew'] = $this->isNew;
        if (isset($this->isGuest)) $o['isGuest'] = $this->isGuest;
        return empty($o) ? new class(){} : $o;
    }
}

PHP FindBookingRate DTOs

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

HTTP + OTHER

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

POST /jsonl/reply/FindBookingRate HTTP/1.1 
Host: reservation.api.dev.86degrees.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"facilityId":0,"bookingUserId":0,"requestedSlots":[{"start":"String","end":"String","status":0,"bookingId":0,"remindStart":false,"remind30Mins":false,"remind1Hour":false,"remind6Hours":false,"remind12Hours":false,"remind1Day":false,"remind1Week":false,"billableAmount":0,"bookedByName":"String","billableHours":0,"slotLength":0,"extraRequirements":"String"}],"isNew":false,"isGuest":false,"apiKey":"String","latitude":0,"longitude":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"updatedSlot":[{"start":"String","end":"String","status":0,"bookingId":0,"remindStart":false,"remind30Mins":false,"remind1Hour":false,"remind6Hours":false,"remind12Hours":false,"remind1Day":false,"remind1Week":false,"billableAmount":0,"bookedByName":"String","billableHours":0,"slotLength":0,"extraRequirements":"String"}],"rates":[0],"wasMerge":false,"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}