import Foundation
import ServiceStack
public class GetFacilitySchedule : ApiServiceRequest
{
public var facilityId:Int
public var start:Date
public var end:Date
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case facilityId
case start
case end
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
facilityId = try container.decodeIfPresent(Int.self, forKey: .facilityId)
start = try container.decodeIfPresent(Date.self, forKey: .start)
end = try container.decodeIfPresent(Date.self, forKey: .end)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if facilityId != nil { try container.encode(facilityId, forKey: .facilityId) }
if start != nil { try container.encode(start, forKey: .start) }
if end != nil { try container.encode(end, forKey: .end) }
}
}
public class ApiServiceRequest : IServiceRequest, IHasApiKey, IHasDeviceInfo, Codable
{
/**
* The API Key required for authentication
*/
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
public var apiKey:String
/**
* Latitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
public var latitude:Double
/**
* Longitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
public var longitude:Double
required public init(){}
}
public class GetFacilityScheduleResponse : ApiServiceResponse
{
public var schedule:[ScheduleDayData] = []
public var bookAheadMaxDate:String
public var openHour:Int
public var closeHour:Int
public var duration:Int
public var isCoordinator:Bool
public var facilityTimeOffset:Int
public var facility:FacilityData
public var venueName:String
public var allowGuests:Bool
public var allowExtraRequirements:Bool
public var allowBookingInProgress:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case schedule
case bookAheadMaxDate
case openHour
case closeHour
case duration
case isCoordinator
case facilityTimeOffset
case facility
case venueName
case allowGuests
case allowExtraRequirements
case allowBookingInProgress
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
schedule = try container.decodeIfPresent([ScheduleDayData].self, forKey: .schedule) ?? []
bookAheadMaxDate = try container.decodeIfPresent(String.self, forKey: .bookAheadMaxDate)
openHour = try container.decodeIfPresent(Int.self, forKey: .openHour)
closeHour = try container.decodeIfPresent(Int.self, forKey: .closeHour)
duration = try container.decodeIfPresent(Int.self, forKey: .duration)
isCoordinator = try container.decodeIfPresent(Bool.self, forKey: .isCoordinator)
facilityTimeOffset = try container.decodeIfPresent(Int.self, forKey: .facilityTimeOffset)
facility = try container.decodeIfPresent(FacilityData.self, forKey: .facility)
venueName = try container.decodeIfPresent(String.self, forKey: .venueName)
allowGuests = try container.decodeIfPresent(Bool.self, forKey: .allowGuests)
allowExtraRequirements = try container.decodeIfPresent(Bool.self, forKey: .allowExtraRequirements)
allowBookingInProgress = try container.decodeIfPresent(Bool.self, forKey: .allowBookingInProgress)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if schedule.count > 0 { try container.encode(schedule, forKey: .schedule) }
if bookAheadMaxDate != nil { try container.encode(bookAheadMaxDate, forKey: .bookAheadMaxDate) }
if openHour != nil { try container.encode(openHour, forKey: .openHour) }
if closeHour != nil { try container.encode(closeHour, forKey: .closeHour) }
if duration != nil { try container.encode(duration, forKey: .duration) }
if isCoordinator != nil { try container.encode(isCoordinator, forKey: .isCoordinator) }
if facilityTimeOffset != nil { try container.encode(facilityTimeOffset, forKey: .facilityTimeOffset) }
if facility != nil { try container.encode(facility, forKey: .facility) }
if venueName != nil { try container.encode(venueName, forKey: .venueName) }
if allowGuests != nil { try container.encode(allowGuests, forKey: .allowGuests) }
if allowExtraRequirements != nil { try container.encode(allowExtraRequirements, forKey: .allowExtraRequirements) }
if allowBookingInProgress != nil { try container.encode(allowBookingInProgress, forKey: .allowBookingInProgress) }
}
}
public class ApiServiceResponse : IServiceResponse, Codable
{
public var Description:String
public var heading:String
public var wasSuccessful:Bool
//modelState:Object ignored. Type could not be extended in Swift
required public init(){}
}
public class ScheduleDayData : Codable
{
public var date:String
public var slots:[SlotData] = []
required public init(){}
}
public class SlotData : Codable
{
public var start:String
public var end:String
public var status:SlotStatus
public var bookingId:Int
public var remindStart:Bool
public var remind30Mins:Bool
public var remind1Hour:Bool
public var remind6Hours:Bool
public var remind12Hours:Bool
public var remind1Day:Bool
public var remind1Week:Bool
public var billableAmount:Double
public var bookedByName:String
public var billableHours:Double
public var slotLength:Double
public var userData:GuestData
public var extraRequirements:String
required public init(){}
}
public enum SlotStatus : Int, Codable
{
case Available = 0
case Closed = 1
case Booked = 2
case UserBooked = 3
case GroupBooked = 4
case ToBook = 5
}
public class GuestData : Codable
{
public var name:String
public var emailAddress:String
public var mobileNumber:String
public var userCustomFields:[UserCustomFieldData] = []
public var isAlreadyUser:Bool
public var systemUserId:Int
required public init(){}
}
public class UserCustomFieldData : Codable
{
public var id:String
public var value:String
public var name:String
public var optional:Bool
required public init(){}
}
public class FacilityData : Codable
{
public var facilityId:Int
public var facilityGuid:String
public var name:String
public var Description:String
public var nextAvailable:String
public var hasNextAvailable:Bool
public var rates:[RatesItem] = []
public var themeColor:String
public var bookingNotes:String
public var leadTime:Int
public var venueId:Int
public var allowExtraRequirements:Bool
required public init(){}
}
public class RatesItem : Codable
{
public var rate:Double
public var minutes:Int
required public init(){}
}
Swift GetFacilitySchedule DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /jsonl/reply/GetFacilitySchedule HTTP/1.1
Host: reservation.api.dev.86degrees.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"facilityId":0,"start":"0001-01-01T00:00:00.0000000","end":"0001-01-01T00:00:00.0000000","apiKey":"String","latitude":0,"longitude":0}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"schedule":[{"date":"String","slots":[{"start":"String","end":"String","status":0,"bookingId":0,"remindStart":false,"remind30Mins":false,"remind1Hour":false,"remind6Hours":false,"remind12Hours":false,"remind1Day":false,"remind1Week":false,"billableAmount":0,"bookedByName":"String","billableHours":0,"slotLength":0,"extraRequirements":"String"}]}],"bookAheadMaxDate":"String","openHour":0,"closeHour":0,"duration":0,"isCoordinator":false,"facilityTimeOffset":0,"venueName":"String","allowGuests":false,"allowExtraRequirements":false,"allowBookingInProgress":false,"description":"String","heading":"String","wasSuccessful":false,"modelState":{}}