Sanctions Search API: v2

<back to all web services

AddClientTemplate

<?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;
    }
}

// @DataContract(Name="CreateMobileClientType", Namespace="http://schemas.servicestack.net/types")
enum CreateMobileClientType : string
{
    case Undefined = 'Undefined';
    case ValidateMe = 'ValidateMe';
    case PassportChipVerification = 'PassportChipVerification';
}

class ProofOfDocument implements JsonSerializable
{
    public function __construct(
        /** @description The ID of the ProofOfDocument */
        // @ApiMember(Description="The ID of the ProofOfDocument", IsRequired=true)
        /** @var int */
        public int $id=0,

        /** @description The name of the ProofOfDocument */
        // @ApiMember(Description="The name of the ProofOfDocument", IsRequired=true)
        /** @var string */
        public string $name=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of ProofOfDocument
 */
class ArrayOfProofOfDocuments extends \ArrayObject implements JsonSerializable
{
    public function __construct(ProofOfDocument ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof ProofOfDocument)
            parent::append($value);
        else
            throw new \Exception("Can only append a ProofOfDocument to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new ProofOfDocument();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

class ProofOfDocumentCategory implements JsonSerializable
{
    public function __construct(
        /** @description The ID of the ProofOfDocumentCategory */
        // @ApiMember(Description="The ID of the ProofOfDocumentCategory", IsRequired=true)
        /** @var int */
        public int $id=0,

        /** @description The category or subject that requires proof (e.g., 'Name', 'Address', 'Right to work') */
        // @ApiMember(Description="The category or subject that requires proof (e.g., 'Name', 'Address', 'Right to work')", IsRequired=true)
        /** @var string */
        public string $proofOf='',

        /** @description The documents that can be used to provide proof for the specified category. */
        // @ApiMember(Description="The documents that can be used to provide proof for the specified category.", IsRequired=true)
        /** @var ArrayOfProofOfDocuments|null */
        public ?ArrayOfProofOfDocuments $proofOfDocuments=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['proofOf'])) $this->proofOf = $o['proofOf'];
        if (isset($o['proofOfDocuments'])) $this->proofOfDocuments = JsonConverters::from('ArrayOfProofOfDocuments', $o['proofOfDocuments']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->proofOf)) $o['proofOf'] = $this->proofOf;
        if (isset($this->proofOfDocuments)) $o['proofOfDocuments'] = JsonConverters::to('ArrayOfProofOfDocuments', $this->proofOfDocuments);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of ProofOfDocumentCategory
 */
class ArrayOfProofOfDocumentCategories extends \ArrayObject implements JsonSerializable
{
    public function __construct(ProofOfDocumentCategory ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof ProofOfDocumentCategory)
            parent::append($value);
        else
            throw new \Exception("Can only append a ProofOfDocumentCategory to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new ProofOfDocumentCategory();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

class LinkedTo implements JsonSerializable
{
    public function __construct(
        /** @var int|null */
        public ?int $clientId=null,
        /** @var int|null */
        public ?int $id=null,
        /** @var string|null */
        public ?string $type=null,
        /** @var string|null */
        public ?string $subtype=null,
        /** @var string|null */
        public ?string $status=null,
        /** @var string|null */
        public ?string $description=null,
        /** @var bool|null */
        public ?bool $isArchived=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var DateTime|null */
        public ?DateTime $date=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['clientId'])) $this->clientId = $o['clientId'];
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['type'])) $this->type = $o['type'];
        if (isset($o['subtype'])) $this->subtype = $o['subtype'];
        if (isset($o['status'])) $this->status = $o['status'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['isArchived'])) $this->isArchived = $o['isArchived'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->clientId)) $o['clientId'] = $this->clientId;
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->type)) $o['type'] = $this->type;
        if (isset($this->subtype)) $o['subtype'] = $this->subtype;
        if (isset($this->status)) $o['status'] = $this->status;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->isArchived)) $o['isArchived'] = $this->isArchived;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of LinkedTo
 */
