| GET | /v4/collections/list |
|---|
<?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};
// @DataContract
class V4BaseRequest implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class V4PaginatedBaseRequest extends V4BaseRequest implements JsonSerializable
{
public function __construct(
// @DataMember(Name="offset")
/** @var int */
public int $offset=0,
// @DataMember(Name="limit")
/** @var int */
public int $limit=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['limit'])) $this->limit = $o['limit'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->limit)) $o['limit'] = $this->limit;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class V4ListRequest extends V4PaginatedBaseRequest implements JsonSerializable
{
/**
* @param int $offset
* @param int $limit
*/
public function __construct(
int $offset=0,
int $limit=0,
// @DataMember(Name="ids")
/** @var array<string>|null */
public ?array $ids=null
) {
parent::__construct($offset,$limit);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ids'])) $this->ids = JsonConverters::fromArray('string', $o['ids']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ids)) $o['ids'] = JsonConverters::toArray('string', $this->ids);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class V4BaseResponse implements JsonSerializable
{
public function __construct(
// @DataMember(Name="status")
/** @var ResponseStatus|null */
public ?ResponseStatus $status=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['status'])) $this->status = JsonConverters::from('ResponseStatus', $o['status']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->status)) $o['status'] = JsonConverters::to('ResponseStatus', $this->status);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class V4PageObject implements JsonSerializable
{
public function __construct(
// @DataMember(Name="offset")
/** @var int */
public int $offset=0,
// @DataMember(Name="limit")
/** @var int */
public int $limit=0,
// @DataMember(Name="totalRecords")
/** @var int */
public int $totalRecords=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['limit'])) $this->limit = $o['limit'];
if (isset($o['totalRecords'])) $this->totalRecords = $o['totalRecords'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->limit)) $o['limit'] = $this->limit;
if (isset($this->totalRecords)) $o['totalRecords'] = $this->totalRecords;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class V4PaginatedBaseResponse extends V4BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $status
*/
public function __construct(
?ResponseStatus $status=null,
// @DataMember(Name="page")
/** @var V4PageObject|null */
public ?V4PageObject $page=null
) {
parent::__construct($status);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['page'])) $this->page = JsonConverters::from('V4PageObject', $o['page']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->page)) $o['page'] = JsonConverters::to('V4PageObject', $this->page);
return empty($o) ? new class(){} : $o;
}
}
/**
* @property string|null $id
* @property string|null $title
* @property array<string>|null $linkIds
* @property string|null $collectionSettingsId
*/
interface IUserCollection
{
}
// @DataContract
class GetCollectionsResponse extends V4PaginatedBaseResponse implements IGetCollectionsResponse, JsonSerializable
{
/**
* @param ResponseStatus|null $status
* @param V4PageObject|null $page
*/
public function __construct(
?ResponseStatus $status=null,
?V4PageObject $page=null,
// @DataMember(Name="data")
/** @var array<IUserCollection>|null */
public ?array $data=null
) {
parent::__construct($status,$page);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['data'])) $this->data = JsonConverters::fromArray('IUserCollection', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->data)) $o['data'] = JsonConverters::toArray('IUserCollection', $this->data);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetCollectionsRequest extends V4ListRequest implements JsonSerializable
{
/**
* @param int $offset
* @param int $limit
* @param array<string>|null $ids
*/
public function __construct(
int $offset=0,
int $limit=0,
?array $ids=null
) {
parent::__construct($offset,$limit,$ids);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
return empty($o) ? new class(){} : $o;
}
}
PHP GetCollectionsRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /v4/collections/list HTTP/1.1 Host: collections-api-zane.dev.platform.georiot.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"page":{"offset":0,"limit":0,"totalRecords":0},"status":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}