GET | /posts/comment |
---|
<?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 QueryBase implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var int|null */
public ?int $skip=null,
// @DataMember(Order=2)
/** @var int|null */
public ?int $take=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $orderBy=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $orderByDesc=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $include=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $fields=null,
// @DataMember(Order=7)
/** @var array<string,string>|null */
public ?array $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['skip'])) $this->skip = $o['skip'];
if (isset($o['take'])) $this->take = $o['take'];
if (isset($o['orderBy'])) $this->orderBy = $o['orderBy'];
if (isset($o['orderByDesc'])) $this->orderByDesc = $o['orderByDesc'];
if (isset($o['include'])) $this->include = $o['include'];
if (isset($o['fields'])) $this->fields = $o['fields'];
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->skip)) $o['skip'] = $this->skip;
if (isset($this->take)) $o['take'] = $this->take;
if (isset($this->orderBy)) $o['orderBy'] = $this->orderBy;
if (isset($this->orderByDesc)) $o['orderByDesc'] = $this->orderByDesc;
if (isset($this->include)) $o['include'] = $this->include;
if (isset($this->fields)) $o['fields'] = $this->fields;
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class QueryDb extends QueryBase implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): QueryDb {
$to = new QueryDb();
$to->genericArgs = $genericArgs;
return $to;
}
/**
* @param int|null $skip
* @param int|null $take
* @param string|null $orderBy
* @param string|null $orderByDesc
* @param string|null $include
* @param string|null $fields
* @param array<string,string>|null $meta
*/
public function __construct(
mixed $skip=null,
mixed $take=null,
mixed $orderBy=null,
mixed $orderByDesc=null,
mixed $include=null,
mixed $fields=null,
mixed $meta=null
) {
parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
}
/** @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;
}
}
class PostComment implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var int */
public int $postId=0,
/** @var int */
public int $userId=0,
/** @var int|null */
public ?int $replyId=null,
// @StringLength(2147483647)
/** @var string|null */
public ?string $content=null,
// @StringLength(2147483647)
/** @var string|null */
public ?string $contentHtml=null,
/** @var int */
public int $score=0,
/** @var int */
public int $rank=0,
/** @var int */
public int $upVotes=0,
/** @var int */
public int $downVotes=0,
/** @var int */
public int $favorites=0,
/** @var int */
public int $wordCount=0,
/** @var int */
public int $reportCount=0,
/** @var DateTime|null */
public ?DateTime $deleted=null,
/** @var DateTime|null */
public ?DateTime $hidden=null,
/** @var DateTime */
public DateTime $modified=new DateTime(),
/** @var DateTime */
public DateTime $created=new DateTime(),
/** @var string|null */
public ?string $createdBy=null,
/** @var int|null */
public ?int $refId=null,
/** @var string|null */
public ?string $refSource=null,
/** @var string|null */
public ?string $refUrn=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['postId'])) $this->postId = $o['postId'];
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['replyId'])) $this->replyId = $o['replyId'];
if (isset($o['content'])) $this->content = $o['content'];
if (isset($o['contentHtml'])) $this->contentHtml = $o['contentHtml'];
if (isset($o['score'])) $this->score = $o['score'];
if (isset($o['rank'])) $this->rank = $o['rank'];
if (isset($o['upVotes'])) $this->upVotes = $o['upVotes'];
if (isset($o['downVotes'])) $this->downVotes = $o['downVotes'];
if (isset($o['favorites'])) $this->favorites = $o['favorites'];
if (isset($o['wordCount'])) $this->wordCount = $o['wordCount'];
if (isset($o['reportCount'])) $this->reportCount = $o['reportCount'];
if (isset($o['deleted'])) $this->deleted = JsonConverters::from('DateTime', $o['deleted']);
if (isset($o['hidden'])) $this->hidden = JsonConverters::from('DateTime', $o['hidden']);
if (isset($o['modified'])) $this->modified = JsonConverters::from('DateTime', $o['modified']);
if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
if (isset($o['refId'])) $this->refId = $o['refId'];
if (isset($o['refSource'])) $this->refSource = $o['refSource'];
if (isset($o['refUrn'])) $this->refUrn = $o['refUrn'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->postId)) $o['postId'] = $this->postId;
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->replyId)) $o['replyId'] = $this->replyId;
if (isset($this->content)) $o['content'] = $this->content;
if (isset($this->contentHtml)) $o['contentHtml'] = $this->contentHtml;
if (isset($this->score)) $o['score'] = $this->score;
if (isset($this->rank)) $o['rank'] = $this->rank;
if (isset($this->upVotes)) $o['upVotes'] = $this->upVotes;
if (isset($this->downVotes)) $o['downVotes'] = $this->downVotes;
if (isset($this->favorites)) $o['favorites'] = $this->favorites;
if (isset($this->wordCount)) $o['wordCount'] = $this->wordCount;
if (isset($this->reportCount)) $o['reportCount'] = $this->reportCount;
if (isset($this->deleted)) $o['deleted'] = JsonConverters::to('DateTime', $this->deleted);
if (isset($this->hidden)) $o['hidden'] = JsonConverters::to('DateTime', $this->hidden);
if (isset($this->modified)) $o['modified'] = JsonConverters::to('DateTime', $this->modified);
if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
if (isset($this->refId)) $o['refId'] = $this->refId;
if (isset($this->refSource)) $o['refSource'] = $this->refSource;
if (isset($this->refUrn)) $o['refUrn'] = $this->refUrn;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template QueryDb of PostComment
*/
class QueryPostComments extends QueryDb implements JsonSerializable
{
/**
* @param int|null $skip
* @param int|null $take
* @param string|null $orderBy
* @param string|null $orderByDesc
* @param string|null $include
* @param string|null $fields
* @param array<string,string>|null $meta
*/
public function __construct(
?int $skip=null,
?int $take=null,
?string $orderBy=null,
?string $orderByDesc=null,
?string $include=null,
?string $fields=null,
?array $meta=null,
/** @var int|null */
public ?int $id=null,
/** @var int|null */
public ?int $userId=null,
/** @var int|null */
public ?int $postId=null,
/** @var string|null */
public ?string $contentContains=null,
/** @var int|null */
public ?int $upVotesAbove=null,
/** @var int|null */
public ?int $upVotesBelow=null,
/** @var int|null */
public ?int $downVotesAbove=null,
/** @var int|null */
public ?int $downVotes=null,
/** @var int|null */
public ?int $favoritesAbove=null,
/** @var int|null */
public ?int $favoritesBelow=null,
/** @var int|null */
public ?int $wordCountAbove=null,
/** @var int|null */
public ?int $wordCountBelow=null,
/** @var int|null */
public ?int $reportCountAbove=null,
/** @var int|null */
public ?int $reportCountBelow=null
) {
parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['postId'])) $this->postId = $o['postId'];
if (isset($o['contentContains'])) $this->contentContains = $o['contentContains'];
if (isset($o['upVotesAbove'])) $this->upVotesAbove = $o['upVotesAbove'];
if (isset($o['upVotesBelow'])) $this->upVotesBelow = $o['upVotesBelow'];
if (isset($o['downVotesAbove'])) $this->downVotesAbove = $o['downVotesAbove'];
if (isset($o['downVotes'])) $this->downVotes = $o['downVotes'];
if (isset($o['favoritesAbove'])) $this->favoritesAbove = $o['favoritesAbove'];
if (isset($o['favoritesBelow'])) $this->favoritesBelow = $o['favoritesBelow'];
if (isset($o['wordCountAbove'])) $this->wordCountAbove = $o['wordCountAbove'];
if (isset($o['wordCountBelow'])) $this->wordCountBelow = $o['wordCountBelow'];
if (isset($o['reportCountAbove'])) $this->reportCountAbove = $o['reportCountAbove'];
if (isset($o['reportCountBelow'])) $this->reportCountBelow = $o['reportCountBelow'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->postId)) $o['postId'] = $this->postId;
if (isset($this->contentContains)) $o['contentContains'] = $this->contentContains;
if (isset($this->upVotesAbove)) $o['upVotesAbove'] = $this->upVotesAbove;
if (isset($this->upVotesBelow)) $o['upVotesBelow'] = $this->upVotesBelow;
if (isset($this->downVotesAbove)) $o['downVotesAbove'] = $this->downVotesAbove;
if (isset($this->downVotes)) $o['downVotes'] = $this->downVotes;
if (isset($this->favoritesAbove)) $o['favoritesAbove'] = $this->favoritesAbove;
if (isset($this->favoritesBelow)) $o['favoritesBelow'] = $this->favoritesBelow;
if (isset($this->wordCountAbove)) $o['wordCountAbove'] = $this->wordCountAbove;
if (isset($this->wordCountBelow)) $o['wordCountBelow'] = $this->wordCountBelow;
if (isset($this->reportCountAbove)) $o['reportCountAbove'] = $this->reportCountAbove;
if (isset($this->reportCountBelow)) $o['reportCountBelow'] = $this->reportCountBelow;
return empty($o) ? new class(){} : $o;
}
}
enum PostType : string
{
case Announcement = 'Announcement';
case Post = 'Post';
case Showcase = 'Showcase';
case Question = 'Question';
case Request = 'Request';
}
class Post implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var int */
public int $organizationId=0,
/** @var int */
public int $userId=0,
/** @var PostType|null */
public ?PostType $type=null,
/** @var int */
public int $categoryId=0,
/** @var string|null */
public ?string $title=null,
/** @var string|null */
public ?string $slug=null,
/** @var string|null */
public ?string $url=null,
/** @var string|null */
public ?string $imageUrl=null,
// @StringLength(2147483647)
/** @var string|null */
public ?string $content=null,
// @StringLength(2147483647)
/** @var string|null */
public ?string $contentHtml=null,
/** @var int|null */
public ?int $pinCommentId=null,
/** @var int[]|null */
public ?array $technologyIds=null,
/** @var DateTime|null */
public ?DateTime $fromDate=null,
/** @var DateTime|null */
public ?DateTime $toDate=null,
/** @var string|null */
public ?string $location=null,
/** @var string|null */
public ?string $metaType=null,
/** @var string|null */
public ?string $meta=null,
/** @var bool|null */
public ?bool $approved=null,
/** @var int */
public int $upVotes=0,
/** @var int */
public int $downVotes=0,
/** @var int */
public int $points=0,
/** @var int */
public int $views=0,
/** @var int */
public int $favorites=0,
/** @var int */
public int $subscribers=0,
/** @var int */
public int $replyCount=0,
/** @var int */
public int $commentsCount=0,
/** @var int */
public int $wordCount=0,
/** @var int */
public int $reportCount=0,
/** @var int */
public int $linksCount=0,
/** @var int */
public int $linkedToCount=0,
/** @var int */
public int $score=0,
/** @var int */
public int $rank=0,
/** @var string[]|null */
public ?array $labels=null,
/** @var int[]|null */
public ?array $refUserIds=null,
/** @var string[]|null */
public ?array $refLinks=null,
/** @var int[]|null */
public ?array $muteUserIds=null,
/** @var DateTime|null */
public ?DateTime $lastCommentDate=null,
/** @var int|null */
public ?int $lastCommentId=null,
/** @var int|null */
public ?int $lastCommentUserId=null,
/** @var DateTime|null */
public ?DateTime $deleted=null,
/** @var string|null */
public ?string $deletedBy=null,
/** @var DateTime|null */
public ?DateTime $locked=null,
/** @var string|null */
public ?string $lockedBy=null,
/** @var DateTime|null */
public ?DateTime $hidden=null,
/** @var string|null */
public ?string $hiddenBy=null,
/** @var string|null */
public ?string $status=null,
/** @var DateTime|null */
public ?DateTime $statusDate=null,
/** @var string|null */
public ?string $statusBy=null,
/** @var bool|null */
public ?bool $archived=null,
/** @var DateTime|null */
public ?DateTime $bumped=null,
/** @var DateTime */
public DateTime $created=new DateTime(),
/** @var string|null */
public ?string $createdBy=null,
/** @var DateTime */
public DateTime $modified=new DateTime(),
/** @var string|null */
public ?string $modifiedBy=null,
/** @var int|null */
public ?int $refId=null,
/** @var string|null */
public ?string $refSource=null,
/** @var string|null */
public ?string $refUrn=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['organizationId'])) $this->organizationId = $o['organizationId'];
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['type'])) $this->type = JsonConverters::from('PostType', $o['type']);
if (isset($o['categoryId'])) $this->categoryId = $o['categoryId'];
if (isset($o['title'])) $this->title = $o['title'];
if (isset($o['slug'])) $this->slug = $o['slug'];
if (isset($o['url'])) $this->url = $o['url'];
if (isset($o['imageUrl'])) $this->imageUrl = $o['imageUrl'];
if (isset($o['content'])) $this->content = $o['content'];
if (isset($o['contentHtml'])) $this->contentHtml = $o['contentHtml'];
if (isset($o['pinCommentId'])) $this->pinCommentId = $o['pinCommentId'];
if (isset($o['technologyIds'])) $this->technologyIds = JsonConverters::fromArray('int', $o['technologyIds']);
if (isset($o['fromDate'])) $this->fromDate = JsonConverters::from('DateTime', $o['fromDate']);
if (isset($o['toDate'])) $this->toDate = JsonConverters::from('DateTime', $o['toDate']);
if (isset($o['location'])) $this->location = $o['location'];
if (isset($o['metaType'])) $this->metaType = $o['metaType'];
if (isset($o['meta'])) $this->meta = $o['meta'];
if (isset($o['approved'])) $this->approved = $o['approved'];
if (isset($o['upVotes'])) $this->upVotes = $o['upVotes'];
if (isset($o['downVotes'])) $this->downVotes = $o['downVotes'];
if (isset($o['points'])) $this->points = $o['points'];
if (isset($o['views'])) $this->views = $o['views'];
if (isset($o['favorites'])) $this->favorites = $o['favorites'];
if (isset($o['subscribers'])) $this->subscribers = $o['subscribers'];
if (isset($o['replyCount'])) $this->replyCount = $o['replyCount'];
if (isset($o['commentsCount'])) $this->commentsCount = $o['commentsCount'];
if (isset($o['wordCount'])) $this->wordCount = $o['wordCount'];
if (isset($o['reportCount'])) $this->reportCount = $o['reportCount'];
if (isset($o['linksCount'])) $this->linksCount = $o['linksCount'];
if (isset($o['linkedToCount'])) $this->linkedToCount = $o['linkedToCount'];
if (isset($o['score'])) $this->score = $o['score'];
if (isset($o['rank'])) $this->rank = $o['rank'];
if (isset($o['labels'])) $this->labels = JsonConverters::fromArray('string', $o['labels']);
if (isset($o['refUserIds'])) $this->refUserIds = JsonConverters::fromArray('int', $o['refUserIds']);
if (isset($o['refLinks'])) $this->refLinks = JsonConverters::fromArray('string', $o['refLinks']);
if (isset($o['muteUserIds'])) $this->muteUserIds = JsonConverters::fromArray('int', $o['muteUserIds']);
if (isset($o['lastCommentDate'])) $this->lastCommentDate = JsonConverters::from('DateTime', $o['lastCommentDate']);
if (isset($o['lastCommentId'])) $this->lastCommentId = $o['lastCommentId'];
if (isset($o['lastCommentUserId'])) $this->lastCommentUserId = $o['lastCommentUserId'];
if (isset($o['deleted'])) $this->deleted = JsonConverters::from('DateTime', $o['deleted']);
if (isset($o['deletedBy'])) $this->deletedBy = $o['deletedBy'];
if (isset($o['locked'])) $this->locked = JsonConverters::from('DateTime', $o['locked']);
if (isset($o['lockedBy'])) $this->lockedBy = $o['lockedBy'];
if (isset($o['hidden'])) $this->hidden = JsonConverters::from('DateTime', $o['hidden']);
if (isset($o['hiddenBy'])) $this->hiddenBy = $o['hiddenBy'];
if (isset($o['status'])) $this->status = $o['status'];
if (isset($o['statusDate'])) $this->statusDate = JsonConverters::from('DateTime', $o['statusDate']);
if (isset($o['statusBy'])) $this->statusBy = $o['statusBy'];
if (isset($o['archived'])) $this->archived = $o['archived'];
if (isset($o['bumped'])) $this->bumped = JsonConverters::from('DateTime', $o['bumped']);
if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
if (isset($o['createdBy'])) $this->createdBy = $o['createdBy'];
if (isset($o['modified'])) $this->modified = JsonConverters::from('DateTime', $o['modified']);
if (isset($o['modifiedBy'])) $this->modifiedBy = $o['modifiedBy'];
if (isset($o['refId'])) $this->refId = $o['refId'];
if (isset($o['refSource'])) $this->refSource = $o['refSource'];
if (isset($o['refUrn'])) $this->refUrn = $o['refUrn'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->organizationId)) $o['organizationId'] = $this->organizationId;
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->type)) $o['type'] = JsonConverters::to('PostType', $this->type);
if (isset($this->categoryId)) $o['categoryId'] = $this->categoryId;
if (isset($this->title)) $o['title'] = $this->title;
if (isset($this->slug)) $o['slug'] = $this->slug;
if (isset($this->url)) $o['url'] = $this->url;
if (isset($this->imageUrl)) $o['imageUrl'] = $this->imageUrl;
if (isset($this->content)) $o['content'] = $this->content;
if (isset($this->contentHtml)) $o['contentHtml'] = $this->contentHtml;
if (isset($this->pinCommentId)) $o['pinCommentId'] = $this->pinCommentId;
if (isset($this->technologyIds)) $o['technologyIds'] = JsonConverters::toArray('int', $this->technologyIds);
if (isset($this->fromDate)) $o['fromDate'] = JsonConverters::to('DateTime', $this->fromDate);
if (isset($this->toDate)) $o['toDate'] = JsonConverters::to('DateTime', $this->toDate);
if (isset($this->location)) $o['location'] = $this->location;
if (isset($this->metaType)) $o['metaType'] = $this->metaType;
if (isset($this->meta)) $o['meta'] = $this->meta;
if (isset($this->approved)) $o['approved'] = $this->approved;
if (isset($this->upVotes)) $o['upVotes'] = $this->upVotes;
if (isset($this->downVotes)) $o['downVotes'] = $this->downVotes;
if (isset($this->points)) $o['points'] = $this->points;
if (isset($this->views)) $o['views'] = $this->views;
if (isset($this->favorites)) $o['favorites'] = $this->favorites;
if (isset($this->subscribers)) $o['subscribers'] = $this->subscribers;
if (isset($this->replyCount)) $o['replyCount'] = $this->replyCount;
if (isset($this->commentsCount)) $o['commentsCount'] = $this->commentsCount;
if (isset($this->wordCount)) $o['wordCount'] = $this->wordCount;
if (isset($this->reportCount)) $o['reportCount'] = $this->reportCount;
if (isset($this->linksCount)) $o['linksCount'] = $this->linksCount;
if (isset($this->linkedToCount)) $o['linkedToCount'] = $this->linkedToCount;
if (isset($this->score)) $o['score'] = $this->score;
if (isset($this->rank)) $o['rank'] = $this->rank;
if (isset($this->labels)) $o['labels'] = JsonConverters::toArray('string', $this->labels);
if (isset($this->refUserIds)) $o['refUserIds'] = JsonConverters::toArray('int', $this->refUserIds);
if (isset($this->refLinks)) $o['refLinks'] = JsonConverters::toArray('string', $this->refLinks);
if (isset($this->muteUserIds)) $o['muteUserIds'] = JsonConverters::toArray('int', $this->muteUserIds);
if (isset($this->lastCommentDate)) $o['lastCommentDate'] = JsonConverters::to('DateTime', $this->lastCommentDate);
if (isset($this->lastCommentId)) $o['lastCommentId'] = $this->lastCommentId;
if (isset($this->lastCommentUserId)) $o['lastCommentUserId'] = $this->lastCommentUserId;
if (isset($this->deleted)) $o['deleted'] = JsonConverters::to('DateTime', $this->deleted);
if (isset($this->deletedBy)) $o['deletedBy'] = $this->deletedBy;
if (isset($this->locked)) $o['locked'] = JsonConverters::to('DateTime', $this->locked);
if (isset($this->lockedBy)) $o['lockedBy'] = $this->lockedBy;
if (isset($this->hidden)) $o['hidden'] = JsonConverters::to('DateTime', $this->hidden);
if (isset($this->hiddenBy)) $o['hiddenBy'] = $this->hiddenBy;
if (isset($this->status)) $o['status'] = $this->status;
if (isset($this->statusDate)) $o['statusDate'] = JsonConverters::to('DateTime', $this->statusDate);
if (isset($this->statusBy)) $o['statusBy'] = $this->statusBy;
if (isset($this->archived)) $o['archived'] = $this->archived;
if (isset($this->bumped)) $o['bumped'] = JsonConverters::to('DateTime', $this->bumped);
if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
if (isset($this->createdBy)) $o['createdBy'] = $this->createdBy;
if (isset($this->modified)) $o['modified'] = JsonConverters::to('DateTime', $this->modified);
if (isset($this->modifiedBy)) $o['modifiedBy'] = $this->modifiedBy;
if (isset($this->refId)) $o['refId'] = $this->refId;
if (isset($this->refSource)) $o['refSource'] = $this->refSource;
if (isset($this->refUrn)) $o['refUrn'] = $this->refUrn;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
/**
* @template T
*/
class QueryResponse implements JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): QueryResponse {
$to = new QueryResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
// @DataMember(Order=1)
/** @var int */
public mixed $offset=0,
// @DataMember(Order=2)
/** @var int */
public mixed $total=0,
// @DataMember(Order=3)
/** @var array<Post>|null */
public mixed $results=null,
// @DataMember(Order=4)
/** @var array<string,string>|null */
public mixed $meta=null,
// @DataMember(Order=5)
/** @var ResponseStatus|null */
public mixed $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['offset'])) $this->offset = $o['offset'];
if (isset($o['total'])) $this->total = $o['total'];
if (isset($o['results'])) $this->results = JsonConverters::fromArray('Post', $o['results']);
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->offset)) $o['offset'] = $this->offset;
if (isset($this->total)) $o['total'] = $this->total;
if (isset($this->results)) $o['results'] = JsonConverters::toArray('Post', $this->results);
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
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.
GET /posts/comment HTTP/1.1 Host: techstacks.io Accept: text/jsonl
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"offset":0,"total":0,"results":[{"id":0,"postId":0,"userId":0,"replyId":0,"content":"String","contentHtml":"String","score":0,"rank":0,"upVotes":0,"downVotes":0,"favorites":0,"wordCount":0,"reportCount":0,"deleted":"0001-01-01T00:00:00.0000000","hidden":"0001-01-01T00:00:00.0000000","modified":"0001-01-01T00:00:00.0000000","created":"0001-01-01T00:00:00.0000000","createdBy":"String","refId":0,"refSource":"String","refUrn":"String"}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}