ClubReady Api

<back to all web services

ClassRosterRequest

The following routes are available for this service:
GET/scheduling/class-rosterGet booked and waitlisted users for a class.
import Foundation
import ServiceStack

public class ClassRosterRequest : ClassRosterRequestDto, 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

    /**
    * Store Id or Chain Id is required
    */
    // @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="StoreId", ParameterType="query")
    public var storeId:Int?

    /**
    * Store Id or Chain Id is required
    */
    // @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="ChainId", ParameterType="query")
    public var chainId:Int?

    /**
    * Class Schedule ID
    */
    // @ApiMember(DataType="integer", Description="Class Schedule ID", IsRequired=true, Name="ClassScheduleId", ParameterType="query")
    public var classScheduleId:Int

    public var restrictedId:Int?
    public var restrictedResourceType:RestrictedResourceType

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

    private enum CodingKeys : String, CodingKey {
        case apiKey
        case storeId
        case chainId
        case classScheduleId
        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)
        storeId = try container.decodeIfPresent(Int.self, forKey: .storeId)
        chainId = try container.decodeIfPresent(Int.self, forKey: .chainId)
        classScheduleId = try container.decodeIfPresent(Int.self, forKey: .classScheduleId)
        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 storeId != nil { try container.encode(storeId, forKey: .storeId) }
        if chainId != nil { try container.encode(chainId, forKey: .chainId) }
        if classScheduleId != nil { try container.encode(classScheduleId, forKey: .classScheduleId) }
        if restrictedId != nil { try container.encode(restrictedId, forKey: .restrictedId) }
        if restrictedResourceType != nil { try container.encode(restrictedResourceType, forKey: .restrictedResourceType) }
    }
}

public class ClassRosterRequestDto : ApiDtoBase
{
    public var classScheduleId:Int

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

    private enum CodingKeys : String, CodingKey {
        case classScheduleId
    }

    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)
    }

    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) }
    }
}

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 ClassRosterResponse : ClassRosterResponseDto
{
    public var success:Bool
    public var message:String
    public var classDate:Date
    public var freeSpots:Int
    public var maxSpots:Int
    public var totalBooked:Int
    public var locationType:String
    public var virtualLink:String
    public var classRoster:[ClassRosterItem] = []
    public var waitList:[ClassRosterItem] = []

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

    private enum CodingKeys : String, CodingKey {
        case success
        case message
        case classDate
        case freeSpots
        case maxSpots
        case totalBooked
        case locationType
        case virtualLink
        case classRoster
        case waitList
    }

    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)
        classDate = try container.decodeIfPresent(Date.self, forKey: .classDate)
        freeSpots = try container.decodeIfPresent(Int.self, forKey: .freeSpots)
        maxSpots = try container.decodeIfPresent(Int.self, forKey: .maxSpots)
        totalBooked = try container.decodeIfPresent(Int.self, forKey: .totalBooked)
        locationType = try container.decodeIfPresent(String.self, forKey: .locationType)
        virtualLink = try container.decodeIfPresent(String.self, forKey: .virtualLink)
        classRoster = try container.decodeIfPresent([ClassRosterItem].self, forKey: .classRoster) ?? []
        waitList = try container.decodeIfPresent([ClassRosterItem].self, forKey: .waitList) ?? []
    }

    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 classDate != nil { try container.encode(classDate, forKey: .classDate) }
        if freeSpots != nil { try container.encode(freeSpots, forKey: .freeSpots) }
        if maxSpots != nil { try container.encode(maxSpots, forKey: .maxSpots) }
        if totalBooked != nil { try container.encode(totalBooked, forKey: .totalBooked) }
        if locationType != nil { try container.encode(locationType, forKey: .locationType) }
        if virtualLink != nil { try container.encode(virtualLink, forKey: .virtualLink) }
        if classRoster.count > 0 { try container.encode(classRoster, forKey: .classRoster) }
        if waitList.count > 0 { try container.encode(waitList, forKey: .waitList) }
    }
}

