BokaMera.API.Host

<back to all web services

GetMyBookingReservations

Requires Authentication
The following routes are available for this service:
GET/bookingreservations/mineList the caller's own awaiting-payment reservationsReturns the logged-in customer's reservations that are still awaiting payment (committed but not yet paid/converted) so they can resume payment from their bookings list. Scoped to the caller's customer within the company; expired holds are excluded.
<?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 MyBookingReservationResult 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 reserved service id. */
        // @ApiMember(Description="The reserved service id.")
        /** @var int */
        public int $ServiceId=0,

        /** @description The reserved service name. */
        // @ApiMember(Description="The reserved service name.")
        /** @var string */
        public string $ServiceName='',

        /** @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 Number of reserved spots. */
        // @ApiMember(Description="Number of reserved spots.")
        /** @var int */
        public int $NumberOfBookedSpots=0,

        /** @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 The company's current time, in the same frame as ExpirationDatetime. */
        // @ApiMember(Description="The company's current time, in the same frame as ExpirationDatetime.")
        /** @var DateTime */
        public DateTime $ServerTime=new DateTime(),

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

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

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

        /** @description The payable reference to use as the checkout InternalReferenceId when resuming payment. */
        // @ApiMember(Description="The payable reference to use as the checkout InternalReferenceId when resuming payment.")
        /** @var string */
        public string $InternalReferenceId=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['SessionKey'])) $this->SessionKey = $o['SessionKey'];
        if (isset($o['ServiceId'])) $this->ServiceId = $o['ServiceId'];
        if (isset($o['ServiceName'])) $this->ServiceName = $o['ServiceName'];
        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['NumberOfBookedSpots'])) $this->NumberOfBookedSpots = $o['NumberOfBookedSpots'];
        if (isset($o['ExpirationDatetime'])) $this->ExpirationDatetime = JsonConverters::from('DateTime', $o['ExpirationDatetime']);
        if (isset($o['ServerTime'])) $this->ServerTime = JsonConverters::from('DateTime', $o['ServerTime']);
        if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
        if (isset($o['StatusName'])) $this->StatusName = $o['StatusName'];
        if (isset($o['CurrencyId'])) $this->CurrencyId = $o['CurrencyId'];
        if (isset($o['InternalReferenceId'])) $this->InternalReferenceId = $o['InternalReferenceId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->SessionKey)) $o['SessionKey'] = $this->SessionKey;
        if (isset($this->ServiceId)) $o['ServiceId'] = $this->ServiceId;
        if (isset($this->ServiceName)) $o['ServiceName'] = $this->ServiceName;
        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->NumberOfBookedSpots)) $o['NumberOfBookedSpots'] = $this->NumberOfBookedSpots;
        if (isset($this->ExpirationDatetime)) $o['ExpirationDatetime'] = JsonConverters::to('DateTime', $this->ExpirationDatetime);
        if (isset($this->ServerTime)) $o['ServerTime'] = JsonConverters::to('DateTime', $this->ServerTime);
        if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
        if (isset($this->StatusName)) $o['StatusName'] = $this->StatusName;
        if (isset($this->CurrencyId)) $o['CurrencyId'] = $this->CurrencyId;
        if (isset($this->InternalReferenceId)) $o['InternalReferenceId'] = $this->InternalReferenceId;
        return empty($o) ? new class(){} : $o;
    }
}

class MyBookingReservationsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The caller's awaiting-payment reservations. */
        // @ApiMember(Description="The caller's awaiting-payment reservations.")
        /** @var array<MyBookingReservationResult>|null */
        public ?array $Results=null,

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

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Results'])) $this->Results = JsonConverters::fromArray('MyBookingReservationResult', $o['Results']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Results)) $o['Results'] = JsonConverters::toArray('MyBookingReservationResult', $this->Results);
        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)
class GetMyBookingReservations implements ICompany, JsonSerializable
{
    public function __construct(
        /** @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['CompanyId'])) $this->CompanyId = $o['CompanyId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetMyBookingReservations 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/mine HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Results":[{"ServiceId":0,"ServiceName":"String","NumberOfBookedSpots":0,"StatusCode":0,"StatusName":"String","CurrencyId":"String","InternalReferenceId":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}