Antel API

<back to all web services

AutoLogin

<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, JsonSerializable
{
    public function __construct(
        /** @description The API Key required for authentication */
        // @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
        /** @var string */
        public string $apiKey='',

        /** @description Latitude of the user making this request */
        // @ApiMember(DataType="double", Description="Latitude of the user making this request")
        /** @var float */
        public float $latitude=0.0,

        /** @description Longitude of the user making this request */
        // @ApiMember(DataType="double", Description="Longitude of the user making this request")
        /** @var float */
        public float $longitude=0.0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['apiKey'])) $this->apiKey = $o['apiKey'];
        if (isset($o['latitude'])) $this->latitude = $o['latitude'];
        if (isset($o['longitude'])) $this->longitude = $o['longitude'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->apiKey)) $o['apiKey'] = $this->apiKey;
        if (isset($this->latitude)) $o['latitude'] = $this->latitude;
        if (isset($this->longitude)) $o['longitude'] = $this->longitude;
        return empty($o) ? new class(){} : $o;
    }
}

class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
    public function __construct(
        /** @description Information about the response. */
        // @ApiMember(Description="Information about the response.", IsRequired=true)
        /** @var string */
        public string $description='',

        /** @description Heading or summary of the response. */
        // @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
        /** @var string */
        public string $heading='',

        /** @description Did the intended operation for this response complete successfully? */
        // @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
        /** @var bool|null */
        public ?bool $wasSuccessful=null,

        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['heading'])) $this->heading = $o['heading'];
        if (isset($o['wasSuccessful'])) $this->wasSuccessful = $o['wasSuccessful'];
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->heading)) $o['heading'] = $this->heading;
        if (isset($this->wasSuccessful)) $o['wasSuccessful'] = $this->wasSuccessful;
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class StockOperatorData implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        return empty($o) ? new class(){} : $o;
    }
}

class ClaimNumberRule implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $principalId=0,
        /** @var string|null */
        public ?string $channelName=null,
        /** @var string|null */
        public ?string $rulePattern=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['principalId'])) $this->principalId = $o['principalId'];
        if (isset($o['channelName'])) $this->channelName = $o['channelName'];
        if (isset($o['rulePattern'])) $this->rulePattern = $o['rulePattern'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->principalId)) $o['principalId'] = $this->principalId;
        if (isset($this->channelName)) $o['channelName'] = $this->channelName;
        if (isset($this->rulePattern)) $o['rulePattern'] = $this->rulePattern;
        return empty($o) ? new class(){} : $o;
    }
}

