Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /bookings/{Id}/resource | Change a resource on a booking | Update an existing booking with a another available resource. |
---|
import Foundation
import ServiceStack
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
// @ValidateRequest(Validator="IsAuthenticated")
public class ChangeResourceOnBooking : ICompany, Codable
{
/**
* 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.")
public var companyId:String?
/**
* Id of the booking
*/
// @ApiMember(Description="Id of the booking", IsRequired=true, ParameterType="path")
public var id:Int?
/**
* The resource type id
*/
// @ApiMember(Description="The resource type id")
public var resourceTypeId:Int
/**
* The resource id you want to replace
*/
// @ApiMember(Description="The resource id you want to replace")
public var resourceId:Int
/**
* The resource id to be replaced with
*/
// @ApiMember(Description="The resource id to be replaced with")
public var newResourceId:Int
required public init(){}
}
public class BookingQueryResponse : Codable
{
public var id:Int
public var companyId:String
public var from:Date
public var to:Date
public var status:BookingStatusEnum
public var statusId:Int
public var statusName:String
public var statusInfo:BookingStatusQueryResponse
public var sendEmailReminder:Bool
public var sendSmsReminder:Bool
public var sendSmsConfirmation:Bool
public var sendEmailConfirmation:Bool
public var lastTimeToUnBook:Date?
public var customFields:[CustomFieldConfigData] = []
public var customFieldValues:[CustomFieldDataResponse] = []
public var bookedResourceTypes:[BookedResourceType] = []
public var company:BookedCompany
public var customer:BookedCustomer
public var quantities:[BookedQuantity] = []
public var service:ServiceInfoResponse
public var paymentExpiration:Date?
public var log:[BookingLogQueryResponse] = []
public var paymentLog:[BookingPaymentLogQueryResponse] = []
public var checkoutLog:[BookingCheckoutQueryResponse] = []
public var externalReference:[ExternalReferenceResponse] = []
public var responseStatus:ResponseStatus
public var calendarExportStatus:BookingCalendarExportStatus
public var lengthInMinutes:Int?
public var bookedBy:String
public var bookedComments:String
public var unbookedComments:String
public var commentsToCustomer:String
public var createdDate:Date
public var updatedDate:Date
public var unbookedOn:Date?
public var cancellationCode:String
public var ratingCode:String
required public init(){}
}
public enum BookingStatusEnum : Int, Codable
{
case Booked = 1
case Unbooked = 2
case Reserved = 3
case Canceled = 4
case AwaitingPayment = 5
case AwaitingPaymentNoTimeLimit = 6
case Payed = 7
case AwaitingPaymentRequestFromAdmin = 8
case AwaitingPaymentFromProvider = 9
case Invoiced = 10
}
public class BookingStatusQueryResponse : Codable
{
public var id:Int
public var name:String
public var Description:String
public var icon:String
public var color:String
required public init(){}
}
public class CustomFieldConfigData : Codable
{
/**
* Custom field id
*/
// @ApiMember(Description="Custom field id")
public var id:Int
/**
* Configuration name. Example: 'Number of persons'.
*/
// @ApiMember(Description="Configuration name. Example: 'Number of persons'.")
public var name:String
/**
* Custom field description. Example: 'For how many persons is this booking?'
*/
// @ApiMember(Description="Custom field description. Example: 'For how many persons is this booking?'")
public var Description:String
/**
* Field width. Example: 20 for 20px
*/
// @ApiMember(Description="Field width. Example: 20 for 20px")
public var width:Int?
/**
* Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
*/
// @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
public var dataType:String
/**
* Default value of the field. Example: '3'
*/
// @ApiMember(Description="Default value of the field. Example: '3'")
public var defaultValue:String
/**
* Determines if the field is required to have a value or not
*/
// @ApiMember(Description="Determines if the field is required to have a value or not")
public var isMandatory:Bool
/**
* Error message shown to the user if the field data is required but not entered
*/
// @ApiMember(Description="Error message shown to the user if the field data is required but not entered")
public var mandatoryErrorMessage:String
/**
* Max lenght of the field
*/
// @ApiMember(Description="Max lenght of the field")
public var maxLength:Int
/**
* If the field should have multiple lines
*/
// @ApiMember(Description="If the field should have multiple lines")
public var multipleLineText:Bool
/**
* Regular expression used for validation of the field
*/
// @ApiMember(Description="Regular expression used for validation of the field")
public var regEx:String
/**
* Error message shown if the regular expression validation failed
*/
// @ApiMember(Description="Error message shown if the regular expression validation failed")
public var regExErrorMessage:String
/**
* The values to select from if Datatype is DropDown for this custom field
*/
// @ApiMember(Description="The values to select from if Datatype is DropDown for this custom field")
public var values:[CustomFieldValueResponse] = []
required public init(){}
}
public class CustomFieldValueResponse : Codable
{
public var value:String
required public init(){}
}
public class CustomFieldDataResponse : Codable
{
public var id:Int
public var column:String
public var name:String
public var Description:String
public var value:String
/**
* Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'
*/
// @ApiMember(Description="Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox'")
public var dataType:String
required public init(){}
}
public class BookedResourceType : Codable
{
/**
* The resource type id
*/
// @ApiMember(Description="The resource type id")
public var id:Int
/**
* The resource type name
*/
// @ApiMember(Description="The resource type name")
public var name:String
/**
* The resources inside resource type
*/
// @ApiMember(Description="The resources inside resource type")
public var resources:[BookedResource] = []
required public init(){}
}
public class BookedResource : Codable
{
public var id:Int
public var name:String
public var color:String
public var imageUrl:Uri
public var email:String
public var mobilePhone:String
public var accessGroup:String
public var emailNotification:Bool
public var smsNotification:Bool
public var emailReminder:Bool
public var smsReminder:Bool
required public init(){}
}
public class BookedCompany : Codable
{
public var id:String
public var name:String
public var logoType:Uri
public var category:String
public var street1:String
public var street2:String
public var zipCode:String
public var city:String
public var countryId:String
public var longitude:String
public var latitude:String
public var phone:String
public var email:String
public var homePage:String
public var sitePath:String
public var isFavorite:Bool
public var paymentProviderId:Int?
required public init(){}
}
public class BookedCustomer : Codable
{
public var id:String
public var firstname:String
public var lastname:String
public var email:String
public var phone:String
public var facebookUserName:String
public var imageUrl:String
public var corporateIdentityNumber:String
public var invoiceAddress1:String
public var invoiceAddress2:String
public var invoiceCity:String
public var invoicePostalCode:String
public var invoiceCountryCode:String
required public init(){}
}
public class BookedQuantity : Codable
{
/**
* The quantity Id
*/
// @ApiMember(Description="The quantity Id")
public var id:Int
/**
* The quantity for booked on this price category
*/
// @ApiMember(Description="The quantity for booked on this price category")
public var quantity:Int
/**
* The price
*/
// @ApiMember(Description="The price")
public var price:Double?
/**
* The price bofore rebate codes
*/
// @ApiMember(Description="The price bofore rebate codes")
public var priceBeforeRebate:Double?
/**
* The price currency
*/
// @ApiMember(Description="The price currency")
public var currencyId:String
/**
* The price sign
*/
// @ApiMember(Description="The price sign")
public var priceSign:String
/**
* The price category
*/
// @ApiMember(Description="The price category")
public var category:String
/**
* The price VAT in percent
*/
// @ApiMember(Description="The price VAT in percent")
public var vat:Double?
/**
* The price text to display
*/
// @ApiMember(Description="The price text to display")
public var priceText:String
/**
* 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.")
public var occupiesSpot:Bool
required public init(){}
}
public class ServiceInfoResponse : Codable
{
public var id:Int
public var name:String
public var Description:String
public var imageUrl:Uri
public var lengthInMinutes:Int?
public var maxNumberOfSpotsPerBooking:Int
public var minNumberOfSpotsPerBooking:Int
public var groupBooking:GroupBookingSettings
public var multipleResource:MultipleResourceSettings
public var isGroupBooking:Bool
public var isPaymentEnabled:Bool
required public init(){}
}
public class GroupBookingSettings : Codable
{
public var active:Bool
public var min:Int
public var max:Int
required public init(){}
}
public class MultipleResourceSettings : Codable
{
public var active:Bool
public var min:Int
public var max:Int
required public init(){}
}
public class BookingLogQueryResponse : Codable
{
/**
* The booking log id
*/
// @ApiMember(Description="The booking log id")
public var id:Int
/**
* The booking id
*/
// @ApiMember(Description="The booking id")
public var bookingId:Int
/**
* The type of event
*/
// @ApiMember(Description="The type of event")
public var eventTypeId:Int
/**
* The type of event
*/
// @ApiMember(Description="The type of event")
public var eventType:BookingLogEventTypeResponse
/**
* Comments that could be added to the event log item
*/
// @ApiMember(Description="Comments that could be added to the event log item")
public var comments:String
/**
* The user created the event
*/
// @ApiMember(Description="The user created the event")
public var userName:String
/**
* Then date when the event occured
*/
// @ApiMember(Description="Then date when the event occured")
public var created:Date
required public init(){}
}
public class BookingLogEventTypeResponse : Codable
{
/**
* The event type id
*/
// @ApiMember(Description="The event type id")
public var id:Int
/**
* The event type name
*/
// @ApiMember(Description="The event type name")
public var name:String
/**
* The event type description
*/
// @ApiMember(Description="The event type description")
public var Description:String
required public init(){}
}
public class BookingPaymentLogQueryResponse : Codable
{
/**
* The booking payment log id
*/
// @ApiMember(Description="The booking payment log id")
public var id:Int
/**
* The booking id
*/
// @ApiMember(Description="The booking id")
public var bookingId:Int
/**
* The payment reference id
*/
// @ApiMember(Description="The payment reference id")
public var paymentReferenceId:String
/**
* The payment order item reference id
*/
// @ApiMember(Description="The payment order item reference id")
public var orderItemReferenceId:String
/**
* The payment reference id
*/
// @ApiMember(Description="The payment reference id")
public var paymentProviderId:Int?
/**
* The payment amount
*/
// @ApiMember(Description="The payment amount")
public var amount:Double
/**
* The payment VAT in percent
*/
// @ApiMember(Description="The payment VAT in percent")
public var vat:Double
/**
* The payment amount that is credited
*/
// @ApiMember(Description="The payment amount that is credited")
public var amountCredited:Double
/**
* The payment currency id
*/
// @ApiMember(Description="The payment currency id")
public var currencyId:String
/**
* The payment currency info
*/
// @ApiMember(Description="The payment currency info")
public var currencyInfo:CurrencyInfoResponse
/**
* Comments that could be added to the event log item
*/
// @ApiMember(Description="Comments that could be added to the event log item")
public var comments:String
/**
* The date when the payment items was created
*/
// @ApiMember(Description="The date when the payment items was created")
public var created:Date
/**
* The date when the payment items was update
*/
// @ApiMember(Description="The date when the payment items was update")
public var updated:Date
required public init(){}
}
public class CurrencyInfoResponse : Codable
{
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var id:String
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var name:String
/**
* The currency id
*/
// @ApiMember(Description="The currency id")
public var currencySign:String
required public init(){}
}
public class BookingCheckoutQueryResponse : Codable
{
/**
* The checkout id
*/
// @ApiMember(Description="The checkout id")
public var id:String
/**
* The booking id
*/
// @ApiMember(Description="The booking id")
public var bookingId:Int
/**
* The purchase id
*/
// @ApiMember(Description="The purchase id")
public var purchaseId:Int?
/**
* The payment checkout expiration datetime
*/
// @ApiMember(Description="The payment checkout expiration datetime")
public var expirationTime:Date?
/**
* The payment snippet code
*/
// @ApiMember(Description="The payment snippet code")
public var snippet:String
/**
* The payment status
*/
// @ApiMember(Description="The payment status")
public var status:String
/**
* Log message
*/
// @ApiMember(Description="Log message")
public var message:String
/**
* When the checkout log item was created
*/
// @ApiMember(Description="When the checkout log item was created")
public var created:Date
/**
* When the checkout log item was updated
*/
// @ApiMember(Description="When the checkout log item was updated")
public var updated:Date
required public init(){}
}
public class ExternalReferenceResponse : Codable
{
public var companyId:String
public var id:String
public var ownerId:String
public var referenceType:String
public var externalData:String
public var createdBy:String
public var updated:Date
public var created:Date
required public init(){}
}
public class BookingCalendarExportStatus : Codable
{
public var calendarId:String
public var bookingId:Int
public var synced:Bool?
required public init(){}
}
Swift ChangeResourceOnBooking 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.
PUT /bookings/{Id}/resource HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<ChangeResourceOnBooking 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>
<Id>0</Id>
<NewResourceId>0</NewResourceId>
<ResourceId>0</ResourceId>
<ResourceTypeId>0</ResourceTypeId>
</ChangeResourceOnBooking>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <BookingQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <BookedBy>String</BookedBy> <BookedComments>String</BookedComments> <BookedResourceTypes> <BookedResourceType> <Id>0</Id> <Name>String</Name> <Resources> <BookedResource> <AccessGroup>String</AccessGroup> <Color>String</Color> <Email>String</Email> <EmailNotification>false</EmailNotification> <EmailReminder>false</EmailReminder> <Id>0</Id> <ImageUrl i:nil="true" /> <MobilePhone>String</MobilePhone> <Name>String</Name> <SMSNotification>false</SMSNotification> <SMSReminder>false</SMSReminder> </BookedResource> </Resources> </BookedResourceType> </BookedResourceTypes> <CalendarExportStatus> <BookingId>0</BookingId> <CalendarId>String</CalendarId> <Synced>false</Synced> </CalendarExportStatus> <CancellationCode>String</CancellationCode> <CheckoutLog> <BookingCheckoutQueryResponse> <BookingId>0</BookingId> <Created>0001-01-01T00:00:00</Created> <ExpirationTime>0001-01-01T00:00:00</ExpirationTime> <Id>00000000-0000-0000-0000-000000000000</Id> <Message>String</Message> <PurchaseId>0</PurchaseId> <Snippet>String</Snippet> <Status>String</Status> <Updated>0001-01-01T00:00:00</Updated> </BookingCheckoutQueryResponse> </CheckoutLog> <CommentsToCustomer>String</CommentsToCustomer> <Company> <Category>String</Category> <City>String</City> <CountryId>String</CountryId> <Email>String</Email> <HomePage>String</HomePage> <Id>00000000-0000-0000-0000-000000000000</Id> <IsFavorite>false</IsFavorite> <Latitude>String</Latitude> <LogoType i:nil="true" /> <Longitude>String</Longitude> <Name>String</Name> <PaymentProviderId>0</PaymentProviderId> <Phone>String</Phone> <SitePath>String</SitePath> <Street1>String</Street1> <Street2>String</Street2> <ZipCode>String</ZipCode> </Company> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <CustomFieldValues> <CustomFieldDataResponse> <Column>String</Column> <DataType>String</DataType> <Description>String</Description> <Id>0</Id> <Name>String</Name> <Value>String</Value> </CustomFieldDataResponse> </CustomFieldValues> <CustomFields> <CustomFieldConfigData> <DataType>String</DataType> <DefaultValue>String</DefaultValue> <Description>String</Description> <Id>0</Id> <IsMandatory>false</IsMandatory> <MandatoryErrorMessage>String</MandatoryErrorMessage> <MaxLength>0</MaxLength> <MultipleLineText>false</MultipleLineText> <Name>String</Name> <RegEx>String</RegEx> <RegExErrorMessage>String</RegExErrorMessage> <Values> <CustomFieldValueResponse> <Value>String</Value> </CustomFieldValueResponse> </Values> <Width>0</Width> </CustomFieldConfigData> </CustomFields> <Customer> <CorporateIdentityNumber>String</CorporateIdentityNumber> <Email>String</Email> <FacebookUserName>String</FacebookUserName> <Firstname>String</Firstname> <Id>00000000-0000-0000-0000-000000000000</Id> <ImageUrl>String</ImageUrl> <InvoiceAddress1>String</InvoiceAddress1> <InvoiceAddress2>String</InvoiceAddress2> <InvoiceCity>String</InvoiceCity> <InvoiceCountryCode>String</InvoiceCountryCode> <InvoicePostalCode>String</InvoicePostalCode> <Lastname>String</Lastname> <Phone>String</Phone> </Customer> <ExternalReference> <ExternalReferenceResponse> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Created>0001-01-01T00:00:00</Created> <CreatedBy>String</CreatedBy> <ExternalData>String</ExternalData> <Id>00000000-0000-0000-0000-000000000000</Id> <OwnerId>00000000-0000-0000-0000-000000000000</OwnerId> <ReferenceType>String</ReferenceType> <Updated>0001-01-01T00:00:00</Updated> </ExternalReferenceResponse> </ExternalReference> <From>0001-01-01T00:00:00</From> <Id>0</Id> <LastTimeToUnBook>0001-01-01T00:00:00</LastTimeToUnBook> <LengthInMinutes>0</LengthInMinutes> <Log> <BookingLogQueryResponse> <BookingId>0</BookingId> <Comments>String</Comments> <Created>0001-01-01T00:00:00</Created> <EventType> <Description>String</Description> <Id>0</Id> <Name>String</Name> </EventType> <EventTypeId>0</EventTypeId> <Id>0</Id> <UserName>String</UserName> </BookingLogQueryResponse> </Log> <PaymentExpiration>0001-01-01T00:00:00</PaymentExpiration> <PaymentLog> <BookingPaymentLogQueryResponse> <Amount>0</Amount> <AmountCredited>0</AmountCredited> <BookingId>0</BookingId> <Comments>String</Comments> <Created>0001-01-01T00:00:00</Created> <CurrencyId>String</CurrencyId> <CurrencyInfo> <CurrencySign>String</CurrencySign> <Id>String</Id> <Name>String</Name> </CurrencyInfo> <Id>0</Id> <OrderItemReferenceId>String</OrderItemReferenceId> <PaymentProviderId>0</PaymentProviderId> <PaymentReferenceId>String</PaymentReferenceId> <Updated>0001-01-01T00:00:00</Updated> <VAT>0</VAT> </BookingPaymentLogQueryResponse> </PaymentLog> <Quantities> <BookedQuantity> <Category>String</Category> <CurrencyId>String</CurrencyId> <Id>0</Id> <OccupiesSpot>false</OccupiesSpot> <Price>0</Price> <PriceBeforeRebate>0</PriceBeforeRebate> <PriceSign>String</PriceSign> <PriceText>String</PriceText> <Quantity>0</Quantity> <VAT>0</VAT> </BookedQuantity> </Quantities> <RatingCode>String</RatingCode> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <SendEmailConfirmation>false</SendEmailConfirmation> <SendEmailReminder>false</SendEmailReminder> <SendSmsConfirmation>false</SendSmsConfirmation> <SendSmsReminder>false</SendSmsReminder> <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> <Status>Booked</Status> <StatusId>0</StatusId> <StatusInfo> <Color>String</Color> <Description>String</Description> <Icon>String</Icon> <Id>0</Id> <Name>String</Name> </StatusInfo> <StatusName>String</StatusName> <To>0001-01-01T00:00:00</To> <UnbookedComments>String</UnbookedComments> <UnbookedOn>0001-01-01T00:00:00</UnbookedOn> <UpdatedDate>0001-01-01T00:00:00</UpdatedDate> </BookingQueryResponse>