POST | /api/EditInventory |
---|
import Foundation
import ServiceStack
/**
* EditInventoryRequires active-e Inventory Service
*/
// @DataContract
public class EditInventoryRequest : BaseSecureRequest
{
// @DataMember
public var saqPk:Int?
// @DataMember
public var sasPk:Int?
// @DataMember
public var Description:String
// @DataMember
public var ourPrice:Double?
// @DataMember
public var retailPrice:Double?
// @DataMember
public var priceA:Double?
// @DataMember
public var priceB:Double?
// @DataMember
public var priceC:Double?
// @DataMember
public var minPrice:Double?
// @DataMember
public var activeEPrice:Double?
// @DataMember
public var locator:String
// @DataMember
public var updateAllLocations:Bool
/**
* List of Barcodes. If barcodes are sent, they will overwrite existing barcodes.
*/
// @DataMember
// @ApiMember(Description="List of Barcodes. If barcodes are sent, they will overwrite existing barcodes.", Name="Barcodes", ParameterType="body")
public var barcodes:[String] = []
// @DataMember
public var newComputerQuantity:Double?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case saqPk
case sasPk
case Description
case ourPrice
case retailPrice
case priceA
case priceB
case priceC
case minPrice
case activeEPrice
case locator
case updateAllLocations
case barcodes
case newComputerQuantity
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
saqPk = try container.decodeIfPresent(Int.self, forKey: .saqPk)
sasPk = try container.decodeIfPresent(Int.self, forKey: .sasPk)
Description = try container.decodeIfPresent(String.self, forKey: .Description)
ourPrice = try container.decodeIfPresent(Double.self, forKey: .ourPrice)
retailPrice = try container.decodeIfPresent(Double.self, forKey: .retailPrice)
priceA = try container.decodeIfPresent(Double.self, forKey: .priceA)
priceB = try container.decodeIfPresent(Double.self, forKey: .priceB)
priceC = try container.decodeIfPresent(Double.self, forKey: .priceC)
minPrice = try container.decodeIfPresent(Double.self, forKey: .minPrice)
activeEPrice = try container.decodeIfPresent(Double.self, forKey: .activeEPrice)
locator = try container.decodeIfPresent(String.self, forKey: .locator)
updateAllLocations = try container.decodeIfPresent(Bool.self, forKey: .updateAllLocations)
barcodes = try container.decodeIfPresent([String].self, forKey: .barcodes) ?? []
newComputerQuantity = try container.decodeIfPresent(Double.self, forKey: .newComputerQuantity)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if saqPk != nil { try container.encode(saqPk, forKey: .saqPk) }
if sasPk != nil { try container.encode(sasPk, forKey: .sasPk) }
if Description != nil { try container.encode(Description, forKey: .Description) }
if ourPrice != nil { try container.encode(ourPrice, forKey: .ourPrice) }
if retailPrice != nil { try container.encode(retailPrice, forKey: .retailPrice) }
if priceA != nil { try container.encode(priceA, forKey: .priceA) }
if priceB != nil { try container.encode(priceB, forKey: .priceB) }
if priceC != nil { try container.encode(priceC, forKey: .priceC) }
if minPrice != nil { try container.encode(minPrice, forKey: .minPrice) }
if activeEPrice != nil { try container.encode(activeEPrice, forKey: .activeEPrice) }
if locator != nil { try container.encode(locator, forKey: .locator) }
if updateAllLocations != nil { try container.encode(updateAllLocations, forKey: .updateAllLocations) }
if barcodes.count > 0 { try container.encode(barcodes, forKey: .barcodes) }
if newComputerQuantity != nil { try container.encode(newComputerQuantity, forKey: .newComputerQuantity) }
}
}
// @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 EditInventoryResponse : 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 EditInventoryRequest 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.
POST /api/EditInventory HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<EditInventoryRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<OAuthToken>String</OAuthToken>
<AppId>String</AppId>
<DeviceId>String</DeviceId>
<Token>String</Token>
<ActiveEPrice>0</ActiveEPrice>
<Barcodes xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</Barcodes>
<Description>String</Description>
<Locator>String</Locator>
<MinPrice>0</MinPrice>
<NewComputerQuantity>0</NewComputerQuantity>
<OurPrice>0</OurPrice>
<PriceA>0</PriceA>
<PriceB>0</PriceB>
<PriceC>0</PriceC>
<RetailPrice>0</RetailPrice>
<SaqPk>0</SaqPk>
<SasPk>0</SasPk>
<UpdateAllLocations>false</UpdateAllLocations>
</EditInventoryRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <EditInventoryResponse 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> </EditInventoryResponse>