Booklinker.API

<back to all web services

GetCollectionSettingsRequest

Requires Authentication
<?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 V2BaseResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="responseStatus")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class V2PageObject 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 V2PaginatedBaseResponse extends V2BaseResponse implements JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        // @DataMember(Name="page")
        /** @var V2PageObject|null */
        public ?V2PageObject $page=null
    ) {
        parent::__construct($responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['page'])) $this->page = JsonConverters::from('V2PageObject', $o['page']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->page)) $o['page'] = JsonConverters::to('V2PageObject', $this->page);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class GetCollectionsResponse extends V2PaginatedBaseResponse implements IGetCollectionsResponse, JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     * @param V2PageObject|null $page
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        ?V2PageObject $page=null
    ) {
        parent::__construct($responseStatus,$page);
    }

    /** @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;
    }
}

// @DataContract
class GetCollectionSettingsRequest extends V2BaseResponse implements JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        // @DataMember(Name="id")
        /** @var string|null */
        public ?string $id=null
    ) {
        parent::__construct($responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['id'])) $this->id = $o['id'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->id)) $o['id'] = $this->id;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetCollectionSettingsRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /csv/reply/GetCollectionSettingsRequest HTTP/1.1 
Host: api.booklinker.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"id":"String","responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"page":{"offset":0,"limit":0,"totalRecords":0},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}