POST | /api/EditInventory |
---|
<?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='',
// @DataMember
// @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
/** @var string|null */
public ?string $OAuthToken=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
if (isset($o['OAuthToken'])) $this->OAuthToken = $o['OAuthToken'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
if (isset($this->OAuthToken)) $o['OAuthToken'] = $this->OAuthToken;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseSecureRequest extends BaseRequest implements JsonSerializable
{
/**
* @param string $ApiKey
* @param string|null $OAuthToken
*/
public function __construct(
string $ApiKey='',
?string $OAuthToken=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
/** @var string|null */
public ?string $Token=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
/** @var string|null */
public ?string $DeviceId=null,
/** @description */
// @DataMember
// @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
/** @var string */
public string $AppId=''
) {
parent::__construct($ApiKey,$OAuthToken);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Token'])) $this->Token = $o['Token'];
if (isset($o['DeviceId'])) $this->DeviceId = $o['DeviceId'];
if (isset($o['AppId'])) $this->AppId = $o['AppId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Token)) $o['Token'] = $this->Token;
if (isset($this->DeviceId)) $o['DeviceId'] = $this->DeviceId;
if (isset($this->AppId)) $o['AppId'] = $this->AppId;
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 EditInventoryResponse extends BaseResponse implements JsonSerializable
{
/**
* @param BaseResponseResult|null $Status
*/
public function __construct(
?BaseResponseResult $Status=null
) {
parent::__construct($Status);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
/** @description EditInventoryRequires active-e Inventory Service */
// @DataContract
class EditInventoryRequest extends BaseSecureRequest implements JsonSerializable
{
/**
* @param string $ApiKey
* @param string|null $OAuthToken
* @param string|null $Token
* @param string|null $DeviceId
* @param string $AppId
*/
public function __construct(
string $ApiKey='',
?string $OAuthToken=null,
?string $Token=null,
?string $DeviceId=null,
string $AppId='',
// @DataMember
/** @var int|null */
public ?int $SaqPk=null,
// @DataMember
/** @var int|null */
public ?int $SasPk=null,
// @DataMember
/** @var string|null */
public ?string $Description=null,
// @DataMember
/** @var float|null */
public ?float $OurPrice=null,
// @DataMember
/** @var float|null */
public ?float $RetailPrice=null,
// @DataMember
/** @var float|null */
public ?float $PriceA=null,
// @DataMember
/** @var float|null */
public ?float $PriceB=null,
// @DataMember
/** @var float|null */
public ?float $PriceC=null,
// @DataMember
/** @var float|null */
public ?float $MinPrice=null,
// @DataMember
/** @var float|null */
public ?float $ActiveEPrice=null,
// @DataMember
/** @var string|null */
public ?string $Locator=null,
// @DataMember
/** @var bool|null */
public ?bool $UpdateAllLocations=null,
/** @description 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")
/** @var array<string>|null */
public ?array $Barcodes=null,
// @DataMember
/** @var float|null */
public ?float $NewComputerQuantity=null
) {
parent::__construct($ApiKey,$OAuthToken,$Token,$DeviceId,$AppId);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['SaqPk'])) $this->SaqPk = $o['SaqPk'];
if (isset($o['SasPk'])) $this->SasPk = $o['SasPk'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['OurPrice'])) $this->OurPrice = $o['OurPrice'];
if (isset($o['RetailPrice'])) $this->RetailPrice = $o['RetailPrice'];
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['Locator'])) $this->Locator = $o['Locator'];
if (isset($o['UpdateAllLocations'])) $this->UpdateAllLocations = $o['UpdateAllLocations'];
if (isset($o['Barcodes'])) $this->Barcodes = JsonConverters::fromArray('string', $o['Barcodes']);
if (isset($o['NewComputerQuantity'])) $this->NewComputerQuantity = $o['NewComputerQuantity'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->SaqPk)) $o['SaqPk'] = $this->SaqPk;
if (isset($this->SasPk)) $o['SasPk'] = $this->SasPk;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->OurPrice)) $o['OurPrice'] = $this->OurPrice;
if (isset($this->RetailPrice)) $o['RetailPrice'] = $this->RetailPrice;
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->Locator)) $o['Locator'] = $this->Locator;
if (isset($this->UpdateAllLocations)) $o['UpdateAllLocations'] = $this->UpdateAllLocations;
if (isset($this->Barcodes)) $o['Barcodes'] = JsonConverters::toArray('string', $this->Barcodes);
if (isset($this->NewComputerQuantity)) $o['NewComputerQuantity'] = $this->NewComputerQuantity;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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/json
Content-Type: application/json
Content-Length: length
{"SaqPk":0,"SasPk":0,"Description":"String","OurPrice":0,"RetailPrice":0,"PriceA":0,"PriceB":0,"PriceC":0,"MinPrice":0,"ActiveEPrice":0,"Locator":"String","UpdateAllLocations":false,"Barcodes":["String"],"NewComputerQuantity":0,"Token":"String","DeviceId":"String","AppId":"String","ApiKey":"String","OAuthToken":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"Status":{"StatusCode":"String","Login":"String","ErrorCode":"String","ErrorDisplayText":"String","ErrorMessage":"String","DomainName":"String","IpAddress":"String"}}