class ArrayOfLinkedTo extends \ArrayObject implements JsonSerializable
{
    public function __construct(LinkedTo ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof LinkedTo)
            parent::append($value);
        else
            throw new \Exception("Can only append a LinkedTo to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new LinkedTo();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

class AddClientRequest implements JsonSerializable
{
    public function __construct(
        /** @description The full name of the client */
        // @ApiMember(Description="The full name of the client", IsRequired=true)
        /** @var string */
        public string $name='',

        /** @description The email address of the client */
        // @ApiMember(Description="The email address of the client", IsRequired=true)
        /** @var string */
        public string $email='',

        /** @description The client's mobile phone number in international format (e.g. '+447123456789') */
        // @ApiMember(Description="The client's mobile phone number in international format (e.g. '+447123456789')", IsRequired=true)
        /** @var string */
        public string $mobileInternational='',

        /** @description The postal code of the client's address. Used in emails sent to the client to help them recognize the communication as genuine */
        // @ApiMember(Description="The postal code of the client's address. Used in emails sent to the client to help them recognize the communication as genuine", IsRequired=true)
        /** @var string */
        public string $postCode='',

        /** @description Specifies the type of ValidateMe preset. Possible values are 'ValidateMe' for configuring RequiredDocuments, or 'PassportChipVerification' for setting the Passport as Proof of Name */
        // @ApiMember(Description="Specifies the type of ValidateMe preset. Possible values are 'ValidateMe' for configuring RequiredDocuments, or 'PassportChipVerification' for setting the Passport as Proof of Name", IsRequired=true)
        /** @var CreateMobileClientType|null */
        public ?CreateMobileClientType $proofOfPreset=null,

        /** @description The categories of proof and selected documents that the client can use to provide proof. Required if ClientType is set to 'ValidateMe' */
        // @ApiMember(Description="The categories of proof and selected documents that the client can use to provide proof. Required if ClientType is set to 'ValidateMe'")
        /** @var ArrayOfProofOfDocumentCategories|null */
        public ?ArrayOfProofOfDocumentCategories $proofOfDocumentCategories=null,

        /** @description If the client should be linked to other searches, specify the them here */
        // @ApiMember(Description="If the client should be linked to other searches, specify the them here")
        /** @var ArrayOfLinkedTo|null */
        public ?ArrayOfLinkedTo $linkedTo=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['email'])) $this->email = $o['email'];
        if (isset($o['mobileInternational'])) $this->mobileInternational = $o['mobileInternational'];
        if (isset($o['postCode'])) $this->postCode = $o['postCode'];
        if (isset($o['proofOfPreset'])) $this->proofOfPreset = JsonConverters::from('CreateMobileClientType', $o['proofOfPreset']);
        if (isset($o['proofOfDocumentCategories'])) $this->proofOfDocumentCategories = JsonConverters::from('ArrayOfProofOfDocumentCategories', $o['proofOfDocumentCategories']);
        if (isset($o['linkedTo'])) $this->linkedTo = JsonConverters::from('ArrayOfLinkedTo', $o['linkedTo']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->email)) $o['email'] = $this->email;
        if (isset($this->mobileInternational)) $o['mobileInternational'] = $this->mobileInternational;
        if (isset($this->postCode)) $o['postCode'] = $this->postCode;
        if (isset($this->proofOfPreset)) $o['proofOfPreset'] = JsonConverters::to('CreateMobileClientType', $this->proofOfPreset);
        if (isset($this->proofOfDocumentCategories)) $o['proofOfDocumentCategories'] = JsonConverters::to('ArrayOfProofOfDocumentCategories', $this->proofOfDocumentCategories);
        if (isset($this->linkedTo)) $o['linkedTo'] = JsonConverters::to('ArrayOfLinkedTo', $this->linkedTo);
        return empty($o) ? new class(){} : $o;
    }
}

class AddClientTemplateData extends BaseResponse implements JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        /** @var AddClientRequest|null */
        public ?AddClientRequest $request=null
    ) {
        parent::__construct($responseStatus);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['request'])) $this->request = JsonConverters::from('AddClientRequest', $o['request']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->request)) $o['request'] = JsonConverters::to('AddClientRequest', $this->request);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AddClientTemplateResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var AddClientTemplateData|null */
        public ?AddClientTemplateData $data=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['data'])) $this->data = JsonConverters::from('AddClientTemplateData', $o['data']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->data)) $o['data'] = JsonConverters::to('AddClientTemplateData', $this->data);
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class AddClientTemplate extends BaseRequest implements JsonSerializable
{
    /**
     * @param Authentication|null $authentication
     */
    public function __construct(
        ?Authentication $authentication=null
    ) {
        parent::__construct($authentication);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

PHP AddClientTemplate DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .soap12 suffix or ?format=soap12

HTTP + SOAP12

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /soap12 HTTP/1.1 
Host: api.sanctionssearch.com 
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>

<AddClientTemplate xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <Authentication>
    <ApiUserId>String</ApiUserId>
    <ApiUserKey>String</ApiUserKey>
  </Authentication>
</AddClientTemplate>

</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>

<AddClientTemplateResponse 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>
    <Request>
      <Email>String</Email>
      <LinkedTo>
        <LinkedTo>
          <ClientId>0</ClientId>
          <Date>0001-01-01T00:00:00</Date>
          <Description>String</Description>
          <Id>0</Id>
          <IsArchived>false</IsArchived>
          <Name>String</Name>
          <Status>String</Status>
          <Subtype>String</Subtype>
          <Type>String</Type>
        </LinkedTo>
      </LinkedTo>
      <MobileInternational>String</MobileInternational>
      <Name>String</Name>
      <PostCode>String</PostCode>
      <ProofOfDocumentCategories>
        <CategoryId>
          <Id>0</Id>
          <ProofOf>String</ProofOf>
          <ProofOfDocuments>
            <DocumentId>
              <Id>0</Id>
              <Name>String</Name>
            </DocumentId>
          </ProofOfDocuments>
        </CategoryId>
      </ProofOfDocumentCategories>
      <ProofOfPreset>Undefined</ProofOfPreset>
    </Request>
  </Data>
</AddClientTemplateResponse>

</soap12:Body>
</soap12:Envelope>