/* Options: Date: 2024-11-24 13:20:40 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: GetSalesPackagesRequest.* //ExcludeTypes: //ExcludeGenericBaseTypes: False //AddResponseStatus: False //AddImplicitVersion: //AddDescriptionAsComments: True //InitializeCollections: True //TreatTypesAsStrings: //DefaultImports: Foundation,ServiceStack */ import Foundation import ServiceStack // @Route("/sales/packages", "GET") public class GetSalesPackagesRequest : GetSalesPackagesRequestDto, 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 /** * ID # of store to get packages for */ // @ApiMember(DataType="string", Description="ID # of store to get packages for", IsRequired=true, Name="StoreId", ParameterType="query") public var storeId:Int? /** * ID # of the user to get packages for */ // @ApiMember(DataType="integer", Description="ID # of the user to get packages for", Name="UserId", ParameterType="query") public var userId:Int? /** * The filter type which will used for packages credit (Class = 1, ClassSchedule = 2, SessionSize = 3) */ // @ApiMember(DataType="integer", Description="The filter type which will used for packages credit (Class = 1, ClassSchedule = 2, SessionSize = 3)", Name="CreditFilterType", ParameterType="query") public var creditFilterType:Int? /** * ClassId or ClassScheduleId or SessionSizeId packages which drop credits */ // @ApiMember(DataType="integer", Description="ClassId or ClassScheduleId or SessionSizeId packages which drop credits", Name="CreditFilterId", ParameterType="query") public var creditFilterId:Int? public var restrictedId:Int? public var restrictedResourceType:RestrictedResourceType /** * Show packages enabled for In App purchase. True or False */ // @ApiMember(DataType="string", Description="Show packages enabled for In App purchase. True or False", Name="InApp", ParameterType="query") public var inApp:Bool required public init(){ super.init() } private enum CodingKeys : String, CodingKey { case apiKey case storeId case userId case creditFilterType case creditFilterId case restrictedId case restrictedResourceType case inApp } 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) storeId = try container.decodeIfPresent(Int.self, forKey: .storeId) userId = try container.decodeIfPresent(Int.self, forKey: .userId) creditFilterType = try container.decodeIfPresent(Int.self, forKey: .creditFilterType) creditFilterId = try container.decodeIfPresent(Int.self, forKey: .creditFilterId) restrictedId = try container.decodeIfPresent(Int.self, forKey: .restrictedId) restrictedResourceType = try container.decodeIfPresent(RestrictedResourceType.self, forKey: .restrictedResourceType) inApp = try container.decodeIfPresent(Bool.self, forKey: .inApp) } 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 storeId != nil { try container.encode(storeId, forKey: .storeId) } if userId != nil { try container.encode(userId, forKey: .userId) } if creditFilterType != nil { try container.encode(creditFilterType, forKey: .creditFilterType) } if creditFilterId != nil { try container.encode(creditFilterId, forKey: .creditFilterId) } if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) } if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) } if inApp != nil { try container.encode(inApp, forKey: .inApp) } } } 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 GetSalesPackagesRequestDto : ApiDtoBase { required public init(){ super.init() } required public init(from decoder: Decoder) throws { try super.init(from: decoder) } public override func encode(to encoder: Encoder) throws { try super.encode(to: encoder) } }