public class ClassRosterResponseDto : ApiResponseBase
{
    public var classRoster:[ClassRosterItem] = []
    public var waitList:[ClassRosterItem] = []

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

    private enum CodingKeys : String, CodingKey {
        case classRoster
        case waitList
    }

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

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

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

    required public init(){}
}

public class ClassRosterItem : Codable
{
    public var bookingId:Int
    public var userId:Int
    public var firstName:String
    public var lastName:String
    public var email:String
    public var phone:String
    public var bookingMade:Date
    public var firstTimeBooking:Bool
    public var packageName:String
    public var packageId:Int?
    public var leadTypeName:String
    public var leadTypeId:Int?
    public var isMember:Bool
    public var memberExpiration:Date?
    public var creditType:ClassRosterCreditType
    public var creditsRemaining:Int
    public var nextCreditExpiration:Date?
    public var bookingStatusId:Int16?
    public var bookingStatusDescription:String

    required public init(){}
}

public enum ClassRosterCreditType : Int, Codable
{
    case Uninitialized = 0
    case PaidCredit = 1
    case FreeCredit = 2
    case AmenityCredit = 3
    case MembershipTypeCredit = 4
    case ClassPassCredit = 5
    case Error = -1
}


Swift ClassRosterRequest DTOs

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

HTTP + XML

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

GET /scheduling/class-roster HTTP/1.1 
Host: clubready.com 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ClassRosterResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Scheduling.Model">
  <Message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Message>
  <Success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Success>
  <ClassRoster xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">
    <ClassRosterItem>
      <BookingId>0</BookingId>
      <BookingMade>0001-01-01T00:00:00</BookingMade>
      <BookingStatusDescription>String</BookingStatusDescription>
      <BookingStatusId>0</BookingStatusId>
      <CreditType>Uninitialized</CreditType>
      <CreditsRemaining>0</CreditsRemaining>
      <Email>String</Email>
      <FirstName>String</FirstName>
      <FirstTimeBooking>false</FirstTimeBooking>
      <IsMember>false</IsMember>
      <IsWaitList>false</IsWaitList>
      <LastName>String</LastName>
      <LeadTypeId>0</LeadTypeId>
      <LeadTypeName>String</LeadTypeName>
      <MemberExpiration>0001-01-01T00:00:00</MemberExpiration>
      <NextCreditExpiration>0001-01-01T00:00:00</NextCreditExpiration>
      <PackageId>0</PackageId>
      <PackageName>String</PackageName>
      <Phone>String</Phone>
      <UserId>0</UserId>
    </ClassRosterItem>
  </ClassRoster>
  <WaitList xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">
    <ClassRosterItem>
      <BookingId>0</BookingId>
      <BookingMade>0001-01-01T00:00:00</BookingMade>
      <BookingStatusDescription>String</BookingStatusDescription>
      <BookingStatusId>0</BookingStatusId>
      <CreditType>Uninitialized</CreditType>
      <CreditsRemaining>0</CreditsRemaining>
      <Email>String</Email>
      <FirstName>String</FirstName>
      <FirstTimeBooking>false</FirstTimeBooking>
      <IsMember>false</IsMember>
      <IsWaitList>false</IsWaitList>
      <LastName>String</LastName>
      <LeadTypeId>0</LeadTypeId>
      <LeadTypeName>String</LeadTypeName>
      <MemberExpiration>0001-01-01T00:00:00</MemberExpiration>
      <NextCreditExpiration>0001-01-01T00:00:00</NextCreditExpiration>
      <PackageId>0</PackageId>
      <PackageName>String</PackageName>
      <Phone>String</Phone>
      <UserId>0</UserId>
    </ClassRosterItem>
  </WaitList>
  <ClassDate>0001-01-01T00:00:00</ClassDate>
  <FreeSpots>0</FreeSpots>
  <LocationType>String</LocationType>
  <MaxSpots>0</MaxSpots>
  <TotalBooked>0</TotalBooked>
  <VirtualLink>String</VirtualLink>
</ClassRosterResponse>