GET | /scheduling/class-roster | Get booked and waitlisted users for a class. |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiDtoBase:
api_key: Optional[str] = None
store_id: Optional[int] = None
chain_id: Optional[int] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ClassRosterRequestDto(ApiDtoBase):
class_schedule_id: int = 0
class RestrictedResourceType(str, Enum):
STORE = 'Store'
CHAIN = 'Chain'
USER = 'User'
UNDEFINED = 'Undefined'
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ClassRosterRequest(ClassRosterRequestDto, IRestrictedApiRequest):
# @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
api_key: Optional[str] = None
"""
Api Key - grants access to resources
"""
# @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="StoreId", ParameterType="query")
store_id: Optional[int] = None
"""
Store Id or Chain Id is required
"""
# @ApiMember(DataType="integer", Description="Store Id or Chain Id is required", Name="ChainId", ParameterType="query")
chain_id: Optional[int] = None
"""
Store Id or Chain Id is required
"""
# @ApiMember(DataType="integer", Description="Class Schedule ID", IsRequired=true, Name="ClassScheduleId", ParameterType="query")
class_schedule_id: int = 0
"""
Class Schedule ID
"""
restricted_id: Optional[int] = None
restricted_resource_type: Optional[RestrictedResourceType] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ApiResponseBase:
success: bool = False
message: Optional[str] = None
class ClassRosterCreditType(IntEnum):
UNINITIALIZED = 0
PAID_CREDIT = 1
FREE_CREDIT = 2
AMENITY_CREDIT = 3
MEMBERSHIP_TYPE_CREDIT = 4
CLASS_PASS_CREDIT = 5
ERROR = -1
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ClassRosterItem:
booking_id: int = 0
user_id: int = 0
first_name: Optional[str] = None
last_name: Optional[str] = None
email: Optional[str] = None
phone: Optional[str] = None
booking_made: datetime.datetime = datetime.datetime(1, 1, 1)
first_time_booking: bool = False
package_name: Optional[str] = None
package_id: Optional[int] = None
lead_type_name: Optional[str] = None
lead_type_id: Optional[int] = None
is_member: bool = False
member_expiration: Optional[datetime.datetime] = None
credit_type: Optional[ClassRosterCreditType] = None
credits_remaining: int = 0
next_credit_expiration: Optional[datetime.datetime] = None
booking_status_id: Optional[int] = None
booking_status_description: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ClassRosterResponseDto(ApiResponseBase):
class_roster: Optional[List[ClassRosterItem]] = None
wait_list: Optional[List[ClassRosterItem]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ClassRosterResponse(ClassRosterResponseDto):
success: bool = False
message: Optional[str] = None
class_date: datetime.datetime = datetime.datetime(1, 1, 1)
free_spots: int = 0
max_spots: int = 0
total_booked: int = 0
location_type: Optional[str] = None
virtual_link: Optional[str] = None
class_roster: Optional[List[ClassRosterItem]] = None
wait_list: Optional[List[ClassRosterItem]] = None
Python ClassRosterRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Success: False, Message: String, ClassDate: 0001-01-01, FreeSpots: 0, MaxSpots: 0, TotalBooked: 0, LocationType: String, VirtualLink: String, ClassRoster: [ { BookingId: 0, UserId: 0, FirstName: String, LastName: String, Email: String, Phone: String, BookingMade: 0001-01-01, FirstTimeBooking: False, PackageName: String, PackageId: 0, LeadTypeName: String, LeadTypeId: 0, IsMember: False, MemberExpiration: 0001-01-01, CreditType: Uninitialized, CreditsRemaining: 0, NextCreditExpiration: 0001-01-01, BookingStatusId: 0, BookingStatusDescription: String } ], WaitList: [ { BookingId: 0, UserId: 0, FirstName: String, LastName: String, Email: String, Phone: String, BookingMade: 0001-01-01, FirstTimeBooking: False, PackageName: String, PackageId: 0, LeadTypeName: String, LeadTypeId: 0, IsMember: False, MemberExpiration: 0001-01-01, CreditType: Uninitialized, CreditsRemaining: 0, NextCreditExpiration: 0001-01-01, BookingStatusId: 0, BookingStatusDescription: String } ] }