| GET | /api/creditNote/type/{Type} | Get paged credit note response by type |
|---|
<?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 Credit Note */
// @Api(Description="Credit Note")
// @ApiResponse(Description="Paged credit note response by type", IsDefaultResponse=true, StatusCode=200)
class GetCreditNoteByType implements JsonSerializable
{
public function __construct(
/** @description Not used */
// @ApiMember(Description="Not used")
/** @var string */
public string $searchTerm='',
/** @description Requested page number, starting at 1 */
// @ApiMember(Description="Requested page number, starting at 1")
/** @var int */
public int $requestedPage=0,
/** @description Number of records to return on a page */
// @ApiMember(Description="Number of records to return on a page")
/** @var int */
public int $numberOfRecordsPerPage=0,
/** @description Credit Note type to be returned */
// @ApiMember(Description="Credit Note type to be returned", ExcludeInSchema=true, ParameterType="path")
/** @var string */
public string $type=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['searchTerm'])) $this->searchTerm = $o['searchTerm'];
if (isset($o['requestedPage'])) $this->requestedPage = $o['requestedPage'];
if (isset($o['numberOfRecordsPerPage'])) $this->numberOfRecordsPerPage = $o['numberOfRecordsPerPage'];
if (isset($o['type'])) $this->type = $o['type'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->searchTerm)) $o['searchTerm'] = $this->searchTerm;
if (isset($this->requestedPage)) $o['requestedPage'] = $this->requestedPage;
if (isset($this->numberOfRecordsPerPage)) $o['numberOfRecordsPerPage'] = $this->numberOfRecordsPerPage;
if (isset($this->type)) $o['type'] = $this->type;
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;
}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/creditNote/type/{Type} HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"startIndex":0,"endIndex":0,"numberOfRecordsReturned":0,"totalNumberOfPages":0,"totalNumberOfRecords":0,"results":[{}]}