GET | /api/ShortTermRentalInventory |
---|
import Foundation
import ServiceStack
/**
* ShortTermRentalInventoryRequires active-e Short Term Rental Service
*/
// @DataContract
public class ShortTermRentalInventoryRequest : BaseSecureRequest
{
/**
* Item to lookup. Pass in either this *OR* ItemPk + PkType *OR* Category + SubCategory
*/
// @DataMember
// @ApiMember(Description="Item to lookup. Pass in either this *OR* ItemPk + PkType *OR* Category + SubCategory", Name="Item", ParameterType="query")
public var item:String
// @DataMember
public var locationCode:String
/**
* Key of the item to lookup. Pass in either this plus PkType *OR* Item *OR* Category + SubCategory
*/
// @DataMember
// @ApiMember(Description="Key of the item to lookup. Pass in either this plus PkType *OR* Item *OR* Category + SubCategory", Name="ItemPk", ParameterType="query")
public var itemPk:Int?
/**
* Type of the key passed in. S for SasPk, Q for SaqPk, P for PkhPk. Pass in either this plus ItemPk *OR* Item *OR* Category + SubCategory
*/
// @DataMember
// @ApiMember(Description="Type of the key passed in. S for SasPk, Q for SaqPk, P for PkhPk. Pass in either this plus ItemPk *OR* Item *OR* Category + SubCategory", Name="PkType", ParameterType="query")
public var pkType:String
/**
* Pass in either SubCategory + this *OR* Item *OR* ItemPk + PkType
*/
// @DataMember
// @ApiMember(Description="Pass in either SubCategory + this *OR* Item *OR* ItemPk + PkType", Name="Category", ParameterType="query")
public var category:Int?
/**
* Pass in either Category + this *OR* Item *OR* ItemPk + PkType
*/
// @DataMember
// @ApiMember(Description="Pass in either Category + this *OR* Item *OR* ItemPk + PkType", Name="SubCategory", ParameterType="query")
public var subCategory:Int?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case item
case locationCode
case itemPk
case pkType
case category
case subCategory
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
item = try container.decodeIfPresent(String.self, forKey: .item)
locationCode = try container.decodeIfPresent(String.self, forKey: .locationCode)
itemPk = try container.decodeIfPresent(Int.self, forKey: .itemPk)
pkType = try container.decodeIfPresent(String.self, forKey: .pkType)
category = try container.decodeIfPresent(Int.self, forKey: .category)
subCategory = try container.decodeIfPresent(Int.self, forKey: .subCategory)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if item != nil { try container.encode(item, forKey: .item) }
if locationCode != nil { try container.encode(locationCode, forKey: .locationCode) }
if itemPk != nil { try container.encode(itemPk, forKey: .itemPk) }
if pkType != nil { try container.encode(pkType, forKey: .pkType) }
if category != nil { try container.encode(category, forKey: .category) }
if subCategory != nil { try container.encode(subCategory, forKey: .subCategory) }
}
}
// @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
public class ShortTermRentalInventoryResponse : BaseResponse
{
// @DataMember
public var results:[ShortTermRentalInventoryObj] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case results
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
results = try container.decodeIfPresent([ShortTermRentalInventoryObj].self, forKey: .results) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if results.count > 0 { try container.encode(results, forKey: .results) }
}
}
// @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 ShortTermRentalInventoryObj : Codable
{
// @DataMember
public var rates:[ShortTermRentalInventoryRate] = []
// @DataMember
public var availableSerialPks:[Int] = []
// @DataMember
public var saqPk:Int?
// @DataMember
public var skuPk:Int?
// @DataMember
public var pkhPk:Int?
// @DataMember
public var sku:String
// @DataMember
public var package:String
// @DataMember
public var invType:String
// @DataMember
public var availableQty:Double
required public init(){}
}
// @DataContract
public class ShortTermRentalInventoryRate : Codable
{
// @DataMember
public var headerDesc:String
// @DataMember
public var headerNotes:String
// @DataMember
public var desc:String
// @DataMember
public var intervalType:String
// @DataMember
public var group:String
// @DataMember
public var notes:String
// @DataMember
public var amt:Double
// @DataMember
public var timeInterval:Int
required public init(){}
}
Swift ShortTermRentalInventoryRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/ShortTermRentalInventory HTTP/1.1 Host: active-ewebservice.biz Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ShortTermRentalInventoryResponse 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> <Results> <ShortTermRentalInventoryObj> <AvailableQty>0</AvailableQty> <AvailableSerialPks xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:long>0</d4p1:long> </AvailableSerialPks> <InvType>String</InvType> <Package>String</Package> <PkhPk>0</PkhPk> <Rates> <ShortTermRentalInventoryRate> <Amt>0</Amt> <Desc>String</Desc> <Group>String</Group> <HeaderDesc>String</HeaderDesc> <HeaderNotes>String</HeaderNotes> <IntervalType>String</IntervalType> <Notes>String</Notes> <TimeInterval>0</TimeInterval> </ShortTermRentalInventoryRate> </Rates> <SaqPk>0</SaqPk> <Sku>String</Sku> <SkuPk>0</SkuPk> </ShortTermRentalInventoryObj> </Results> </ShortTermRentalInventoryResponse>