AIM Web Services

<back to all web services

GetTimeSlotsRequest

GetTimeSlots
Requires active-e Contracts Service, active-e Service Ticket Service, active-e Lesson Scheduling Service, active-e Vortx E-Commerce Service, or active-e 3rd Party E-Commerce Service

The following routes are available for this service:
POST, GET/api/GetTimeSlots
import Foundation
import ServiceStack

/**
* GetTimeSlotsRequires active-e Contracts Service, active-e Service Ticket Service, active-e Lesson Scheduling Service, active-e Vortx E-Commerce Service, or active-e 3rd Party E-Commerce Service
*/
// @DataContract
public class GetTimeSlotsRequest : BaseRequest
{
    // @DataMember
    public var dateFrom:Date

    // @DataMember
    public var dateTo:Date

    // @DataMember
    public var timeFrom:Date?

    // @DataMember
    public var timeTo:Date?

    // @DataMember
    public var location:String

    // @DataMember
    public var showOpenSlots:Bool?

    // @DataMember
    public var showReservedSlots:Bool?

    /**
    * If sent, only Time Slots of the sent type are returned. Valid options are STORE and DELIVERY.
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="If sent, only Time Slots of the sent type are returned. Valid options are STORE and DELIVERY.", Name="Type", ParameterType="query")
    public var type:String

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

    private enum CodingKeys : String, CodingKey {
        case dateFrom
        case dateTo
        case timeFrom
        case timeTo
        case location
        case showOpenSlots
        case showReservedSlots
        case type
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        dateFrom = try container.decodeIfPresent(Date.self, forKey: .dateFrom)
        dateTo = try container.decodeIfPresent(Date.self, forKey: .dateTo)
        timeFrom = try container.decodeIfPresent(Date.self, forKey: .timeFrom)
        timeTo = try container.decodeIfPresent(Date.self, forKey: .timeTo)
        location = try container.decodeIfPresent(String.self, forKey: .location)
        showOpenSlots = try container.decodeIfPresent(Bool.self, forKey: .showOpenSlots)
        showReservedSlots = try container.decodeIfPresent(Bool.self, forKey: .showReservedSlots)
        type = try container.decodeIfPresent(String.self, forKey: .type)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if dateFrom != nil { try container.encode(dateFrom, forKey: .dateFrom) }
        if dateTo != nil { try container.encode(dateTo, forKey: .dateTo) }
        if timeFrom != nil { try container.encode(timeFrom, forKey: .timeFrom) }
        if timeTo != nil { try container.encode(timeTo, forKey: .timeTo) }
        if location != nil { try container.encode(location, forKey: .location) }
        if showOpenSlots != nil { try container.encode(showOpenSlots, forKey: .showOpenSlots) }
        if showReservedSlots != nil { try container.encode(showReservedSlots, forKey: .showReservedSlots) }
        if type != nil { try container.encode(type, forKey: .type) }
    }
}

// @DataContract
public class BaseRequest : Codable
{
    /**
    * This is your AIM API Key provided by Tri-Tech
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
    public var apiKey:String

    // @DataMember
    // @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
    public var oAuthToken:String

    required public init(){}
}

// @DataContract
public class GetTimeSlotsResponse : BaseResponse
{
    // @DataMember
    public var timeSlots:[TimeSlotGeneric] = []

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

    private enum CodingKeys : String, CodingKey {
        case timeSlots
    }

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

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

// @DataContract
public class BaseResponse : Codable
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
    public var status:BaseResponseResult

    required public init(){}
}

// @DataContract
public class BaseResponseResult : Codable
{
    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
    public var statusCode:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
    public var login:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
    public var errorCode:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
    public var errorDisplayText:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
    public var errorMessage:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
    public var domainName:String

    /**
    * 
    */
    // @DataMember
    // @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
    public var ipAddress:String

    required public init(){}
}

// @DataContract
public class TimeSlotGeneric : Codable
{
    // @DataMember
    public var id:Int

    // @DataMember
    public var dateTime:Date

    // @DataMember
    public var slotsOpen:Int

    // @DataMember
    public var location:String

    // @DataMember
    public var type:String

    required public init(){}
}


Swift GetTimeSlotsRequest DTOs

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

HTTP + OTHER

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

POST /api/GetTimeSlots HTTP/1.1 
Host: active-ewebservice.biz 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"TimeFrom":"0001-01-01T00:00:00.0000000","TimeTo":"0001-01-01T00:00:00.0000000","Location":"String","ShowOpenSlots":false,"ShowReservedSlots":false,"Type":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"TimeSlots":[{"Id":0,"SlotsOpen":0,"Location":"String","Type":"String"}],"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}