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 .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.

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

<GetTimeSlotsRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <ApiKey>String</ApiKey>
  <OAuthToken>String</OAuthToken>
  <DateFrom>0001-01-01T00:00:00</DateFrom>
  <DateTo>0001-01-01T00:00:00</DateTo>
  <Location>String</Location>
  <ShowOpenSlots>false</ShowOpenSlots>
  <ShowReservedSlots>false</ShowReservedSlots>
  <TimeFrom>0001-01-01T00:00:00</TimeFrom>
  <TimeTo>0001-01-01T00:00:00</TimeTo>
  <Type>String</Type>
</GetTimeSlotsRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetTimeSlotsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
  <Status>
    <DomainName>String</DomainName>
    <ErrorCode>String</ErrorCode>
    <ErrorDisplayText>String</ErrorDisplayText>
    <ErrorMessage>String</ErrorMessage>
    <IpAddress>String</IpAddress>
    <Login>String</Login>
    <StatusCode>String</StatusCode>
  </Status>
  <TimeSlots xmlns:d2p1="http://schemas.datacontract.org/2004/07/AIM">
    <d2p1:TimeSlotGeneric>
      <d2p1:DateTime>0001-01-01T00:00:00</d2p1:DateTime>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:Location>String</d2p1:Location>
      <d2p1:SlotsOpen>0</d2p1:SlotsOpen>
      <d2p1:Type>String</d2p1:Type>
    </d2p1:TimeSlotGeneric>
  </TimeSlots>
</GetTimeSlotsResponse>