Antel API

<back to all web services

GetPrincipal

Requires Authentication
The following routes are available for this service:
GET/principal/get
<?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 ProductData implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $productId=0,
        /** @var int */
        public int $principalId=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $category=null,
        /** @var string|null */
        public ?string $productCode=null,
        /** @var string|null */
        public ?string $unitBarcode=null,
        /** @var int */
        public int $cartonQuantity=0,
        /** @var int */
        public int $shrinkQuantity=0,
        /** @var int */
        public int $unitQuantity=0,
        /** @var string|null */
        public ?string $cartonMeasurement=null,
        /** @var string|null */
        public ?string $shrinkMeasurement=null,
        /** @var string|null */
        public ?string $unitMeasurement=null,
        /** @var float */
        public float $cartonWeight=0.0,
        /** @var float */
        public float $shrinkWeight=0.0,
        /** @var float */
        public float $unitWeight=0.0,
        /** @var float */
        public float $cartonPrice=0.0,
        /** @var float */
        public float $shrinkPrice=0.0,
        /** @var float */
        public float $unitPrice=0.0,
        /** @var int */
        public int $maxQuantity=0,
        /** @var int */
        public int $maxPrice=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['productId'])) $this->productId = $o['productId'];
        if (isset($o['principalId'])) $this->principalId = $o['principalId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['category'])) $this->category = $o['category'];
        if (isset($o['productCode'])) $this->productCode = $o['productCode'];
        if (isset($o['unitBarcode'])) $this->unitBarcode = $o['unitBarcode'];
        if (isset($o['cartonQuantity'])) $this->cartonQuantity = $o['cartonQuantity'];
        if (isset($o['shrinkQuantity'])) $this->shrinkQuantity = $o['shrinkQuantity'];
        if (isset($o['unitQuantity'])) $this->unitQuantity = $o['unitQuantity'];
        if (isset($o['cartonMeasurement'])) $this->cartonMeasurement = $o['cartonMeasurement'];
        if (isset($o['shrinkMeasurement'])) $this->shrinkMeasurement = $o['shrinkMeasurement'];
        if (isset($o['unitMeasurement'])) $this->unitMeasurement = $o['unitMeasurement'];
        if (isset($o['cartonWeight'])) $this->cartonWeight = $o['cartonWeight'];
        if (isset($o['shrinkWeight'])) $this->shrinkWeight = $o['shrinkWeight'];
        if (isset($o['unitWeight'])) $this->unitWeight = $o['unitWeight'];
        if (isset($o['cartonPrice'])) $this->cartonPrice = $o['cartonPrice'];
        if (isset($o['shrinkPrice'])) $this->shrinkPrice = $o['shrinkPrice'];
        if (isset($o['unitPrice'])) $this->unitPrice = $o['unitPrice'];
        if (isset($o['maxQuantity'])) $this->maxQuantity = $o['maxQuantity'];
        if (isset($o['maxPrice'])) $this->maxPrice = $o['maxPrice'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->productId)) $o['productId'] = $this->productId;
        if (isset($this->principalId)) $o['principalId'] = $this->principalId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->category)) $o['category'] = $this->category;
        if (isset($this->productCode)) $o['productCode'] = $this->productCode;
        if (isset($this->unitBarcode)) $o['unitBarcode'] = $this->unitBarcode;
        if (isset($this->cartonQuantity)) $o['cartonQuantity'] = $this->cartonQuantity;
        if (isset($this->shrinkQuantity)) $o['shrinkQuantity'] = $this->shrinkQuantity;
        if (isset($this->unitQuantity)) $o['unitQuantity'] = $this->unitQuantity;
        if (isset($this->cartonMeasurement)) $o['cartonMeasurement'] = $this->cartonMeasurement;
        if (isset($this->shrinkMeasurement)) $o['shrinkMeasurement'] = $this->shrinkMeasurement;
        if (isset($this->unitMeasurement)) $o['unitMeasurement'] = $this->unitMeasurement;
        if (isset($this->cartonWeight)) $o['cartonWeight'] = $this->cartonWeight;
        if (isset($this->shrinkWeight)) $o['shrinkWeight'] = $this->shrinkWeight;
        if (isset($this->unitWeight)) $o['unitWeight'] = $this->unitWeight;
        if (isset($this->cartonPrice)) $o['cartonPrice'] = $this->cartonPrice;
        if (isset($this->shrinkPrice)) $o['shrinkPrice'] = $this->shrinkPrice;
        if (isset($this->unitPrice)) $o['unitPrice'] = $this->unitPrice;
        if (isset($this->maxQuantity)) $o['maxQuantity'] = $this->maxQuantity;
        if (isset($this->maxPrice)) $o['maxPrice'] = $this->maxPrice;
        return empty($o) ? new class(){} : $o;
    }
}

