Trendsic Platform Service

<back to all web services

QcTestResultRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/projects/{ProjectID}/qc-tests/{QcTestID}/result
<?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 QcTest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $QcTestID=0,
        /** @var string */
        public string $QcTestUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var string|null */
        public ?string $TestNo=null,
        /** @var string|null */
        public ?string $TestType=null,
        /** @var string|null */
        public ?string $Location=null,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var string|null */
        public ?string $Spec=null,
        /** @var string|null */
        public ?string $TargetValue=null,
        /** @var string|null */
        public ?string $ResultValue=null,
        /** @var string|null */
        public ?string $Result=null,
        /** @var string|null */
        public ?string $Lab=null,
        /** @var string|null */
        public ?string $ReportName=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var DateTime|null */
        public ?DateTime $TestedAt=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null,
        /** @var int */
        public int $NcrCount=0
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['QcTestID'])) $this->QcTestID = $o['QcTestID'];
        if (isset($o['QcTestUID'])) $this->QcTestUID = $o['QcTestUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['TestNo'])) $this->TestNo = $o['TestNo'];
        if (isset($o['TestType'])) $this->TestType = $o['TestType'];
        if (isset($o['Location'])) $this->Location = $o['Location'];
        if (isset($o['CostCode'])) $this->CostCode = $o['CostCode'];
        if (isset($o['Spec'])) $this->Spec = $o['Spec'];
        if (isset($o['TargetValue'])) $this->TargetValue = $o['TargetValue'];
        if (isset($o['ResultValue'])) $this->ResultValue = $o['ResultValue'];
        if (isset($o['Result'])) $this->Result = $o['Result'];
        if (isset($o['Lab'])) $this->Lab = $o['Lab'];
        if (isset($o['ReportName'])) $this->ReportName = $o['ReportName'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['TestedAt'])) $this->TestedAt = JsonConverters::from('DateTime', $o['TestedAt']);
        if (isset($o['CreatedBy'])) $this->CreatedBy = $o['CreatedBy'];
        if (isset($o['CreatedAt'])) $this->CreatedAt = JsonConverters::from('DateTime', $o['CreatedAt']);
        if (isset($o['UpdatedAt'])) $this->UpdatedAt = JsonConverters::from('DateTime', $o['UpdatedAt']);
        if (isset($o['NcrCount'])) $this->NcrCount = $o['NcrCount'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->QcTestID)) $o['QcTestID'] = $this->QcTestID;
        if (isset($this->QcTestUID)) $o['QcTestUID'] = $this->QcTestUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->TestNo)) $o['TestNo'] = $this->TestNo;
        if (isset($this->TestType)) $o['TestType'] = $this->TestType;
        if (isset($this->Location)) $o['Location'] = $this->Location;
        if (isset($this->CostCode)) $o['CostCode'] = $this->CostCode;
        if (isset($this->Spec)) $o['Spec'] = $this->Spec;
        if (isset($this->TargetValue)) $o['TargetValue'] = $this->TargetValue;
        if (isset($this->ResultValue)) $o['ResultValue'] = $this->ResultValue;
        if (isset($this->Result)) $o['Result'] = $this->Result;
        if (isset($this->Lab)) $o['Lab'] = $this->Lab;
        if (isset($this->ReportName)) $o['ReportName'] = $this->ReportName;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->TestedAt)) $o['TestedAt'] = JsonConverters::to('DateTime', $this->TestedAt);
        if (isset($this->CreatedBy)) $o['CreatedBy'] = $this->CreatedBy;
        if (isset($this->CreatedAt)) $o['CreatedAt'] = JsonConverters::to('DateTime', $this->CreatedAt);
        if (isset($this->UpdatedAt)) $o['UpdatedAt'] = JsonConverters::to('DateTime', $this->UpdatedAt);
        if (isset($this->NcrCount)) $o['NcrCount'] = $this->NcrCount;
        return empty($o) ? new class(){} : $o;
    }
}

class QcTestResponse implements JsonSerializable
{
    public function __construct(
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,
        /** @var QcTest|null */
        public ?QcTest $Test=null
    ) {
    }

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

class QcTestResultRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var int */
        public int $QcTestID=0,
        /** @var string|null */
        public ?string $Result=null,
        /** @var string|null */
        public ?string $ResultValue=null
    ) {
    }

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

PHP QcTestResultRequest 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/projects/{ProjectID}/qc-tests/{QcTestID}/result HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ProjectID: 0,
	QcTestID: 0,
	Result: String,
	ResultValue: String
}
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
		}
	},
	Test: 
	{
		QcTestID: 0,
		QcTestUID: 00000000000000000000000000000000,
		ProjectID: 0,
		TestNo: String,
		TestType: String,
		Location: String,
		CostCode: String,
		Spec: String,
		TargetValue: String,
		ResultValue: String,
		Result: String,
		Lab: String,
		ReportName: String,
		Notes: String,
		TestedAt: 0001-01-01,
		CreatedBy: String,
		CreatedAt: 0001-01-01,
		UpdatedAt: 0001-01-01,
		NcrCount: 0
	}
}