| GET | /api/SaleInfo |
|---|
import Foundation
import ServiceStack
/**
* SaleInfoRequires active-e Inventory Service
*/
// @DataContract
public class SaleInfoRequest : BaseSecureRequest
{
// @DataMember
public var locationId:Int?
/**
* If sent, only sales that are active during the sent Date/Time are returned. Otherwise, the current Date/Time is used
*/
// @DataMember
// @ApiMember(Description="If sent, only sales that are active during the sent Date/Time are returned. Otherwise, the current Date/Time is used", Name="DateTime")
public var dateTime:Date?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case locationId
case dateTime
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
locationId = try container.decodeIfPresent(Int.self, forKey: .locationId)
dateTime = try container.decodeIfPresent(Date.self, forKey: .dateTime)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if locationId != nil { try container.encode(locationId, forKey: .locationId) }
if dateTime != nil { try container.encode(dateTime, forKey: .dateTime) }
}
}
// @DataContract
public class BaseSecureRequest : BaseRequest
{
/**
* The Login Token return by the Security API. Required for secured calls.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The Login Token return by the Security API. Required for secured calls.", Name="Token", ParameterType="Header")
public var token:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case token
}
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)
}
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) }
}
}
// @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
/**
* The OAuthToken token return by AeServices30
*/
// @DataMember
// @ApiMember(DataType="string", Description="The OAuthToken token return by AeServices30", IsRequired=true, Name="OAuthToken", ParameterType="Header")
public var oAuthToken:String
/**
* The Device ID of the Mobile Device. Not used for non-mobile devices.
*/
// @DataMember
// @ApiMember(DataType="string", Description="The Device ID of the Mobile Device. Not used for non-mobile devices.", Name="DeviceId", ParameterType="Header")
public var deviceId:String
/**
* An identifier for your integration
*/
// @DataMember
// @ApiMember(DataType="string", Description="An identifier for your integration", IsRequired=true, Name="AppId", ParameterType="Header")
public var appId:String
required public init(){}
}
// @DataContract
public class SaleInfoResponse : BaseResponse
{
// @DataMember
public var saleRecords:[SaleRecord] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case saleRecords
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
saleRecords = try container.decodeIfPresent([SaleRecord].self, forKey: .saleRecords) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if saleRecords.count > 0 { try container.encode(saleRecords, forKey: .saleRecords) }
}
}
// @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 SaleRecord : Codable
{
// @DataMember
public var sadPk:Int
// @DataMember
public var skuPk:Int
// @DataMember
public var saqPk:Int
// @DataMember
public var model:String
// @DataMember
public var sku:String
// @DataMember
public var locationId:Int
// @DataMember
public var startDate:Date
// @DataMember
public var endDate:Date
// @DataMember
public var customerAccount:Int?
// @DataMember
public var customerDefaultId:Int?
// @DataMember
public var condition:String
// @DataMember
public var discountFromPriceLevel:DiscountFromPriceLevel
// @DataMember
public var discountByPriceLevel:String
// @DataMember
public var discountBySetPrice:Double?
// @DataMember
public var discountByAmount:Double?
// @DataMember
public var recurringSale:RecurringSaleInfo
required public init(){}
}
// @DataContract
public class DiscountFromPriceLevel : Codable
{
// @DataMember
public var basePriceLevel:String
// @DataMember
public var disountPercentage:Double
required public init(){}
}
// @DataContract
public class RecurringSaleInfo : Codable
{
// @DataMember
public var days:[RecurringSaleDay] = []
required public init(){}
}
// @DataContract
public class RecurringSaleDay : Codable
{
// @DataMember
public var weekday:String
// @DataMember
public var beginHour:Int
// @DataMember
public var beginMinute:Int
// @DataMember
public var endHour:Int
// @DataMember
public var endMinute:Int
required public init(){}
}
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/SaleInfo HTTP/1.1 Host: active-ewebservice.biz Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<SaleInfoResponse 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>
<SaleRecords>
<SaleRecord>
<Condition>String</Condition>
<CustomerAccount>0</CustomerAccount>
<CustomerDefaultId>0</CustomerDefaultId>
<DiscountByAmount>0</DiscountByAmount>
<DiscountByPriceLevel>String</DiscountByPriceLevel>
<DiscountBySetPrice>0</DiscountBySetPrice>
<DiscountFromPriceLevel>
<BasePriceLevel>String</BasePriceLevel>
<DisountPercentage>0</DisountPercentage>
</DiscountFromPriceLevel>
<EndDate>0001-01-01T00:00:00</EndDate>
<LocationId>0</LocationId>
<Model>String</Model>
<RecurringSale>
<Days>
<RecurringSaleDay>
<BeginHour>0</BeginHour>
<BeginMinute>0</BeginMinute>
<EndHour>0</EndHour>
<EndMinute>0</EndMinute>
<Weekday>String</Weekday>
</RecurringSaleDay>
</Days>
</RecurringSale>
<SKU>String</SKU>
<SadPk>0</SadPk>
<SaqPk>0</SaqPk>
<SkuPk>0</SkuPk>
<StartDate>0001-01-01T00:00:00</StartDate>
</SaleRecord>
</SaleRecords>
</SaleInfoResponse>