| POST | /api/itemDataNotification/search | Search item data notification based on search parameters |
|---|
<?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};
enum ORDER : string
{
case ASC = 'ASC';
case DESC = 'DESC';
}
class SearchItemDataNotificationQuery implements ISearchItemDataNotification, JsonSerializable
{
public function __construct(
/** @var string */
public string $receiverGln='',
/** @var string */
public string $senderGln='',
/** @var array<string>|null */
public ?array $partnerGln=null,
/** @var int */
public int $requestedPage=0,
/** @var int */
public int $numberOfRecordsPerPage=0,
/** @var string */
public string $continuationToken='',
/** @var string */
public string $categoryCode='',
/** @var string */
public string $identifier='',
/** @var string */
public string $tradeItemDescription='',
/** @var string */
public string $gtin='',
/** @var string */
public string $orderBy='',
/** @var ORDER|null */
public ?ORDER $order=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['receiverGln'])) $this->receiverGln = $o['receiverGln'];
if (isset($o['senderGln'])) $this->senderGln = $o['senderGln'];
if (isset($o['partnerGln'])) $this->partnerGln = JsonConverters::fromArray('string', $o['partnerGln']);
if (isset($o['requestedPage'])) $this->requestedPage = $o['requestedPage'];
if (isset($o['numberOfRecordsPerPage'])) $this->numberOfRecordsPerPage = $o['numberOfRecordsPerPage'];
if (isset($o['continuationToken'])) $this->continuationToken = $o['continuationToken'];
if (isset($o['categoryCode'])) $this->categoryCode = $o['categoryCode'];
if (isset($o['identifier'])) $this->identifier = $o['identifier'];
if (isset($o['tradeItemDescription'])) $this->tradeItemDescription = $o['tradeItemDescription'];
if (isset($o['gtin'])) $this->gtin = $o['gtin'];
if (isset($o['orderBy'])) $this->orderBy = $o['orderBy'];
if (isset($o['order'])) $this->order = JsonConverters::from('ORDER', $o['order']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->receiverGln)) $o['receiverGln'] = $this->receiverGln;
if (isset($this->senderGln)) $o['senderGln'] = $this->senderGln;
if (isset($this->partnerGln)) $o['partnerGln'] = JsonConverters::toArray('string', $this->partnerGln);
if (isset($this->requestedPage)) $o['requestedPage'] = $this->requestedPage;
if (isset($this->numberOfRecordsPerPage)) $o['numberOfRecordsPerPage'] = $this->numberOfRecordsPerPage;
if (isset($this->continuationToken)) $o['continuationToken'] = $this->continuationToken;
if (isset($this->categoryCode)) $o['categoryCode'] = $this->categoryCode;
if (isset($this->identifier)) $o['identifier'] = $this->identifier;
if (isset($this->tradeItemDescription)) $o['tradeItemDescription'] = $this->tradeItemDescription;
if (isset($this->gtin)) $o['gtin'] = $this->gtin;
if (isset($this->orderBy)) $o['orderBy'] = $this->orderBy;
if (isset($this->order)) $o['order'] = JsonConverters::to('ORDER', $this->order);
return empty($o) ? new class(){} : $o;
}
}
/** @description Item Data Notification */
// @Api(Description="Item Data Notification")
// @ApiResponse(Description="Paged ItemDataNotification data", IsDefaultResponse=true, ResponseType="typeof(DX.STF.Models.Queries.QueryResult.PagedQueryResponseWithToken`1[[DX.Framework.Core.Querying.ResultItem`1[[DX.STF.Models.Dto.GS1.ItemDataNotificationMessage, DX.STF.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], DX.Framework.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]])", StatusCode=200)
class SearchItemDataNotification implements JsonSerializable
{
public function __construct(
/** @description Search query */
// @ApiMember(Description="Search query", ParameterType="model")
/** @var SearchItemDataNotificationQuery|null */
public ?SearchItemDataNotificationQuery $query=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['query'])) $this->query = JsonConverters::from('SearchItemDataNotificationQuery', $o['query']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->query)) $o['query'] = JsonConverters::to('SearchItemDataNotificationQuery', $this->query);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class PagedQueryResult implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): PagedQueryResult {
$to = new PagedQueryResult();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var int */
public mixed $startIndex=0,
/** @var int */
public mixed $endIndex=0,
/** @var int */
public mixed $numberOfRecordsReturned=0,
/** @var int */
public mixed $totalNumberOfPages=0,
/** @var int */
public mixed $totalNumberOfRecords=0,
/** @var array<ResultItem<ClaimMessage>>|null */
public mixed $results=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['startIndex'])) $this->startIndex = $o['startIndex'];
if (isset($o['endIndex'])) $this->endIndex = $o['endIndex'];
if (isset($o['numberOfRecordsReturned'])) $this->numberOfRecordsReturned = $o['numberOfRecordsReturned'];
if (isset($o['totalNumberOfPages'])) $this->totalNumberOfPages = $o['totalNumberOfPages'];
if (isset($o['totalNumberOfRecords'])) $this->totalNumberOfRecords = $o['totalNumberOfRecords'];
if (isset($o['results'])) $this->results = JsonConverters::fromArray('ResultItem<ClaimMessage>', $o['results']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->startIndex)) $o['startIndex'] = $this->startIndex;
if (isset($this->endIndex)) $o['endIndex'] = $this->endIndex;
if (isset($this->numberOfRecordsReturned)) $o['numberOfRecordsReturned'] = $this->numberOfRecordsReturned;
if (isset($this->totalNumberOfPages)) $o['totalNumberOfPages'] = $this->totalNumberOfPages;
if (isset($this->totalNumberOfRecords)) $o['totalNumberOfRecords'] = $this->totalNumberOfRecords;
if (isset($this->results)) $o['results'] = JsonConverters::toArray('ResultItem<ClaimMessage>', $this->results);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
* @template PagedQueryResult of ResultItem<InvoiceMessage>
*/
class PagedQueryResponseWithToken extends PagedQueryResult implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): PagedQueryResponseWithToken {
$to = new PagedQueryResponseWithToken();
$to->genericArgs = $genericArgs;
return $to;
}
/**
* @param int $startIndex
* @param int $endIndex
* @param int $numberOfRecordsReturned
* @param int $totalNumberOfPages
* @param int $totalNumberOfRecords
* @param array<ResultItem<ClaimMessage>>|null $results
*/
public function __construct(
mixed $startIndex=0,
mixed $endIndex=0,
mixed $numberOfRecordsReturned=0,
mixed $totalNumberOfPages=0,
mixed $totalNumberOfRecords=0,
mixed $results=null,
/** @var string */
public mixed $continuationToken=''
) {
parent::__construct($startIndex,$endIndex,$numberOfRecordsReturned,$totalNumberOfPages,$totalNumberOfRecords,$results);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['continuationToken'])) $this->continuationToken = $o['continuationToken'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->continuationToken)) $o['continuationToken'] = $this->continuationToken;
return empty($o) ? new class(){} : $o;
}
}
PHP SearchItemDataNotification DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/itemDataNotification/search HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
query:
{
receiverGln: String,
senderGln: String,
partnerGln:
[
String
],
requestedPage: 0,
numberOfRecordsPerPage: 0,
continuationToken: String,
categoryCode: String,
identifier: String,
tradeItemDescription: String,
gtin: String,
orderBy: String,
order: ASC
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
continuationToken: String,
startIndex: 0,
endIndex: 0,
numberOfRecordsReturned: 0,
totalNumberOfPages: 0,
totalNumberOfRecords: 0,
results:
[
{
}
]
}