/* Options: Date: 2025-09-15 04:34:40 SwiftVersion: 6.0 Version: 8.80 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://api.bookmore.com //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True //MakePropertiesOptional: True IncludeTypes: CustomerQuery.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: False //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/customers", "GET") // @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401) // @ValidateRequest(Validator="IsAuthenticated") public class CustomerQuery : QueryDb2, IReturn { public typealias Return = QueryResponse /** * Enter the company and id you want to see the information for a customer, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown */ // @ApiMember(Description="Enter the company and id you want to see the information for a customer, if blank company id and you are an admin, your company id will be used. If blank id, all resources will be shown ", IsRequired=true, ParameterType="query") public var companyId:String? /** * Enter the customer id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info. */ // @ApiMember(Description="Enter the customer id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info.", ParameterType="query") public var customerId:String? /** * Enter the user id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info. User Id is the userprofile */ // @ApiMember(Description="Enter the user id you want to see the information for a customer. Only admins are allowed to see all customers on their company, users can only see their own customer info. User Id is the userprofile", ParameterType="query") public var userId:String? /** * Will search by any customer name,phone or email that contains the searchstring provided. */ // @ApiMember(Description="Will search by any customer name,phone or email that contains the searchstring provided.", ParameterType="query") public var search:String? /** * If you want to filter on visible customers. */ // @ApiMember(Description="If you want to filter on visible customers.", ParameterType="query") public var visible:Bool? /** * If you want to include the connected custom fields */ // @ApiMember(DataType="boolean", Description="If you want to include the connected custom fields", ParameterType="query") public var includeCustomFieldValues:Bool? /** * If you want to include the connected custom fields */ // @ApiMember(DataType="boolean", Description="If you want to include the connected custom fields", ParameterType="query") public var includeCustomFields:Bool? /** * If you want to include the comments on the customer */ // @ApiMember(DataType="boolean", Description="If you want to include the comments on the customer", ParameterType="query") public var includeComments:Bool? /** * If you want to include the accesskeys */ // @ApiMember(Description="If you want to include the accesskeys") public var includeAccessKeys:Bool? /** * If you want to include invoice address */ // @ApiMember(Description="If you want to include invoice address") public var includeInvoiceAddress:Bool? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case customerId case userId case search case visible case includeCustomFieldValues case includeCustomFields case includeComments case includeAccessKeys case includeInvoiceAddress } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) userId = try container.decodeIfPresent(String.self, forKey: .userId) search = try container.decodeIfPresent(String.self, forKey: .search) visible = try container.decodeIfPresent(Bool.self, forKey: .visible) includeCustomFieldValues = try container.decodeIfPresent(Bool.self, forKey: .includeCustomFieldValues) includeCustomFields = try container.decodeIfPresent(Bool.self, forKey: .includeCustomFields) includeComments = try container.decodeIfPresent(Bool.self, forKey: .includeComments) includeAccessKeys = try container.decodeIfPresent(Bool.self, forKey: .includeAccessKeys) includeInvoiceAddress = try container.decodeIfPresent(Bool.self, forKey: .includeInvoiceAddress) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if companyId != nil { try container.encode(companyId, forKey: .companyId) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if userId != nil { try container.encode(userId, forKey: .userId) } if search != nil { try container.encode(search, forKey: .search) } if visible != nil { try container.encode(visible, forKey: .visible) } if includeCustomFieldValues != nil { try container.encode(includeCustomFieldValues, forKey: .includeCustomFieldValues) } if includeCustomFields != nil { try container.encode(includeCustomFields, forKey: .includeCustomFields) } if includeComments != nil { try container.encode(includeComments, forKey: .includeComments) } if includeAccessKeys != nil { try container.encode(includeAccessKeys, forKey: .includeAccessKeys) } if includeInvoiceAddress != nil { try container.encode(includeInvoiceAddress, forKey: .includeInvoiceAddress) } } } public class Customer : BaseModel, IUser, ICustomFieldTable { public var identityId:Int? public var id:String? // @Ignore() public var customerId:String? // @Ignore() public var accessKeys:IList? public var email:String? // @Ignore() public var externalReferences:IList? // @Ignore() public var invoiceAddress:IList? // @Ignore() public var mainInvoiceAddress:InvoiceAddress? // @Ignore() public var company:Company? // @Ignore() public var customFieldsConfig:IList? // @Ignore() public var customFieldsData:IList? // @Ignore() public var comments:IList? // @Ignore() public var rebateCodes:IList? public var firstname:String? // @Ignore() public var fullName:String? // @Ignore() public var imageUrl:String? // @Required() public var active:Bool? public var facebookUsername:String? // @Required() public var updated:Date? // @Required() public var created:Date? public var ipAddress:String? public var modifiedDate:Date? public var textField1:String? public var textField2:String? public var textField3:String? public var textField4:String? public var textField5:String? public var textField6:String? public var textField7:String? public var textField8:String? public var textField9:String? public var textField10:String? public var textField11:String? public var textField12:String? public var textField13:String? public var textField14:String? public var textField15:String? public var textField16:String? public var textField17:String? public var textField18:String? public var textField19:String? public var textField20:String? public var userId:String? public var lastname:String? public var phone: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 var companyId:String? public var subscribedToNewsletter:Bool? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case identityId case id case customerId case accessKeys case email case externalReferences case invoiceAddress case mainInvoiceAddress case company case customFieldsConfig case customFieldsData case comments case rebateCodes case firstname case fullName case imageUrl case active case facebookUsername case updated case created case ipAddress case modifiedDate case textField1 case textField2 case textField3 case textField4 case textField5 case textField6 case textField7 case textField8 case textField9 case textField10 case textField11 case textField12 case textField13 case textField14 case textField15 case textField16 case textField17 case textField18 case textField19 case textField20 case userId case lastname case phone case corporateIdentityNumber case invoiceAddress1 case invoiceAddress2 case invoiceCity case invoicePostalCode case invoiceCountryCode case companyId case subscribedToNewsletter } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) identityId = try container.decodeIfPresent(Int.self, forKey: .identityId) id = try container.decodeIfPresent(String.self, forKey: .id) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) accessKeys = try container.decodeIfPresent(IList.self, forKey: .accessKeys) email = try container.decodeIfPresent(String.self, forKey: .email) externalReferences = try container.decodeIfPresent(IList.self, forKey: .externalReferences) invoiceAddress = try container.decodeIfPresent(IList.self, forKey: .invoiceAddress) mainInvoiceAddress = try container.decodeIfPresent(InvoiceAddress.self, forKey: .mainInvoiceAddress) company = try container.decodeIfPresent(Company.self, forKey: .company) customFieldsConfig = try container.decodeIfPresent(IList.self, forKey: .customFieldsConfig) customFieldsData = try container.decodeIfPresent(IList.self, forKey: .customFieldsData) comments = try container.decodeIfPresent(IList.self, forKey: .comments) rebateCodes = try container.decodeIfPresent(IList.self, forKey: .rebateCodes) firstname = try container.decodeIfPresent(String.self, forKey: .firstname) fullName = try container.decodeIfPresent(String.self, forKey: .fullName) imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl) active = try container.decodeIfPresent(Bool.self, forKey: .active) facebookUsername = try container.decodeIfPresent(String.self, forKey: .facebookUsername) updated = try container.decodeIfPresent(Date.self, forKey: .updated) created = try container.decodeIfPresent(Date.self, forKey: .created) ipAddress = try container.decodeIfPresent(String.self, forKey: .ipAddress) modifiedDate = try container.decodeIfPresent(Date.self, forKey: .modifiedDate) textField1 = try container.decodeIfPresent(String.self, forKey: .textField1) textField2 = try container.decodeIfPresent(String.self, forKey: .textField2) textField3 = try container.decodeIfPresent(String.self, forKey: .textField3) textField4 = try container.decodeIfPresent(String.self, forKey: .textField4) textField5 = try container.decodeIfPresent(String.self, forKey: .textField5) textField6 = try container.decodeIfPresent(String.self, forKey: .textField6) textField7 = try container.decodeIfPresent(String.self, forKey: .textField7) textField8 = try container.decodeIfPresent(String.self, forKey: .textField8) textField9 = try container.decodeIfPresent(String.self, forKey: .textField9) textField10 = try container.decodeIfPresent(String.self, forKey: .textField10) textField11 = try container.decodeIfPresent(String.self, forKey: .textField11) textField12 = try container.decodeIfPresent(String.self, forKey: .textField12) textField13 = try container.decodeIfPresent(String.self, forKey: .textField13) textField14 = try container.decodeIfPresent(String.self, forKey: .textField14) textField15 = try container.decodeIfPresent(String.self, forKey: .textField15) textField16 = try container.decodeIfPresent(String.self, forKey: .textField16) textField17 = try container.decodeIfPresent(String.self, forKey: .textField17) textField18 = try container.decodeIfPresent(String.self, forKey: .textField18) textField19 = try container.decodeIfPresent(String.self, forKey: .textField19) textField20 = try container.decodeIfPresent(String.self, forKey: .textField20) userId = try container.decodeIfPresent(String.self, forKey: .userId) lastname = try container.decodeIfPresent(String.self, forKey: .lastname) phone = try container.decodeIfPresent(String.self, forKey: .phone) corporateIdentityNumber = try container.decodeIfPresent(String.self, forKey: .corporateIdentityNumber) invoiceAddress1 = try container.decodeIfPresent(String.self, forKey: .invoiceAddress1) invoiceAddress2 = try container.decodeIfPresent(String.self, forKey: .invoiceAddress2) invoiceCity = try container.decodeIfPresent(String.self, forKey: .invoiceCity) invoicePostalCode = try container.decodeIfPresent(String.self, forKey: .invoicePostalCode) invoiceCountryCode = try container.decodeIfPresent(String.self, forKey: .invoiceCountryCode) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) subscribedToNewsletter = try container.decodeIfPresent(Bool.self, forKey: .subscribedToNewsletter) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if identityId != nil { try container.encode(identityId, forKey: .identityId) } if id != nil { try container.encode(id, forKey: .id) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if accessKeys != nil { try container.encode(accessKeys, forKey: .accessKeys) } if email != nil { try container.encode(email, forKey: .email) } if externalReferences != nil { try container.encode(externalReferences, forKey: .externalReferences) } if invoiceAddress != nil { try container.encode(invoiceAddress, forKey: .invoiceAddress) } if mainInvoiceAddress != nil { try container.encode(mainInvoiceAddress, forKey: .mainInvoiceAddress) } if company != nil { try container.encode(company, forKey: .company) } if customFieldsConfig != nil { try container.encode(customFieldsConfig, forKey: .customFieldsConfig) } if customFieldsData != nil { try container.encode(customFieldsData, forKey: .customFieldsData) } if comments != nil { try container.encode(comments, forKey: .comments) } if rebateCodes != nil { try container.encode(rebateCodes, forKey: .rebateCodes) } if firstname != nil { try container.encode(firstname, forKey: .firstname) } if fullName != nil { try container.encode(fullName, forKey: .fullName) } if imageUrl != nil { try container.encode(imageUrl, forKey: .imageUrl) } if active != nil { try container.encode(active, forKey: .active) } if facebookUsername != nil { try container.encode(facebookUsername, forKey: .facebookUsername) } if updated != nil { try container.encode(updated, forKey: .updated) } if created != nil { try container.encode(created, forKey: .created) } if ipAddress != nil { try container.encode(ipAddress, forKey: .ipAddress) } if modifiedDate != nil { try container.encode(modifiedDate, forKey: .modifiedDate) } if textField1 != nil { try container.encode(textField1, forKey: .textField1) } if textField2 != nil { try container.encode(textField2, forKey: .textField2) } if textField3 != nil { try container.encode(textField3, forKey: .textField3) } if textField4 != nil { try container.encode(textField4, forKey: .textField4) } if textField5 != nil { try container.encode(textField5, forKey: .textField5) } if textField6 != nil { try container.encode(textField6, forKey: .textField6) } if textField7 != nil { try container.encode(textField7, forKey: .textField7) } if textField8 != nil { try container.encode(textField8, forKey: .textField8) } if textField9 != nil { try container.encode(textField9, forKey: .textField9) } if textField10 != nil { try container.encode(textField10, forKey: .textField10) } if textField11 != nil { try container.encode(textField11, forKey: .textField11) } if textField12 != nil { try container.encode(textField12, forKey: .textField12) } if textField13 != nil { try container.encode(textField13, forKey: .textField13) } if textField14 != nil { try container.encode(textField14, forKey: .textField14) } if textField15 != nil { try container.encode(textField15, forKey: .textField15) } if textField16 != nil { try container.encode(textField16, forKey: .textField16) } if textField17 != nil { try container.encode(textField17, forKey: .textField17) } if textField18 != nil { try container.encode(textField18, forKey: .textField18) } if textField19 != nil { try container.encode(textField19, forKey: .textField19) } if textField20 != nil { try container.encode(textField20, forKey: .textField20) } if userId != nil { try container.encode(userId, forKey: .userId) } if lastname != nil { try container.encode(lastname, forKey: .lastname) } if phone != nil { try container.encode(phone, forKey: .phone) } if corporateIdentityNumber != nil { try container.encode(corporateIdentityNumber, forKey: .corporateIdentityNumber) } if invoiceAddress1 != nil { try container.encode(invoiceAddress1, forKey: .invoiceAddress1) } if invoiceAddress2 != nil { try container.encode(invoiceAddress2, forKey: .invoiceAddress2) } if invoiceCity != nil { try container.encode(invoiceCity, forKey: .invoiceCity) } if invoicePostalCode != nil { try container.encode(invoicePostalCode, forKey: .invoicePostalCode) } if invoiceCountryCode != nil { try container.encode(invoiceCountryCode, forKey: .invoiceCountryCode) } if companyId != nil { try container.encode(companyId, forKey: .companyId) } if subscribedToNewsletter != nil { try container.encode(subscribedToNewsletter, forKey: .subscribedToNewsletter) } } } public class InvoiceAddressResponse : Codable { public var invoiceAddressId:String? public var userId: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 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 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 UserAccessKeys : BaseModel { // @Required() public var companyId:String? // @Required() public var accessKeyTypeId:Int? // @Required() public var value:String? // @Required() public var customerId:String? public var Description:String? // @Required() public var id:String? required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case companyId case accessKeyTypeId case value case customerId case Description case id } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) companyId = try container.decodeIfPresent(String.self, forKey: .companyId) accessKeyTypeId = try container.decodeIfPresent(Int.self, forKey: .accessKeyTypeId) value = try container.decodeIfPresent(String.self, forKey: .value) customerId = try container.decodeIfPresent(String.self, forKey: .customerId) Description = try container.decodeIfPresent(String.self, forKey: .Description) id = try container.decodeIfPresent(String.self, forKey: .id) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if companyId != nil { try container.encode(companyId, forKey: .companyId) } if accessKeyTypeId != nil { try container.encode(accessKeyTypeId, forKey: .accessKeyTypeId) } if value != nil { try container.encode(value, forKey: .value) } if customerId != nil { try container.encode(customerId, forKey: .customerId) } if Description != nil { try container.encode(Description, forKey: .Description) } if id != nil { try container.encode(id, forKey: .id) } } } public class BaseModel : Codable { required public init(){} } public class CustomFieldValueResponse : Codable { public var value:String? required public init(){} } public class Customer : Codable { public var city:String? public var countryCode:String? public var identityNumber:String? public var email:String? public var firstName:String? public var lastName:String? public var phone:String? public var postalCode:String? public var street:String? public var reference:String? public var type:CustomerType? required public init(){} } public class CustomerQueryResponse : Codable { public var id:String? public var firstname:String? public var lastname:String? public var email:String? public var phone:String? public var imageUrl:String? public var customFields:[CustomFieldConfigData]? public var customFieldValues:[CustomFieldDataResponse]? public var comments:[CustomerCommentsResponse]? public var accessKeys:[UserAccessKeys]? public var updated:Date? public var created:Date? public var responseStatus:String? public var subscribedToNewsletter:Bool? public var invoiceAddress:InvoiceAddressResponse? required public init(){} } public class CustomerCommentsResponse : Codable { public var id:Int? public var customerId:String? public var comments:String? public var updated:Date? public var created:Date? public var imageUrl:Uri? required public init(){} }