GET | /api/CategoryListing |
---|
import Foundation
import ServiceStack
/**
* CategoryListingRequires active-e Inventory Service.
*/
// @DataContract
public class CategoryListingRequest : BaseSecureRequest
{
/**
* If true, Inactive Categories and Subcategories will be returned. Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="If true, Inactive Categories and Subcategories will be returned. Defaults to false.", Name="IncludeInactive", ParameterType="query")
public var includeInactive:Bool?
/**
* Category Number lookup. If sent, only this category and it's subs will be returned. Further parameters will be ignored.
*/
// @DataMember
// @ApiMember(DataType="integer", Description="Category Number lookup. If sent, only this category and it's subs will be returned. Further parameters will be ignored.", Format="int64", Name="CategoryNumber", ParameterType="query")
public var categoryNumber:Int?
/**
* If true, Inventory Categories will be returned. Defaults to true.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="If true, Inventory Categories will be returned. Defaults to true.", Name="IncludeInventory", ParameterType="query")
public var includeInventory:Bool?
/**
* If true, Non-Inventory Categories will be returned. Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="If true, Non-Inventory Categories will be returned. Defaults to false.", Name="IncludeNonInventory", ParameterType="query")
public var includeNonInventory:Bool?
/**
* If true, Return Payment Categories will be returned. Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="If true, Return Payment Categories will be returned. Defaults to false.", Name="IncludeReturn", ParameterType="query")
public var includeReturn:Bool?
/**
* If true, Payment Categories will be returned. Defaults to false.
*/
// @DataMember
// @ApiMember(DataType="boolean", Description="If true, Payment Categories will be returned. Defaults to false.", Name="IncludePayment", ParameterType="query")
public var includePayment:Bool?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case includeInactive
case categoryNumber
case includeInventory
case includeNonInventory
case includeReturn
case includePayment
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
includeInactive = try container.decodeIfPresent(Bool.self, forKey: .includeInactive)
categoryNumber = try container.decodeIfPresent(Int.self, forKey: .categoryNumber)
includeInventory = try container.decodeIfPresent(Bool.self, forKey: .includeInventory)
includeNonInventory = try container.decodeIfPresent(Bool.self, forKey: .includeNonInventory)
includeReturn = try container.decodeIfPresent(Bool.self, forKey: .includeReturn)
includePayment = try container.decodeIfPresent(Bool.self, forKey: .includePayment)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if includeInactive != nil { try container.encode(includeInactive, forKey: .includeInactive) }
if categoryNumber != nil { try container.encode(categoryNumber, forKey: .categoryNumber) }
if includeInventory != nil { try container.encode(includeInventory, forKey: .includeInventory) }
if includeNonInventory != nil { try container.encode(includeNonInventory, forKey: .includeNonInventory) }
if includeReturn != nil { try container.encode(includeReturn, forKey: .includeReturn) }
if includePayment != nil { try container.encode(includePayment, forKey: .includePayment) }
}
}
// @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 CategoryListingResponse : BaseResponse
{
// @DataMember
public var categoryListing:[CategoryInfo] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case categoryListing
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
categoryListing = try container.decodeIfPresent([CategoryInfo].self, forKey: .categoryListing) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if categoryListing.count > 0 { try container.encode(categoryListing, forKey: .categoryListing) }
}
}
// @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 CategoryInfo : Codable
{
// @DataMember
public var categoryNumber:Int
// @DataMember
public var categoryType:String
// @DataMember
public var Description:String
// @DataMember
public var active:Bool
// @DataMember
public var subCategoryListing:[SubCategoryInfo] = []
// @DataMember
public var paymentCategoryType:String
// @DataMember
public var allowedOnMobile:Bool?
required public init(){}
}
// @DataContract
public class SubCategoryInfo : Codable
{
// @DataMember
public var subNumber:Int
// @DataMember
public var Description:String
// @DataMember
public var active:Bool
// @DataMember
public var price:Double
// @DataMember
public var skuAttributes:[SubCategoryAttributeInfo] = []
// @DataMember
public var serialAttributes:[SubCategoryAttributeInfo] = []
required public init(){}
}
// @DataContract
public class SubCategoryAttributeInfo : Codable
{
// @DataMember
public var attributeName:String
// @DataMember
public var priority:Int
required public init(){}
}
Swift CategoryListingRequest 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/CategoryListing HTTP/1.1 Host: active-ewebservice.biz Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CategoryListingResponse 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> <CategoryListing> <CategoryInfo> <Active>false</Active> <AllowedOnMobile>false</AllowedOnMobile> <CategoryNumber>0</CategoryNumber> <CategoryType>String</CategoryType> <Description>String</Description> <PaymentCategoryType>String</PaymentCategoryType> <SubCategoryListing> <SubCategoryInfo> <Active>false</Active> <Description>String</Description> <Price>0</Price> <SerialAttributes> <SubCategoryAttributeInfo> <AttributeName>String</AttributeName> <Priority>0</Priority> </SubCategoryAttributeInfo> </SerialAttributes> <SkuAttributes> <SubCategoryAttributeInfo> <AttributeName>String</AttributeName> <Priority>0</Priority> </SubCategoryAttributeInfo> </SkuAttributes> <SubNumber>0</SubNumber> </SubCategoryInfo> </SubCategoryListing> </CategoryInfo> </CategoryListing> </CategoryListingResponse>