Tax Filing Service

<back to all web services

SearchProductsAsync

SearchProductsAsync

Represents a service to search for product data in an asynchronous operation.

Requires Authentication
Required role:AdminRequired permission:CanAccess
The following routes are available for this service:
GET/async/products/search
<?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 search for products. */
// @Api(Description="Specifies a service to search for products.")
class SearchProductsBase extends PaginationBase implements IGet, JsonSerializable
{
    /**
     * @param int|null $skip
     * @param int|null $take
     */
    public function __construct(
        ?int $skip=null,
        ?int $take=null,
        /** @description The unique identifier of the account associated with the product. */
        // @ApiMember(Description="The unique identifier of the account associated with the product.")
        /** @var int|null */
        public ?int $productId=null,

        /** @description The unique identifier of the account associated with the product. */
        // @ApiMember(Description="The unique identifier of the account associated with the product.")
        /** @var int|null */
        public ?int $accountId=null,

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

        /** @description Search by using the name of the product that starts with the specified value. */
        // @ApiMember(Description="Search by using the name of the product that starts with the specified value.")
        /** @var string|null */
        public ?string $nameStartsWith=null,

        /** @description Search by using the name of the product that ends with the specified value. */
        // @ApiMember(Description="Search by using the name of the product that ends with the specified value.")
        /** @var string|null */
        public ?string $nameEndsWith=null,

        /** @description Search by using the name of the product that contains the specified value. */
        // @ApiMember(Description="Search by using the name of the product that contains the specified value.")
        /** @var string|null */
        public ?string $nameContains=null,

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

        /** @description Search by using the version of the product that starts with the specified value. */
        // @ApiMember(Description="Search by using the version of the product that starts with the specified value.")
        /** @var string|null */
        public ?string $versionStartsWith=null,

        /** @description Search by using the version of the product that ends with the specified value. */
        // @ApiMember(Description="Search by using the version of the product that ends with the specified value.")
        /** @var string|null */
        public ?string $versionEndsWith=null,

        /** @description Search by using the version of the product that contains the specified value. */
        // @ApiMember(Description="Search by using the version of the product that contains the specified value.")
        /** @var string|null */
        public ?string $versionContains=null,

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

        /** @description Search by using the description of the product that starts with the specified value. */
        // @ApiMember(Description="Search by using the description of the product that starts with the specified value.")
        /** @var string|null */
        public ?string $descriptionStartsWith=null,

        /** @description Search by using the description of the product that ends with the specified value. */
        // @ApiMember(Description="Search by using the description of the product that ends with the specified value.")
        /** @var string|null */
        public ?string $descriptionEndsWith=null,

        /** @description Search by using the description of the product that contains the specified value. */
        // @ApiMember(Description="Search by using the description of the product that contains the specified value.")
        /** @var string|null */
        public ?string $descriptionContains=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['productId'])) $this->productId = $o['productId'];
        if (isset($o['accountId'])) $this->accountId = $o['accountId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['nameStartsWith'])) $this->nameStartsWith = $o['nameStartsWith'];
        if (isset($o['nameEndsWith'])) $this->nameEndsWith = $o['nameEndsWith'];
        if (isset($o['nameContains'])) $this->nameContains = $o['nameContains'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['versionStartsWith'])) $this->versionStartsWith = $o['versionStartsWith'];
        if (isset($o['versionEndsWith'])) $this->versionEndsWith = $o['versionEndsWith'];
        if (isset($o['versionContains'])) $this->versionContains = $o['versionContains'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['descriptionStartsWith'])) $this->descriptionStartsWith = $o['descriptionStartsWith'];
        if (isset($o['descriptionEndsWith'])) $this->descriptionEndsWith = $o['descriptionEndsWith'];
        if (isset($o['descriptionContains'])) $this->descriptionContains = $o['descriptionContains'];
        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->productId)) $o['productId'] = $this->productId;
        if (isset($this->accountId)) $o['accountId'] = $this->accountId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->nameStartsWith)) $o['nameStartsWith'] = $this->nameStartsWith;
        if (isset($this->nameEndsWith)) $o['nameEndsWith'] = $this->nameEndsWith;
        if (isset($this->nameContains)) $o['nameContains'] = $this->nameContains;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->versionStartsWith)) $o['versionStartsWith'] = $this->versionStartsWith;
        if (isset($this->versionEndsWith)) $o['versionEndsWith'] = $this->versionEndsWith;
        if (isset($this->versionContains)) $o['versionContains'] = $this->versionContains;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->descriptionStartsWith)) $o['descriptionStartsWith'] = $this->descriptionStartsWith;
        if (isset($this->descriptionEndsWith)) $o['descriptionEndsWith'] = $this->descriptionEndsWith;
        if (isset($this->descriptionContains)) $o['descriptionContains'] = $this->descriptionContains;
        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 to search for product data in an asynchronous operation. */
