ClubReady Api

<back to all web services

BookingStatusEventsRequest

The following routes are available for this service:
GET/scheduling/booking-status-eventsList of booking status changes in a time frame.
import Foundation
import ServiceStack

public class BookingStatusEventsRequest : BookingStatusEventsRequestDto, 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?

    /**
    * UTC Format
    */
    // @ApiMember(DataType="date", Description="UTC Format", IsRequired=true, Name="FromDate", ParameterType="query")
    public var fromDate:Date

    /**
    * Max 24 Hours (UTC Format)
    */
    // @ApiMember(DataType="date", Description="Max 24 Hours (UTC Format)", IsRequired=true, Name="ToDate", ParameterType="query")
    public var toDate:Date

    /**
    * 0 = All, 1 = Classes, 2 = Services
    */
    // @ApiMember(DataType="integer", Description="0 = All, 1 = Classes, 2 = Services", IsRequired=true, Name="BookingTypeFilter", ParameterType="query")
    public var bookingTypeFilter:Int

    /**
    * 0 = Any, 1 = Only Consults, 2 = Exclude Consults
    */
    // @ApiMember(DataType="integer", Description="0 = Any, 1 = Only Consults, 2 = Exclude Consults", IsRequired=true, Name="ConsultFilter", ParameterType="query")
    public var consultFilter:Int

    /**
    * Leave blank for any, otherwise use ClubReady BookingStatus enum
    */
    // @ApiMember(DataType="integer", Description="Leave blank for any, otherwise use ClubReady BookingStatus enum", Name="StatusFilter", ParameterType="query")
    public var statusFilter: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 fromDate
        case toDate
        case bookingTypeFilter
        case consultFilter
        case statusFilter
        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)
        fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate)
        toDate = try container.decodeIfPresent(Date.self, forKey: .toDate)
        bookingTypeFilter = try container.decodeIfPresent(Int.self, forKey: .bookingTypeFilter)
        consultFilter = try container.decodeIfPresent(Int.self, forKey: .consultFilter)
        statusFilter = try container.decodeIfPresent(Int.self, forKey: .statusFilter)
        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 fromDate != nil { try container.encode(fromDate, forKey: .fromDate) }
        if toDate != nil { try container.encode(toDate, forKey: .toDate) }
        if bookingTypeFilter != nil { try container.encode(bookingTypeFilter, forKey: .bookingTypeFilter) }
        if consultFilter != nil { try container.encode(consultFilter, forKey: .consultFilter) }
        if statusFilter != nil { try container.encode(statusFilter, forKey: .statusFilter) }
        if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
        if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
    }
}

public class BookingStatusEventsRequestDto : ApiDtoBase
{
    public var fromDate:Date
    public var toDate:Date
    public var bookingTypeFilter:Int
    public var consultFilter:Int
    public var statusFilter:Int?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case fromDate
        case toDate
        case bookingTypeFilter
        case consultFilter
        case statusFilter
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        fromDate = try container.decodeIfPresent(Date.self, forKey: .fromDate)
        toDate = try container.decodeIfPresent(Date.self, forKey: .toDate)
        bookingTypeFilter = try container.decodeIfPresent(Int.self, forKey: .bookingTypeFilter)
        consultFilter = try container.decodeIfPresent(Int.self, forKey: .consultFilter)
        statusFilter = try container.decodeIfPresent(Int.self, forKey: .statusFilter)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if fromDate != nil { try container.encode(fromDate, forKey: .fromDate) }
        if toDate != nil { try container.encode(toDate, forKey: .toDate) }
        if bookingTypeFilter != nil { try container.encode(bookingTypeFilter, forKey: .bookingTypeFilter) }
        if consultFilter != nil { try container.encode(consultFilter, forKey: .consultFilter) }
        if statusFilter != nil { try container.encode(statusFilter, forKey: .statusFilter) }
    }
}

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 BookingStatusEventsResponse : BookingStatusEventsResponseDto
{
    public var success:Bool
    public var message:String
    public var bookingStatusEvents:[BookingStatusEventItem] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case success
        case message
        case bookingStatusEvents
    }

    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)
        bookingStatusEvents = try container.decodeIfPresent([BookingStatusEventItem].self, forKey: .bookingStatusEvents) ?? []
    }

    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 bookingStatusEvents.count > 0 { try container.encode(bookingStatusEvents, forKey: .bookingStatusEvents) }
    }
}

public class BookingStatusEventsResponseDto : ApiResponseBase
{
    public var bookingStatusEvents:[BookingStatusEventItem] = []

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case bookingStatusEvents
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        bookingStatusEvents = try container.decodeIfPresent([BookingStatusEventItem].self, forKey: .bookingStatusEvents) ?? []
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if bookingStatusEvents.count > 0 { try container.encode(bookingStatusEvents, forKey: .bookingStatusEvents) }
    }
}

public class ApiResponseBase : Codable
{
    public var success:Bool
    public var message:String

    required public init(){}
}

public class BookingStatusEventItem : Codable
{
    public var chainId:Int?
    public var storeId:Int?
    public var userId:Int
    public var bookingId:Int
    public var classScheduleId:Int?
    public var serviceId:Int?
    public var sessionSizeId:Int?
    public var bookingDateTime:Date
    public var status:BookingStatus
    public var statusId:Int
    public var statusChanged:Date
    public var consult:Bool
    public var bookedFromWaitList:Bool

    required public init(){}
}

public enum BookingStatus : Int, Codable
{
    case Undefined = 0
    case Unavailable = 1
    case Open = 2
    case CancelledWithinPolicy = 3
    case CancelledOutsidePolicy = 4
    case Completed = 5
    case NoShow = 6
    case RescheduledWithinPolicy = 8
    case RescheduledByAdmin = 9
    case CancelledByAdminNotCustomerFault = 10
    case Pending = 11
    case WaitListed = 12
    case Error = -1
}


Swift BookingStatusEventsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /scheduling/booking-status-events 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","BookingStatusEvents":[{"ChainId":0,"StoreId":0,"UserId":0,"BookingId":0,"ClassScheduleId":0,"ServiceId":0,"SessionSizeId":0,"BookingDateTime":"0001-01-01T00:00:00.0000000","Status":"Undefined","StatusId":0,"StatusChanged":"0001-01-01T00:00:00.0000000","Consult":false,"BookedFromWaitList":false}]}