| POST, GET | /api/SerialDetail |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
// @DataContract
class BaseRequest implements JsonSerializable
{
public function __construct(
/** @description 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")
/** @var string */
public string $ApiKey='',
/** @description The OAuthToken token return by AeServices30 */
// @DataMember
// @ApiMember(DataType="string", Description="The OAuthToken token return by AeServices30", IsRequired=true, Name="OAuthToken", ParameterType="Header")
/** @var string */
public string $OAuthToken='',
/** @description 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")
/** @var string|null */
public ?string $DeviceId=null,
/** @description An identifier for your integration */
// @DataMember
// @ApiMember(DataType="string", Description="An identifier for your integration", IsRequired=true, Name="AppId", ParameterType="Header")
/** @var string */
public string $AppId=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
if (isset($o['OAuthToken'])) $this->OAuthToken = $o['OAuthToken'];
if (isset($o['DeviceId'])) $this->DeviceId = $o['DeviceId'];
if (isset($o['AppId'])) $this->AppId = $o['AppId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
if (isset($this->OAuthToken)) $o['OAuthToken'] = $this->OAuthToken;
if (isset($this->DeviceId)) $o['DeviceId'] = $this->DeviceId;
if (isset($this->AppId)) $o['AppId'] = $this->AppId;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseSecureRequest extends BaseRequest implements JsonSerializable
{
/**
* @param string $ApiKey
* @param string $OAuthToken
* @param string|null $DeviceId
* @param string $AppId
*/
public function __construct(
string $ApiKey='',
string $OAuthToken='',
?string $DeviceId=null,
string $AppId='',
/** @description 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")
/** @var string|null */
public ?string $Token=null
) {
parent::__construct($ApiKey,$OAuthToken,$DeviceId,$AppId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Token'])) $this->Token = $o['Token'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Token)) $o['Token'] = $this->Token;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseResponseResult implements JsonSerializable
{
public function __construct(
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
/** @var string|null */
public ?string $StatusCode=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
/** @var string|null */
public ?string $Login=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
/** @var string|null */
public ?string $ErrorCode=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
/** @var string|null */
public ?string $ErrorDisplayText=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
/** @var string|null */
public ?string $ErrorMessage=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
/** @var string|null */
public ?string $DomainName=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
/** @var string|null */
public ?string $IpAddress=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
if (isset($o['Login'])) $this->Login = $o['Login'];
if (isset($o['ErrorCode'])) $this->ErrorCode = $o['ErrorCode'];
if (isset($o['ErrorDisplayText'])) $this->ErrorDisplayText = $o['ErrorDisplayText'];
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
if (isset($o['DomainName'])) $this->DomainName = $o['DomainName'];
if (isset($o['IpAddress'])) $this->IpAddress = $o['IpAddress'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
if (isset($this->Login)) $o['Login'] = $this->Login;
if (isset($this->ErrorCode)) $o['ErrorCode'] = $this->ErrorCode;
if (isset($this->ErrorDisplayText)) $o['ErrorDisplayText'] = $this->ErrorDisplayText;
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
if (isset($this->DomainName)) $o['DomainName'] = $this->DomainName;
if (isset($this->IpAddress)) $o['IpAddress'] = $this->IpAddress;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseResponse implements JsonSerializable
{
public function __construct(
/** @description */
// @DataMember
// @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
/** @var BaseResponseResult|null */
public ?BaseResponseResult $Status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Status'])) $this->Status = JsonConverters::from('BaseResponseResult', $o['Status']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Status)) $o['Status'] = JsonConverters::to('BaseResponseResult', $this->Status);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class InventoryDetailAttribute implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string|null */
public ?string $Name=null,
// @DataMember
/** @var string|null */
public ?string $Value=null,
// @DataMember
/** @var int */
public int $Priority=0,
/** @description 1 is 'Don't Send to Web', 2 is 'Send To Web' */
// @DataMember
// @ApiMember(DataType="int", Description="1 is 'Don't Send to Web', 2 is 'Send To Web'", Name="WebType", ParameterType="query")
/** @var int */
public int $WebType=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Value'])) $this->Value = $o['Value'];
if (isset($o['Priority'])) $this->Priority = $o['Priority'];
if (isset($o['WebType'])) $this->WebType = $o['WebType'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Value)) $o['Value'] = $this->Value;
if (isset($this->Priority)) $o['Priority'] = $this->Priority;
if (isset($this->WebType)) $o['WebType'] = $this->WebType;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class ImageInfo implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string|null */
public ?string $Url=null,
// @DataMember
/** @var string|null */
public ?string $ImageStream=null,
// @DataMember
/** @var string|null */
public ?string $ImageSize=null,
// @DataMember
/** @var string|null */
public ?string $ErrorMessage=null,
// @DataMember
/** @var int|null */
public ?int $UriPk=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Url'])) $this->Url = $o['Url'];
if (isset($o['ImageStream'])) $this->ImageStream = $o['ImageStream'];
if (isset($o['ImageSize'])) $this->ImageSize = $o['ImageSize'];
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
if (isset($o['UriPk'])) $this->UriPk = $o['UriPk'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Url)) $o['Url'] = $this->Url;
if (isset($this->ImageStream)) $o['ImageStream'] = $this->ImageStream;
if (isset($this->ImageSize)) $o['ImageSize'] = $this->ImageSize;
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
if (isset($this->UriPk)) $o['UriPk'] = $this->UriPk;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class InventoryDetailBySerial implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var int */
public int $SasPk=0,
// @DataMember
/** @var string|null */
public ?string $Serial=null,
// @DataMember
/** @var float */
public float $Retail=0.0,
// @DataMember
/** @var float */
public float $OurPrice=0.0,
// @DataMember
/** @var float|null */
public ?float $SalePrice=null,
// @DataMember
/** @var string|null */
public ?string $Status=null,
// @DataMember
/** @var string|null */
public ?string $SaleInfo=null,
// @DataMember
/** @var float */
public float $PriceA=0.0,
// @DataMember
/** @var float */
public float $PriceB=0.0,
// @DataMember
/** @var float */
public float $PriceC=0.0,
// @DataMember
/** @var float */
public float $MinPrice=0.0,
// @DataMember
/** @var float */
public float $ActiveEPrice=0.0,
// @DataMember
/** @var bool|null */
public ?bool $AllowPriceChange=null,
// @DataMember
/** @var float|null */
public ?float $Cost=null,
// @DataMember
/** @var float|null */
public ?float $WeightedCost=null,
// @DataMember
/** @var string|null */
public ?string $Notes=null,
// @DataMember
/** @var array<InventoryDetailAttribute>|null */
public ?array $Attributes=null,
// @DataMember
/** @var array<ImageInfo>|null */
public ?array $Images=null,
// @DataMember
/** @var bool|null */
public ?bool $HasImages=null,
// @DataMember
/** @var bool|null */
public ?bool $IsActiveeHoldback=null,
// @DataMember
/** @var int|null */
public ?int $CustomerAcct=null,
// @DataMember
/** @var bool|null */
public ?bool $AvailableForSTR=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SasPk'])) $this->SasPk = $o['SasPk'];
if (isset($o['Serial'])) $this->Serial = $o['Serial'];
if (isset($o['Retail'])) $this->Retail = $o['Retail'];
if (isset($o['OurPrice'])) $this->OurPrice = $o['OurPrice'];
if (isset($o['SalePrice'])) $this->SalePrice = $o['SalePrice'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['SaleInfo'])) $this->SaleInfo = $o['SaleInfo'];
if (isset($o['PriceA'])) $this->PriceA = $o['PriceA'];
if (isset($o['PriceB'])) $this->PriceB = $o['PriceB'];
if (isset($o['PriceC'])) $this->PriceC = $o['PriceC'];
if (isset($o['MinPrice'])) $this->MinPrice = $o['MinPrice'];
if (isset($o['ActiveEPrice'])) $this->ActiveEPrice = $o['ActiveEPrice'];
if (isset($o['AllowPriceChange'])) $this->AllowPriceChange = $o['AllowPriceChange'];
if (isset($o['Cost'])) $this->Cost = $o['Cost'];
if (isset($o['WeightedCost'])) $this->WeightedCost = $o['WeightedCost'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['Attributes'])) $this->Attributes = JsonConverters::fromArray('InventoryDetailAttribute', $o['Attributes']);
if (isset($o['Images'])) $this->Images = JsonConverters::fromArray('ImageInfo', $o['Images']);
if (isset($o['HasImages'])) $this->HasImages = $o['HasImages'];
if (isset($o['IsActiveeHoldback'])) $this->IsActiveeHoldback = $o['IsActiveeHoldback'];
if (isset($o['CustomerAcct'])) $this->CustomerAcct = $o['CustomerAcct'];
if (isset($o['AvailableForSTR'])) $this->AvailableForSTR = $o['AvailableForSTR'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SasPk)) $o['SasPk'] = $this->SasPk;
if (isset($this->Serial)) $o['Serial'] = $this->Serial;
if (isset($this->Retail)) $o['Retail'] = $this->Retail;
if (isset($this->OurPrice)) $o['OurPrice'] = $this->OurPrice;
if (isset($this->SalePrice)) $o['SalePrice'] = $this->SalePrice;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->SaleInfo)) $o['SaleInfo'] = $this->SaleInfo;
if (isset($this->PriceA)) $o['PriceA'] = $this->PriceA;
if (isset($this->PriceB)) $o['PriceB'] = $this->PriceB;
if (isset($this->PriceC)) $o['PriceC'] = $this->PriceC;
if (isset($this->MinPrice)) $o['MinPrice'] = $this->MinPrice;
if (isset($this->ActiveEPrice)) $o['ActiveEPrice'] = $this->ActiveEPrice;
if (isset($this->AllowPriceChange)) $o['AllowPriceChange'] = $this->AllowPriceChange;
if (isset($this->Cost)) $o['Cost'] = $this->Cost;
if (isset($this->WeightedCost)) $o['WeightedCost'] = $this->WeightedCost;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->Attributes)) $o['Attributes'] = JsonConverters::toArray('InventoryDetailAttribute', $this->Attributes);
if (isset($this->Images)) $o['Images'] = JsonConverters::toArray('ImageInfo', $this->Images);
if (isset($this->HasImages)) $o['HasImages'] = $this->HasImages;
if (isset($this->IsActiveeHoldback)) $o['IsActiveeHoldback'] = $this->IsActiveeHoldback;
if (isset($this->CustomerAcct)) $o['CustomerAcct'] = $this->CustomerAcct;
if (isset($this->AvailableForSTR)) $o['AvailableForSTR'] = $this->AvailableForSTR;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class SerialDetailResponse extends BaseResponse implements JsonSerializable
{
/**
* @param BaseResponseResult|null $Status
*/
public function __construct(
?BaseResponseResult $Status=null,
// @DataMember
/** @var int */
public int $SasPk=0,
// @DataMember
/** @var string|null */
public ?string $Serial=null,
// @DataMember
/** @var int */
public int $SaqPk=0,
// @DataMember
/** @var int */
public int $LocPk=0,
// @DataMember
/** @var string|null */
public ?string $Location=null,
// @DataMember
/** @var int */
public int $SkuPk=0,
// @DataMember
/** @var string|null */
public ?string $SKU=null,
// @DataMember
/** @var int */
public int $SadPk=0,
// @DataMember
/** @var string|null */
public ?string $Model=null,
// @DataMember
/** @var InventoryDetailBySerial|null */
public ?InventoryDetailBySerial $Details=null
) {
parent::__construct($Status);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['SasPk'])) $this->SasPk = $o['SasPk'];
if (isset($o['Serial'])) $this->Serial = $o['Serial'];
if (isset($o['SaqPk'])) $this->SaqPk = $o['SaqPk'];
if (isset($o['LocPk'])) $this->LocPk = $o['LocPk'];
if (isset($o['Location'])) $this->Location = $o['Location'];
if (isset($o['SkuPk'])) $this->SkuPk = $o['SkuPk'];
if (isset($o['SKU'])) $this->SKU = $o['SKU'];
if (isset($o['SadPk'])) $this->SadPk = $o['SadPk'];
if (isset($o['Model'])) $this->Model = $o['Model'];
if (isset($o['Details'])) $this->Details = JsonConverters::from('InventoryDetailBySerial', $o['Details']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->SasPk)) $o['SasPk'] = $this->SasPk;
if (isset($this->Serial)) $o['Serial'] = $this->Serial;
if (isset($this->SaqPk)) $o['SaqPk'] = $this->SaqPk;
if (isset($this->LocPk)) $o['LocPk'] = $this->LocPk;
if (isset($this->Location)) $o['Location'] = $this->Location;
if (isset($this->SkuPk)) $o['SkuPk'] = $this->SkuPk;
if (isset($this->SKU)) $o['SKU'] = $this->SKU;
if (isset($this->SadPk)) $o['SadPk'] = $this->SadPk;
if (isset($this->Model)) $o['Model'] = $this->Model;
if (isset($this->Details)) $o['Details'] = JsonConverters::to('InventoryDetailBySerial', $this->Details);
return empty($o) ? new class(){} : $o;
}
}
/** @description SerialDetailRequires active-e Inventory Service */
// @DataContract
class SerialDetailRequest extends BaseSecureRequest implements JsonSerializable
{
/**
* @param string $ApiKey
* @param string $OAuthToken
* @param string|null $DeviceId
* @param string $AppId
* @param string|null $Token
*/
public function __construct(
string $ApiKey='',
string $OAuthToken='',
?string $DeviceId=null,
string $AppId='',
?string $Token=null,
/** @description The PK being used for lookup. Do not use if Serial is passed in. */
// @DataMember
// @ApiMember(DataType="integer", Description="The PK being used for lookup. Do not use if Serial is passed in.", Format="int64", Name="Pk", ParameterType="query")
/** @var int|null */
public ?int $Pk=null,
/** @description The Serial# being used for lookup. Do not use if Pk is passed in. */
// @DataMember
// @ApiMember(DataType="string", Description="The Serial# being used for lookup. Do not use if Pk is passed in.", Name="Serial", ParameterType="query")
/** @var string|null */
public ?string $Serial=null,
// @DataMember
/** @var bool|null */
public ?bool $SkipImages=null,
/** @description If sent, the Customer Acct will be used for customer specific pricing. */
// @DataMember
// @ApiMember(DataType="integer", Description="If sent, the Customer Acct will be used for customer specific pricing.", Format="int32", Name="CustomerAcct", ParameterType="query")
/** @var int|null */
public ?int $CustomerAcct=null
) {
parent::__construct($ApiKey,$OAuthToken,$DeviceId,$AppId,$Token);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Pk'])) $this->Pk = $o['Pk'];
if (isset($o['Serial'])) $this->Serial = $o['Serial'];
if (isset($o['SkipImages'])) $this->SkipImages = $o['SkipImages'];
if (isset($o['CustomerAcct'])) $this->CustomerAcct = $o['CustomerAcct'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Pk)) $o['Pk'] = $this->Pk;
if (isset($this->Serial)) $o['Serial'] = $this->Serial;
if (isset($this->SkipImages)) $o['SkipImages'] = $this->SkipImages;
if (isset($this->CustomerAcct)) $o['CustomerAcct'] = $this->CustomerAcct;
return empty($o) ? new class(){} : $o;
}
}
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/SerialDetail HTTP/1.1
Host: active-ewebservice.biz
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<SerialDetailRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService">
<ApiKey>String</ApiKey>
<AppId>String</AppId>
<DeviceId>String</DeviceId>
<OAuthToken>String</OAuthToken>
<Token>String</Token>
<CustomerAcct>0</CustomerAcct>
<Pk>0</Pk>
<Serial>String</Serial>
<SkipImages>false</SkipImages>
</SerialDetailRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<SerialDetailResponse 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>
<Details i:nil="true" />
<LocPk>0</LocPk>
<Location>String</Location>
<Model>String</Model>
<SKU>String</SKU>
<SadPk>0</SadPk>
<SaqPk>0</SaqPk>
<SasPk>0</SasPk>
<Serial>String</Serial>
<SkuPk>0</SkuPk>
</SerialDetailResponse>