Trendsic Platform Service

<back to all web services

OrganizationTypeRequest

Requires Authentication
Requires any of the roles:Agent, Administrator, Agent, Administrator, Agent, Administrator, Agent, Administrator
The following routes are available for this service:
GET,DELETE,OPTIONS/v1/OrganizationType/{OrganizationTypeId}
GET,POST,PUT,OPTIONS/v1/OrganizationType
<?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 OrganizationType implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $OrganizationTypeId=0,
        /** @var string|null */
        public ?string $OrganizationTypeName=null,
        /** @var string|null */
        public ?string $DisplayFor=null,
        /** @var string|null */
        public ?string $Level1DisplayName=null,
        /** @var string|null */
        public ?string $Level2DisplayName=null,
        /** @var bool|null */
        public ?bool $HasLevel2=null
    ) {
    }

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

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

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

class OrganizationTypeRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $OrganizationTypeId=0,
        /** @var OrganizationType|null */
        public ?OrganizationType $OrganizationType=null
    ) {
    }

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

PHP OrganizationTypeRequest 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/OrganizationType HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	OrganizationTypeId: 0,
	OrganizationType: 
	{
		OrganizationTypeId: 0,
		OrganizationTypeName: String,
		DisplayFor: String,
		Level1DisplayName: String,
		Level2DisplayName: String,
		HasLevel2: False
	}
}
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
		}
	},
	OrganizationType: 
	[
		{
			OrganizationTypeId: 0,
			OrganizationTypeName: String,
			DisplayFor: String,
			Level1DisplayName: String,
			Level2DisplayName: String,
			HasLevel2: False
		}
	]
}