GET | /sales/packages | Get Available packages for a chain or store |
---|
import Foundation
import ServiceStack
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 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)
}
}
public class ApiDtoBase : Codable
{
public var apiKey:String
public var storeId:Int?
public var chainId:Int?
required public init(){}
}
public enum RestrictedResourceType : String, Codable
{
case Store
case Chain
case User
case Undefined
}
Swift GetSalesPackagesRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /sales/packages HTTP/1.1 Host: clubready.com Accept: text/csv