Trendsic Platform Service

<back to all web services

OrganizationRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,POST,PUT,DELETE,OPTIONS/v1/Organization/{OrganizationId}
GET,POST,PUT,DELETE,OPTIONS/v1/Organization
<?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 $OrganizationId=0,
        /** @var int */
        public int $OrganizationTypeId=0,
        /** @var int */
        public int $StateID=0,
        /** @var string|null */
        public ?string $StateName=null,
        /** @var int */
        public int $DistrictID=0,
        /** @var string|null */
        public ?string $DistrictName=null,
        /** @var int */
        public int $CountyID=0,
        /** @var string|null */
        public ?string $CountyName=null,
        /** @var int */
        public int $SchoolID=0,
        /** @var string|null */
        public ?string $SchoolName=null,
        /** @var string|null */
        public ?string $EntityName=null,
        /** @var string|null */
        public ?string $EntityId=null,
        /** @var string|null */
        public ?string $Source=null,
        /** @var int */
        public int $Pera_ListId=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['OrganizationId'])) $this->OrganizationId = $o['OrganizationId'];
        if (isset($o['OrganizationTypeId'])) $this->OrganizationTypeId = $o['OrganizationTypeId'];
        if (isset($o['StateID'])) $this->StateID = $o['StateID'];
        if (isset($o['StateName'])) $this->StateName = $o['StateName'];
        if (isset($o['DistrictID'])) $this->DistrictID = $o['DistrictID'];
        if (isset($o['DistrictName'])) $this->DistrictName = $o['DistrictName'];
        if (isset($o['CountyID'])) $this->CountyID = $o['CountyID'];
        if (isset($o['CountyName'])) $this->CountyName = $o['CountyName'];
        if (isset($o['SchoolID'])) $this->SchoolID = $o['SchoolID'];
        if (isset($o['SchoolName'])) $this->SchoolName = $o['SchoolName'];
        if (isset($o['EntityName'])) $this->EntityName = $o['EntityName'];
        if (isset($o['EntityId'])) $this->EntityId = $o['EntityId'];
        if (isset($o['Source'])) $this->Source = $o['Source'];
        if (isset($o['Pera_ListId'])) $this->Pera_ListId = $o['Pera_ListId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->OrganizationId)) $o['OrganizationId'] = $this->OrganizationId;
        if (isset($this->OrganizationTypeId)) $o['OrganizationTypeId'] = $this->OrganizationTypeId;
        if (isset($this->StateID)) $o['StateID'] = $this->StateID;
        if (isset($this->StateName)) $o['StateName'] = $this->StateName;
        if (isset($this->DistrictID)) $o['DistrictID'] = $this->DistrictID;
        if (isset($this->DistrictName)) $o['DistrictName'] = $this->DistrictName;
        if (isset($this->CountyID)) $o['CountyID'] = $this->CountyID;
        if (isset($this->CountyName)) $o['CountyName'] = $this->CountyName;
        if (isset($this->SchoolID)) $o['SchoolID'] = $this->SchoolID;
        if (isset($this->SchoolName)) $o['SchoolName'] = $this->SchoolName;
        if (isset($this->EntityName)) $o['EntityName'] = $this->EntityName;
        if (isset($this->EntityId)) $o['EntityId'] = $this->EntityId;
        if (isset($this->Source)) $o['Source'] = $this->Source;
        if (isset($this->Pera_ListId)) $o['Pera_ListId'] = $this->Pera_ListId;
        return empty($o) ? new class(){} : $o;
    }
}

class OrganizationResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var array<Organization>|null */
        public ?array $Organization=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
        if (isset($o['Organization'])) $this->Organization = JsonConverters::fromArray('Organization', $o['Organization']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        if (isset($this->Organization)) $o['Organization'] = JsonConverters::toArray('Organization', $this->Organization);
        return empty($o) ? new class(){} : $o;
    }
}

class OrganizationRequest implements JsonSerializable
{
    public function __construct(
        /** @var array<Organization>|null */
        public ?array $Organization=null,
        /** @var int */
        public int $OrganizationId=0
    ) {
    }

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

PHP OrganizationRequest 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.

POST /v1/Organization/{OrganizationId} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Organization: 
	[
		{
			OrganizationId: 0,
			OrganizationTypeId: 0,
			StateID: 0,
			StateName: String,
			DistrictID: 0,
			DistrictName: String,
			CountyID: 0,
			CountyName: String,
			SchoolID: 0,
			SchoolName: String,
			EntityName: String,
			EntityId: String,
			Source: String,
			Pera_ListId: 0
		}
	],
	OrganizationId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Organization: 
	[
		{
			OrganizationId: 0,
			OrganizationTypeId: 0,
			StateID: 0,
			StateName: String,
			DistrictID: 0,
			DistrictName: String,
			CountyID: 0,
			CountyName: String,
			SchoolID: 0,
			SchoolName: String,
			EntityName: String,
			EntityId: String,
			Source: String,
			Pera_ListId: 0
		}
	]
}