Trendsic Platform Service

<back to all web services

NcrUpdateRequest

Requires Authentication
The following routes are available for this service:
PUT,OPTIONS/v1/projects/{ProjectID}/ncrs/{NcrID}
<?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 Ncr implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $NcrID=0,
        /** @var string */
        public string $NcrUID='',
        /** @var int */
        public int $ProjectID=0,
        /** @var int|null */
        public ?int $QcTestID=null,
        /** @var string|null */
        public ?string $NcrNo=null,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var string|null */
        public ?string $Disposition=null,
        /** @var string|null */
        public ?string $DispositionType=null,
        /** @var string|null */
        public ?string $CorrectiveAction=null,
        /** @var string|null */
        public ?string $DispositionedBy=null,
        /** @var DateTime|null */
        public ?DateTime $DispositionedAt=null,
        /** @var string|null */
        public ?string $CreatedBy=null,
        /** @var DateTime|null */
        public ?DateTime $CreatedAt=null,
        /** @var DateTime|null */
        public ?DateTime $UpdatedAt=null,
        /** @var string|null */
        public ?string $TestNo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['NcrID'])) $this->NcrID = $o['NcrID'];
        if (isset($o['NcrUID'])) $this->NcrUID = $o['NcrUID'];
        if (isset($o['ProjectID'])) $this->ProjectID = $o['ProjectID'];
        if (isset($o['QcTestID'])) $this->QcTestID = $o['QcTestID'];
        if (isset($o['NcrNo'])) $this->NcrNo = $o['NcrNo'];
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
        if (isset($o['CostCode'])) $this->CostCode = $o['CostCode'];
        if (isset($o['Disposition'])) $this->Disposition = $o['Disposition'];
        if (isset($o['DispositionType'])) $this->DispositionType = $o['DispositionType'];
        if (isset($o['CorrectiveAction'])) $this->CorrectiveAction = $o['CorrectiveAction'];
        if (isset($o['DispositionedBy'])) $this->DispositionedBy = $o['DispositionedBy'];
        if (isset($o['DispositionedAt'])) $this->DispositionedAt = JsonConverters::from('DateTime', $o['DispositionedAt']);
        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['TestNo'])) $this->TestNo = $o['TestNo'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->NcrID)) $o['NcrID'] = $this->NcrID;
        if (isset($this->NcrUID)) $o['NcrUID'] = $this->NcrUID;
        if (isset($this->ProjectID)) $o['ProjectID'] = $this->ProjectID;
        if (isset($this->QcTestID)) $o['QcTestID'] = $this->QcTestID;
        if (isset($this->NcrNo)) $o['NcrNo'] = $this->NcrNo;
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        if (isset($this->CostCode)) $o['CostCode'] = $this->CostCode;
        if (isset($this->Disposition)) $o['Disposition'] = $this->Disposition;
        if (isset($this->DispositionType)) $o['DispositionType'] = $this->DispositionType;
        if (isset($this->CorrectiveAction)) $o['CorrectiveAction'] = $this->CorrectiveAction;
        if (isset($this->DispositionedBy)) $o['DispositionedBy'] = $this->DispositionedBy;
        if (isset($this->DispositionedAt)) $o['DispositionedAt'] = JsonConverters::to('DateTime', $this->DispositionedAt);
        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->TestNo)) $o['TestNo'] = $this->TestNo;
        return empty($o) ? new class(){} : $o;
    }
}

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

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

class NcrUpdateRequest implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $ProjectID=0,
        /** @var int */
        public int $NcrID=0,
        /** @var string|null */
        public ?string $Title=null,
        /** @var string|null */
        public ?string $Description=null,
        /** @var string|null */
        public ?string $CostCode=null,
        /** @var string|null */
        public ?string $CorrectiveAction=null
    ) {
    }

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

PHP NcrUpdateRequest 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.

PUT /v1/projects/{ProjectID}/ncrs/{NcrID} HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ProjectID: 0,
	NcrID: 0,
	Title: String,
	Description: String,
	CostCode: String,
	CorrectiveAction: 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
		}
	},
	Ncr: 
	{
		NcrID: 0,
		NcrUID: 00000000000000000000000000000000,
		ProjectID: 0,
		QcTestID: 0,
		NcrNo: String,
		Title: String,
		Description: String,
		CostCode: String,
		Disposition: String,
		DispositionType: String,
		CorrectiveAction: String,
		DispositionedBy: String,
		DispositionedAt: 0001-01-01,
		CreatedBy: String,
		CreatedAt: 0001-01-01,
		UpdatedAt: 0001-01-01,
		TestNo: String
	}
}