POST | /RestApi/comments-api/threads/filter |
---|
<?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 ThreadsFilterExtended implements JsonSerializable
{
public function __construct(
/** @var array<string>|null */
public ?array $ThreadKey=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ThreadKey'])) $this->ThreadKey = JsonConverters::fromArray('string', $o['ThreadKey']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ThreadKey)) $o['ThreadKey'] = JsonConverters::toArray('string', $this->ThreadKey);
return empty($o) ? new class(){} : $o;
}
}
class CommentResponse implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Key=null,
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Message=null,
/** @var DateTime */
public DateTime $DateCreated=new DateTime(),
/** @var string|null */
public ?string $ProfilePictureUrl=null,
/** @var string|null */
public ?string $ProfilePictureThumbnailUrl=null,
/** @var string|null */
public ?string $Status=null,
/** @var string|null */
public ?string $Email=null,
/** @var string|null */
public ?string $ThreadKey=null,
/** @var string|null */
public ?string $AuthorIpAddress=null,
/** @var string|null */
public ?string $CustomData=null,
/** @var float|null */
public ?float $Rating=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Key'])) $this->Key = $o['Key'];
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Message'])) $this->Message = $o['Message'];
if (isset($o['DateCreated'])) $this->DateCreated = JsonConverters::from('DateTime', $o['DateCreated']);
if (isset($o['ProfilePictureUrl'])) $this->ProfilePictureUrl = $o['ProfilePictureUrl'];
if (isset($o['ProfilePictureThumbnailUrl'])) $this->ProfilePictureThumbnailUrl = $o['ProfilePictureThumbnailUrl'];
if (isset($o['Status'])) $this->Status = $o['Status'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['ThreadKey'])) $this->ThreadKey = $o['ThreadKey'];
if (isset($o['AuthorIpAddress'])) $this->AuthorIpAddress = $o['AuthorIpAddress'];
if (isset($o['CustomData'])) $this->CustomData = $o['CustomData'];
if (isset($o['Rating'])) $this->Rating = $o['Rating'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Key)) $o['Key'] = $this->Key;
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Message)) $o['Message'] = $this->Message;
if (isset($this->DateCreated)) $o['DateCreated'] = JsonConverters::to('DateTime', $this->DateCreated);
if (isset($this->ProfilePictureUrl)) $o['ProfilePictureUrl'] = $this->ProfilePictureUrl;
if (isset($this->ProfilePictureThumbnailUrl)) $o['ProfilePictureThumbnailUrl'] = $this->ProfilePictureThumbnailUrl;
if (isset($this->Status)) $o['Status'] = $this->Status;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->ThreadKey)) $o['ThreadKey'] = $this->ThreadKey;
if (isset($this->AuthorIpAddress)) $o['AuthorIpAddress'] = $this->AuthorIpAddress;
if (isset($this->CustomData)) $o['CustomData'] = $this->CustomData;
if (isset($this->Rating)) $o['Rating'] = $this->Rating;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template CommentResponse
*/
class CollectionResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): CollectionResponse {
$to = new CollectionResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var int */
public mixed $TotalCount=0,
/** @var array<CommentResponse>|null */
public mixed $Items=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TotalCount'])) $this->TotalCount = $o['TotalCount'];
if (isset($o['Items'])) $this->Items = JsonConverters::fromArray($this->genericArgs[0], $o['Items']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TotalCount)) $o['TotalCount'] = $this->TotalCount;
if (isset($this->Items)) $o['Items'] = JsonConverters::toArray($this->genericArgs[0], $this->Items);
return empty($o) ? new class(){} : $o;
}
}
PHP ThreadsFilterExtended DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /RestApi/comments-api/threads/filter HTTP/1.1
Host: www.asg.com.au
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"ThreadKey":["String"]}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"TotalCount":0}