class LoginData implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $systemUserId=0,
        /** @var string|null */
        public ?string $refreshToken=null,
        /** @var string|null */
        public ?string $friendlyName=null,
        /** @var float */
        public float $vatValue=0.0,
        /** @var bool|null */
        public ?bool $canUplift=null,
        /** @var bool|null */
        public ?bool $stockCanDropOff=null,
        /** @var bool|null */
        public ?bool $stockCanCloseArrival=null,
        /** @var bool|null */
        public ?bool $blockUpliftIfLineCountDoesNotMatch=null,
        /** @var bool|null */
        public ?bool $blockUpliftIfQuantityDoesNotMatch=null,
        /** @var bool|null */
        public ?bool $canRipTip=null,
        /** @var bool|null */
        public ?bool $canDeleteUplifts=null,
        /** @var array<StockOperatorData>|null */
        public ?array $stockOperators=null,
        /** @var array<ClaimNumberRule>|null */
        public ?array $claimNumberRules=null,
        /** @var int */
        public int $upliftSyncInterval=0,
        /** @var int */
        public int $lateUpliftThreshold=0,
        /** @var array<string>|null */
        public ?array $pauseUpliftReasons=null,
        /** @var array<string>|null */
        public ?array $noGoodsToUpliftReasons=null,
        /** @var float */
        public float $blurryImageErrorScore=0.0,
        /** @var float */
        public float $blurryImageWarningScore=0.0,
        /** @var bool|null */
        public ?bool $blurryImageDetectionEnabled=null,
        /** @var string|null */
        public ?string $profileImageUrl=null,
        /** @var float */
        public float $claimValueWarningVariance=0.0,
        /** @var bool|null */
        public ?bool $stockCanVehicleAssignment=null,
        /** @var bool|null */
        public ?bool $stockCanOperatorAssignment=null,
        /** @var bool|null */
        public ?bool $stockCanStockEnd=null,
        /** @var bool|null */
        public ?bool $stockCanCheckSealDetails=null,
        /** @var bool|null */
        public ?bool $stockManualEnabled=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['systemUserId'])) $this->systemUserId = $o['systemUserId'];
        if (isset($o['refreshToken'])) $this->refreshToken = $o['refreshToken'];
        if (isset($o['friendlyName'])) $this->friendlyName = $o['friendlyName'];
        if (isset($o['vatValue'])) $this->vatValue = $o['vatValue'];
        if (isset($o['canUplift'])) $this->canUplift = $o['canUplift'];
        if (isset($o['stockCanDropOff'])) $this->stockCanDropOff = $o['stockCanDropOff'];
        if (isset($o['stockCanCloseArrival'])) $this->stockCanCloseArrival = $o['stockCanCloseArrival'];
        if (isset($o['blockUpliftIfLineCountDoesNotMatch'])) $this->blockUpliftIfLineCountDoesNotMatch = $o['blockUpliftIfLineCountDoesNotMatch'];
        if (isset($o['blockUpliftIfQuantityDoesNotMatch'])) $this->blockUpliftIfQuantityDoesNotMatch = $o['blockUpliftIfQuantityDoesNotMatch'];
        if (isset($o['canRipTip'])) $this->canRipTip = $o['canRipTip'];
        if (isset($o['canDeleteUplifts'])) $this->canDeleteUplifts = $o['canDeleteUplifts'];
        if (isset($o['stockOperators'])) $this->stockOperators = JsonConverters::fromArray('StockOperatorData', $o['stockOperators']);
        if (isset($o['claimNumberRules'])) $this->claimNumberRules = JsonConverters::fromArray('ClaimNumberRule', $o['claimNumberRules']);
        if (isset($o['upliftSyncInterval'])) $this->upliftSyncInterval = $o['upliftSyncInterval'];
        if (isset($o['lateUpliftThreshold'])) $this->lateUpliftThreshold = $o['lateUpliftThreshold'];
        if (isset($o['pauseUpliftReasons'])) $this->pauseUpliftReasons = JsonConverters::fromArray('string', $o['pauseUpliftReasons']);
        if (isset($o['noGoodsToUpliftReasons'])) $this->noGoodsToUpliftReasons = JsonConverters::fromArray('string', $o['noGoodsToUpliftReasons']);
        if (isset($o['blurryImageErrorScore'])) $this->blurryImageErrorScore = $o['blurryImageErrorScore'];
        if (isset($o['blurryImageWarningScore'])) $this->blurryImageWarningScore = $o['blurryImageWarningScore'];
        if (isset($o['blurryImageDetectionEnabled'])) $this->blurryImageDetectionEnabled = $o['blurryImageDetectionEnabled'];
        if (isset($o['profileImageUrl'])) $this->profileImageUrl = $o['profileImageUrl'];
        if (isset($o['claimValueWarningVariance'])) $this->claimValueWarningVariance = $o['claimValueWarningVariance'];
        if (isset($o['stockCanVehicleAssignment'])) $this->stockCanVehicleAssignment = $o['stockCanVehicleAssignment'];
        if (isset($o['stockCanOperatorAssignment'])) $this->stockCanOperatorAssignment = $o['stockCanOperatorAssignment'];
        if (isset($o['stockCanStockEnd'])) $this->stockCanStockEnd = $o['stockCanStockEnd'];
        if (isset($o['stockCanCheckSealDetails'])) $this->stockCanCheckSealDetails = $o['stockCanCheckSealDetails'];
        if (isset($o['stockManualEnabled'])) $this->stockManualEnabled = $o['stockManualEnabled'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->systemUserId)) $o['systemUserId'] = $this->systemUserId;
        if (isset($this->refreshToken)) $o['refreshToken'] = $this->refreshToken;
        if (isset($this->friendlyName)) $o['friendlyName'] = $this->friendlyName;
        if (isset($this->vatValue)) $o['vatValue'] = $this->vatValue;
        if (isset($this->canUplift)) $o['canUplift'] = $this->canUplift;
        if (isset($this->stockCanDropOff)) $o['stockCanDropOff'] = $this->stockCanDropOff;
        if (isset($this->stockCanCloseArrival)) $o['stockCanCloseArrival'] = $this->stockCanCloseArrival;
        if (isset($this->blockUpliftIfLineCountDoesNotMatch)) $o['blockUpliftIfLineCountDoesNotMatch'] = $this->blockUpliftIfLineCountDoesNotMatch;
        if (isset($this->blockUpliftIfQuantityDoesNotMatch)) $o['blockUpliftIfQuantityDoesNotMatch'] = $this->blockUpliftIfQuantityDoesNotMatch;
        if (isset($this->canRipTip)) $o['canRipTip'] = $this->canRipTip;
        if (isset($this->canDeleteUplifts)) $o['canDeleteUplifts'] = $this->canDeleteUplifts;
        if (isset($this->stockOperators)) $o['stockOperators'] = JsonConverters::toArray('StockOperatorData', $this->stockOperators);
        if (isset($this->claimNumberRules)) $o['claimNumberRules'] = JsonConverters::toArray('ClaimNumberRule', $this->claimNumberRules);
        if (isset($this->upliftSyncInterval)) $o['upliftSyncInterval'] = $this->upliftSyncInterval;
        if (isset($this->lateUpliftThreshold)) $o['lateUpliftThreshold'] = $this->lateUpliftThreshold;
        if (isset($this->pauseUpliftReasons)) $o['pauseUpliftReasons'] = JsonConverters::toArray('string', $this->pauseUpliftReasons);
        if (isset($this->noGoodsToUpliftReasons)) $o['noGoodsToUpliftReasons'] = JsonConverters::toArray('string', $this->noGoodsToUpliftReasons);
        if (isset($this->blurryImageErrorScore)) $o['blurryImageErrorScore'] = $this->blurryImageErrorScore;
        if (isset($this->blurryImageWarningScore)) $o['blurryImageWarningScore'] = $this->blurryImageWarningScore;
        if (isset($this->blurryImageDetectionEnabled)) $o['blurryImageDetectionEnabled'] = $this->blurryImageDetectionEnabled;
        if (isset($this->profileImageUrl)) $o['profileImageUrl'] = $this->profileImageUrl;
        if (isset($this->claimValueWarningVariance)) $o['claimValueWarningVariance'] = $this->claimValueWarningVariance;
        if (isset($this->stockCanVehicleAssignment)) $o['stockCanVehicleAssignment'] = $this->stockCanVehicleAssignment;
        if (isset($this->stockCanOperatorAssignment)) $o['stockCanOperatorAssignment'] = $this->stockCanOperatorAssignment;
        if (isset($this->stockCanStockEnd)) $o['stockCanStockEnd'] = $this->stockCanStockEnd;
        if (isset($this->stockCanCheckSealDetails)) $o['stockCanCheckSealDetails'] = $this->stockCanCheckSealDetails;
        if (isset($this->stockManualEnabled)) $o['stockManualEnabled'] = $this->stockManualEnabled;
        return empty($o) ? new class(){} : $o;
    }
}

