| POST | /v1/provision |
|---|
<?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 ProvisionResult implements JsonSerializable
{
public function __construct(
/** @var string */
public string $TenantId='',
/** @var string|null */
public ?string $TenantName=null,
/** @var string|null */
public ?string $Slug=null,
/** @var string|null */
public ?string $PackCode=null,
/** @var string */
public string $BranchId='',
/** @var string|null */
public ?string $BranchName=null,
/** @var array<string>|null */
public ?array $RolesCreated=null,
/** @var int */
public int $CatalogItemsSeeded=0,
/** @var bool|null */
public ?bool $OwnerAssigned=null,
/** @var string|null */
public ?string $OwnerEmail=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TenantId'])) $this->TenantId = $o['TenantId'];
if (isset($o['TenantName'])) $this->TenantName = $o['TenantName'];
if (isset($o['Slug'])) $this->Slug = $o['Slug'];
if (isset($o['PackCode'])) $this->PackCode = $o['PackCode'];
if (isset($o['BranchId'])) $this->BranchId = $o['BranchId'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
if (isset($o['RolesCreated'])) $this->RolesCreated = JsonConverters::fromArray('string', $o['RolesCreated']);
if (isset($o['CatalogItemsSeeded'])) $this->CatalogItemsSeeded = $o['CatalogItemsSeeded'];
if (isset($o['OwnerAssigned'])) $this->OwnerAssigned = $o['OwnerAssigned'];
if (isset($o['OwnerEmail'])) $this->OwnerEmail = $o['OwnerEmail'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TenantId)) $o['TenantId'] = $this->TenantId;
if (isset($this->TenantName)) $o['TenantName'] = $this->TenantName;
if (isset($this->Slug)) $o['Slug'] = $this->Slug;
if (isset($this->PackCode)) $o['PackCode'] = $this->PackCode;
if (isset($this->BranchId)) $o['BranchId'] = $this->BranchId;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
if (isset($this->RolesCreated)) $o['RolesCreated'] = JsonConverters::toArray('string', $this->RolesCreated);
if (isset($this->CatalogItemsSeeded)) $o['CatalogItemsSeeded'] = $this->CatalogItemsSeeded;
if (isset($this->OwnerAssigned)) $o['OwnerAssigned'] = $this->OwnerAssigned;
if (isset($this->OwnerEmail)) $o['OwnerEmail'] = $this->OwnerEmail;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class ProvisionTenantRequest implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Name=null,
/** @var string|null */
public ?string $Slug=null,
/** @var string|null */
public ?string $PackCode=null,
/** @var string|null */
public ?string $BranchName=null,
/** @var string|null */
public ?string $TimeZoneId=null,
/** @var bool|null */
public ?bool $SeedCatalog=null,
/** @var bool|null */
public ?bool $AssignMeAsOwner=null,
/** @var string|null */
public ?string $OwnerEmail=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Name'])) $this->Name = $o['Name'];
if (isset($o['Slug'])) $this->Slug = $o['Slug'];
if (isset($o['PackCode'])) $this->PackCode = $o['PackCode'];
if (isset($o['BranchName'])) $this->BranchName = $o['BranchName'];
if (isset($o['TimeZoneId'])) $this->TimeZoneId = $o['TimeZoneId'];
if (isset($o['SeedCatalog'])) $this->SeedCatalog = $o['SeedCatalog'];
if (isset($o['AssignMeAsOwner'])) $this->AssignMeAsOwner = $o['AssignMeAsOwner'];
if (isset($o['OwnerEmail'])) $this->OwnerEmail = $o['OwnerEmail'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Name)) $o['Name'] = $this->Name;
if (isset($this->Slug)) $o['Slug'] = $this->Slug;
if (isset($this->PackCode)) $o['PackCode'] = $this->PackCode;
if (isset($this->BranchName)) $o['BranchName'] = $this->BranchName;
if (isset($this->TimeZoneId)) $o['TimeZoneId'] = $this->TimeZoneId;
if (isset($this->SeedCatalog)) $o['SeedCatalog'] = $this->SeedCatalog;
if (isset($this->AssignMeAsOwner)) $o['AssignMeAsOwner'] = $this->AssignMeAsOwner;
if (isset($this->OwnerEmail)) $o['OwnerEmail'] = $this->OwnerEmail;
return empty($o) ? new class(){} : $o;
}
}
PHP ProvisionTenantRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/provision HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Name: String,
Slug: String,
PackCode: String,
BranchName: String,
TimeZoneId: String,
SeedCatalog: False,
AssignMeAsOwner: False,
OwnerEmail: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
TenantId: 00000000000000000000000000000000,
TenantName: String,
Slug: String,
PackCode: String,
BranchId: 00000000000000000000000000000000,
BranchName: String,
RolesCreated:
[
String
],
CatalogItemsSeeded: 0,
OwnerAssigned: False,
OwnerEmail: String,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}