Tax Filing Service

<back to all web services

RetrieveAllProductsAsync

RetrieveProductsAsync

Represents a service request to retrieve all products in an asynchronous operation.

Requires Authentication
Required role:AdminRequired permission:CanAccess
The following routes are available for this service:
GET/async/products
<?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};


/** @description The number of query results to skip. */
// @Api(Description="The number of query results to skip.")
class PaginationBase implements IPaginate, JsonSerializable
{
    public function __construct(
        /** @description The number of query results to skip. */
        // @ApiMember(Description="The number of query results to skip.")
        /** @var int|null */
        public ?int $skip=null,

        /** @description The number of query results to include. */
        // @ApiMember(Description="The number of query results to include.")
        /** @var int|null */
        public ?int $take=null
    ) {
    }

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

/** @description Specifies a service to retrieve all products. */
// @Api(Description="Specifies a service to retrieve all products.")
class RetrieveAllProductsBase extends PaginationBase implements IGet, JsonSerializable
{
    /**
     * @param int|null $skip
     * @param int|null $take
     */
    public function __construct(
        ?int $skip=null,
        ?int $take=null,
        /** @description Should the related orders of the account be included in the retrieved products? */
        // @ApiMember(Description="Should the related orders of the account be included in the retrieved products?")
        /** @var bool|null */
        public ?bool $includeOrders=null,

        /** @description Specifies the number of orders to skip per product. Applicable only when 'IncludeOrders' is true.  */
        // @ApiMember(Description="Specifies the number of orders to skip per product. Applicable only when 'IncludeOrders' is true. ")
        /** @var int|null */
        public ?int $skipOrders=null,

        /** @description Specifies the number of orders to include per product. Applicable only when 'IncludeOrders' is true.  */
        // @ApiMember(Description="Specifies the number of orders to include per product. Applicable only when 'IncludeOrders' is true. ")
        /** @var int|null */
        public ?int $takeOrders=null
    ) {
        parent::__construct($skip,$take);
    }

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

/** @description Represents a product. */
// @Api(Description="Represents a product.")
class Product implements IHasName, JsonSerializable
{
    public function __construct(
        /** @description The unique identifier of the product. */
        // @ApiMember(Description="The unique identifier of the product.", IsRequired=true)
        /** @var int */
        public int $id=0,

        /** @description The position of this instance in a collection of 'Product' instances */
        // @ApiMember(Description="The position of this instance in a collection of 'Product' instances", IsRequired=true)
        /** @var int */
        public int $index=0,

        /** @description The name of the product. */
        // @ApiMember(Description="The name of the product.", IsRequired=true)
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $name='',

        /** @description The version of the product. */
        // @ApiMember(Description="The version of the product.", IsRequired=true)
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $version='',

        /** @description The version of the product. */
        // @ApiMember(Description="The version of the product.")
        /** @var string|null */
        public ?string $description=null,

        /** @description Tags associated with the product. */
        // @ApiMember(Description="Tags associated with the product.")
        /** @var array<string>|null */
        public ?array $tags=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['index'])) $this->index = $o['index'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('string', $o['tags']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->index)) $o['index'] = $this->index;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('string', $this->tags);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a query response that contains a structured error information and encapsulates products. */
// @Api(Description="Represents a query response that contains a structured error information and encapsulates products.")
/**
 * @template QueryResponse of Product
 */
class ProductQueryResponse extends QueryResponse implements JsonSerializable
{
    /**
     * @param int $offset
     * @param int $total
     * @param array<T>|null $results
     * @param array<string,string>|null $meta
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        int $offset=0,
        int $total=0,
        ?array $results=null,
        ?array $meta=null,
        ?ResponseStatus $responseStatus=null,
        /** @description The dictionary of orders associated with each found product. */
        // @ApiMember(Description="The dictionary of orders associated with each found product.")
        /** @var array<string,Order[]>|null */
        public ?array $ordersMap=null
    ) {
        parent::__construct($offset,$total,$results,$meta,$responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['ordersMap'])) $this->ordersMap = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['int','List<Order>']), $o['ordersMap']);
        if (isset($o['offset'])) $this->offset = $o['offset'];
        if (isset($o['total'])) $this->total = $o['total'];
        if (isset($o['results'])) $this->results = JsonConverters::fromArray('Product', $o['results']);
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->ordersMap)) $o['ordersMap'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['int','List<Order>']), $this->ordersMap);
        if (isset($this->offset)) $o['offset'] = $this->offset;
        if (isset($this->total)) $o['total'] = $this->total;
        if (isset($this->results)) $o['results'] = JsonConverters::toArray('Product', $this->results);
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Represents a service request to retrieve all products in an asynchronous operation. */
// @Api(Description="Represents a service request to retrieve all products in an asynchronous operation.")
class RetrieveAllProductsAsync extends RetrieveAllProductsBase implements JsonSerializable
{
    /**
     * @param int|null $skip
     * @param int|null $take
     * @param bool|null $includeOrders
     * @param int|null $skipOrders
     * @param int|null $takeOrders
     * @param int|null $skip
     * @param int|null $take
     */
    public function __construct(
        ?int $skip=null,
        ?int $take=null,
        ?bool $includeOrders=null,
        ?int $skipOrders=null,
        ?int $takeOrders=null,
        ?int $skip=null,
        ?int $take=null
    ) {
        parent::__construct($skip,$take,$includeOrders,$skipOrders,$takeOrders,$skip,$take);
    }

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

// @DataContract
/**
 * @template T
 */
class QueryResponse implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): QueryResponse {
        $to = new QueryResponse();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        // @DataMember(Order=1)
        /** @var int */
        public mixed $offset=0,

        // @DataMember(Order=2)
        /** @var int */
        public mixed $total=0,

        // @DataMember(Order=3)
        /** @var array<T>|null */
        public mixed $results=null,

        // @DataMember(Order=4)
        /** @var array<string,string>|null */
        public mixed $meta=null,

        // @DataMember(Order=5)
        /** @var ResponseStatus|null */
        public mixed $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['offset'])) $this->offset = $o['offset'];
        if (isset($o['total'])) $this->total = $o['total'];
        if (isset($o['results'])) $this->results = JsonConverters::fromArray($this->genericArgs[0], $o['results']);
        if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->offset)) $o['offset'] = $this->offset;
        if (isset($this->total)) $o['total'] = $this->total;
        if (isset($this->results)) $o['results'] = JsonConverters::toArray($this->genericArgs[0], $this->results);
        if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

PHP RetrieveAllProductsAsync DTOs

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

HTTP + JSON

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

GET /async/products HTTP/1.1 
Host: taxfiling.pwc.de 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"ordersMap":{"0":[{"id":0,"productId":0,"accountId":0,"name":"String","serviceName":"String","requestTimestamp":"\/Date(-62135596800000-0000)\/","responseTimestamp":"\/Date(-62135596800000-0000)\/","requestUri":"String","requestHttpMethod":"String","requestDuration":"PT0S","responseStatusCode":"Continue","clientIPAddress":"String","unitOfMeasurement":"String","processType":"String","dataType":"String","dataName":"String","creationDate":"\/Date(-62135596800000-0000)\/","expiryDate":"\/Date(-62135596800000-0000)\/","isTest":false}]},"offset":0,"total":0,"results":[{"id":0,"index":0,"name":"String","version":"String","description":"String","tags":["String"]}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}