BokaMera.API.Host

<back to all web services

GetBookingReservation

The following routes are available for this service:
GET/bookingreservations/{SessionKey}Get a booking reservationReturns the current state of a reservation identified by its opaque session key.
<?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 BookingReservationResponse implements JsonSerializable
{
    public function __construct(
        /** @description The opaque session key that identifies the reservation. */
        // @ApiMember(Description="The opaque session key that identifies the reservation.")
        /** @var string */
        public string $SessionKey='',

        /** @description The company id. */
        // @ApiMember(Description="The company id.")
        /** @var string */
        public string $CompanyId='',

        /** @description The reserved service id. */
        // @ApiMember(Description="The reserved service id.")
        /** @var int */
        public int $ServiceId=0,

        /** @description The reservation start. */
        // @ApiMember(Description="The reservation start.")
        /** @var DateTime */
        public DateTime $From=new DateTime(),

        /** @description The reservation end. */
        // @ApiMember(Description="The reservation end.")
        /** @var DateTime */
        public DateTime $To=new DateTime(),

        /** @description The BookingReservationStatus value. */
        // @ApiMember(Description="The BookingReservationStatus value.")
        /** @var int */
        public int $StatusCode=0,

        /** @description The BookingReservationStatus name. */
        // @ApiMember(Description="The BookingReservationStatus name.")
        /** @var string */
        public string $StatusName='',

        /** @description When the hold expires (company-local time). */
        // @ApiMember(Description="When the hold expires (company-local time).")
        /** @var DateTime */
        public DateTime $ExpirationDatetime=new DateTime(),

        /** @description Number of reserved spots. */
        // @ApiMember(Description="Number of reserved spots.")
        /** @var int */
        public int $NumberOfBookedSpots=0,

        /** @description The computed price of the reservation, if any. */
        // @ApiMember(Description="The computed price of the reservation, if any.")
        /** @var float|null */
        public ?float $Price=null,

        /** @description The currency of the price, if any. */
        // @ApiMember(Description="The currency of the price, if any.")
        /** @var string */
        public string $CurrencyId='',

        /** @description Ids of the resources held by the reservation. */
        // @ApiMember(Description="Ids of the resources held by the reservation.")
        /** @var array<int>|null */
        public ?array $ResourceIds=null,

        /** @description The full in-progress selection payload (wizard/session state) as JSON. */
        // @ApiMember(Description="The full in-progress selection payload (wizard/session state) as JSON.")
        /** @var string */
        public string $SelectionPayload='',

        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SessionKey'])) $this->SessionKey = $o['SessionKey'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ServiceId'])) $this->ServiceId = $o['ServiceId'];
        if (isset($o['From'])) $this->From = JsonConverters::from('DateTime', $o['From']);
        if (isset($o['To'])) $this->To = JsonConverters::from('DateTime', $o['To']);
        if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['ExpirationDatetime'])) $this->ExpirationDatetime = JsonConverters::from('DateTime', $o['ExpirationDatetime']);
        if (isset($o['NumberOfBookedSpots'])) $this->NumberOfBookedSpots = $o['NumberOfBookedSpots'];
        if (isset($o['Price'])) $this->Price = $o['Price'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['ResourceIds'])) $this->ResourceIds = JsonConverters::fromArray('int', $o['ResourceIds']);
        if (isset($o['SelectionPayload'])) $this->SelectionPayload = $o['SelectionPayload'];
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SessionKey)) $o['SessionKey'] = $this->SessionKey;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ServiceId)) $o['ServiceId'] = $this->ServiceId;
        if (isset($this->From)) $o['From'] = JsonConverters::to('DateTime', $this->From);
        if (isset($this->To)) $o['To'] = JsonConverters::to('DateTime', $this->To);
        if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->ExpirationDatetime)) $o['ExpirationDatetime'] = JsonConverters::to('DateTime', $this->ExpirationDatetime);
        if (isset($this->NumberOfBookedSpots)) $o['NumberOfBookedSpots'] = $this->NumberOfBookedSpots;
        if (isset($this->Price)) $o['Price'] = $this->Price;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->ResourceIds)) $o['ResourceIds'] = JsonConverters::toArray('int', $this->ResourceIds);
        if (isset($this->SelectionPayload)) $o['SelectionPayload'] = $this->SelectionPayload;
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="No reservation found for the given session key", StatusCode=404)
class GetBookingReservation implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The opaque session key that identifies the reservation. */
        // @ApiMember(Description="The opaque session key that identifies the reservation.", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $SessionKey='',

        /** @description The company id, if empty will use the company id for the user you are logged in with. */
        // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
        /** @var string|null */
        public ?string $CompanyId=null
    ) {
    }

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

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

GET /bookingreservations/{SessionKey} HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ServiceId":0,"StatusCode":0,"StatusName":"String","NumberOfBookedSpots":0,"Price":0,"CurrencyId":"String","ResourceIds":[0],"SelectionPayload":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}