Trendsic Platform Service

<back to all web services

QcTestCreateRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/projects/{ProjectID}/qc-tests
<?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 QcTestCreateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @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 $Notes=null,
        /** @var DateTime|null */
        public ?DateTime $TestedAt=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        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['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['TestedAt'])) $this->TestedAt = JsonConverters::from('DateTime', $o['TestedAt']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        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->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->TestedAt)) $o['TestedAt'] = JsonConverters::to('DateTime', $this->TestedAt);
        return empty($o) ? new class(){} : $o;
    }
}

PHP QcTestCreateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/projects/{ProjectID}/qc-tests HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<QcTestCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <CostCode>String</CostCode>
  <Lab>String</Lab>
  <Location>String</Location>
  <Notes>String</Notes>
  <ProjectID>0</ProjectID>
  <Result>String</Result>
  <ResultValue>String</ResultValue>
  <Spec>String</Spec>
  <TargetValue>String</TargetValue>
  <TestType>String</TestType>
  <TestedAt>0001-01-01T00:00:00</TestedAt>
</QcTestCreateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<QcTestResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Test>
    <CostCode>String</CostCode>
    <CreatedAt>0001-01-01T00:00:00</CreatedAt>
    <CreatedBy>String</CreatedBy>
    <Lab>String</Lab>
    <Location>String</Location>
    <NcrCount>0</NcrCount>
    <Notes>String</Notes>
    <ProjectID>0</ProjectID>
    <QcTestID>0</QcTestID>
    <QcTestUID>00000000-0000-0000-0000-000000000000</QcTestUID>
    <ReportName>String</ReportName>
    <Result>String</Result>
    <ResultValue>String</ResultValue>
    <Spec>String</Spec>
    <TargetValue>String</TargetValue>
    <TestNo>String</TestNo>
    <TestType>String</TestType>
    <TestedAt>0001-01-01T00:00:00</TestedAt>
    <UpdatedAt>0001-01-01T00:00:00</UpdatedAt>
  </Test>
</QcTestResponse>