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 Authentication implements JsonSerializable
{
public function __construct(
/** @description The API User ID provided by us when you signed up to use our API */
// @DataMember
// @ApiMember(Description="The API User ID provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
/** @var string */
public string $apiUserId='',
/** @description The API User Key provided by us when you signed up to use our API */
// @DataMember
// @ApiMember(Description="The API User Key provided by us when you signed up to use our API", IsRequired=true, ParameterType="header, body")
/** @var string */
public string $apiUserKey=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['apiUserId'])) $this->apiUserId = $o['apiUserId'];
if (isset($o['apiUserKey'])) $this->apiUserKey = $o['apiUserKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->apiUserId)) $o['apiUserId'] = $this->apiUserId;
if (isset($this->apiUserKey)) $o['apiUserKey'] = $this->apiUserKey;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class BaseRequest implements IBaseRequest, JsonSerializable
{
public function __construct(
/** @description The authentication credentials */
// @DataMember
// @ApiMember(Description="The authentication credentials", IsRequired=true, ParameterType="header, body")
/** @var Authentication|null */
public ?Authentication $authentication=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['authentication'])) $this->authentication = JsonConverters::from('Authentication', $o['authentication']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->authentication)) $o['authentication'] = JsonConverters::to('Authentication', $this->authentication);
return empty($o) ? new class(){} : $o;
}
}
// @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 RegisterAccountData extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
/** @description A unique identifier for the users API access */
// @ApiMember(Description="A unique identifier for the users API access")
/** @var string|null */
public ?string $apiUserId=null,
/** @description A secure, randomly generated key used for API authentication */
// @ApiMember(Description="A secure, randomly generated key used for API authentication")
/** @var string|null */
public ?string $apiUserKey=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['apiUserId'])) $this->apiUserId = $o['apiUserId'];
if (isset($o['apiUserKey'])) $this->apiUserKey = $o['apiUserKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->apiUserId)) $o['apiUserId'] = $this->apiUserId;
if (isset($this->apiUserKey)) $o['apiUserKey'] = $this->apiUserKey;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class RegisterAccountResponse implements JsonSerializable
{
public function __construct(
/** @description The response data */
// @DataMember
// @ApiMember(Description="The response data")
/** @var RegisterAccountData|null */
public ?RegisterAccountData $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::from('RegisterAccountData', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::to('RegisterAccountData', $this->data);
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;
}
}
// @DataContract
class RegisterAccount extends BaseRequest implements JsonSerializable
{
/**
* @param Authentication|null $authentication
*/
public function __construct(
?Authentication $authentication=null,
// @DataMember
/** @var RegisterAccountRequest|null */
public ?RegisterAccountRequest $request=null
) {
parent::__construct($authentication);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['request'])) $this->request = JsonConverters::from('RegisterAccountRequest', $o['request']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->request)) $o['request'] = JsonConverters::to('RegisterAccountRequest', $this->request);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .soap11 suffix or ?format=soap11
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /soap11 HTTP/1.1
Host: api.sanctionssearch.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: RegisterAccount
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<RegisterAccount xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Authentication>
<ApiUserId>String</ApiUserId>
<ApiUserKey>String</ApiUserKey>
</Authentication>
<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>
</RegisterAccount>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <RegisterAccountResponse 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> <ApiUserId>String</ApiUserId> <ApiUserKey>String</ApiUserKey> </Data> </RegisterAccountResponse> </soap:Body> </soap:Envelope>