Trendsic Platform Service

<back to all web services

CadRenderRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/cad/{AttachmentId}/render
<?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 CadDerivative implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $CadDerivativeID=0,
        /** @var string */
        public string $AttachmentId='',
        /** @var int */
        public int $VersionNo=0,
        /** @var string|null */
        public ?string $Urn=null,
        /** @var string|null */
        public ?string $ObjectKey=null,
        /** @var string|null */
        public ?string $Status=null,
        /** @var int */
        public int $Progress=0,
        /** @var string|null */
        public ?string $StageLabel=null,
        /** @var bool|null */
        public ?bool $Has2d=null,
        /** @var bool|null */
        public ?bool $Has3d=null,
        /** @var bool|null */
        public ?bool $HasPdf=null,
        /** @var string|null */
        public ?string $ThumbKey=null,
        /** @var string|null */
        public ?string $ThumbUrl=null,
        /** @var string|null */
        public ?string $PdfAttachmentId=null,
        /** @var string|null */
        public ?string $ErrorText=null,
        /** @var string|null */
        public ?string $RequestedBy=null,
        /** @var DateTime|null */
        public ?DateTime $RequestedAt=null,
        /** @var DateTime|null */
        public ?DateTime $FinishedAt=null,
        /** @var int */
        public int $AgeSeconds=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CadDerivativeID'])) $this->CadDerivativeID = $o['CadDerivativeID'];
        if (isset($o['AttachmentId'])) $this->AttachmentId = $o['AttachmentId'];
        if (isset($o['VersionNo'])) $this->VersionNo = $o['VersionNo'];
        if (isset($o['Urn'])) $this->Urn = $o['Urn'];
        if (isset($o['ObjectKey'])) $this->ObjectKey = $o['ObjectKey'];
        if (isset($o['Status'])) $this->Status = $o['Status'];
        if (isset($o['Progress'])) $this->Progress = $o['Progress'];
        if (isset($o['StageLabel'])) $this->StageLabel = $o['StageLabel'];
        if (isset($o['Has2d'])) $this->Has2d = $o['Has2d'];
        if (isset($o['Has3d'])) $this->Has3d = $o['Has3d'];
        if (isset($o['HasPdf'])) $this->HasPdf = $o['HasPdf'];
        if (isset($o['ThumbKey'])) $this->ThumbKey = $o['ThumbKey'];
        if (isset($o['ThumbUrl'])) $this->ThumbUrl = $o['ThumbUrl'];
        if (isset($o['PdfAttachmentId'])) $this->PdfAttachmentId = $o['PdfAttachmentId'];
        if (isset($o['ErrorText'])) $this->ErrorText = $o['ErrorText'];
        if (isset($o['RequestedBy'])) $this->RequestedBy = $o['RequestedBy'];
        if (isset($o['RequestedAt'])) $this->RequestedAt = JsonConverters::from('DateTime', $o['RequestedAt']);
        if (isset($o['FinishedAt'])) $this->FinishedAt = JsonConverters::from('DateTime', $o['FinishedAt']);
        if (isset($o['AgeSeconds'])) $this->AgeSeconds = $o['AgeSeconds'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CadDerivativeID)) $o['CadDerivativeID'] = $this->CadDerivativeID;
        if (isset($this->AttachmentId)) $o['AttachmentId'] = $this->AttachmentId;
        if (isset($this->VersionNo)) $o['VersionNo'] = $this->VersionNo;
        if (isset($this->Urn)) $o['Urn'] = $this->Urn;
        if (isset($this->ObjectKey)) $o['ObjectKey'] = $this->ObjectKey;
        if (isset($this->Status)) $o['Status'] = $this->Status;
        if (isset($this->Progress)) $o['Progress'] = $this->Progress;
        if (isset($this->StageLabel)) $o['StageLabel'] = $this->StageLabel;
        if (isset($this->Has2d)) $o['Has2d'] = $this->Has2d;
        if (isset($this->Has3d)) $o['Has3d'] = $this->Has3d;
        if (isset($this->HasPdf)) $o['HasPdf'] = $this->HasPdf;
        if (isset($this->ThumbKey)) $o['ThumbKey'] = $this->ThumbKey;
        if (isset($this->ThumbUrl)) $o['ThumbUrl'] = $this->ThumbUrl;
        if (isset($this->PdfAttachmentId)) $o['PdfAttachmentId'] = $this->PdfAttachmentId;
        if (isset($this->ErrorText)) $o['ErrorText'] = $this->ErrorText;
        if (isset($this->RequestedBy)) $o['RequestedBy'] = $this->RequestedBy;
        if (isset($this->RequestedAt)) $o['RequestedAt'] = JsonConverters::to('DateTime', $this->RequestedAt);
        if (isset($this->FinishedAt)) $o['FinishedAt'] = JsonConverters::to('DateTime', $this->FinishedAt);
        if (isset($this->AgeSeconds)) $o['AgeSeconds'] = $this->AgeSeconds;
        return empty($o) ? new class(){} : $o;
    }
}

class CadRenderResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var CadDerivative|null */
        public ?CadDerivative $Derivative=null
    ) {
    }

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

class CadRenderRequest implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $AttachmentId='',
        /** @var int|null */
        public ?int $VersionNo=null
    ) {
    }

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

PHP CadRenderRequest 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/cad/{AttachmentId}/render HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	AttachmentId: 00000000000000000000000000000000,
	VersionNo: 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
		}
	},
	Derivative: 
	{
		CadDerivativeID: 0,
		AttachmentId: 00000000000000000000000000000000,
		VersionNo: 0,
		Urn: String,
		ObjectKey: String,
		Status: String,
		Progress: 0,
		StageLabel: String,
		Has2d: False,
		Has3d: False,
		HasPdf: False,
		ThumbKey: String,
		ThumbUrl: String,
		PdfAttachmentId: 00000000000000000000000000000000,
		ErrorText: String,
		RequestedBy: String,
		RequestedAt: 0001-01-01,
		FinishedAt: 0001-01-01,
		AgeSeconds: 0
	}
}