""" Options: Date: 2024-11-21 12:13:29 Version: 8.23 Tip: To override a DTO option, remove "#" prefix before updating BaseUrl: https://api.bokamera.se #GlobalNamespace: #AddServiceStackTypes: True #AddResponseStatus: False #AddImplicitVersion: #AddDescriptionAsComments: True IncludeTypes: CreateBookings.* #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 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class AddCustomField: id: int = 0 value: Optional[str] = None 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 DatesToRepeat(IInterval): # @ApiMember(Description="Booking start") from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) """ Booking start """ # @ApiMember(Description="Booking end") to: datetime.datetime = datetime.datetime(1, 1, 1) """ Booking end """ # @ApiMember(Description="Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.") quantities: Optional[List[QuantityToBook]] = None """ Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. """ @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 ResourceToBook: resource_type_id: int = 0 resource_id: int = 0 @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBookingBase: # @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 ordinairy 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 ordinairy 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: Optional[List[ResourceToBook]] = None # @ApiMember(Description="Rebate codes applied to booking") rebate_code_ids: Optional[List[int]] = None """ Rebate codes applied to booking """ # @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: Optional[List[AddCustomField]] = None """ 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: Optional[List[AddCustomField]] = None """ 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 """ 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) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class FailedBookings: from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) reason: Optional[str] = None # @ApiMember(Description="Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot.") quantities: Optional[List[QuantityToBook]] = None """ Set the number of spots you want to book. You add number of spots per price category. Multiple spots require that the service has GroupBooking enabled. Default is one spot. """ @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class BookingQueryResponse: id: int = 0 company_id: Optional[str] = None from_: datetime.datetime = field(metadata=config(field_name='from'), default=datetime.datetime(1, 1, 1)) to: datetime.datetime = datetime.datetime(1, 1, 1) status: Optional[BookingStatusEnum] = None status_id: int = 0 status_name: Optional[str] = None status_info: Optional[BookingStatusQueryResponse] = None send_email_reminder: bool = False send_sms_reminder: bool = False send_sms_confirmation: bool = False send_email_confirmation: bool = False last_time_to_un_book: Optional[datetime.datetime] = None custom_fields: Optional[List[CustomFieldConfigData]] = None custom_field_values: Optional[List[CustomFieldDataResponse]] = None booked_resource_types: Optional[List[BookedResourceType]] = None company: Optional[BookedCompany] = None customer: Optional[BookedCustomer] = None quantities: Optional[List[BookedQuantity]] = None service: Optional[ServiceInfoResponse] = None payment_expiration: Optional[datetime.datetime] = None log: Optional[List[BookingLogQueryResponse]] = None payment_log: Optional[List[BookingPaymentLogQueryResponse]] = None checkout_log: Optional[List[BookingCheckoutQueryResponse]] = None external_reference: Optional[List[ExternalReferenceResponse]] = None response_status: Optional[ResponseStatus] = None calendar_export_status: Optional[BookingCalendarExportStatus] = None length_in_minutes: Optional[int] = None booked_by: Optional[str] = None booked_comments: Optional[str] = None unbooked_comments: Optional[str] = None comments_to_customer: Optional[str] = None created_date: datetime.datetime = datetime.datetime(1, 1, 1) updated_date: datetime.datetime = datetime.datetime(1, 1, 1) unbooked_on: Optional[datetime.datetime] = None cancellation_code: Optional[str] = None rating_code: Optional[str] = None @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBookingsResponse: # @ApiMember(Description="The datetime you want to end the booking.", IsRequired=true) created: Optional[List[BookingQueryResponse]] = None """ The datetime you want to end the booking. """ # @ApiMember(Description="The dates that didn't work to book.", IsRequired=true) failed: Optional[List[FailedBookings]] = None """ The dates that didn't work to book. """ response_status: Optional[ResponseStatus] = None # @Route("/bookings/repeat", "POST") # @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) @dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE) @dataclass class CreateBookings(CreateBookingBase, IReturn[CreateBookingsResponse]): # @ApiMember(DataType="List", Description="Set the dates you want to book and it's quantities. It's an array of dates and quantities.", IsRequired=true) dates_to_repeat: Optional[List[DatesToRepeat]] = None """ Set the dates you want to book and it's quantities. It's an array of dates and quantities. """