Sanctions Search API: v1

<back to all web services

GetListSearches

Sanctions
The following routes are available for this service:
POST/searches/listGet all sanctions searches
<?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
    ) {
    }

    /** @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'];
    }
    
    /** @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;
        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
    ) {
    }

    /** @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']);
    }
    
    /** @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);
        return empty($o) ? new class(){} : $o;
    }
}

class SearchCriteria implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $Name=null,
        /** @var string|null */
        public ?string $DateOfBirth=null,
        /** @var string|null */
        public ?string $CountryOfBirth=null,
        /** @var string|null */
        public ?string $Nationality=null,
        /** @var string|null */
        public ?string $Address=null
    ) {
    }

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

class SearchListItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $Id=0,
        /** @var string|null */
        public ?string $SearchType=null,
        /** @var DateTime */
        public DateTime $DateSearched=new DateTime(),
        /** @var DateTime */
        public DateTime $DateUpdated=new DateTime(),
        /** @var int */
        public int $NumOfResults=0,
        /** @var bool|null */
        public ?bool $ClientInResults=null,
        /** @var bool|null */
        public ?bool $ClientNotInResults=null,
        /** @var bool|null */
        public ?bool $AffectedByUpdate=null,
        /** @var SearchCriteria|null */
        public ?SearchCriteria $SearchCriteria=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['SearchType'])) $this->SearchType = $o['SearchType'];
        if (isset($o['DateSearched'])) $this->DateSearched = JsonConverters::from('DateTime', $o['DateSearched']);
        if (isset($o['DateUpdated'])) $this->DateUpdated = JsonConverters::from('DateTime', $o['DateUpdated']);
        if (isset($o['NumOfResults'])) $this->NumOfResults = $o['NumOfResults'];
        if (isset($o['ClientInResults'])) $this->ClientInResults = $o['ClientInResults'];
        if (isset($o['ClientNotInResults'])) $this->ClientNotInResults = $o['ClientNotInResults'];
        if (isset($o['AffectedByUpdate'])) $this->AffectedByUpdate = $o['AffectedByUpdate'];
        if (isset($o['SearchCriteria'])) $this->SearchCriteria = JsonConverters::from('SearchCriteria', $o['SearchCriteria']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->SearchType)) $o['SearchType'] = $this->SearchType;
        if (isset($this->DateSearched)) $o['DateSearched'] = JsonConverters::to('DateTime', $this->DateSearched);
        if (isset($this->DateUpdated)) $o['DateUpdated'] = JsonConverters::to('DateTime', $this->DateUpdated);
        if (isset($this->NumOfResults)) $o['NumOfResults'] = $this->NumOfResults;
        if (isset($this->ClientInResults)) $o['ClientInResults'] = $this->ClientInResults;
        if (isset($this->ClientNotInResults)) $o['ClientNotInResults'] = $this->ClientNotInResults;
        if (isset($this->AffectedByUpdate)) $o['AffectedByUpdate'] = $this->AffectedByUpdate;
        if (isset($this->SearchCriteria)) $o['SearchCriteria'] = JsonConverters::to('SearchCriteria', $this->SearchCriteria);
        return empty($o) ? new class(){} : $o;
    }
}

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

// @DataContract
class GetListSearchesData implements IBaseDataResponse, IHasResponseStatus, JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null,

        // @DataMember
        /** @var int */
        public int $TotalSearchRecords=0,

        // @DataMember
        /** @var int */
        public int $CurrentPageNum=0,

        // @DataMember
        /** @var int */
        public int $MaxPageNum=0,

        // @DataMember
        /** @var ArrayOfSearchListItem|null */
        public ?ArrayOfSearchListItem $SearchRecords=null
    ) {
    }

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

// @DataContract
class GetListSearchesResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var GetListSearchesData|null */
        public ?GetListSearchesData $Data=null
    ) {
    }

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

// @DataContract
class Authentication implements IAuthentication, JsonSerializable
{
    public function __construct(
        /** @description The API User ID that will authenticate your request */
        // @DataMember
        // @ApiMember(DataType="string", Description="The API User ID that will authenticate your request", IsRequired=true)
        /** @var string */
        public string $ApiUserId='',

        /** @description The API User Key that will authenticate your request */
        // @DataMember
        // @ApiMember(DataType="string", Description="The API User Key that will authenticate your request", IsRequired=true)
        /** @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;
    }
}

// @ApiResponse(Description="Your request is successful if the \"<em>Data.ResponseStatus.Message</em>\" field is \"<b>Success</b>\".", StatusCode=200)
// @DataContract
class GetListSearches implements IBaseRequest, JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var Authentication|null */
        public ?Authentication $Authentication=null,

        // @DataMember
        /** @var int */
        public int $Page=0,

        // @DataMember
        /** @var string|null */
        public ?string $SortOrder=null,

        // @DataMember
        /** @var string|null */
        public ?string $NameSearch=null
    ) {
    }

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

PHP GetListSearches DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /searches/list HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Authentication":{"ApiUserId":"String","ApiUserKey":"String"},"Page":0,"SortOrder":"String","NameSearch":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Data":{"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String"}]},"TotalSearchRecords":0,"CurrentPageNum":0,"MaxPageNum":0,"SearchRecords":[{"Id":0,"SearchType":"String","DateSearched":"\/Date(-62135596800000-0000)\/","DateUpdated":"\/Date(-62135596800000-0000)\/","NumOfResults":0,"ClientInResults":false,"ClientNotInResults":false,"AffectedByUpdate":false,"SearchCriteria":{"Name":"String","DateOfBirth":"String","CountryOfBirth":"String","Nationality":"String","Address":"String"}}]}}