| POST | /warranty/equipment | Create Equipment Warranty | Create Equipment Warranty API |
|---|
<?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 CreateEquipmentWarrantyResponse implements JsonSerializable
{
public function __construct(
/** @description Equipment number */
// @ApiMember(Description="Equipment number", IsRequired=true)
/** @var string */
public string $equipment='',
/** @description Warranty type */
// @ApiMember(Description="Warranty type", IsRequired=true)
/** @var string */
public string $warrantyType='',
/** @description Master warranty */
// @ApiMember(Description="Master warranty", IsRequired=true)
/** @var string */
public string $masterWarranty='',
/** @description Warranty start date */
// @ApiMember(Description="Warranty start date", IsRequired=true)
/** @var string */
public string $warrantyStartDate='',
/** @description Warranty end date */
// @ApiMember(Description="Warranty end date")
/** @var string|null */
public ?string $warrantyEndDate=null,
/** @description Warranty creation date */
// @ApiMember(Description="Warranty creation date", IsRequired=true)
/** @var string */
public string $warrantyCreationDate='',
/** @description Warranty creation time */
// @ApiMember(Description="Warranty creation time", IsRequired=true)
/** @var string */
public string $warrantyCreationTime='',
/** @description Object number (ERP) */
// @ApiMember(Description="Object number (ERP)", IsRequired=true)
/** @var string */
public string $objectNumber=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['equipment'])) $this->equipment = $o['equipment'];
if (isset($o['warrantyType'])) $this->warrantyType = $o['warrantyType'];
if (isset($o['masterWarranty'])) $this->masterWarranty = $o['masterWarranty'];
if (isset($o['warrantyStartDate'])) $this->warrantyStartDate = $o['warrantyStartDate'];
if (isset($o['warrantyEndDate'])) $this->warrantyEndDate = $o['warrantyEndDate'];
if (isset($o['warrantyCreationDate'])) $this->warrantyCreationDate = $o['warrantyCreationDate'];
if (isset($o['warrantyCreationTime'])) $this->warrantyCreationTime = $o['warrantyCreationTime'];
if (isset($o['objectNumber'])) $this->objectNumber = $o['objectNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->equipment)) $o['equipment'] = $this->equipment;
if (isset($this->warrantyType)) $o['warrantyType'] = $this->warrantyType;
if (isset($this->masterWarranty)) $o['masterWarranty'] = $this->masterWarranty;
if (isset($this->warrantyStartDate)) $o['warrantyStartDate'] = $this->warrantyStartDate;
if (isset($this->warrantyEndDate)) $o['warrantyEndDate'] = $this->warrantyEndDate;
if (isset($this->warrantyCreationDate)) $o['warrantyCreationDate'] = $this->warrantyCreationDate;
if (isset($this->warrantyCreationTime)) $o['warrantyCreationTime'] = $this->warrantyCreationTime;
if (isset($this->objectNumber)) $o['objectNumber'] = $this->objectNumber;
return empty($o) ? new class(){} : $o;
}
}
class CreateEquipmentWarranty implements JsonSerializable
{
public function __construct(
/** @description Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided */
// @ApiMember(Description="Brand Trigram, e.g. CAR, IWC; compulsory only if articleCode is not provided")
/** @var string|null */
public ?string $brand=null,
/** @description Richemont POS code */
// @ApiMember(Description="Richemont POS code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Equipment */
// @ApiMember(Description="Equipment", IsRequired=true)
/** @var string */
public string $equipment='',
/** @description Warranty type */
// @ApiMember(Description="Warranty type", IsRequired=true)
/** @var string */
public string $warrantyType='',
/** @description Date of the warranty start date e.g. 2025-06-01 */
// @ApiMember(Description="Date of the warranty start date e.g. 2025-06-01", IsRequired=true)
/** @var DateTime */
public DateTime $warrantyStartDate=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['brand'])) $this->brand = $o['brand'];
if (isset($o['posCode'])) $this->posCode = $o['posCode'];
if (isset($o['equipment'])) $this->equipment = $o['equipment'];
if (isset($o['warrantyType'])) $this->warrantyType = $o['warrantyType'];
if (isset($o['warrantyStartDate'])) $this->warrantyStartDate = JsonConverters::from('DateTime', $o['warrantyStartDate']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->brand)) $o['brand'] = $this->brand;
if (isset($this->posCode)) $o['posCode'] = $this->posCode;
if (isset($this->equipment)) $o['equipment'] = $this->equipment;
if (isset($this->warrantyType)) $o['warrantyType'] = $this->warrantyType;
if (isset($this->warrantyStartDate)) $o['warrantyStartDate'] = JsonConverters::to('DateTime', $this->warrantyStartDate);
return empty($o) ? new class(){} : $o;
}
}
PHP CreateEquipmentWarranty DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /warranty/equipment HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
brand: String,
posCode: String,
equipment: String,
warrantyType: String,
warrantyStartDate: 0001-01-01
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
equipment: String,
warrantyType: String,
masterWarranty: String,
warrantyStartDate: String,
warrantyEndDate: String,
warrantyCreationDate: String,
warrantyCreationTime: String,
objectNumber: String
}