POST | /bookinguserqueue | Join user to the booking queue |
---|
<?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 BookingUserQueuePriceResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $CompanyId='',
/** @var int */
public int $Id=0,
/** @var int */
public int $BookingUserQueueId=0,
/** @var int|null */
public ?int $ServicePriceId=null,
/** @var int|null */
public ?int $Quantity=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['BookingUserQueueId'])) $this->BookingUserQueueId = $o['BookingUserQueueId'];
if (isset($o['ServicePriceId'])) $this->ServicePriceId = $o['ServicePriceId'];
if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->BookingUserQueueId)) $o['BookingUserQueueId'] = $this->BookingUserQueueId;
if (isset($this->ServicePriceId)) $o['ServicePriceId'] = $this->ServicePriceId;
if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
return empty($o) ? new class(){} : $o;
}
}
class GroupBookingSettings implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Active=null,
/** @var int */
public int $Min=0,
/** @var int */
public int $Max=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Active'])) $this->Active = $o['Active'];
if (isset($o['Min'])) $this->Min = $o['Min'];
if (isset($o['Max'])) $this->Max = $o['Max'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Active)) $o['Active'] = $this->Active;
if (isset($this->Min)) $o['Min'] = $this->Min;
if (isset($this->Max)) $o['Max'] = $this->Max;
return empty($o) ? new class(){} : $o;
}
}
class MultipleResourceSettings implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $Active=null,
/** @var int */
public int $Min=0,
/** @var int */
public int $Max=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Active'])) $this->Active = $o['Active'];
if (isset($o['Min'])) $this->Min = $o['Min'];
if (isset($o['Max'])) $this->Max = $o['Max'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Active)) $o['Active'] = $this->Active;
if (isset($this->Min)) $o['Min'] = $this->Min;
if (isset($this->Max)) $o['Max'] = $this->Max;
return empty($o) ? new class(){} : $o;
}
}
class ServiceInfoResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $ImageUrl=null,
/** @var int|null */
public ?int $LengthInMinutes=null,
/** @var int */
public int $MaxNumberOfSpotsPerBooking=0,
/** @var int */
public int $MinNumberOfSpotsPerBooking=0,
/** @var GroupBookingSettings|null */
public ?GroupBookingSettings $GroupBooking=null,
/** @var MultipleResourceSettings|null */
public ?MultipleResourceSettings $MultipleResource=null,
/** @var bool|null */
public ?bool $IsGroupBooking=null,
/** @var bool|null */
public ?bool $IsPaymentEnabled=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
if (isset($o['LengthInMinutes'])) $this->LengthInMinutes = $o['LengthInMinutes'];
if (isset($o['MaxNumberOfSpotsPerBooking'])) $this->MaxNumberOfSpotsPerBooking = $o['MaxNumberOfSpotsPerBooking'];
if (isset($o['MinNumberOfSpotsPerBooking'])) $this->MinNumberOfSpotsPerBooking = $o['MinNumberOfSpotsPerBooking'];
if (isset($o['GroupBooking'])) $this->GroupBooking = JsonConverters::from('GroupBookingSettings', $o['GroupBooking']);
if (isset($o['MultipleResource'])) $this->MultipleResource = JsonConverters::from('MultipleResourceSettings', $o['MultipleResource']);
if (isset($o['IsGroupBooking'])) $this->IsGroupBooking = $o['IsGroupBooking'];
if (isset($o['IsPaymentEnabled'])) $this->IsPaymentEnabled = $o['IsPaymentEnabled'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
if (isset($this->LengthInMinutes)) $o['LengthInMinutes'] = $this->LengthInMinutes;
if (isset($this->MaxNumberOfSpotsPerBooking)) $o['MaxNumberOfSpotsPerBooking'] = $this->MaxNumberOfSpotsPerBooking;
if (isset($this->MinNumberOfSpotsPerBooking)) $o['MinNumberOfSpotsPerBooking'] = $this->MinNumberOfSpotsPerBooking;
if (isset($this->GroupBooking)) $o['GroupBooking'] = JsonConverters::to('GroupBookingSettings', $this->GroupBooking);
if (isset($this->MultipleResource)) $o['MultipleResource'] = JsonConverters::to('MultipleResourceSettings', $this->MultipleResource);
if (isset($this->IsGroupBooking)) $o['IsGroupBooking'] = $this->IsGroupBooking;
if (isset($this->IsPaymentEnabled)) $o['IsPaymentEnabled'] = $this->IsPaymentEnabled;
return empty($o) ? new class(){} : $o;
}
}
class CompanyInfoResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $Id='',
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $LogoType=null,
/** @var string|null */
public ?string $Category=null,
/** @var string|null */
public ?string $Street1=null,
/** @var string|null */
public ?string $Street2=null,
/** @var string|null */
public ?string $ZipCode=null,
/** @var string|null */
public ?string $City=null,
/** @var string|null */
public ?string $CountryId=null,
/** @var string|null */
public ?string $Longitude=null,
/** @var string|null */
public ?string $Latitude=null,
/** @var string|null */
public ?string $Phone=null,
/** @var string|null */
public ?string $Email=null,
/** @var string|null */
public ?string $HomePage=null,
/** @var string|null */
public ?string $SitePath=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['LogoType'])) $this->LogoType = JsonConverters::from('string', $o['LogoType']);
if (isset($o['Category'])) $this->Category = $o['Category'];
if (isset($o['Street1'])) $this->Street1 = $o['Street1'];
if (isset($o['Street2'])) $this->Street2 = $o['Street2'];
if (isset($o['ZipCode'])) $this->ZipCode = $o['ZipCode'];
if (isset($o['City'])) $this->City = $o['City'];
if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
if (isset($o['Longitude'])) $this->Longitude = $o['Longitude'];
if (isset($o['Latitude'])) $this->Latitude = $o['Latitude'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['HomePage'])) $this->HomePage = $o['HomePage'];
if (isset($o['SitePath'])) $this->SitePath = $o['SitePath'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->LogoType)) $o['LogoType'] = JsonConverters::to('string', $this->LogoType);
if (isset($this->Category)) $o['Category'] = $this->Category;
if (isset($this->Street1)) $o['Street1'] = $this->Street1;
if (isset($this->Street2)) $o['Street2'] = $this->Street2;
if (isset($this->ZipCode)) $o['ZipCode'] = $this->ZipCode;
if (isset($this->City)) $o['City'] = $this->City;
if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
if (isset($this->Longitude)) $o['Longitude'] = $this->Longitude;
if (isset($this->Latitude)) $o['Latitude'] = $this->Latitude;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->HomePage)) $o['HomePage'] = $this->HomePage;
if (isset($this->SitePath)) $o['SitePath'] = $this->SitePath;
return empty($o) ? new class(){} : $o;
}
}
class BookingUserQueueItemResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $BookingUserQueueId=0,
/** @var string */
public string $CompanyId='',
/** @var string */
public string $CustomerId='',
/** @var int */
public int $ServiceId=0,
/** @var DateTime */
public DateTime $From=new DateTime(),
/** @var DateTime */
public DateTime $To=new DateTime(),
/** @var int */
public int $StatusCode=0,
/** @var string|null */
public ?string $StatusName=null,
/** @var DateTime|null */
public ?DateTime $SendConfirmationTime=null,
/** @var array<BookingUserQueuePriceResponse>|null */
public ?array $Quantities=null,
/** @var ServiceInfoResponse|null */
public ?ServiceInfoResponse $Service=null,
/** @var CompanyInfoResponse|null */
public ?CompanyInfoResponse $Company=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['BookingUserQueueId'])) $this->BookingUserQueueId = $o['BookingUserQueueId'];
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
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['SendConfirmationTime'])) $this->SendConfirmationTime = JsonConverters::from('DateTime', $o['SendConfirmationTime']);
if (isset($o['Quantities'])) $this->Quantities = JsonConverters::fromArray('BookingUserQueuePriceResponse', $o['Quantities']);
if (isset($o['Service'])) $this->Service = JsonConverters::from('ServiceInfoResponse', $o['Service']);
if (isset($o['Company'])) $this->Company = JsonConverters::from('CompanyInfoResponse', $o['Company']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->BookingUserQueueId)) $o['BookingUserQueueId'] = $this->BookingUserQueueId;
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
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->SendConfirmationTime)) $o['SendConfirmationTime'] = JsonConverters::to('DateTime', $this->SendConfirmationTime);
if (isset($this->Quantities)) $o['Quantities'] = JsonConverters::toArray('BookingUserQueuePriceResponse', $this->Quantities);
if (isset($this->Service)) $o['Service'] = JsonConverters::to('ServiceInfoResponse', $this->Service);
if (isset($this->Company)) $o['Company'] = JsonConverters::to('CompanyInfoResponse', $this->Company);
return empty($o) ? new class(){} : $o;
}
}
class CustomerToHandle implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $CustomerId=null,
/** @var string|null */
public ?string $Firstname=null,
/** @var string|null */
public ?string $Lastname=null,
/** @var string|null */
public ?string $Email=null,
/** @var string|null */
public ?string $Phone=null,
/** @var bool|null */
public ?bool $SubscribedToNewsletter=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['Firstname'])) $this->Firstname = $o['Firstname'];
if (isset($o['Lastname'])) $this->Lastname = $o['Lastname'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['Phone'])) $this->Phone = $o['Phone'];
if (isset($o['SubscribedToNewsletter'])) $this->SubscribedToNewsletter = $o['SubscribedToNewsletter'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Firstname)) $o['Firstname'] = $this->Firstname;
if (isset($this->Lastname)) $o['Lastname'] = $this->Lastname;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->Phone)) $o['Phone'] = $this->Phone;
if (isset($this->SubscribedToNewsletter)) $o['SubscribedToNewsletter'] = $this->SubscribedToNewsletter;
return empty($o) ? new class(){} : $o;
}
}
class QuantityToBook implements JsonSerializable
{
public function __construct(
/** @description If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book) */
// @ApiMember(Description="If service has a price, enter the price id for that price. If no price exists for the service set 0 as PriceId. If you put 0 and a price exists, it will use that price (only works if just one price exists for the current selected date to book)", IsRequired=true)
/** @var int */
public int $PriceId=0,
/** @description Set the number of spots or resources you want to book on the specific price category */
// @ApiMember(Description="Set the number of spots or resources you want to book on the specific price category", IsRequired=true)
/** @var int */
public int $Quantity=0,
/** @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
// @ApiMember(Description="If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.")
/** @var bool|null */
public ?bool $OccupiesSpot=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['PriceId'])) $this->PriceId = $o['PriceId'];
if (isset($o['Quantity'])) $this->Quantity = $o['Quantity'];
if (isset($o['OccupiesSpot'])) $this->OccupiesSpot = $o['OccupiesSpot'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->PriceId)) $o['PriceId'] = $this->PriceId;
if (isset($this->Quantity)) $o['Quantity'] = $this->Quantity;
if (isset($this->OccupiesSpot)) $o['OccupiesSpot'] = $this->OccupiesSpot;
return empty($o) ? new class(){} : $o;
}
}
class CreateBookingUserQueue implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $CompanyId=null,
/** @var string|null */
public ?string $CustomerId=null,
/** @var CustomerToHandle|null */
public ?CustomerToHandle $Customer=null,
/** @var int */
public int $ServiceId=0,
/** @var DateTime */
public DateTime $From=new DateTime(),
/** @var DateTime */
public DateTime $To=new DateTime(),
/** @var array<QuantityToBook>|null */
public ?array $Quantities=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['Customer'])) $this->Customer = JsonConverters::from('CustomerToHandle', $o['Customer']);
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['Quantities'])) $this->Quantities = JsonConverters::fromArray('QuantityToBook', $o['Quantities']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->Customer)) $o['Customer'] = JsonConverters::to('CustomerToHandle', $this->Customer);
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->Quantities)) $o['Quantities'] = JsonConverters::toArray('QuantityToBook', $this->Quantities);
return empty($o) ? new class(){} : $o;
}
}
PHP CreateBookingUserQueue 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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bookinguserqueue HTTP/1.1
Host: api.bokamera.se
Accept: application/json
Content-Type: application/json
Content-Length: length
{"CompanyId":"00000000-0000-0000-0000-000000000000","CustomerId":"00000000-0000-0000-0000-000000000000","Customer":{"CustomerId":"00000000-0000-0000-0000-000000000000","Firstname":"String","Lastname":"String","Email":"String","Phone":"String","SubscribedToNewsletter":false},"ServiceId":0,"Quantities":[{"PriceId":0,"Quantity":0,"OccupiesSpot":false}]}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"BookingUserQueueId":0,"ServiceId":0,"StatusCode":0,"StatusName":"String","SendConfirmationTime":"0001-01-01T00:00:00","Quantities":[{"Id":0,"BookingUserQueueId":0,"ServicePriceId":0,"Quantity":0}],"Service":{"Id":0,"Name":"String","Description":"String","LengthInMinutes":0,"MaxNumberOfSpotsPerBooking":0,"MinNumberOfSpotsPerBooking":0,"GroupBooking":{"Active":false,"Min":0,"Max":0},"MultipleResource":{"Active":false,"Min":0,"Max":0},"IsGroupBooking":false,"IsPaymentEnabled":false},"Company":{"Name":"String","Category":"String","Street1":"String","Street2":"String","ZipCode":"String","City":"String","CountryId":"String","Longitude":"String","Latitude":"String","Phone":"String","Email":"String","HomePage":"String","SitePath":"String"}}