CollectionsAPI

<back to all web services

GetCollectionsRequest

Requires Authentication
The following routes are available for this service:
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 .xml suffix or ?format=xml

HTTP + XML

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: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GetCollectionsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CollectionsAPI.ServiceModel.V4.Responses">
  <status xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1: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>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1: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>
    </d2p1:Meta>
  </status>
  <page>
    <limit>0</limit>
    <offset>0</offset>
    <totalRecords>0</totalRecords>
  </page>
  <data xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
</GetCollectionsResponse>