/* Options: Date: 2024-11-24 14:51:08 SwiftVersion: 5.0 Version: 6.50 Tip: To override a DTO option, remove "//" prefix before updating BaseUrl: https://clubready.com/api/current //BaseClass: //AddModelExtensions: True //AddServiceStackTypes: True IncludeTypes: DoCheckInRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack /** * Check a user into a club */ // @Route("/users/checkin", "POST") // @Api(Description="Check a user into a club") public class DoCheckInRequest : DoCheckInRequestDto, IRestrictedApiRequest { /** * Api Key - grants access to resources */ // @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query") public var apiKey:String /** * User barcode */ // @ApiMember(DataType="string", Description="User barcode", IsRequired=true, Name="Barcode", ParameterType="query") public var barcode:String /** * ClubReady StoreId required */ // @ApiMember(DataType="integer", Description="ClubReady StoreId required", IsRequired=true, Name="StoreId", ParameterType="query") public var storeId:Int? /** * UserId to check into club */ // @ApiMember(DataType="integer", Description="UserId to check into club", Name="UserId", ParameterType="query") public var userId:Int? public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case apiKey case barcode case storeId case userId case restrictedId case restrictedResourceType } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) apiKey = try container.decodeIfPresent(String.self, forKey: .apiKey) barcode = try container.decodeIfPresent(String.self, forKey: .barcode) storeId = try container.decodeIfPresent(Int.self, forKey: .storeId) userId = try container.decodeIfPresent(Int.self, forKey: .userId) restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId) restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if apiKey != nil { try container.encode(apiKey, forKey: .apiKey) } if barcode != nil { try container.encode(barcode, forKey: .barcode) } if storeId != nil { try container.encode(storeId, forKey: .storeId) } if userId != nil { try container.encode(userId, forKey: .userId) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } } } public enum RestrictedResourceType : String, Codable { case Store case Chain case User case Undefined } public protocol IRestrictedApiRequest : IApiKeyEndpoint { var restrictedId:Int? { get set } var restrictedResourceType:RestrictedResourceType { get set } } public protocol IApiKeyEndpoint { var apiKey:String { get set } } public class ApiDtoBase : Codable { public var apiKey:String public var storeId:Int? public var chainId:Int? required public init(){} } public class DoCheckInRequestDto : ApiDtoBase { public var barcode:String public var userId:Int? public var utcTimeStamp:Date required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case barcode case userId case utcTimeStamp } required public init(from decoder: Decoder) throws { try super.init(from: decoder) let container = try decoder.container(keyedBy: CodingKeys.self) barcode = try container.decodeIfPresent(String.self, forKey: .barcode) userId = try container.decodeIfPresent(Int.self, forKey: .userId) utcTimeStamp = try container.decodeIfPresent(Date.self, forKey: .utcTimeStamp) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) if barcode != nil { try container.encode(barcode, forKey: .barcode) } if userId != nil { try container.encode(userId, forKey: .userId) } if utcTimeStamp != nil { try container.encode(utcTimeStamp, forKey: .utcTimeStamp) } } }