Required role: | Admin | Required permission: | CanAccess |
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;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ProductQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Services.Contracts.Responses"> <Offset xmlns="http://schemas.servicestack.net/types">0</Offset> <Total xmlns="http://schemas.servicestack.net/types">0</Total> <Results xmlns:d2p1="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Domain.Concretes.Models" xmlns="http://schemas.servicestack.net/types"> <d2p1:Product> <d2p1:Description>String</d2p1:Description> <d2p1:Id>0</d2p1:Id> <d2p1:Index>0</d2p1:Index> <d2p1:Name>String</d2p1:Name> <d2p1:Tags xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:string>String</d4p1:string> </d2p1:Tags> <d2p1:Version>String</d2p1:Version> </d2p1:Product> </Results> <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.servicestack.net/types"> <d2p1:KeyValueOfstringstring> <d2p1:Key>String</d2p1:Key> <d2p1:Value>String</d2p1:Value> </d2p1:KeyValueOfstringstring> </Meta> <ResponseStatus xmlns="http://schemas.servicestack.net/types"> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </Meta> </ResponseStatus> <OrdersMap xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:KeyValueOfintArrayOfOrderKY2vvLcG> <d2p1:Key>0</d2p1:Key> <d2p1:Value xmlns:d4p1="http://schemas.datacontract.org/2004/07/PwC.Metering.Core.Domain.Concretes.Models"> <d4p1:Order> <d4p1:AccountId>0</d4p1:AccountId> <d4p1:ClientIPAddress>String</d4p1:ClientIPAddress> <d4p1:CreationDate>0001-01-01T00:00:00</d4p1:CreationDate> <d4p1:DataName>String</d4p1:DataName> <d4p1:DataType>String</d4p1:DataType> <d4p1:ExpiryDate>0001-01-01T00:00:00</d4p1:ExpiryDate> <d4p1:Id>0</d4p1:Id> <d4p1:IsTest>false</d4p1:IsTest> <d4p1:Name>String</d4p1:Name> <d4p1:ProcessType>String</d4p1:ProcessType> <d4p1:ProductId>0</d4p1:ProductId> <d4p1:RequestDuration>PT0S</d4p1:RequestDuration> <d4p1:RequestHttpMethod>String</d4p1:RequestHttpMethod> <d4p1:RequestTimestamp>0001-01-01T00:00:00</d4p1:RequestTimestamp> <d4p1:RequestUri>String</d4p1:RequestUri> <d4p1:ResponseStatusCode>Continue</d4p1:ResponseStatusCode> <d4p1:ResponseTimestamp>0001-01-01T00:00:00</d4p1:ResponseTimestamp> <d4p1:ServiceName>String</d4p1:ServiceName> <d4p1:UnitOfMeasurement>String</d4p1:UnitOfMeasurement> </d4p1:Order> </d2p1:Value> </d2p1:KeyValueOfintArrayOfOrderKY2vvLcG> </OrdersMap> </ProductQueryResponse>