class AutoLoginResponse extends ApiServiceResponse implements JsonSerializable
{
    /**
     * @param string $description
     * @param string $heading
     * @param bool|null $wasSuccessful
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        string $description='',
        string $heading='',
        ?bool $wasSuccessful=null,
        ?ResponseStatus $responseStatus=null,
        /** @var LoginData|null */
        public ?LoginData $data=null
    ) {
        parent::__construct($description,$heading,$wasSuccessful,$responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['data'])) $this->data = JsonConverters::from('LoginData', $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->data)) $o['data'] = JsonConverters::to('LoginData', $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

class AutoLogin extends ApiServiceRequest implements JsonSerializable
{
    /**
     * @param string $apiKey
     * @param float $latitude
     * @param float $longitude
     */
    public function __construct(
        string $apiKey='',
        float $latitude=0.0,
        float $longitude=0.0,
        /** @var int */
        public int $systemUserId=0,
        /** @var string|null */
        public ?string $refreshToken=null,
        /** @var int */
        public int $utcOffset=0
    ) {
        parent::__construct($apiKey,$latitude,$longitude);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['systemUserId'])) $this->systemUserId = $o['systemUserId'];
        if (isset($o['refreshToken'])) $this->refreshToken = $o['refreshToken'];
        if (isset($o['utcOffset'])) $this->utcOffset = $o['utcOffset'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->systemUserId)) $o['systemUserId'] = $this->systemUserId;
        if (isset($this->refreshToken)) $o['refreshToken'] = $this->refreshToken;
        if (isset($this->utcOffset)) $o['utcOffset'] = $this->utcOffset;
        return empty($o) ? new class(){} : $o;
    }
}

PHP AutoLogin DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /jsv/reply/AutoLogin HTTP/1.1 
Host: antel.api.dev.86degrees.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	systemUserId: 0,
	refreshToken: String,
	utcOffset: 0,
	apiKey: String,
	latitude: 0,
	longitude: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	data: 
	{
		systemUserId: 0,
		refreshToken: String,
		friendlyName: String,
		vatValue: 0,
		canUplift: False,
		stockCanDropOff: False,
		stockCanCloseArrival: False,
		blockUpliftIfLineCountDoesNotMatch: False,
		blockUpliftIfQuantityDoesNotMatch: False,
		canRipTip: False,
		canDeleteUplifts: False,
		stockOperators: 
		[
			{
				
			}
		],
		claimNumberRules: 
		[
			{
				
			}
		],
		upliftSyncInterval: 0,
		lateUpliftThreshold: 0,
		pauseUpliftReasons: 
		[
			String
		],
		noGoodsToUpliftReasons: 
		[
			String
		],
		blurryImageErrorScore: 0,
		blurryImageWarningScore: 0,
		blurryImageDetectionEnabled: False,
		profileImageUrl: String,
		claimValueWarningVariance: 0,
		stockCanVehicleAssignment: False,
		stockCanOperatorAssignment: False,
		stockCanStockEnd: False,
		stockCanCheckSealDetails: False,
		stockManualEnabled: False
	},
	description: String,
	heading: String,
	wasSuccessful: False,
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}