| POST | /warranty/v1/ValidatePostalAddress |
|---|
<?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};
/**
* @template TResponse
*/
class BaseRequest implements IRequest, JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): BaseRequest {
$to = new BaseRequest();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var string|null */
public mixed $sid=null,
/** @var string|null */
public mixed $app=null,
/** @var string|null */
public mixed $_os=null,
/** @var string|null */
public mixed $_appVersion=null,
/** @var string|null */
public mixed $_searchMethod=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['sid'])) $this->sid = $o['sid'];
if (isset($o['app'])) $this->app = $o['app'];
if (isset($o['_os'])) $this->_os = $o['_os'];
if (isset($o['_appVersion'])) $this->_appVersion = $o['_appVersion'];
if (isset($o['_searchMethod'])) $this->_searchMethod = $o['_searchMethod'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->sid)) $o['sid'] = $this->sid;
if (isset($this->app)) $o['app'] = $this->app;
if (isset($this->_os)) $o['_os'] = $this->_os;
if (isset($this->_appVersion)) $o['_appVersion'] = $this->_appVersion;
if (isset($this->_searchMethod)) $o['_searchMethod'] = $this->_searchMethod;
return empty($o) ? new class(){} : $o;
}
}
class BaseResponse implements IRespose, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $_xmlns=null,
/** @var string|null */
public ?string $_type=null,
/** @var string|null */
public ?string $_source=null,
/** @var string|null */
public ?string $_tstamp=null,
/** @var string|null */
public ?string $_user=null,
/** @var string|null */
public ?string $_env=null,
/** @var string|null */
public ?string $_uri=null,
/** @var string|null */
public ?string $_query=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['_xmlns'])) $this->_xmlns = $o['_xmlns'];
if (isset($o['_type'])) $this->_type = $o['_type'];
if (isset($o['_source'])) $this->_source = $o['_source'];
if (isset($o['_tstamp'])) $this->_tstamp = $o['_tstamp'];
if (isset($o['_user'])) $this->_user = $o['_user'];
if (isset($o['_env'])) $this->_env = $o['_env'];
if (isset($o['_uri'])) $this->_uri = $o['_uri'];
if (isset($o['_query'])) $this->_query = $o['_query'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->_xmlns)) $o['_xmlns'] = $this->_xmlns;
if (isset($this->_type)) $o['_type'] = $this->_type;
if (isset($this->_source)) $o['_source'] = $this->_source;
if (isset($this->_tstamp)) $o['_tstamp'] = $this->_tstamp;
if (isset($this->_user)) $o['_user'] = $this->_user;
if (isset($this->_env)) $o['_env'] = $this->_env;
if (isset($this->_uri)) $o['_uri'] = $this->_uri;
if (isset($this->_query)) $o['_query'] = $this->_query;
return empty($o) ? new class(){} : $o;
}
}
class status implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $errorCode=null,
/** @var string|null */
public ?string $validationStatusCode=null,
/** @var int */
public int $statusId=0,
/** @var string|null */
public ?string $errorDescription=null,
/** @var string|null */
public ?string $statusDescription=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
if (isset($o['validationStatusCode'])) $this->validationStatusCode = $o['validationStatusCode'];
if (isset($o['statusId'])) $this->statusId = $o['statusId'];
if (isset($o['errorDescription'])) $this->errorDescription = $o['errorDescription'];
if (isset($o['statusDescription'])) $this->statusDescription = $o['statusDescription'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
if (isset($this->validationStatusCode)) $o['validationStatusCode'] = $this->validationStatusCode;
if (isset($this->statusId)) $o['statusId'] = $this->statusId;
if (isset($this->errorDescription)) $o['errorDescription'] = $this->errorDescription;
if (isset($this->statusDescription)) $o['statusDescription'] = $this->statusDescription;
return empty($o) ? new class(){} : $o;
}
}
class suggestion implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $zipCode=null,
/** @var string|null */
public ?string $regionId=null,
/** @var string|null */
public ?string $regionDescription=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $street=null,
/** @var string|null */
public ?string $houseNumber=null,
/** @var string|null */
public ?string $countryId=null,
/** @var string|null */
public ?string $countryDescription=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['zipCode'])) $this->zipCode = $o['zipCode'];
if (isset($o['regionId'])) $this->regionId = $o['regionId'];
if (isset($o['regionDescription'])) $this->regionDescription = $o['regionDescription'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['houseNumber'])) $this->houseNumber = $o['houseNumber'];
if (isset($o['countryId'])) $this->countryId = $o['countryId'];
if (isset($o['countryDescription'])) $this->countryDescription = $o['countryDescription'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->zipCode)) $o['zipCode'] = $this->zipCode;
if (isset($this->regionId)) $o['regionId'] = $this->regionId;
if (isset($this->regionDescription)) $o['regionDescription'] = $this->regionDescription;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->houseNumber)) $o['houseNumber'] = $this->houseNumber;
if (isset($this->countryId)) $o['countryId'] = $this->countryId;
if (isset($this->countryDescription)) $o['countryDescription'] = $this->countryDescription;
return empty($o) ? new class(){} : $o;
}
}
class ValidatePostalAddressResponse extends BaseResponse implements JsonSerializable
{
/**
* @param string|null $_xmlns
* @param string|null $_type
* @param string|null $_source
* @param string|null $_tstamp
* @param string|null $_user
* @param string|null $_env
* @param string|null $_uri
* @param string|null $_query
*/
public function __construct(
?string $_xmlns=null,
?string $_type=null,
?string $_source=null,
?string $_tstamp=null,
?string $_user=null,
?string $_env=null,
?string $_uri=null,
?string $_query=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
/** @var status|null */
public ?status $status=null,
/** @var suggestion|null */
public ?suggestion $suggestion=null
) {
parent::__construct($_xmlns,$_type,$_source,$_tstamp,$_user,$_env,$_uri,$_query);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['status'])) $this->status = JsonConverters::from('status', $o['status']);
if (isset($o['suggestion'])) $this->suggestion = JsonConverters::from('suggestion', $o['suggestion']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->status)) $o['status'] = JsonConverters::to('status', $this->status);
if (isset($this->suggestion)) $o['suggestion'] = JsonConverters::to('suggestion', $this->suggestion);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template BaseRequest of ValidatePostalAddressResponse
*/
class ValidatePostalAddress extends BaseRequest implements JsonSerializable
{
/**
* @param string|null $sid
* @param string|null $app
* @param string|null $_os
* @param string|null $_appVersion
* @param string|null $_searchMethod
*/
public function __construct(
?string $sid=null,
?string $app=null,
?string $_os=null,
?string $_appVersion=null,
?string $_searchMethod=null,
/** @var string|null */
public ?string $zipCode=null,
/** @var string|null */
public ?string $region=null,
/** @var string|null */
public ?string $city=null,
/** @var string|null */
public ?string $street=null,
/** @var string|null */
public ?string $houseNumber=null,
/** @var string|null */
public ?string $countryId=null
) {
parent::__construct($sid,$app,$_os,$_appVersion,$_searchMethod);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['zipCode'])) $this->zipCode = $o['zipCode'];
if (isset($o['region'])) $this->region = $o['region'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['street'])) $this->street = $o['street'];
if (isset($o['houseNumber'])) $this->houseNumber = $o['houseNumber'];
if (isset($o['countryId'])) $this->countryId = $o['countryId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->zipCode)) $o['zipCode'] = $this->zipCode;
if (isset($this->region)) $o['region'] = $this->region;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->street)) $o['street'] = $this->street;
if (isset($this->houseNumber)) $o['houseNumber'] = $this->houseNumber;
if (isset($this->countryId)) $o['countryId'] = $this->countryId;
return empty($o) ? new class(){} : $o;
}
}
PHP ValidatePostalAddress DTOs
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 /warranty/v1/ValidatePostalAddress HTTP/1.1
Host: qp-microservices-booster.richemont.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"zipCode":"String","region":"String","city":"String","street":"String","houseNumber":"String","countryId":"String","sid":"String","app":"String","_os":"String","_appVersion":"String","_searchMethod":"String"}
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"}},"status":{"errorCode":"String","validationStatusCode":"String","statusId":0,"errorDescription":"String","statusDescription":"String"},"suggestion":{"zipCode":"String","regionId":"String","regionDescription":"String","city":"String","street":"String","houseNumber":"String","countryId":"String","countryDescription":"String"},"_xmlns":"String","_type":"String","_source":"String","_tstamp":"String","_user":"String","_env":"String","_uri":"String","_query":"String"}