class ProductDataCategory implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $unitBarcode=null,
        /** @var array<ProductData>|null */
        public ?array $products=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['unitBarcode'])) $this->unitBarcode = $o['unitBarcode'];
        if (isset($o['products'])) $this->products = JsonConverters::fromArray('ProductData', $o['products']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->unitBarcode)) $o['unitBarcode'] = $this->unitBarcode;
        if (isset($this->products)) $o['products'] = JsonConverters::toArray('ProductData', $this->products);
        return empty($o) ? new class(){} : $o;
    }
}

class ProductExceptionData implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $region=null,
        /** @var string|null */
        public ?string $channel=null,
        /** @var int */
        public int $productId=0,
        /** @var array<int>|null */
        public ?array $stockStatusIds=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['region'])) $this->region = $o['region'];
        if (isset($o['channel'])) $this->channel = $o['channel'];
        if (isset($o['productId'])) $this->productId = $o['productId'];
        if (isset($o['stockStatusIds'])) $this->stockStatusIds = JsonConverters::fromArray('int', $o['stockStatusIds']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->region)) $o['region'] = $this->region;
        if (isset($this->channel)) $o['channel'] = $this->channel;
        if (isset($this->productId)) $o['productId'] = $this->productId;
        if (isset($this->stockStatusIds)) $o['stockStatusIds'] = JsonConverters::toArray('int', $this->stockStatusIds);
        return empty($o) ? new class(){} : $o;
    }
}

