TechStacks!

<back to all web services

GetOrganizationBySlug

Organization
The following routes are available for this service:
GET/organizations/{Slug}
<?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 Organization implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $slug=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $descriptionHtml=null,
        /** @var string|null */
        public ?string $color=null,
        /** @var string|null */
        public ?string $textColor=null,
        /** @var string|null */
        public ?string $linkColor=null,
        /** @var string|null */
        public ?string $backgroundColor=null,
        /** @var string|null */
        public ?string $backgroundUrl=null,
        /** @var string|null */
        public ?string $logoUrl=null,
        /** @var string|null */
        public ?string $heroUrl=null,
        /** @var string|null */
        public ?string $lang=null,
        /** @var string|null */
        public ?string $defaultPostType=null,
        /** @var string[]|null */
        public ?array $defaultSubscriptionPostTypes=null,
        /** @var string[]|null */
        public ?array $postTypes=null,
        /** @var string[]|null */
        public ?array $moderatorPostTypes=null,
        /** @var int */
        public int $deletePostsWithReportCount=0,
        /** @var bool|null */
        public ?bool $disableInvites=null,
        /** @var int */
        public int $upVotes=0,
        /** @var int */
        public int $downVotes=0,
        /** @var int */
        public int $views=0,
        /** @var int */
        public int $favorites=0,
        /** @var int */
        public int $subscribers=0,
        /** @var int */
        public int $commentsCount=0,
        /** @var int */
        public int $postsCount=0,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0,
        /** @var int|null */
        public ?int $refId=null,
        /** @var string|null */
        public ?string $refSource=null,
        /** @var DateTime|null */
        public ?DateTime $hidden=null,
        /** @var string|null */
        public ?string $hiddenBy=null,
        /** @var DateTime|null */
        public ?DateTime $locked=null,
        /** @var string|null */
        public ?string $lockedBy=null,
        /** @var DateTime|null */
        public ?DateTime $deleted=null,
        /** @var string|null */
        public ?string $deletedBy=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
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['descriptionHtml'])) $this->descriptionHtml = $o['descriptionHtml'];
        if (isset($o['color'])) $this->color = $o['color'];
        if (isset($o['textColor'])) $this->textColor = $o['textColor'];
        if (isset($o['linkColor'])) $this->linkColor = $o['linkColor'];
        if (isset($o['backgroundColor'])) $this->backgroundColor = $o['backgroundColor'];
        if (isset($o['backgroundUrl'])) $this->backgroundUrl = $o['backgroundUrl'];
        if (isset($o['logoUrl'])) $this->logoUrl = $o['logoUrl'];
        if (isset($o['heroUrl'])) $this->heroUrl = $o['heroUrl'];
        if (isset($o['lang'])) $this->lang = $o['lang'];
        if (isset($o['defaultPostType'])) $this->defaultPostType = $o['defaultPostType'];
        if (isset($o['defaultSubscriptionPostTypes'])) $this->defaultSubscriptionPostTypes = JsonConverters::fromArray('string', $o['defaultSubscriptionPostTypes']);
        if (isset($o['postTypes'])) $this->postTypes = JsonConverters::fromArray('string', $o['postTypes']);
        if (isset($o['moderatorPostTypes'])) $this->moderatorPostTypes = JsonConverters::fromArray('string', $o['moderatorPostTypes']);
        if (isset($o['deletePostsWithReportCount'])) $this->deletePostsWithReportCount = $o['deletePostsWithReportCount'];
        if (isset($o['disableInvites'])) $this->disableInvites = $o['disableInvites'];
        if (isset($o['upVotes'])) $this->upVotes = $o['upVotes'];
        if (isset($o['downVotes'])) $this->downVotes = $o['downVotes'];
        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['commentsCount'])) $this->commentsCount = $o['commentsCount'];
        if (isset($o['postsCount'])) $this->postsCount = $o['postsCount'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
        if (isset($o['refId'])) $this->refId = $o['refId'];
        if (isset($o['refSource'])) $this->refSource = $o['refSource'];
        if (isset($o['hidden'])) $this->hidden = JsonConverters::from('DateTime', $o['hidden']);
        if (isset($o['hiddenBy'])) $this->hiddenBy = $o['hiddenBy'];
        if (isset($o['locked'])) $this->locked = JsonConverters::from('DateTime', $o['locked']);
        if (isset($o['lockedBy'])) $this->lockedBy = $o['lockedBy'];
        if (isset($o['deleted'])) $this->deleted = JsonConverters::from('DateTime', $o['deleted']);
        if (isset($o['deletedBy'])) $this->deletedBy = $o['deletedBy'];
        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'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->descriptionHtml)) $o['descriptionHtml'] = $this->descriptionHtml;
        if (isset($this->color)) $o['color'] = $this->color;
        if (isset($this->textColor)) $o['textColor'] = $this->textColor;
        if (isset($this->linkColor)) $o['linkColor'] = $this->linkColor;
        if (isset($this->backgroundColor)) $o['backgroundColor'] = $this->backgroundColor;
        if (isset($this->backgroundUrl)) $o['backgroundUrl'] = $this->backgroundUrl;
        if (isset($this->logoUrl)) $o['logoUrl'] = $this->logoUrl;
        if (isset($this->heroUrl)) $o['heroUrl'] = $this->heroUrl;
        if (isset($this->lang)) $o['lang'] = $this->lang;
        if (isset($this->defaultPostType)) $o['defaultPostType'] = $this->defaultPostType;
        if (isset($this->defaultSubscriptionPostTypes)) $o['defaultSubscriptionPostTypes'] = JsonConverters::toArray('string', $this->defaultSubscriptionPostTypes);
        if (isset($this->postTypes)) $o['postTypes'] = JsonConverters::toArray('string', $this->postTypes);
        if (isset($this->moderatorPostTypes)) $o['moderatorPostTypes'] = JsonConverters::toArray('string', $this->moderatorPostTypes);
        if (isset($this->deletePostsWithReportCount)) $o['deletePostsWithReportCount'] = $this->deletePostsWithReportCount;
        if (isset($this->disableInvites)) $o['disableInvites'] = $this->disableInvites;
        if (isset($this->upVotes)) $o['upVotes'] = $this->upVotes;
        if (isset($this->downVotes)) $o['downVotes'] = $this->downVotes;
        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->commentsCount)) $o['commentsCount'] = $this->commentsCount;
        if (isset($this->postsCount)) $o['postsCount'] = $this->postsCount;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        if (isset($this->refId)) $o['refId'] = $this->refId;
        if (isset($this->refSource)) $o['refSource'] = $this->refSource;
        if (isset($this->hidden)) $o['hidden'] = JsonConverters::to('DateTime', $this->hidden);
        if (isset($this->hiddenBy)) $o['hiddenBy'] = $this->hiddenBy;
        if (isset($this->locked)) $o['locked'] = JsonConverters::to('DateTime', $this->locked);
        if (isset($this->lockedBy)) $o['lockedBy'] = $this->lockedBy;
        if (isset($this->deleted)) $o['deleted'] = JsonConverters::to('DateTime', $this->deleted);
        if (isset($this->deletedBy)) $o['deletedBy'] = $this->deletedBy;
        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;
        return empty($o) ? new class(){} : $o;
    }
}

