GET | /scheduling/booking-status-check | Determine if a user can book a class. |
---|
import Foundation
import ServiceStack
public class CheckBookingStatusRequest : CheckClassBookingStatusRequestDto, 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
/**
* Chain ID
*/
// @ApiMember(DataType="integer", Description="Chain ID", Name="ChainId", ParameterType="query")
public var chainId:Int?
/**
* Store ID
*/
// @ApiMember(DataType="integer", Description="Store ID", Name="StoreId", ParameterType="query")
public var storeId:Int?
/**
* ClubReady Class Schedule ID
*/
// @ApiMember(DataType="integer", Description="ClubReady Class Schedule ID", IsRequired=true, Name="ClassScheduleId", ParameterType="query")
public var classScheduleId:Int
/**
* ClubReady User ID
*/
// @ApiMember(DataType="integer", Description="ClubReady User ID", IsRequired=true, 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 chainId
case storeId
case classScheduleId
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)
chainId = try container.decodeIfPresent(Int.self, forKey: .chainId)
storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
classScheduleId = try container.decodeIfPresent(Int.self, forKey: .classScheduleId)
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 chainId != nil { try container.encode(chainId, forKey: .chainId) }
if storeId != nil { try container.encode(storeId, forKey: .storeId) }
if classScheduleId != nil { try container.encode(classScheduleId, forKey: .classScheduleId) }
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 class CheckClassBookingStatusRequestDto : ApiDtoBase
{
public var classScheduleId:Int
public var userId:Int
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case classScheduleId
case userId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
classScheduleId = try container.decodeIfPresent(Int.self, forKey: .classScheduleId)
userId = try container.decodeIfPresent(Int.self, forKey: .userId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if classScheduleId != nil { try container.encode(classScheduleId, forKey: .classScheduleId) }
if userId != nil { try container.encode(userId, forKey: .userId) }
}
}
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
}
public class CheckBookingStatusResponse : CheckBookingStatusResponseDto
{
public var success:Bool
public var message:String
public var canBook:Bool
public var consumesCredit:Bool
public var source:String
public var availableCredits:Int
public var isBooked:Bool
public var isWaitListed:Bool
public var cancelHours:Int
public var leadTime:Int
public var maxLeadTime:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case success
case message
case canBook
case consumesCredit
case source
case availableCredits
case isBooked
case isWaitListed
case cancelHours
case leadTime
case maxLeadTime
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
success = try container.decodeIfPresent(Bool.self, forKey: .success)
message = try container.decodeIfPresent(String.self, forKey: .message)
canBook = try container.decodeIfPresent(Bool.self, forKey: .canBook)
consumesCredit = try container.decodeIfPresent(Bool.self, forKey: .consumesCredit)
source = try container.decodeIfPresent(String.self, forKey: .source)
availableCredits = try container.decodeIfPresent(Int.self, forKey: .availableCredits)
isBooked = try container.decodeIfPresent(Bool.self, forKey: .isBooked)
isWaitListed = try container.decodeIfPresent(Bool.self, forKey: .isWaitListed)
cancelHours = try container.decodeIfPresent(Int.self, forKey: .cancelHours)
leadTime = try container.decodeIfPresent(Int.self, forKey: .leadTime)
maxLeadTime = try container.decodeIfPresent(Int.self, forKey: .maxLeadTime)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if success != nil { try container.encode(success, forKey: .success) }
if message != nil { try container.encode(message, forKey: .message) }
if canBook != nil { try container.encode(canBook, forKey: .canBook) }
if consumesCredit != nil { try container.encode(consumesCredit, forKey: .consumesCredit) }
if source != nil { try container.encode(source, forKey: .source) }
if availableCredits != nil { try container.encode(availableCredits, forKey: .availableCredits) }
if isBooked != nil { try container.encode(isBooked, forKey: .isBooked) }
if isWaitListed != nil { try container.encode(isWaitListed, forKey: .isWaitListed) }
if cancelHours != nil { try container.encode(cancelHours, forKey: .cancelHours) }
if leadTime != nil { try container.encode(leadTime, forKey: .leadTime) }
if maxLeadTime != nil { try container.encode(maxLeadTime, forKey: .maxLeadTime) }
}
}
public class CheckBookingStatusResponseDto : ApiResponseBase
{
public var canBook:Bool
public var consumesCredit:Bool
public var source:String
public var availableCredits:Int
public var isBooked:Bool
public var isWaitListed:Bool
public var cancelHours:Int
public var leadTime:Int
public var maxLeadTime:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case canBook
case consumesCredit
case source
case availableCredits
case isBooked
case isWaitListed
case cancelHours
case leadTime
case maxLeadTime
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
canBook = try container.decodeIfPresent(Bool.self, forKey: .canBook)
consumesCredit = try container.decodeIfPresent(Bool.self, forKey: .consumesCredit)
source = try container.decodeIfPresent(String.self, forKey: .source)
availableCredits = try container.decodeIfPresent(Int.self, forKey: .availableCredits)
isBooked = try container.decodeIfPresent(Bool.self, forKey: .isBooked)
isWaitListed = try container.decodeIfPresent(Bool.self, forKey: .isWaitListed)
cancelHours = try container.decodeIfPresent(Int.self, forKey: .cancelHours)
leadTime = try container.decodeIfPresent(Int.self, forKey: .leadTime)
maxLeadTime = try container.decodeIfPresent(Int.self, forKey: .maxLeadTime)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if canBook != nil { try container.encode(canBook, forKey: .canBook) }
if consumesCredit != nil { try container.encode(consumesCredit, forKey: .consumesCredit) }
if source != nil { try container.encode(source, forKey: .source) }
if availableCredits != nil { try container.encode(availableCredits, forKey: .availableCredits) }
if isBooked != nil { try container.encode(isBooked, forKey: .isBooked) }
if isWaitListed != nil { try container.encode(isWaitListed, forKey: .isWaitListed) }
if cancelHours != nil { try container.encode(cancelHours, forKey: .cancelHours) }
if leadTime != nil { try container.encode(leadTime, forKey: .leadTime) }
if maxLeadTime != nil { try container.encode(maxLeadTime, forKey: .maxLeadTime) }
}
}
public class ApiResponseBase : Codable
{
public var success:Bool
public var message:String
required public init(){}
}
Swift CheckBookingStatusRequest 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 /scheduling/booking-status-check HTTP/1.1 Host: clubready.com Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Success":false,"Message":"String","CanBook":false,"ConsumesCredit":false,"Source":"String","AvailableCredits":0,"IsBooked":false,"IsWaitListed":false,"CancelHours":0,"LeadTime":0,"MaxLeadTime":0}