POST | /api/StationReservation |
---|
import Foundation
import ServiceStack
/**
* StationReservationRequires active-e Station Reservations Service
*/
// @DataContract
public class StationReservationRequest : BaseSecureRequest
{
/**
* The ID of the station being reserved
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The ID of the station being reserved", Format="int64", IsRequired=true, Name="StationId", ParameterType="query")
public var stationId:Int
/**
* The Customer Acct assosicated with the reservation. Either this or CustomerInfo is required.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The Customer Acct assosicated with the reservation. Either this or CustomerInfo is required.", Format="int32", Name="Acct", ParameterType="query")
public var acct:Int?
/**
*
*/
// @DataMember
// @ApiMember(DataType="object", Description="", Name="CustomerInfo", ParameterType="query")
public var customerInfo:CustomerInfo
/**
*
*/
// @DataMember
// @ApiMember(DataType="object", Description="", Name="CcInfo ", ParameterType="query")
public var ccInfo:CcInfo
/**
* The start date/time of the reservation.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The start date/time of the reservation.", Format="date-time", IsRequired=true, Name="Start", ParameterType="query")
public var start:Date
/**
* The length (in minutes) of the reservation.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The length (in minutes) of the reservation.", Format="int32", IsRequired=true, Name="Length", ParameterType="query")
public var length:Int
/**
* Number of guests (in addition to the customer) included in this reservation. Defaults to 0.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Number of guests (in addition to the customer) included in this reservation. Defaults to 0.", Format="int32", Name="Guests", ParameterType="query")
public var guests:Int
/**
* Notes
*/
// @DataMember
// @ApiMember(DataType="string", Description="Notes", Name="Notes", ParameterType="query")
public var notes:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case stationId
case acct
case customerInfo
case ccInfo
case start
case length
case guests
case notes
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
stationId = try container.decodeIfPresent(Int.self, forKey: .stationId)
acct = try container.decodeIfPresent(Int.self, forKey: .acct)
customerInfo = try container.decodeIfPresent(CustomerInfo.self, forKey: .customerInfo)
ccInfo = try container.decodeIfPresent(CcInfo.self, forKey: .ccInfo)
start = try container.decodeIfPresent(Date.self, forKey: .start)
length = try container.decodeIfPresent(Int.self, forKey: .length)
guests = try container.decodeIfPresent(Int.self, forKey: .guests)
notes = try container.decodeIfPresent(String.self, forKey: .notes)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if stationId != nil { try container.encode(stationId, forKey: .stationId) }
if acct != nil { try container.encode(acct, forKey: .acct) }
if customerInfo != nil { try container.encode(customerInfo, forKey: .customerInfo) }
if ccInfo != nil { try container.encode(ccInfo, forKey: .ccInfo) }
if start != nil { try container.encode(start, forKey: .start) }
if length != nil { try container.encode(length, forKey: .length) }
if guests != nil { try container.encode(guests, forKey: .guests) }
if notes != nil { try container.encode(notes, forKey: .notes) }
}
}
// @DataContract
public class BaseSecureRequest : BaseRequest
{
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
public var token:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
public var deviceId:String
/**
*
*/
// @DataMember
// @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
public var appId:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case token
case deviceId
case appId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
token = try container.decodeIfPresent(String.self, forKey: .token)
deviceId = try container.decodeIfPresent(String.self, forKey: .deviceId)
appId = try container.decodeIfPresent(String.self, forKey: .appId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if token != nil { try container.encode(token, forKey: .token) }
if deviceId != nil { try container.encode(deviceId, forKey: .deviceId) }
if appId != nil { try container.encode(appId, forKey: .appId) }
}
}
// @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(Name="CustomerInfo")
public class CustomerInfo : Codable
{
/**
* The WebId of the customer. Optional.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="The WebId of the customer. Optional.", Format="int32", IsRequired=true, Name="WebId", ParameterType="query")
public var webId:Int?
/**
* Name of the customer.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Name of the customer.", IsRequired=true, Name="Name", ParameterType="query")
public var name:String
/**
* Address line 1 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 1 of the customer", Name="Addr1", ParameterType="query")
public var addr1:String
/**
* Address line 2 of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Address line 2 of the customer", Name="Addr2", ParameterType="query")
public var addr2:String
/**
* City of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="City of the customer", Name="City", ParameterType="query")
public var city:String
/**
* State/Province of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="State/Province of the customer", Name="St", ParameterType="query")
public var st:String
/**
* Zip code of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Zip code of the customer", Name="Zip", ParameterType="query")
public var zip:String
/**
* Country of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Country of the customer", Name="Country", ParameterType="query")
public var country:String
/**
* Phone number of the customer
*/
// @DataMember
// @ApiMember(DataType="string", Description="Phone number of the customer", Name="Phone", ParameterType="query")
public var phone:String
/**
* Email address of the customer. Required.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Email address of the customer. Required.", IsRequired=true, Name="Email", ParameterType="query")
public var email:String
required public init(){}
}
// @DataContract(Name="CCInfo")
public class CcInfo : Codable
{
/**
* Token returned from processor
*/
// @DataMember
// @ApiMember(DataType="string", Description="Token returned from processor", IsRequired=true, Name="TokenStr", ParameterType="query")
public var tokenStr:String
/**
* Card Type (VISA, MCARD, AMEX, DSCVR)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Card Type (VISA, MCARD, AMEX, DSCVR)", IsRequired=true, Name="CardType", ParameterType="query")
public var cardType:String
/**
* Last four of the card
*/
// @DataMember
// @ApiMember(DataType="string", Description="Last four of the card", IsRequired=true, Name="LastFour", ParameterType="query")
public var lastFour:String
/**
* Expiration Date of the Card. (MM/YY)
*/
// @DataMember
// @ApiMember(DataType="string", Description="Expiration Date of the Card. (MM/YY)", Name="Expiration", ParameterType="query")
public var expiration:String
/**
* Reason the card is on file.
*/
// @DataMember
// @ApiMember(DataType="string", Description="Reason the card is on file.", Name="ReasonOnFile", ParameterType="query")
public var reasonOnFile:String
/**
* ID of the existing Token Record in AIM, if applicable
*/
// @DataMember
// @ApiMember(DataType="integer", Description="ID of the existing Token Record in AIM, if applicable", Format="int64", Name="TokenPk", ParameterType="query")
public var tokenPk:Int?
/**
* Is this the customer's primary card? Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="Is this the customer's primary card? Defaults to false.", Name="Primary", ParameterType="query")
public var primary:Bool?
required public init(){}
}
// @DataContract
public class StationReservationResponse : BaseResponse
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
// @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(){}
}
Swift StationReservationRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/StationReservation HTTP/1.1
Host: active-ewebservice.biz
Accept: application/json
Content-Type: application/json
Content-Length: length
{"StationId":0,"Acct":0,"CustomerInfo":{"WebId":0,"Name":"String","Addr1":"String","Addr2":"String","City":"String","St":"String","Zip":"String","Country":"String","Phone":"String","Email":"String"},"CcInfo":{"TokenStr":"String","CardType":"String","LastFour":"String","Expiration":"String","ReasonOnFile":"String","TokenPk":0,"Primary":false},"Length":0,"Guests":0,"Notes":"String","Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}