class PrincipalData implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $principalId=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var array<string>|null */
        public ?array $authLetterFileUrl=null,
        /** @var string|null */
        public ?string $logoImageUrl=null,
        /** @var array<ProductDataCategory>|null */
        public ?array $products=null,
        /** @var string|null */
        public ?string $upliftPrefix=null,
        /** @var string|null */
        public ?string $contactName=null,
        /** @var string|null */
        public ?string $contactNumber=null,
        /** @var string|null */
        public ?string $contactEmail=null,
        /** @var bool|null */
        public ?bool $allowProductLookup=null,
        /** @var bool|null */
        public ?bool $hasLogo=null,
        /** @var bool|null */
        public ?bool $hasAuthLetter=null,
        /** @var bool|null */
        public ?bool $sealNetWeightMandatory=null,
        /** @var bool|null */
        public ?bool $allowBillableSeals=null,
        /** @var bool|null */
        public ?bool $captureSerialNumber=null,
        /** @var bool|null */
        public ?bool $batchCodesMandatory=null,
        /** @var bool|null */
        public ?bool $captureManufactureAndExpiryDate=null,
        /** @var array<ProductExceptionData>|null */
        public ?array $productExceptions=null,
        /** @var bool|null */
        public ?bool $usesOwnSealNumbers=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['principalId'])) $this->principalId = $o['principalId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['authLetterFileUrl'])) $this->authLetterFileUrl = JsonConverters::fromArray('string', $o['authLetterFileUrl']);
        if (isset($o['logoImageUrl'])) $this->logoImageUrl = $o['logoImageUrl'];
        if (isset($o['products'])) $this->products = JsonConverters::fromArray('ProductDataCategory', $o['products']);
        if (isset($o['upliftPrefix'])) $this->upliftPrefix = $o['upliftPrefix'];
        if (isset($o['contactName'])) $this->contactName = $o['contactName'];
        if (isset($o['contactNumber'])) $this->contactNumber = $o['contactNumber'];
        if (isset($o['contactEmail'])) $this->contactEmail = $o['contactEmail'];
        if (isset($o['allowProductLookup'])) $this->allowProductLookup = $o['allowProductLookup'];
        if (isset($o['hasLogo'])) $this->hasLogo = $o['hasLogo'];
        if (isset($o['hasAuthLetter'])) $this->hasAuthLetter = $o['hasAuthLetter'];
        if (isset($o['sealNetWeightMandatory'])) $this->sealNetWeightMandatory = $o['sealNetWeightMandatory'];
        if (isset($o['allowBillableSeals'])) $this->allowBillableSeals = $o['allowBillableSeals'];
        if (isset($o['captureSerialNumber'])) $this->captureSerialNumber = $o['captureSerialNumber'];
        if (isset($o['batchCodesMandatory'])) $this->batchCodesMandatory = $o['batchCodesMandatory'];
        if (isset($o['captureManufactureAndExpiryDate'])) $this->captureManufactureAndExpiryDate = $o['captureManufactureAndExpiryDate'];
        if (isset($o['productExceptions'])) $this->productExceptions = JsonConverters::fromArray('ProductExceptionData', $o['productExceptions']);
        if (isset($o['usesOwnSealNumbers'])) $this->usesOwnSealNumbers = $o['usesOwnSealNumbers'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->principalId)) $o['principalId'] = $this->principalId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->authLetterFileUrl)) $o['authLetterFileUrl'] = JsonConverters::toArray('string', $this->authLetterFileUrl);
        if (isset($this->logoImageUrl)) $o['logoImageUrl'] = $this->logoImageUrl;
        if (isset($this->products)) $o['products'] = JsonConverters::toArray('ProductDataCategory', $this->products);
        if (isset($this->upliftPrefix)) $o['upliftPrefix'] = $this->upliftPrefix;
        if (isset($this->contactName)) $o['contactName'] = $this->contactName;
        if (isset($this->contactNumber)) $o['contactNumber'] = $this->contactNumber;
        if (isset($this->contactEmail)) $o['contactEmail'] = $this->contactEmail;
        if (isset($this->allowProductLookup)) $o['allowProductLookup'] = $this->allowProductLookup;
        if (isset($this->hasLogo)) $o['hasLogo'] = $this->hasLogo;
        if (isset($this->hasAuthLetter)) $o['hasAuthLetter'] = $this->hasAuthLetter;
        if (isset($this->sealNetWeightMandatory)) $o['sealNetWeightMandatory'] = $this->sealNetWeightMandatory;
        if (isset($this->allowBillableSeals)) $o['allowBillableSeals'] = $this->allowBillableSeals;
        if (isset($this->captureSerialNumber)) $o['captureSerialNumber'] = $this->captureSerialNumber;
        if (isset($this->batchCodesMandatory)) $o['batchCodesMandatory'] = $this->batchCodesMandatory;
        if (isset($this->captureManufactureAndExpiryDate)) $o['captureManufactureAndExpiryDate'] = $this->captureManufactureAndExpiryDate;
        if (isset($this->productExceptions)) $o['productExceptions'] = JsonConverters::toArray('ProductExceptionData', $this->productExceptions);
        if (isset($this->usesOwnSealNumbers)) $o['usesOwnSealNumbers'] = $this->usesOwnSealNumbers;
        return empty($o) ? new class(){} : $o;
    }
}

class GetPrincipalResponse 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 PrincipalData|null */
        public ?PrincipalData $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('PrincipalData', $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->data)) $o['data'] = JsonConverters::to('PrincipalData', $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

class GetPrincipal 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 $principalId=0
    ) {
        parent::__construct($apiKey,$latitude,$longitude);
    }

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

PHP GetPrincipal DTOs

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

HTTP + OTHER

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

GET /principal/get HTTP/1.1 
Host: antel.api.dev.86degrees.com 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"data":{"principalId":0,"name":"String","authLetterFileUrl":["String"],"logoImageUrl":"String","products":[{"unitBarcode":"String","products":[{"productId":0,"principalId":0,"name":"String","category":"String","productCode":"String","unitBarcode":"String","cartonQuantity":0,"shrinkQuantity":0,"unitQuantity":0,"cartonMeasurement":"String","shrinkMeasurement":"String","unitMeasurement":"String","cartonWeight":0,"shrinkWeight":0,"unitWeight":0,"cartonPrice":0,"shrinkPrice":0,"unitPrice":0,"maxQuantity":0,"maxPrice":0}]}],"upliftPrefix":"String","contactName":"String","contactNumber":"String","contactEmail":"String","allowProductLookup":false,"hasLogo":false,"hasAuthLetter":false,"sealNetWeightMandatory":false,"allowBillableSeals":false,"captureSerialNumber":false,"batchCodesMandatory":false,"captureManufactureAndExpiryDate":false,"productExceptions":[{"region":"String","channel":"String","productId":0,"stockStatusIds":[0]}],"usesOwnSealNumbers":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"}}}