Sanctions Search API: v2

<back to all web services

GetCompanyLookups

CompanyLookup
The following routes are available for this service:
POST/companylookups/listGet all company lookups
<?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 SearchCriteria implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $name=null,
        /** @var string|null */
        public ?string $address=null,
        /** @var string|null */
        public ?string $country=null,
        /** @var string|null */
        public ?string $dateOfBirth=null,
        /** @var string|null */
        public ?string $nationality=null,
        /** @var string|null */
        public ?string $reference=null
    ) {
    }

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

/**
 * @template array of String
 */
class ArrayOfLists 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 CompanyLookupListItem implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $id=0,
        /** @var SearchCriteria|null */
        public ?SearchCriteria $searchCriteria=null,
        /** @var ArrayOfLists|null */
        public ?ArrayOfLists $selectedLists=null,
        /** @var DateTime */
        public DateTime $date=new DateTime(),
        /** @var bool|null */
        public ?bool $hasCompanyId=null,
        /** @var bool|null */
        public ?bool $hasCompanyDetails=null,
        /** @var bool|null */
        public ?bool $hasStartedSearches=null,
        /** @var bool|null */
        public ?bool $hasCompletedSearches=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['searchCriteria'])) $this->searchCriteria = JsonConverters::from('SearchCriteria', $o['searchCriteria']);
        if (isset($o['selectedLists'])) $this->selectedLists = JsonConverters::from('ArrayOfLists', $o['selectedLists']);
        if (isset($o['date'])) $this->date = JsonConverters::from('DateTime', $o['date']);
        if (isset($o['hasCompanyId'])) $this->hasCompanyId = $o['hasCompanyId'];
        if (isset($o['hasCompanyDetails'])) $this->hasCompanyDetails = $o['hasCompanyDetails'];
        if (isset($o['hasStartedSearches'])) $this->hasStartedSearches = $o['hasStartedSearches'];
        if (isset($o['hasCompletedSearches'])) $this->hasCompletedSearches = $o['hasCompletedSearches'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->searchCriteria)) $o['searchCriteria'] = JsonConverters::to('SearchCriteria', $this->searchCriteria);
        if (isset($this->selectedLists)) $o['selectedLists'] = JsonConverters::to('ArrayOfLists', $this->selectedLists);
        if (isset($this->date)) $o['date'] = JsonConverters::to('DateTime', $this->date);
        if (isset($this->hasCompanyId)) $o['hasCompanyId'] = $this->hasCompanyId;
        if (isset($this->hasCompanyDetails)) $o['hasCompanyDetails'] = $this->hasCompanyDetails;
        if (isset($this->hasStartedSearches)) $o['hasStartedSearches'] = $this->hasStartedSearches;
        if (isset($this->hasCompletedSearches)) $o['hasCompletedSearches'] = $this->hasCompletedSearches;
        return empty($o) ? new class(){} : $o;
    }
}

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

class GetCompanyLookupsData extends BaseResponse implements JsonSerializable
{
    /**
     * @param ResponseStatus|null $responseStatus
     */
    public function __construct(
        ?ResponseStatus $responseStatus=null,
        /** @var int */
        public int $totalRecords=0,
        /** @var int */
        public int $currentPageNum=0,
        /** @var int */
        public int $maxPageNum=0,
        /** @var ArrayOfCompanyLookupListItem|null */
        public ?ArrayOfCompanyLookupListItem $companyLookupRecords=null
    ) {
        parent::__construct($responseStatus);
    }

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

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

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

class GetCompanyLookupsRequest implements JsonSerializable
{
    public function __construct(
        /** @description If the searches are being accessed by a sub user, specify their username here to only return searches they have permissions to view */
        // @ApiMember(Description="If the searches are being accessed by a sub user, specify their username here to only return searches they have permissions to view")
        /** @var string|null */
        public ?string $subUserName=null,

        /** @var bool|null */
        public ?bool $listIncompleteSearches=null,
        /** @var int */
        public int $page=0,
        /** @var string|null */
        public ?string $sortOrder=null,
        /** @var string|null */
        public ?string $nameSearch=null,
        /** @var string|null */
        public ?string $filterReference=null,
        /** @var DateTime|null */
        public ?DateTime $filterDateFrom=null,
        /** @var DateTime|null */
        public ?DateTime $filterDateTo=null,
        /** @description If set, will only return searches created by the user */
        // @ApiMember(Description="If set, will only return searches created by the user")
        /** @var string|null */
        public ?string $filterUserName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['subUserName'])) $this->subUserName = $o['subUserName'];
        if (isset($o['listIncompleteSearches'])) $this->listIncompleteSearches = $o['listIncompleteSearches'];
        if (isset($o['page'])) $this->page = $o['page'];
        if (isset($o['sortOrder'])) $this->sortOrder = $o['sortOrder'];
        if (isset($o['nameSearch'])) $this->nameSearch = $o['nameSearch'];
        if (isset($o['filterReference'])) $this->filterReference = $o['filterReference'];
        if (isset($o['filterDateFrom'])) $this->filterDateFrom = JsonConverters::from('DateTime', $o['filterDateFrom']);
        if (isset($o['filterDateTo'])) $this->filterDateTo = JsonConverters::from('DateTime', $o['filterDateTo']);
        if (isset($o['filterUserName'])) $this->filterUserName = $o['filterUserName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->subUserName)) $o['subUserName'] = $this->subUserName;
        if (isset($this->listIncompleteSearches)) $o['listIncompleteSearches'] = $this->listIncompleteSearches;
        if (isset($this->page)) $o['page'] = $this->page;
        if (isset($this->sortOrder)) $o['sortOrder'] = $this->sortOrder;
        if (isset($this->nameSearch)) $o['nameSearch'] = $this->nameSearch;
        if (isset($this->filterReference)) $o['filterReference'] = $this->filterReference;
        if (isset($this->filterDateFrom)) $o['filterDateFrom'] = JsonConverters::to('DateTime', $this->filterDateFrom);
        if (isset($this->filterDateTo)) $o['filterDateTo'] = JsonConverters::to('DateTime', $this->filterDateTo);
        if (isset($this->filterUserName)) $o['filterUserName'] = $this->filterUserName;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract
class GetCompanyLookups extends BaseRequest implements JsonSerializable
{
    /**
     * @param Authentication|null $authentication
     */
    public function __construct(
        ?Authentication $authentication=null,
        // @DataMember
        /** @var GetCompanyLookupsRequest|null */
        public ?GetCompanyLookupsRequest $request=null
    ) {
        parent::__construct($authentication);
    }

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

PHP GetCompanyLookups 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 /companylookups/list HTTP/1.1 
Host: api.sanctionssearch.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"request":{"subUserName":"String","listIncompleteSearches":false,"page":0,"sortOrder":"String","nameSearch":"String","filterReference":"String","filterDateFrom":"\/Date(-62135596800000-0000)\/","filterDateTo":"\/Date(-62135596800000-0000)\/","filterUserName":"String"},"authentication":{"apiUserId":"String","apiUserKey":"String"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"data":{"totalRecords":0,"currentPageNum":0,"maxPageNum":0,"companyLookupRecords":[{"id":0,"searchCriteria":{"name":"String","address":"String","country":"String","dateOfBirth":"String","nationality":"String","reference":"String"},"selectedLists":["String"],"date":"\/Date(-62135596800000-0000)\/","hasCompanyId":false,"hasCompanyDetails":false,"hasStartedSearches":false,"hasCompletedSearches":false}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}}