GET | /account/register/template | Get a template to create a new account |
---|
<?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 ResponseError implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var string|null */
public ?string $errorCode=null,
// @DataMember(Order=2)
/** @var string|null */
public ?string $fieldName=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $message=null,
// @DataMember(Order=4)
/** @var array<string,string>|null */
public ?array $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
if (isset($o['fieldName'])) $this->fieldName = $o['fieldName'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
if (isset($this->fieldName)) $o['fieldName'] = $this->fieldName;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
/**
* @template array of ResponseError
*/
class ArrayOfResponseError extends \ArrayObject implements JsonSerializable
{
public function __construct(ResponseError ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof ResponseError)
parent::append($value);
else
throw new \Exception("Can only append a ResponseError to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new ResponseError();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
// @DataContract
class ResponseStatus implements JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var string|null */
public ?string $errorCode=null,
// @DataMember(Order=2)
/** @var string|null */
public ?string $message=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $stackTrace=null,
// @DataMember(Order=4)
/** @var ArrayOfResponseError|null */
public ?ArrayOfResponseError $errors=null,
// @DataMember(Order=5)
/** @var array<string,string>|null */
public ?array $meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['errorCode'])) $this->errorCode = $o['errorCode'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['stackTrace'])) $this->stackTrace = $o['stackTrace'];
if (isset($o['errors'])) $this->errors = JsonConverters::from('ArrayOfResponseError', $o['errors']);
if (isset($o['meta'])) $this->meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->errorCode)) $o['errorCode'] = $this->errorCode;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->stackTrace)) $o['stackTrace'] = $this->stackTrace;
if (isset($this->errors)) $o['errors'] = JsonConverters::to('ArrayOfResponseError', $this->errors);
if (isset($this->meta)) $o['meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->meta);
return empty($o) ? new class(){} : $o;
}
}
class BaseResponse implements IBaseDataResponse, IHasResponseStatus, JsonSerializable
{
public function __construct(
/** @description The status of the response */
// @ApiMember(Description="The status of the response")
/** @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;
}
}
class RegisterAccountRequest implements JsonSerializable
{
public function __construct(
/** @description The desired login username for the account */
// @ApiMember(Description="The desired login username for the account", IsRequired=true)
/** @var string */
public string $username='',
/** @description The password for account login */
// @ApiMember(Description="The password for account login", IsRequired=true)
/** @var string */
public string $password='',
/** @description The contact email address for the account holder */
// @ApiMember(Description="The contact email address for the account holder", IsRequired=true)
/** @var string */
public string $email='',
/** @description The full legal name of the account holder */
// @ApiMember(Description="The full legal name of the account holder", IsRequired=true)
/** @var string */
public string $fullName='',
/** @description The registered name of the company associated with this account */
// @ApiMember(Description="The registered name of the company associated with this account", IsRequired=true)
/** @var string */
public string $companyName='',
/** @description The primary contact phone number of the company */
// @ApiMember(Description="The primary contact phone number of the company", IsRequired=true)
/** @var string */
public string $companyPhone='',
/** @description The first line of the company’s address (e.g., street name and number) */
// @ApiMember(Description="The first line of the company’s address (e.g., street name and number)", IsRequired=true)
/** @var string */
public string $address1='',
/** @description The second line of the company’s address (optional) */
// @ApiMember(Description="The second line of the company’s address (optional)")
/** @var string|null */
public ?string $address2=null,
/** @description The third line of the company’s address (optional) */
// @ApiMember(Description="The third line of the company’s address (optional)")
/** @var string|null */
public ?string $address3=null,
/** @description The city where the company is located (optional) */
// @ApiMember(Description="The city where the company is located (optional)")
/** @var string|null */
public ?string $city=null,
/** @description The postal or ZIP code of the company’s address */
// @ApiMember(Description="The postal or ZIP code of the company’s address", IsRequired=true)
/** @var string */
public string $postcode='',
/** @description The country where the company is registered */
// @ApiMember(Description="The country where the company is registered", IsRequired=true)
/** @var string */
public string $country='',
/** @description The classification of the company (e.g., LLC, Corporation, Sole Proprietorship) */
// @ApiMember(Description="The classification of the company (e.g., LLC, Corporation, Sole Proprietorship)", IsRequired=true)
/** @var string */
public string $companyType='',
/** @description The industry sector the company operates in */
// @ApiMember(Description="The industry sector the company operates in", IsRequired=true)
/** @var string */
public string $companyIndustry='',
/** @description The trade body, network, or affiliation the company is a member of (if applicable) */
// @ApiMember(Description="The trade body, network, or affiliation the company is a member of (if applicable)")
/** @var string|null */
public ?string $companyNetwork=null,
/** @description Indicates agreement to the terms and conditions (required) */
// @ApiMember(Description="Indicates agreement to the terms and conditions (required)", IsRequired=true)
/** @var bool|null */
public ?bool $agreeToTerms=null,
/** @description Indicates agreement to the data protection statement (required) */
// @ApiMember(Description="Indicates agreement to the data protection statement (required)", IsRequired=true)
/** @var bool|null */
public ?bool $agreeToDataProtection=null,
/** @description Indicates consent to be contacted (optional) */
// @ApiMember(Description="Indicates consent to be contacted (optional)")
/** @var bool|null */
public ?bool $agreeToContact=null,
/** @description Indicates agreement to the privacy policy (required) */
// @ApiMember(Description="Indicates agreement to the privacy policy (required)", IsRequired=true)
/** @var bool|null */
public ?bool $agreeToPrivacy=null,
/** @description An optional voucher code for discounts or promotions */
// @ApiMember(Description="An optional voucher code for discounts or promotions")
/** @var string|null */
public ?string $voucherCode=null,
/** @description An optional code that grants access to certain features or subscriptions */
// @ApiMember(Description="An optional code that grants access to certain features or subscriptions")
/** @var string|null */
public ?string $accountActivationCode=null,
/** @description The company's VAT registration number (if applicable) */
// @ApiMember(Description="The company's VAT registration number (if applicable)")
/** @var string|null */
public ?string $vatNumber=null,
/** @description The country where the company is VAT-registered */
// @ApiMember(Description="The country where the company is VAT-registered")
/** @var string|null */
public ?string $vatCountry=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['username'])) $this->username = $o['username'];
if (isset($o['password'])) $this->password = $o['password'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['fullName'])) $this->fullName = $o['fullName'];
if (isset($o['companyName'])) $this->companyName = $o['companyName'];
if (isset($o['companyPhone'])) $this->companyPhone = $o['companyPhone'];
if (isset($o['address1'])) $this->address1 = $o['address1'];
if (isset($o['address2'])) $this->address2 = $o['address2'];
if (isset($o['address3'])) $this->address3 = $o['address3'];
if (isset($o['city'])) $this->city = $o['city'];
if (isset($o['postcode'])) $this->postcode = $o['postcode'];
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['companyType'])) $this->companyType = $o['companyType'];
if (isset($o['companyIndustry'])) $this->companyIndustry = $o['companyIndustry'];
if (isset($o['companyNetwork'])) $this->companyNetwork = $o['companyNetwork'];
if (isset($o['agreeToTerms'])) $this->agreeToTerms = $o['agreeToTerms'];
if (isset($o['agreeToDataProtection'])) $this->agreeToDataProtection = $o['agreeToDataProtection'];
if (isset($o['agreeToContact'])) $this->agreeToContact = $o['agreeToContact'];
if (isset($o['agreeToPrivacy'])) $this->agreeToPrivacy = $o['agreeToPrivacy'];
if (isset($o['voucherCode'])) $this->voucherCode = $o['voucherCode'];
if (isset($o['accountActivationCode'])) $this->accountActivationCode = $o['accountActivationCode'];
if (isset($o['vatNumber'])) $this->vatNumber = $o['vatNumber'];
if (isset($o['vatCountry'])) $this->vatCountry = $o['vatCountry'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->username)) $o['username'] = $this->username;
if (isset($this->password)) $o['password'] = $this->password;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->fullName)) $o['fullName'] = $this->fullName;
if (isset($this->companyName)) $o['companyName'] = $this->companyName;
if (isset($this->companyPhone)) $o['companyPhone'] = $this->companyPhone;
if (isset($this->address1)) $o['address1'] = $this->address1;
if (isset($this->address2)) $o['address2'] = $this->address2;
if (isset($this->address3)) $o['address3'] = $this->address3;
if (isset($this->city)) $o['city'] = $this->city;
if (isset($this->postcode)) $o['postcode'] = $this->postcode;
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->companyType)) $o['companyType'] = $this->companyType;
if (isset($this->companyIndustry)) $o['companyIndustry'] = $this->companyIndustry;
if (isset($this->companyNetwork)) $o['companyNetwork'] = $this->companyNetwork;
if (isset($this->agreeToTerms)) $o['agreeToTerms'] = $this->agreeToTerms;
if (isset($this->agreeToDataProtection)) $o['agreeToDataProtection'] = $this->agreeToDataProtection;
if (isset($this->agreeToContact)) $o['agreeToContact'] = $this->agreeToContact;
if (isset($this->agreeToPrivacy)) $o['agreeToPrivacy'] = $this->agreeToPrivacy;
if (isset($this->voucherCode)) $o['voucherCode'] = $this->voucherCode;
if (isset($this->accountActivationCode)) $o['accountActivationCode'] = $this->accountActivationCode;
if (isset($this->vatNumber)) $o['vatNumber'] = $this->vatNumber;
if (isset($this->vatCountry)) $o['vatCountry'] = $this->vatCountry;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template array of String
*/
class ArrayOfCountry extends \ArrayObject implements JsonSerializable
{
public function __construct(String ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof String)
parent::append($value);
else
throw new \Exception("Can only append a String to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new String();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
/**
* @template array of String
*/
class ArrayOfCompanyIndustry extends \ArrayObject implements JsonSerializable
{
public function __construct(String ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof String)
parent::append($value);
else
throw new \Exception("Can only append a String to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new String();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
/**
* @template array of String
*/
class ArrayOfCompanyType extends \ArrayObject implements JsonSerializable
{
public function __construct(String ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof String)
parent::append($value);
else
throw new \Exception("Can only append a String to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new String();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
/**
* @template array of String
*/
class ArrayOfVATCountry extends \ArrayObject implements JsonSerializable
{
public function __construct(String ...$items) {
parent::__construct($items, \ArrayObject::STD_PROP_LIST);
}
/** @throws \Exception */
public function append($value): void {
if ($value instanceof String)
parent::append($value);
else
throw new \Exception("Can only append a String to " . __CLASS__);
}
/** @throws Exception */
public function fromMap($o): void {
foreach ($o as $item) {
$el = new String();
$el->fromMap($item);
$this->append($el);
}
}
/** @throws Exception */
public function jsonSerialize(): array {
return parent::getArrayCopy();
}
}
class ReferenceData implements JsonSerializable
{
public function __construct(
/** @description A list of supported country values */
// @ApiMember(Description="A list of supported country values")
/** @var ArrayOfCountry|null */
public ?ArrayOfCountry $countries=null,
/** @description A list of valid industry classifications for companies */
// @ApiMember(Description="A list of valid industry classifications for companies")
/** @var ArrayOfCompanyIndustry|null */
public ?ArrayOfCompanyIndustry $companyIndustries=null,
/** @description A list of accepted company types */
// @ApiMember(Description="A list of accepted company types")
/** @var ArrayOfCompanyType|null */
public ?ArrayOfCompanyType $companyTypes=null,
/** @description A list of countries where VAT registration is recognized */
// @ApiMember(Description="A list of countries where VAT registration is recognized")
/** @var ArrayOfVATCountry|null */
public ?ArrayOfVATCountry $vatCountries=null,
/** @description A URL linking to the terms and conditions document */
// @ApiMember(Description="A URL linking to the terms and conditions document")
/** @var string|null */
public ?string $termsAndConditionsLink=null,
/** @description A URL linking to the privacy policy */
// @ApiMember(Description="A URL linking to the privacy policy")
/** @var string|null */
public ?string $privacyPolicyLink=null,
/** @description The statement regarding contact preferences */
// @ApiMember(Description="The statement regarding contact preferences")
/** @var string|null */
public ?string $contactStatement=null,
/** @description The statement outlining data protection policies */
// @ApiMember(Description="The statement outlining data protection policies")
/** @var string|null */
public ?string $dataProtectionStatement=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['countries'])) $this->countries = JsonConverters::from('ArrayOfCountry', $o['countries']);
if (isset($o['companyIndustries'])) $this->companyIndustries = JsonConverters::from('ArrayOfCompanyIndustry', $o['companyIndustries']);
if (isset($o['companyTypes'])) $this->companyTypes = JsonConverters::from('ArrayOfCompanyType', $o['companyTypes']);
if (isset($o['vatCountries'])) $this->vatCountries = JsonConverters::from('ArrayOfVATCountry', $o['vatCountries']);
if (isset($o['termsAndConditionsLink'])) $this->termsAndConditionsLink = $o['termsAndConditionsLink'];
if (isset($o['privacyPolicyLink'])) $this->privacyPolicyLink = $o['privacyPolicyLink'];
if (isset($o['contactStatement'])) $this->contactStatement = $o['contactStatement'];
if (isset($o['dataProtectionStatement'])) $this->dataProtectionStatement = $o['dataProtectionStatement'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->countries)) $o['countries'] = JsonConverters::to('ArrayOfCountry', $this->countries);
if (isset($this->companyIndustries)) $o['companyIndustries'] = JsonConverters::to('ArrayOfCompanyIndustry', $this->companyIndustries);
if (isset($this->companyTypes)) $o['companyTypes'] = JsonConverters::to('ArrayOfCompanyType', $this->companyTypes);
if (isset($this->vatCountries)) $o['vatCountries'] = JsonConverters::to('ArrayOfVATCountry', $this->vatCountries);
if (isset($this->termsAndConditionsLink)) $o['termsAndConditionsLink'] = $this->termsAndConditionsLink;
if (isset($this->privacyPolicyLink)) $o['privacyPolicyLink'] = $this->privacyPolicyLink;
if (isset($this->contactStatement)) $o['contactStatement'] = $this->contactStatement;
if (isset($this->dataProtectionStatement)) $o['dataProtectionStatement'] = $this->dataProtectionStatement;
return empty($o) ? new class(){} : $o;
}
}
class RegisterAccountTemplateData extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
/** @description The request body of the RegisterAccount endpoint */
// @ApiMember(Description="The request body of the RegisterAccount endpoint")
/** @var RegisterAccountRequest|null */
public ?RegisterAccountRequest $request=null,
/** @description Reference data to fill out the RegisterAccount body */
// @ApiMember(Description="Reference data to fill out the RegisterAccount body")
/** @var ReferenceData|null */
public ?ReferenceData $referenceData=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['request'])) $this->request = JsonConverters::from('RegisterAccountRequest', $o['request']);
if (isset($o['referenceData'])) $this->referenceData = JsonConverters::from('ReferenceData', $o['referenceData']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->request)) $o['request'] = JsonConverters::to('RegisterAccountRequest', $this->request);
if (isset($this->referenceData)) $o['referenceData'] = JsonConverters::to('ReferenceData', $this->referenceData);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class RegisterAccountTemplateResponse implements JsonSerializable
{
public function __construct(
/** @description The response data */
// @DataMember
// @ApiMember(Description="The response data")
/** @var RegisterAccountTemplateData|null */
public ?RegisterAccountTemplateData $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::from('RegisterAccountTemplateData', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::to('RegisterAccountTemplateData', $this->data);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class RegisterAccountTemplate implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
PHP RegisterAccountTemplate DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /account/register/template HTTP/1.1 Host: api.sanctionssearch.com Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <RegisterAccountTemplateResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Data> <ResponseStatus> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d6p1:KeyValueOfstringstring> <d6p1:Key>String</d6p1:Key> <d6p1:Value>String</d6p1:Value> </d6p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d4p1:KeyValueOfstringstring> <d4p1:Key>String</d4p1:Key> <d4p1:Value>String</d4p1:Value> </d4p1:KeyValueOfstringstring> </Meta> </ResponseStatus> <ReferenceData> <CompanyIndustries> <CompanyIndustry>String</CompanyIndustry> </CompanyIndustries> <CompanyTypes> <CompanyType>String</CompanyType> </CompanyTypes> <ContactStatement>String</ContactStatement> <Countries> <Country>String</Country> </Countries> <DataProtectionStatement>String</DataProtectionStatement> <PrivacyPolicyLink>String</PrivacyPolicyLink> <TermsAndConditionsLink>String</TermsAndConditionsLink> <VATCountries> <VATCountry>String</VATCountry> </VATCountries> </ReferenceData> <Request> <AccountActivationCode>String</AccountActivationCode> <Address1>String</Address1> <Address2>String</Address2> <Address3>String</Address3> <AgreeToContact>false</AgreeToContact> <AgreeToDataProtection>false</AgreeToDataProtection> <AgreeToPrivacy>false</AgreeToPrivacy> <AgreeToTerms>false</AgreeToTerms> <City>String</City> <CompanyIndustry>String</CompanyIndustry> <CompanyName>String</CompanyName> <CompanyNetwork>String</CompanyNetwork> <CompanyPhone>String</CompanyPhone> <CompanyType>String</CompanyType> <Country>String</Country> <Email>String</Email> <FullName>String</FullName> <Password>String</Password> <Postcode>String</Postcode> <Username>String</Username> <VATCountry>String</VATCountry> <VATNumber>String</VATNumber> <VoucherCode>String</VoucherCode> </Request> </Data> </RegisterAccountTemplateResponse>