TechStacks!

<back to all web services

QueryPosts

AutoQueryPosts
The following routes are available for this service:
GET/posts
<?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);
        if (isset($o['skip'])) $this->skip = JsonConverters::from('int', $o['skip']);
        if (isset($o['take'])) $this->take = JsonConverters::from('int', $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 = parent::jsonSerialize();
        if (isset($this->skip)) $o['skip'] = JsonConverters::to('int', $this->skip);
        if (isset($this->take)) $o['take'] = JsonConverters::to('int', $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;
    }
}

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;
    }
}

/**
 * @template QueryDb of Post
 */
class QueryPosts 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
     * @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,
        ?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 ?array $ids=null,
        /** @var int|null */
        public ?int $organizationId=null,
        /** @var array<int>|null */
        public ?array $organizationIds=null,
        /** @var array<string>|null */
        public ?array $types=null,
        /** @var array<int>|null */
        public ?array $anyTechnologyIds=null,
        /** @var string[]|null */
        public ?array $is=null
    ) {
        parent::__construct($skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta,$skip,$take,$orderBy,$orderByDesc,$include,$fields,$meta);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['ids'])) $this->ids = JsonConverters::fromArray('int', $o['ids']);
        if (isset($o['organizationId'])) $this->organizationId = $o['organizationId'];
        if (isset($o['organizationIds'])) $this->organizationIds = JsonConverters::fromArray('int', $o['organizationIds']);
        if (isset($o['types'])) $this->types = JsonConverters::fromArray('string', $o['types']);
        if (isset($o['anyTechnologyIds'])) $this->anyTechnologyIds = JsonConverters::fromArray('int', $o['anyTechnologyIds']);
        if (isset($o['is'])) $this->is = JsonConverters::fromArray('string', $o['is']);
        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 = parent::jsonSerialize();
        if (isset($this->ids)) $o['ids'] = JsonConverters::toArray('int', $this->ids);
        if (isset($this->organizationId)) $o['organizationId'] = $this->organizationId;
        if (isset($this->organizationIds)) $o['organizationIds'] = JsonConverters::toArray('int', $this->organizationIds);
        if (isset($this->types)) $o['types'] = JsonConverters::toArray('string', $this->types);
        if (isset($this->anyTechnologyIds)) $o['anyTechnologyIds'] = JsonConverters::toArray('int', $this->anyTechnologyIds);
        if (isset($this->is)) $o['is'] = JsonConverters::toArray('string', $this->is);
        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;
    }
}

// @DataContract
/**
 * @template Post
 */
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($this->genericArgs[0], $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($this->genericArgs[0], $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;
    }
}

PHP QueryPosts DTOs

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

HTTP + JSV

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

GET /posts HTTP/1.1 
Host: techstacks.io 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	offset: 0,
	total: 0,
	results: 
	[
		{
			id: 0,
			organizationId: 0,
			userId: 0,
			type: Announcement,
			categoryId: 0,
			title: String,
			slug: String,
			url: String,
			imageUrl: String,
			content: String,
			contentHtml: String,
			pinCommentId: 0,
			technologyIds: 
			[
				0
			],
			fromDate: 0001-01-01,
			toDate: 0001-01-01,
			location: String,
			metaType: String,
			meta: String,
			approved: False,
			upVotes: 0,
			downVotes: 0,
			points: 0,
			views: 0,
			favorites: 0,
			subscribers: 0,
			replyCount: 0,
			commentsCount: 0,
			wordCount: 0,
			reportCount: 0,
			linksCount: 0,
			linkedToCount: 0,
			score: 0,
			rank: 0,
			labels: 
			[
				String
			],
			refUserIds: 
			[
				0
			],
			refLinks: 
			[
				String
			],
			muteUserIds: 
			[
				0
			],
			lastCommentDate: 0001-01-01,
			lastCommentId: 0,
			lastCommentUserId: 0,
			deleted: 0001-01-01,
			deletedBy: String,
			locked: 0001-01-01,
			lockedBy: String,
			hidden: 0001-01-01,
			hiddenBy: String,
			status: String,
			statusDate: 0001-01-01,
			statusBy: String,
			archived: False,
			bumped: 0001-01-01,
			created: 0001-01-01,
			createdBy: String,
			modified: 0001-01-01,
			modifiedBy: 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
		}
	}
}