class OrganizationLabel implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $slug=null,
        /** @var int */
        public int $organizationId=0,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $color=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['organizationId'])) $this->organizationId = $o['organizationId'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['color'])) $this->color = $o['color'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->organizationId)) $o['organizationId'] = $this->organizationId;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->color)) $o['color'] = $this->color;
        return empty($o) ? new class(){} : $o;
    }
}

class Category implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var int */
        public int $organizationId=0,
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $slug=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var string|null */
        public ?string $color=null,
        /** @var int[]|null */
        public ?array $technologyIds=null,
        /** @var int */
        public int $commentsCount=0,
        /** @var int */
        public int $postsCount=0,
        /** @var int */
        public int $score=0,
        /** @var int */
        public int $rank=0
    ) {
    }

    /** @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['name'])) $this->name = $o['name'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['color'])) $this->color = $o['color'];
        if (isset($o['technologyIds'])) $this->technologyIds = JsonConverters::fromArray('int', $o['technologyIds']);
        if (isset($o['commentsCount'])) $this->commentsCount = $o['commentsCount'];
        if (isset($o['postsCount'])) $this->postsCount = $o['postsCount'];
        if (isset($o['score'])) $this->score = $o['score'];
        if (isset($o['rank'])) $this->rank = $o['rank'];
    }
    
    /** @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->name)) $o['name'] = $this->name;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->color)) $o['color'] = $this->color;
        if (isset($this->technologyIds)) $o['technologyIds'] = JsonConverters::toArray('int', $this->technologyIds);
        if (isset($this->commentsCount)) $o['commentsCount'] = $this->commentsCount;
        if (isset($this->postsCount)) $o['postsCount'] = $this->postsCount;
        if (isset($this->score)) $o['score'] = $this->score;
        if (isset($this->rank)) $o['rank'] = $this->rank;
        return empty($o) ? new class(){} : $o;
    }
}

class OrganizationMember implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var int */
        public int $organizationId=0,
        /** @var int */
        public int $userId=0,
        /** @var string|null */
        public ?string $userName=null,
        /** @var bool|null */
        public ?bool $isOwner=null,
        /** @var bool|null */
        public ?bool $isModerator=null,
        /** @var bool|null */
        public ?bool $denyAll=null,
        /** @var bool|null */
        public ?bool $denyPosts=null,
        /** @var bool|null */
        public ?bool $denyComments=null,
        /** @var string|null */
        public ?string $notes=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['userName'])) $this->userName = $o['userName'];
        if (isset($o['isOwner'])) $this->isOwner = $o['isOwner'];
        if (isset($o['isModerator'])) $this->isModerator = $o['isModerator'];
        if (isset($o['denyAll'])) $this->denyAll = $o['denyAll'];
        if (isset($o['denyPosts'])) $this->denyPosts = $o['denyPosts'];
        if (isset($o['denyComments'])) $this->denyComments = $o['denyComments'];
        if (isset($o['notes'])) $this->notes = $o['notes'];
    }
    
    /** @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->userName)) $o['userName'] = $this->userName;
        if (isset($this->isOwner)) $o['isOwner'] = $this->isOwner;
        if (isset($this->isModerator)) $o['isModerator'] = $this->isModerator;
        if (isset($this->denyAll)) $o['denyAll'] = $this->denyAll;
        if (isset($this->denyPosts)) $o['denyPosts'] = $this->denyPosts;
        if (isset($this->denyComments)) $o['denyComments'] = $this->denyComments;
        if (isset($this->notes)) $o['notes'] = $this->notes;
        return empty($o) ? new class(){} : $o;
    }
}

class GetOrganizationResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $cache=0,
        /** @var int */
        public int $id=0,
        /** @var string|null */
        public ?string $slug=null,
        /** @var Organization|null */
        public ?Organization $organization=null,
        /** @var array<OrganizationLabel>|null */
        public ?array $labels=null,
        /** @var array<Category>|null */
        public ?array $categories=null,
        /** @var array<OrganizationMember>|null */
        public ?array $owners=null,
        /** @var array<OrganizationMember>|null */
        public ?array $moderators=null,
        /** @var int */
        public int $membersCount=0,
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['cache'])) $this->cache = $o['cache'];
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['slug'])) $this->slug = $o['slug'];
        if (isset($o['organization'])) $this->organization = JsonConverters::from('Organization', $o['organization']);
        if (isset($o['labels'])) $this->labels = JsonConverters::fromArray('OrganizationLabel', $o['labels']);
        if (isset($o['categories'])) $this->categories = JsonConverters::fromArray('Category', $o['categories']);
        if (isset($o['owners'])) $this->owners = JsonConverters::fromArray('OrganizationMember', $o['owners']);
        if (isset($o['moderators'])) $this->moderators = JsonConverters::fromArray('OrganizationMember', $o['moderators']);
        if (isset($o['membersCount'])) $this->membersCount = $o['membersCount'];
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->cache)) $o['cache'] = $this->cache;
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->slug)) $o['slug'] = $this->slug;
        if (isset($this->organization)) $o['organization'] = JsonConverters::to('Organization', $this->organization);
        if (isset($this->labels)) $o['labels'] = JsonConverters::toArray('OrganizationLabel', $this->labels);
        if (isset($this->categories)) $o['categories'] = JsonConverters::toArray('Category', $this->categories);
        if (isset($this->owners)) $o['owners'] = JsonConverters::toArray('OrganizationMember', $this->owners);
        if (isset($this->moderators)) $o['moderators'] = JsonConverters::toArray('OrganizationMember', $this->moderators);
        if (isset($this->membersCount)) $o['membersCount'] = $this->membersCount;
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class GetOrganizationBySlug implements IGet, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $slug=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['slug'])) $this->slug = $o['slug'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->slug)) $o['slug'] = $this->slug;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetOrganizationBySlug DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /organizations/{Slug} HTTP/1.1 
Host: techstacks.io 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"cache":0,"id":0,"slug":"String","organization":{"id":0,"name":"String","slug":"String","description":"String","descriptionHtml":"String","color":"String","textColor":"String","linkColor":"String","backgroundColor":"String","backgroundUrl":"String","logoUrl":"String","heroUrl":"String","lang":"String","defaultPostType":"String","defaultSubscriptionPostTypes":["String"],"postTypes":["String"],"moderatorPostTypes":["String"],"deletePostsWithReportCount":0,"disableInvites":false,"upVotes":0,"downVotes":0,"views":0,"favorites":0,"subscribers":0,"commentsCount":0,"postsCount":0,"score":0,"rank":0,"refId":0,"refSource":"String","hidden":"0001-01-01T00:00:00.0000000","hiddenBy":"String","locked":"0001-01-01T00:00:00.0000000","lockedBy":"String","deleted":"0001-01-01T00:00:00.0000000","deletedBy":"String","created":"0001-01-01T00:00:00.0000000","createdBy":"String","modified":"0001-01-01T00:00:00.0000000","modifiedBy":"String"},"labels":[{"slug":"String","organizationId":0,"description":"String","color":"String"}],"categories":[{"id":0,"organizationId":0,"name":"String","slug":"String","description":"String","color":"String","technologyIds":[0],"commentsCount":0,"postsCount":0,"score":0,"rank":0}],"owners":[{"id":0,"organizationId":0,"userId":0,"userName":"String","isOwner":false,"isModerator":false,"denyAll":false,"denyPosts":false,"denyComments":false,"notes":"String"}],"moderators":[{"id":0,"organizationId":0,"userId":0,"userName":"String","isOwner":false,"isModerator":false,"denyAll":false,"denyPosts":false,"denyComments":false,"notes":"String"}],"membersCount":0,"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}