// @Api(Description="Represents a service to search for product data in an asynchronous operation.")
class SearchProductsAsync extends SearchProductsBase implements JsonSerializable
{
    /**
     * @param int|null $skip
     * @param int|null $take
     * @param int|null $productId
     * @param int|null $accountId
     * @param string|null $name
     * @param string|null $nameStartsWith
     * @param string|null $nameEndsWith
     * @param string|null $nameContains
     * @param string|null $version
     * @param string|null $versionStartsWith
     * @param string|null $versionEndsWith
     * @param string|null $versionContains
     * @param string|null $description
     * @param string|null $descriptionStartsWith
     * @param string|null $descriptionEndsWith
     * @param string|null $descriptionContains
     * @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,
        ?int $productId=null,
        ?int $accountId=null,
        ?string $name=null,
        ?string $nameStartsWith=null,
        ?string $nameEndsWith=null,
        ?string $nameContains=null,
        ?string $version=null,
        ?string $versionStartsWith=null,
        ?string $versionEndsWith=null,
        ?string $versionContains=null,
        ?string $description=null,
        ?string $descriptionStartsWith=null,
        ?string $descriptionEndsWith=null,
        ?string $descriptionContains=null,
        ?bool $includeOrders=null,
        ?int $skipOrders=null,
        ?int $takeOrders=null,
        ?int $skip=null,
        ?int $take=null
    ) {
        parent::__construct($skip,$take,$productId,$accountId,$name,$nameStartsWith,$nameEndsWith,$nameContains,$version,$versionStartsWith,$versionEndsWith,$versionContains,$description,$descriptionStartsWith,$descriptionEndsWith,$descriptionContains,$includeOrders,$skipOrders,$takeOrders,$skip,$take);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['productId'])) $this->productId = $o['productId'];
        if (isset($o['accountId'])) $this->accountId = $o['accountId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['nameStartsWith'])) $this->nameStartsWith = $o['nameStartsWith'];
        if (isset($o['nameEndsWith'])) $this->nameEndsWith = $o['nameEndsWith'];
        if (isset($o['nameContains'])) $this->nameContains = $o['nameContains'];
        if (isset($o['version'])) $this->version = $o['version'];
        if (isset($o['versionStartsWith'])) $this->versionStartsWith = $o['versionStartsWith'];
        if (isset($o['versionEndsWith'])) $this->versionEndsWith = $o['versionEndsWith'];
        if (isset($o['versionContains'])) $this->versionContains = $o['versionContains'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['descriptionStartsWith'])) $this->descriptionStartsWith = $o['descriptionStartsWith'];
        if (isset($o['descriptionEndsWith'])) $this->descriptionEndsWith = $o['descriptionEndsWith'];
        if (isset($o['descriptionContains'])) $this->descriptionContains = $o['descriptionContains'];
        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->productId)) $o['productId'] = $this->productId;
        if (isset($this->accountId)) $o['accountId'] = $this->accountId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->nameStartsWith)) $o['nameStartsWith'] = $this->nameStartsWith;
        if (isset($this->nameEndsWith)) $o['nameEndsWith'] = $this->nameEndsWith;
        if (isset($this->nameContains)) $o['nameContains'] = $this->nameContains;
        if (isset($this->version)) $o['version'] = $this->version;
        if (isset($this->versionStartsWith)) $o['versionStartsWith'] = $this->versionStartsWith;
        if (isset($this->versionEndsWith)) $o['versionEndsWith'] = $this->versionEndsWith;
        if (isset($this->versionContains)) $o['versionContains'] = $this->versionContains;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->descriptionStartsWith)) $o['descriptionStartsWith'] = $this->descriptionStartsWith;
        if (isset($this->descriptionEndsWith)) $o['descriptionEndsWith'] = $this->descriptionEndsWith;
        if (isset($this->descriptionContains)) $o['descriptionContains'] = $this->descriptionContains;
        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 SearchProductsAsync 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 /async/products/search HTTP/1.1 
Host: taxfiling.pwc.de 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
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"}}}