POST | /bookinguserqueue | Join user to the booking queue |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookingUserQueuePriceResponse:
company_id: Optional[str] = None
id: int = 0
booking_user_queue_id: int = 0
service_price_id: Optional[int] = None
quantity: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class GroupBookingSettings:
active: bool = False
min: int = 0
max: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class MultipleResourceSettings:
active: bool = False
min: int = 0
max: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ServiceInfoResponse:
id: int = 0
name: Optional[str] = None
description: Optional[str] = None
image_url: Optional[str] = None
length_in_minutes: Optional[int] = None
max_number_of_spots_per_booking: int = 0
min_number_of_spots_per_booking: int = 0
group_booking: Optional[GroupBookingSettings] = None
multiple_resource: Optional[MultipleResourceSettings] = None
is_group_booking: bool = False
is_payment_enabled: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CompanyInfoResponse:
id: Optional[str] = None
name: Optional[str] = None
logo_type: Optional[str] = None
category: Optional[str] = None
street1: Optional[str] = None
street2: Optional[str] = None
zip_code: Optional[str] = None
city: Optional[str] = None
country_id: Optional[str] = None
longitude: Optional[str] = None
latitude: Optional[str] = None
phone: Optional[str] = None
email: Optional[str] = None
home_page: Optional[str] = None
site_path: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BookingUserQueueItemResponse:
booking_user_queue_id: int = 0
company_id: Optional[str] = None
customer_id: Optional[str] = None
service_id: int = 0
from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1))
to: datetime.datetime = datetime.datetime(1, 1, 1)
status_code: int = 0
status_name: Optional[str] = None
send_confirmation_time: Optional[datetime.datetime] = None
quantities: Optional[List[BookingUserQueuePriceResponse]] = None
service: Optional[ServiceInfoResponse] = None
company: Optional[CompanyInfoResponse] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerToHandle:
customer_id: Optional[str] = None
firstname: Optional[str] = None
lastname: Optional[str] = None
email: Optional[str] = None
phone: Optional[str] = None
subscribed_to_newsletter: bool = False
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class QuantityToBook:
# @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)
price_id: int = 0
"""
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="Set the number of spots or resources you want to book on the specific price category", IsRequired=true)
quantity: int = 0
"""
Set the number of spots or resources you want to book on the specific price category
"""
# @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.")
occupies_spot: bool = False
"""
If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CreateBookingUserQueue:
company_id: Optional[str] = None
customer_id: Optional[str] = None
customer: Optional[CustomerToHandle] = None
service_id: int = 0
from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1))
to: datetime.datetime = datetime.datetime(1, 1, 1)
quantities: Optional[List[QuantityToBook]] = None
Python CreateBookingUserQueue DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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/xml
Content-Type: application/xml
Content-Length: length
<CreateBookingUserQueue xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<Customer>
<CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
<Email>String</Email>
<Firstname>String</Firstname>
<Lastname>String</Lastname>
<Phone>String</Phone>
<SubscribedToNewsletter>false</SubscribedToNewsletter>
</Customer>
<CustomerId>00000000-0000-0000-0000-000000000000</CustomerId>
<From>0001-01-01T00:00:00</From>
<Quantities>
<QuantityToBook>
<OccupiesSpot>false</OccupiesSpot>
<PriceId>0</PriceId>
<Quantity>0</Quantity>
</QuantityToBook>
</Quantities>
<ServiceId>0</ServiceId>
<To>0001-01-01T00:00:00</To>
</CreateBookingUserQueue>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <BookingUserQueueItemResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <BookingUserQueueId>0</BookingUserQueueId> <Company> <Category>String</Category> <City>String</City> <CountryId>String</CountryId> <Email>String</Email> <HomePage>String</HomePage> <Id>00000000-0000-0000-0000-000000000000</Id> <Latitude>String</Latitude> <LogoType i:nil="true" /> <Longitude>String</Longitude> <Name>String</Name> <Phone>String</Phone> <SitePath>String</SitePath> <Street1>String</Street1> <Street2>String</Street2> <ZipCode>String</ZipCode> </Company> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <CustomerId>00000000-0000-0000-0000-000000000000</CustomerId> <From>0001-01-01T00:00:00</From> <Quantities> <BookingUserQueuePriceResponse> <BookingUserQueueId>0</BookingUserQueueId> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Id>0</Id> <Quantity>0</Quantity> <ServicePriceId>0</ServicePriceId> </BookingUserQueuePriceResponse> </Quantities> <SendConfirmationTime>0001-01-01T00:00:00</SendConfirmationTime> <Service> <Description>String</Description> <GroupBooking> <Active>false</Active> <Max>0</Max> <Min>0</Min> </GroupBooking> <Id>0</Id> <ImageUrl i:nil="true" /> <IsGroupBooking>false</IsGroupBooking> <IsPaymentEnabled>false</IsPaymentEnabled> <LengthInMinutes>0</LengthInMinutes> <MaxNumberOfSpotsPerBooking>0</MaxNumberOfSpotsPerBooking> <MinNumberOfSpotsPerBooking>0</MinNumberOfSpotsPerBooking> <MultipleResource> <Active>false</Active> <Max>0</Max> <Min>0</Min> </MultipleResource> <Name>String</Name> </Service> <ServiceId>0</ServiceId> <StatusCode>0</StatusCode> <StatusName>String</StatusName> <To>0001-01-01T00:00:00</To> </BookingUserQueueItemResponse>