""" Options: Date: 2026-08-05 21:24:50 Version: 10.05 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://testapi.bokamera.se #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: UpdateBookingReservation.* #ExcludeTypes: #DefaultImports: datetime,decimal,marshmallow.fields:*,servicestack:*,typing:*,dataclasses:dataclass/field,dataclasses_json:dataclass_json/LetterCase/Undefined/config,enum:Enum/IntEnum #DataClass: #DataClassJson: """ 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 Object = TypeVar('Object') @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomerBase(ICustomerBase): 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 personal_identity_number: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CustomerToHandle(CustomerBase): pass @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class InvoiceAddressToHandle(IInvoiceAddress): corporate_identity_number: Optional[str] = None invoice_address1: Optional[str] = None invoice_address2: Optional[str] = None invoice_city: Optional[str] = None invoice_postal_code: Optional[str] = None invoice_country_code: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class ResourceToBook: resource_type_id: int = 0 resource_id: int = 0 class PaymentOptions(str, Enum): DEFAULT_SETTING = 'DefaultSetting' BOOK_WITHOUT_PAYMENT = 'BookWithoutPayment' BOOK_WITH_PAYMENT_MESSAGE_TO_CUSTOMER = 'BookWithPaymentMessageToCustomer' BOOK_WITH_MANUAL_PAYMENT = 'BookWithManualPayment' @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddCustomField: id: int = 0 value: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBookingBase(ICreateBookingBase): # @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.") company_id: Optional[str] = None """ The company id, if empty will use the company id for the user you are logged in with. """ # @ApiMember(Description="If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank.") customer_id: Optional[str] = None """ If you want to book on an existing customer instead of CustomerToBook info set the CustomerId here. Set Empty Guid (00000000-0000-0000-0000-000000000000) if you want to book without any customer, this is only allowed by admin. The customer id is shown in the customer list named as id. When booking as customer (no admin) leave this field blank. """ # @ApiMember(Description="If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here.") pin_code: Optional[str] = None """ If company requires to be authenticated or a pin code entered to book on a specific customer, enter it here. """ # @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. ") customer: Optional[CustomerToHandle] = None """ If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. """ # @ApiMember(Description="If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. ") invoice_address: Optional[InvoiceAddressToHandle] = None """ If you want to book with customer information instead of the Customer Id send the customer information here. Note: If customer profile already exists with the same email the information will not be changed, instead the provided information will be added as BookingsComments if it differs from the ordinary profile. """ # @ApiMember(Description="The service to be booked", IsRequired=true) service_id: int = 0 """ The service to be booked """ # @ApiMember(Description="If you want to add comments to a booking you can add them here, this comments are never shared with the customer") booked_comments: Optional[str] = None """ If you want to add comments to a booking you can add them here, this comments are never shared with the customer """ # @ApiMember(Description="If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation") comments_to_customer: Optional[str] = None """ If you want to add comments to the booking that is sent to the customer, you can add them here. Comments will be sent in the booking confirmation """ resources: List[ResourceToBook] = field(default_factory=list) # @ApiMember(Description="Rebate codes applied to booking") rebate_code_ids: Optional[List[int]] = None """ Rebate codes applied to booking """ # @ApiMember(Description="Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service.", IsRequired=true) articles: List[ArticleToCreateBase] = field(default_factory=list) """ Article ids that should be booked with the service. The articles must be of type ServiceAddonArticle and connected to the service. """ # @ApiMember(Description="If you want to send Email reminder") send_email_reminder: Optional[bool] = None """ If you want to send Email reminder """ # @ApiMember(Description="If you want to send SMS reminder") send_sms_reminder: Optional[bool] = None """ If you want to send SMS reminder """ # @ApiMember(Description="If you want to send SMS confirmation") send_sms_confirmation: Optional[bool] = None """ If you want to send SMS confirmation """ # @ApiMember(Description="Only admins are allowed to not send an email confirmation. Default is true") send_email_confirmation: Optional[bool] = None """ Only admins are allowed to not send an email confirmation. Default is true """ # @ApiMember(Description="If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment).") payment_option: Optional[PaymentOptions] = None """ If payment is enabled and you're an administrator, optional to choose payment option, if empty then the default settings will be used. Following payment options exists. DefaultSetting = 0, BookWithoutPayment = 1 (will be direcyly booked without payment), BookWithPaymentMessageToCustomer = 2 (will set status AwaitingPayment and send payment instructions to customer), BookWithManualPayment = 3 (Will set status AwaitingPaymentNoTimeLimit and Admin will need to manually mark the booking as payed when recieved payment). """ # @ApiMember(Description="If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved") custom_fields: List[AddCustomField] = field(default_factory=list) """ If Custom Fields are added to the booking, here you will send the id and the value for each custom field to be saved """ # @ApiMember(Description="If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated") customer_custom_fields: List[AddCustomField] = field(default_factory=list) """ If Custom Fields are added to the customer, here you will send the id and the value for each custom field to be updated """ # @ApiMember(Description="If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators") allow_booking_outside_schedules: bool = False """ If want to allow to book outside the service schedules. This means you can book a time after the schedule opening hours as long as the resource are available. This is only allowed by administrators """ # @ApiMember(Description="Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company.") tag_ids: List[int] = field(default_factory=list) """ Ids of tags to attach to the booking at creation time. Tags must have Scope = Booking and belong to the company. """ class ICreateBookingBase: company_id: Optional[str] = None customer_id: Optional[str] = None pin_code: Optional[str] = None customer: Optional[CustomerToHandle] = None invoice_address: Optional[InvoiceAddressToHandle] = None service_id: int = 0 booked_comments: Optional[str] = None comments_to_customer: Optional[str] = None resources: List[ResourceToBook] = field(default_factory=list) rebate_code_ids: List[int] = field(default_factory=list) send_email_reminder: Optional[bool] = None send_sms_reminder: Optional[bool] = None send_sms_confirmation: Optional[bool] = None send_email_confirmation: Optional[bool] = None payment_option: Optional[PaymentOptions] = None custom_fields: List[AddCustomField] = field(default_factory=list) customer_custom_fields: List[AddCustomField] = field(default_factory=list) allow_booking_outside_schedules: bool = False class IInterval: from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) class ICustomerBase: 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 personal_identity_number: Optional[str] = None class IInvoiceAddress: corporate_identity_number: Optional[str] = None invoice_address1: Optional[str] = None invoice_address2: Optional[str] = None invoice_city: Optional[str] = None invoice_postal_code: Optional[str] = None invoice_country_code: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingReservationResponse: # @ApiMember(Description="The opaque session key that identifies the reservation.") session_key: Optional[str] = None """ The opaque session key that identifies the reservation. """ # @ApiMember(Description="The company id.") company_id: Optional[str] = None """ The company id. """ # @ApiMember(Description="The reserved service id.") service_id: int = 0 """ The reserved service id. """ # @ApiMember(Description="The reservation start.") from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ The reservation start. """ # @ApiMember(Description="The reservation end.") to: datetime.datetime = datetime.datetime(1, 1, 1) """ The reservation end. """ # @ApiMember(Description="The BookingReservationStatus value.") status_code: int = 0 """ The BookingReservationStatus value. """ # @ApiMember(Description="The BookingReservationStatus name.") status_name: Optional[str] = None """ The BookingReservationStatus name. """ # @ApiMember(Description="When the hold expires (company-local time).") expiration_datetime: datetime.datetime = datetime.datetime(1, 1, 1) """ When the hold expires (company-local time). """ # @ApiMember(Description="The company's current time, in the same company-local frame as ExpirationDatetime. Clients compute the remaining hold as (ExpirationDatetime - ServerTime) so a countdown is correct regardless of the viewer's timezone or clock skew.") server_time: datetime.datetime = datetime.datetime(1, 1, 1) """ The company's current time, in the same company-local frame as ExpirationDatetime. Clients compute the remaining hold as (ExpirationDatetime - ServerTime) so a countdown is correct regardless of the viewer's timezone or clock skew. """ # @ApiMember(Description="Number of reserved spots.") number_of_booked_spots: int = 0 """ Number of reserved spots. """ # @ApiMember(Description="The computed price of the reservation, if any.") price: Optional[Decimal] = None """ The computed price of the reservation, if any. """ # @ApiMember(Description="The currency of the price, if any.") currency_id: Optional[str] = None """ The currency of the price, if any. """ # @ApiMember(Description="Ids of the resources held by the reservation.") resource_ids: List[int] = field(default_factory=list) """ Ids of the resources held by the reservation. """ # @ApiMember(Description="The full in-progress selection payload (wizard/session state) as JSON.") selection_payload: Optional[str] = None """ The full in-progress selection payload (wizard/session state) as JSON. """ response_status: Optional[ResponseStatus] = None # @Route("/bookingreservations/{SessionKey}", "PUT") # @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) # @ApiResponse(Description="No reservation found for the given session key", StatusCode=404) # @ApiResponse(Description="The selected slot is no longer available", StatusCode=409) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class UpdateBookingReservation(CreateBookingBase, IReturn[BookingReservationResponse], IInterval): # @ApiMember(Description="The opaque session key that identifies the reservation.", IsRequired=true, ParameterType="path") session_key: Optional[str] = None """ The opaque session key that identifies the reservation. """ # @ApiMember(Description="The datetime you want to start the reservation.", IsRequired=true) from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ The datetime you want to start the reservation. """ # @ApiMember(Description="The datetime you want to end the reservation.", IsRequired=true) to: datetime.datetime = datetime.datetime(1, 1, 1) """ The datetime you want to end the reservation. """ # @ApiMember(Description="Set the number of spots you want to reserve. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.") quantities: List[QuantityToBook] = field(default_factory=list) """ Set the number of spots you want to reserve. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. """