GET | /agreements | Gets agreements |
---|
<?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};
class AgreementQueryResponse implements JsonSerializable
{
public function __construct(
/** @var string */
public string $AgreementId='',
/** @var DateTime|null */
public ?DateTime $AgreementCreated=null,
/** @var array<string>|null */
public ?array $Documents=null,
/** @var Object|null */
public ?Object $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['AgreementId'])) $this->AgreementId = $o['AgreementId'];
if (isset($o['AgreementCreated'])) $this->AgreementCreated = JsonConverters::from('DateTime', $o['AgreementCreated']);
if (isset($o['Documents'])) $this->Documents = JsonConverters::fromArray('string', $o['Documents']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('Object', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->AgreementId)) $o['AgreementId'] = $this->AgreementId;
if (isset($this->AgreementCreated)) $o['AgreementCreated'] = JsonConverters::to('DateTime', $this->AgreementCreated);
if (isset($this->Documents)) $o['Documents'] = JsonConverters::toArray('string', $this->Documents);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('Object', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @ApiResponse(Description="Returned if there is a validation error on the input parameters", StatusCode=400)
class AgreementQuery implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
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.
GET /agreements HTTP/1.1 Host: api.bokamera.se Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { AgreementCreated: "0001-01-01T00:00:00", Documents: [ String ], ResponseStatus: {} }