| POST | /dealers/authenticate | Authenticate with user name and password. Returns session token. Note: the token expires after 5 minutes of inactivity. |
|---|
<?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};
class AuthenticateResult implements JsonSerializable
{
public function __construct(
/** @description Session token to use in successive calls to the services. */
// @ApiMember(Description="Session token to use in successive calls to the services.", ParameterType="model")
/** @var string|null */
public ?string $SessionToken=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['SessionToken'])) $this->SessionToken = $o['SessionToken'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->SessionToken)) $o['SessionToken'] = $this->SessionToken;
return empty($o) ? new class(){} : $o;
}
}
class OperationResult implements JsonSerializable
{
public function __construct(
/** @description Specifies if the operation was successful. */
// @ApiMember(Description="Specifies if the operation was successful.", ParameterType="model")
/** @var bool|null */
public ?bool $IsSuccessful=null,
/** @description States error message in case of unsuccessful operation. */
// @ApiMember(Description="States error message in case of unsuccessful operation.", ParameterType="model")
/** @var string|null */
public ?string $ErrorMessage=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['IsSuccessful'])) $this->IsSuccessful = $o['IsSuccessful'];
if (isset($o['ErrorMessage'])) $this->ErrorMessage = $o['ErrorMessage'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->IsSuccessful)) $o['IsSuccessful'] = $this->IsSuccessful;
if (isset($this->ErrorMessage)) $o['ErrorMessage'] = $this->ErrorMessage;
return empty($o) ? new class(){} : $o;
}
}
class PartInfoResultImage implements JsonSerializable
{
public function __construct(
/** @description Image number */
// @ApiMember(Description="Image number")
/** @var int */
public int $ImageNumber=0,
/** @description Image URL */
// @ApiMember(Description="Image URL")
/** @var string|null */
public ?string $ImageUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ImageNumber'])) $this->ImageNumber = $o['ImageNumber'];
if (isset($o['ImageUrl'])) $this->ImageUrl = $o['ImageUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ImageNumber)) $o['ImageNumber'] = $this->ImageNumber;
if (isset($this->ImageUrl)) $o['ImageUrl'] = $this->ImageUrl;
return empty($o) ? new class(){} : $o;
}
}
class PartStockQuantity implements JsonSerializable
{
public function __construct(
/** @description Location ID */
// @ApiMember(Description="Location ID")
/** @var int */
public int $LocationId=0,
/** @description Location code */
// @ApiMember(Description="Location code")
/** @var string|null */
public ?string $LocationCode=null,
/** @description Stock quantity in location */
// @ApiMember(Description="Stock quantity in location")
/** @var int */
public int $StockQuantity=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['LocationId'])) $this->LocationId = $o['LocationId'];
if (isset($o['LocationCode'])) $this->LocationCode = $o['LocationCode'];
if (isset($o['StockQuantity'])) $this->StockQuantity = $o['StockQuantity'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->LocationId)) $o['LocationId'] = $this->LocationId;
if (isset($this->LocationCode)) $o['LocationCode'] = $this->LocationCode;
if (isset($this->StockQuantity)) $o['StockQuantity'] = $this->StockQuantity;
return empty($o) ? new class(){} : $o;
}
}
class PartInfoResult implements JsonSerializable
{
public function __construct(
/** @description Unique ID for the part. */
// @ApiMember(Description="Unique ID for the part.")
/** @var int */
public int $Id=0,
/** @description Part number. */
// @ApiMember(Description="Part number.")
/** @var string|null */
public ?string $PartNumber=null,
/** @description Description of the part. */
// @ApiMember(Description="Description of the part.")
/** @var string|null */
public ?string $Description=null,
/** @description Part manufacturer. */
// @ApiMember(Description="Part manufacturer.")
/** @var string|null */
public ?string $Manufacturer=null,
/** @description Determines if the part can be ordered. */
// @ApiMember(Description="Determines if the part can be ordered.")
/** @var bool|null */
public ?bool $CanBeOrdered=null,
/** @description Textual representation of the status of the part. */
// @ApiMember(Description="Textual representation of the status of the part.")
/** @var string|null */
public ?string $StatusText=null,
/** @description Available stock to order. */
// @ApiMember(Description="Available stock to order.")
/** @var int */
public int $AvailableStockQuantity=0,
/** @description Average days needed for delivery. */
// @ApiMember(Description="Average days needed for delivery.")
/** @var int|null */
public ?int $AverageDeliveryInDays=null,
/** @description Price of a single unit, excluding VAT. */
// @ApiMember(Description="Price of a single unit, excluding VAT.")
/** @var float|null */
public ?float $UnitPrice=null,
/** @description EAN number. */
// @ApiMember(Description="EAN number.")
/** @var string|null */
public ?string $EanNumber=null,
/** @description Images */
// @ApiMember(Description="Images")
/** @var array<PartInfoResultImage>|null */
public ?array $Images=null,
/** @description Secondary article numbers */
// @ApiMember(Description="Secondary article numbers")
/** @var array<string>|null */
public ?array $SecondaryArticleNumbers=null,
/** @description Replacement article numbers */
// @ApiMember(Description="Replacement article numbers")
/** @var array<string>|null */
public ?array $ReplacementArticleNumbers=null,
/** @description Stock quantities */
// @ApiMember(Description="Stock quantities")
/** @var array<PartStockQuantity>|null */
public ?array $StockQuantities=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['PartNumber'])) $this->PartNumber = $o['PartNumber'];
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Manufacturer'])) $this->Manufacturer = $o['Manufacturer'];
if (isset($o['CanBeOrdered'])) $this->CanBeOrdered = $o['CanBeOrdered'];
if (isset($o['StatusText'])) $this->StatusText = $o['StatusText'];
if (isset($o['AvailableStockQuantity'])) $this->AvailableStockQuantity = $o['AvailableStockQuantity'];
if (isset($o['AverageDeliveryInDays'])) $this->AverageDeliveryInDays = $o['AverageDeliveryInDays'];
if (isset($o['UnitPrice'])) $this->UnitPrice = $o['UnitPrice'];
if (isset($o['EanNumber'])) $this->EanNumber = $o['EanNumber'];
if (isset($o['Images'])) $this->Images = JsonConverters::fromArray('PartInfoResultImage', $o['Images']);
if (isset($o['SecondaryArticleNumbers'])) $this->SecondaryArticleNumbers = JsonConverters::fromArray('string', $o['SecondaryArticleNumbers']);
if (isset($o['ReplacementArticleNumbers'])) $this->ReplacementArticleNumbers = JsonConverters::fromArray('string', $o['ReplacementArticleNumbers']);
if (isset($o['StockQuantities'])) $this->StockQuantities = JsonConverters::fromArray('PartStockQuantity', $o['StockQuantities']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->PartNumber)) $o['PartNumber'] = $this->PartNumber;
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Manufacturer)) $o['Manufacturer'] = $this->Manufacturer;
if (isset($this->CanBeOrdered)) $o['CanBeOrdered'] = $this->CanBeOrdered;
if (isset($this->StatusText)) $o['StatusText'] = $this->StatusText;
if (isset($this->AvailableStockQuantity)) $o['AvailableStockQuantity'] = $this->AvailableStockQuantity;
if (isset($this->AverageDeliveryInDays)) $o['AverageDeliveryInDays'] = $this->AverageDeliveryInDays;
if (isset($this->UnitPrice)) $o['UnitPrice'] = $this->UnitPrice;
if (isset($this->EanNumber)) $o['EanNumber'] = $this->EanNumber;
if (isset($this->Images)) $o['Images'] = JsonConverters::toArray('PartInfoResultImage', $this->Images);
if (isset($this->SecondaryArticleNumbers)) $o['SecondaryArticleNumbers'] = JsonConverters::toArray('string', $this->SecondaryArticleNumbers);
if (isset($this->ReplacementArticleNumbers)) $o['ReplacementArticleNumbers'] = JsonConverters::toArray('string', $this->ReplacementArticleNumbers);
if (isset($this->StockQuantities)) $o['StockQuantities'] = JsonConverters::toArray('PartStockQuantity', $this->StockQuantities);
return empty($o) ? new class(){} : $o;
}
}
class PartResults implements JsonSerializable
{
public function __construct(
/** @description Total number of parts available. */
// @ApiMember(Description="Total number of parts available.")
/** @var int */
public int $TotalNumberOfParts=0,
/** @description Indication if there are more parts to retrieve. */
// @ApiMember(Description="Indication if there are more parts to retrieve.")
/** @var bool|null */
public ?bool $HasMoreRecords=null,
/** @description Part records. */
// @ApiMember(Description="Part records.")
/** @var array<PartInfoResult>|null */
public ?array $Parts=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TotalNumberOfParts'])) $this->TotalNumberOfParts = $o['TotalNumberOfParts'];
if (isset($o['HasMoreRecords'])) $this->HasMoreRecords = $o['HasMoreRecords'];
if (isset($o['Parts'])) $this->Parts = JsonConverters::fromArray('PartInfoResult', $o['Parts']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TotalNumberOfParts)) $o['TotalNumberOfParts'] = $this->TotalNumberOfParts;
if (isset($this->HasMoreRecords)) $o['HasMoreRecords'] = $this->HasMoreRecords;
if (isset($this->Parts)) $o['Parts'] = JsonConverters::toArray('PartInfoResult', $this->Parts);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class OperationResult1 extends OperationResult implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): OperationResult1 {
$to = new OperationResult1();
$to->genericArgs = $genericArgs;
return $to;
}
/**
* @param bool|null $IsSuccessful
* @param string|null $ErrorMessage
*/
public function __construct(
mixed $IsSuccessful=null,
mixed $ErrorMessage=null,
/** @description Result value */
// @ApiMember(Description="Result value", ParameterType="model")
/** @var PartResults|null */
public mixed $Result=null
) {
parent::__construct($IsSuccessful,$ErrorMessage);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Result'])) $this->Result = JsonConverters::from('PartResults', $o['Result']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Result)) $o['Result'] = JsonConverters::to('PartResults', $this->Result);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template OperationResult1 of AuthenticateResult
*/
class AuthenticateResponse extends OperationResult1 implements JsonSerializable
{
/**
* @param bool|null $IsSuccessful
* @param string|null $ErrorMessage
* @param PartResults|null $Result
*/
public function __construct(
?bool $IsSuccessful=null,
?string $ErrorMessage=null,
?PartResults $Result=null
) {
parent::__construct($IsSuccessful,$ErrorMessage,$Result);
}
/** @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;
}
}
class Authenticate implements JsonSerializable
{
public function __construct(
/** @description User name for your account. */
// @ApiMember(Description="User name for your account.", IsRequired=true, ParameterType="query")
/** @var string */
public string $UserName='',
/** @description Password provided by your supplier. */
// @ApiMember(Description="Password provided by your supplier.", IsRequired=true, ParameterType="query")
/** @var string */
public string $Password=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['Password'])) $this->Password = $o['Password'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->Password)) $o['Password'] = $this->Password;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /dealers/authenticate HTTP/1.1
Host: services.acct.2service.nl
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
UserName: String,
Password: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Result:
{
SessionToken: String
},
IsSuccessful: False,
ErrorMessage: String
}