PUT | /unit | ||
---|---|---|---|
PUT | /unit/{Id} | ||
GET POST | /UpdateUnit | ||
GET POST | /UpdateUnit/{Id} |
<?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};
// @DataContract
class UpdateUnitResponse implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class UpdateUnit implements JsonSerializable
{
public function __construct(
// @DataMember
/** @var string|null */
public ?string $id=null,
// @DataMember
/** @var string|null */
public ?string $name=null,
// @DataMember
/** @var string|null */
public ?string $referenceNumber=null,
// @DataMember
/** @var string|null */
public ?string $clientId=null,
// @DataMember
/** @var string|null */
public ?string $categoryId=null,
// @DataMember
/** @var string|null */
public ?string $vehicleType=null,
// @DataMember
/** @var float|null */
public ?float $preKm=null,
// @DataMember
/** @var float|null */
public ?float $preRun1=null,
// @DataMember
/** @var float|null */
public ?float $preRun2=null,
// @DataMember
/** @var string|null */
public ?string $note=null,
// @DataMember
/** @var bool|null */
public ?bool $isActive=null,
// @DataMember
/** @var string|null */
public ?string $input1Name=null,
// @DataMember
/** @var string|null */
public ?string $input2Name=null,
// @DataMember
/** @var string|null */
public ?string $input3Name=null,
// @DataMember
/** @var string|null */
public ?string $input4Name=null,
// @DataMember
/** @var bool|null */
public ?bool $lock=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['referenceNumber'])) $this->referenceNumber = $o['referenceNumber'];
if (isset($o['clientId'])) $this->clientId = $o['clientId'];
if (isset($o['categoryId'])) $this->categoryId = $o['categoryId'];
if (isset($o['vehicleType'])) $this->vehicleType = $o['vehicleType'];
if (isset($o['preKm'])) $this->preKm = $o['preKm'];
if (isset($o['preRun1'])) $this->preRun1 = $o['preRun1'];
if (isset($o['preRun2'])) $this->preRun2 = $o['preRun2'];
if (isset($o['note'])) $this->note = $o['note'];
if (isset($o['isActive'])) $this->isActive = $o['isActive'];
if (isset($o['input1Name'])) $this->input1Name = $o['input1Name'];
if (isset($o['input2Name'])) $this->input2Name = $o['input2Name'];
if (isset($o['input3Name'])) $this->input3Name = $o['input3Name'];
if (isset($o['input4Name'])) $this->input4Name = $o['input4Name'];
if (isset($o['lock'])) $this->lock = $o['lock'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->referenceNumber)) $o['referenceNumber'] = $this->referenceNumber;
if (isset($this->clientId)) $o['clientId'] = $this->clientId;
if (isset($this->categoryId)) $o['categoryId'] = $this->categoryId;
if (isset($this->vehicleType)) $o['vehicleType'] = $this->vehicleType;
if (isset($this->preKm)) $o['preKm'] = $this->preKm;
if (isset($this->preRun1)) $o['preRun1'] = $this->preRun1;
if (isset($this->preRun2)) $o['preRun2'] = $this->preRun2;
if (isset($this->note)) $o['note'] = $this->note;
if (isset($this->isActive)) $o['isActive'] = $this->isActive;
if (isset($this->input1Name)) $o['input1Name'] = $this->input1Name;
if (isset($this->input2Name)) $o['input2Name'] = $this->input2Name;
if (isset($this->input3Name)) $o['input3Name'] = $this->input3Name;
if (isset($this->input4Name)) $o['input4Name'] = $this->input4Name;
if (isset($this->lock)) $o['lock'] = $this->lock;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /UpdateUnit HTTP/1.1
Host: api.trackunit.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"id":"String","name":"String","referenceNumber":"String","clientId":"String","categoryId":"String","vehicleType":"String","preKm":0,"preRun1":0,"preRun2":0,"note":"String","isActive":false,"input1Name":"String","input2Name":"String","input3Name":"String","input4Name":"String","lock":false}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}