PUT | /RestApi/comments-api/threads |
---|
<?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 ThreadUpdateRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Key=null,
/** @var bool|null */
public ?bool $IsClosed=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['IsClosed'])) $this->IsClosed = $o['IsClosed'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->IsClosed)) $o['IsClosed'] = $this->IsClosed;
return empty($o) ? new class(){} : $o;
}
}
class ThreadResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $Type=null,
/** @var int */
public int $CommentsCount=0,
/** @var string|null */
public ?string $Title=null,
/** @var string|null */
public ?string $Language=null,
/** @var bool|null */
public ?bool $IsClosed=null,
/** @var string|null */
public ?string $GroupKey=null,
/** @var string|null */
public ?string $ItemUrl=null,
/** @var string|null */
public ?string $DataSource=null,
/** @var float|null */
public ?float $AverageRating=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Type'])) $this->Type = $o['Type'];
if (isset($o['CommentsCount'])) $this->CommentsCount = $o['CommentsCount'];
if (isset($o['Title'])) $this->Title = $o['Title'];
if (isset($o['Language'])) $this->Language = $o['Language'];
if (isset($o['IsClosed'])) $this->IsClosed = $o['IsClosed'];
if (isset($o['GroupKey'])) $this->GroupKey = $o['GroupKey'];
if (isset($o['ItemUrl'])) $this->ItemUrl = $o['ItemUrl'];
if (isset($o['DataSource'])) $this->DataSource = $o['DataSource'];
if (isset($o['AverageRating'])) $this->AverageRating = $o['AverageRating'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Type)) $o['Type'] = $this->Type;
if (isset($this->CommentsCount)) $o['CommentsCount'] = $this->CommentsCount;
if (isset($this->Title)) $o['Title'] = $this->Title;
if (isset($this->Language)) $o['Language'] = $this->Language;
if (isset($this->IsClosed)) $o['IsClosed'] = $this->IsClosed;
if (isset($this->GroupKey)) $o['GroupKey'] = $this->GroupKey;
if (isset($this->ItemUrl)) $o['ItemUrl'] = $this->ItemUrl;
if (isset($this->DataSource)) $o['DataSource'] = $this->DataSource;
if (isset($this->AverageRating)) $o['AverageRating'] = $this->AverageRating;
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.
PUT /RestApi/comments-api/threads HTTP/1.1
Host: www.asg.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Key: String,
IsClosed: False
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Key: String, Type: String, CommentsCount: 0, Title: String, Language: String, IsClosed: False, GroupKey: String, ItemUrl: String, DataSource: String, AverageRating: 0 }