| POST | /buyin | Create CPO Buy-in |
|---|
<?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 CreateBuyInResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $buyInOrderId=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['buyInOrderId'])) $this->buyInOrderId = $o['buyInOrderId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->buyInOrderId)) $o['buyInOrderId'] = $this->buyInOrderId;
return empty($o) ? new class(){} : $o;
}
}
class CreateBuyIn implements JsonSerializable
{
public function __construct(
/** @description Brand Trigram, e.g. CAR, IWC */
// @ApiMember(Description="Brand Trigram, e.g. CAR, IWC")
/** @var string */
public string $brand='',
/** @description POS Code */
// @ApiMember(Description="POS Code", IsRequired=true)
/** @var string */
public string $posCode='',
/** @description Article Code */
// @ApiMember(Description="Article Code", IsRequired=true)
/** @var string */
public string $articleCode='',
/** @description Serial Number */
// @ApiMember(Description="Serial Number")
/** @var string */
public string $serialNumber='',
/** @description Sales Representative Emails */
// @ApiMember(Description="Sales Representative Emails")
/** @var array<string>|null */
public ?array $saleRepresentativeEmails=null,
/** @description Buy-in creation date */
// @ApiMember(Description="Buy-in creation date", IsRequired=true)
/** @var DateTime */
public DateTime $buyInDate=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['articleCode'])) $this->articleCode = $o['articleCode'];
if (isset($o['serialNumber'])) $this->serialNumber = $o['serialNumber'];
if (isset($o['saleRepresentativeEmails'])) $this->saleRepresentativeEmails = JsonConverters::fromArray('string', $o['saleRepresentativeEmails']);
if (isset($o['buyInDate'])) $this->buyInDate = JsonConverters::from('DateTime', $o['buyInDate']);
}
/** @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->articleCode)) $o['articleCode'] = $this->articleCode;
if (isset($this->serialNumber)) $o['serialNumber'] = $this->serialNumber;
if (isset($this->saleRepresentativeEmails)) $o['saleRepresentativeEmails'] = JsonConverters::toArray('string', $this->saleRepresentativeEmails);
if (isset($this->buyInDate)) $o['buyInDate'] = JsonConverters::to('DateTime', $this->buyInDate);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /buyin HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"brand":"String","posCode":"String","articleCode":"String","serialNumber":"String","saleRepresentativeEmails":["String"],"buyInDate":"\/Date(-62135596800000-0000)\/"}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"buyInOrderId":0}