Get a PDF |
<?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 PdfDocument implements JsonSerializable
{
public function __construct(
/** @description The ID of the saved document */
// @ApiMember(Description="The ID of the saved document")
/** @var int */
public int $id=0,
/** @description Is the document ready to download */
// @ApiMember(Description="Is the document ready to download")
/** @var bool|null */
public ?bool $isReady=null,
/** @description The name of the saved document */
// @ApiMember(Description="The name of the saved document")
/** @var string|null */
public ?string $name=null,
/** @description The file name (including extension) of the saved document */
// @ApiMember(Description="The file name (including extension) of the saved document")
/** @var string|null */
public ?string $fileName=null,
/** @description The type of saved document (Human readable, pep, sanctions, validid, companylookup, etc.) */
// @ApiMember(Description="The type of saved document (Human readable, pep, sanctions, validid, companylookup, etc.)")
/** @var string|null */
public ?string $type=null,
/** @description If this document is a Saved Sanctions Search, the ID of the search it relates to */
// @ApiMember(Description="If this document is a Saved Sanctions Search, the ID of the search it relates to")
/** @var int|null */
public ?int $sanctionsSearchId=null,
/** @description If this document is a Saved PEP Search, the ID of the search it relates to */
// @ApiMember(Description="If this document is a Saved PEP Search, the ID of the search it relates to")
/** @var int|null */
public ?int $pepSearchId=null,
/** @description If this document is a Saved ValidID Search, the ID of the search it relates to */
// @ApiMember(Description="If this document is a Saved ValidID Search, the ID of the search it relates to")
/** @var int|null */
public ?int $validIdSearchId=null,
/** @description If this document is a Saved CompanyLookup Search, the ID of the search it relates to */
// @ApiMember(Description="If this document is a Saved CompanyLookup Search, the ID of the search it relates to")
/** @var int|null */
public ?int $companyLookupSearchId=null,
/** @description The date the saved document was created/requested */
// @ApiMember(Description="The date the saved document was created/requested")
/** @var DateTime */
public DateTime $dateCreated=new DateTime(),
/** @description The date the saved document will be no longer available. You can request a new document using the SaveSearch, SavePepSearch, etc. methods */
// @ApiMember(Description="The date the saved document will be no longer available. You can request a new document using the SaveSearch, SavePepSearch, etc. methods")
/** @var DateTime */
public DateTime $dateExpires=new DateTime()
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['isReady'])) $this->isReady = $o['isReady'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['fileName'])) $this->fileName = $o['fileName'];
if (isset($o['type'])) $this->type = $o['type'];
if (isset($o['sanctionsSearchId'])) $this->sanctionsSearchId = $o['sanctionsSearchId'];
if (isset($o['pepSearchId'])) $this->pepSearchId = $o['pepSearchId'];
if (isset($o['validIdSearchId'])) $this->validIdSearchId = $o['validIdSearchId'];
if (isset($o['companyLookupSearchId'])) $this->companyLookupSearchId = $o['companyLookupSearchId'];
if (isset($o['dateCreated'])) $this->dateCreated = JsonConverters::from('DateTime', $o['dateCreated']);
if (isset($o['dateExpires'])) $this->dateExpires = JsonConverters::from('DateTime', $o['dateExpires']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->isReady)) $o['isReady'] = $this->isReady;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->fileName)) $o['fileName'] = $this->fileName;
if (isset($this->type)) $o['type'] = $this->type;
if (isset($this->sanctionsSearchId)) $o['sanctionsSearchId'] = $this->sanctionsSearchId;
if (isset($this->pepSearchId)) $o['pepSearchId'] = $this->pepSearchId;
if (isset($this->validIdSearchId)) $o['validIdSearchId'] = $this->validIdSearchId;
if (isset($this->companyLookupSearchId)) $o['companyLookupSearchId'] = $this->companyLookupSearchId;
if (isset($this->dateCreated)) $o['dateCreated'] = JsonConverters::to('DateTime', $this->dateCreated);
if (isset($this->dateExpires)) $o['dateExpires'] = JsonConverters::to('DateTime', $this->dateExpires);
return empty($o) ? new class(){} : $o;
}
}
class PdfDocumentWithData extends PdfDocument implements JsonSerializable
{
/**
* @param int $id
* @param bool|null $isReady
* @param string|null $name
* @param string|null $fileName
* @param string|null $type
* @param int|null $sanctionsSearchId
* @param int|null $pepSearchId
* @param int|null $validIdSearchId
* @param int|null $companyLookupSearchId
* @param DateTime $dateCreated
* @param DateTime $dateExpires
*/
public function __construct(
int $id=0,
?bool $isReady=null,
?string $name=null,
?string $fileName=null,
?string $type=null,
?int $sanctionsSearchId=null,
?int $pepSearchId=null,
?int $validIdSearchId=null,
?int $companyLookupSearchId=null,
DateTime $dateCreated=new DateTime(),
DateTime $dateExpires=new DateTime(),
/** @description The file data in a byte array */
// @ApiMember(Description="The file data in a byte array")
/** @var ByteArray|null */
public ?ByteArray $documentBytes=null
) {
parent::__construct($id,$isReady,$name,$fileName,$type,$sanctionsSearchId,$pepSearchId,$validIdSearchId,$companyLookupSearchId,$dateCreated,$dateExpires);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['documentBytes'])) $this->documentBytes = JsonConverters::from('ByteArray', $o['documentBytes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->documentBytes)) $o['documentBytes'] = JsonConverters::to('ByteArray', $this->documentBytes);
return empty($o) ? new class(){} : $o;
}
}
class GetPdfData extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
/** @description The single document that is being returned, including the file data */
// @ApiMember(Description="The single document that is being returned, including the file data")
/** @var PdfDocumentWithData|null */
public ?PdfDocumentWithData $document=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['document'])) $this->document = JsonConverters::from('PdfDocumentWithData', $o['document']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->document)) $o['document'] = JsonConverters::to('PdfDocumentWithData', $this->document);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetPdfResponse implements JsonSerializable
{
public function __construct(
/** @description The response data */
// @DataMember
// @ApiMember(Description="The response data")
/** @var GetPdfData|null */
public ?GetPdfData $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::from('GetPdfData', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::to('GetPdfData', $this->data);
return empty($o) ? new class(){} : $o;
}
}
class GetPdfRequest implements JsonSerializable
{
public function __construct(
/** @description If the saved document is kept within a single Sub User account, specify their username here */
// @ApiMember(Description="If the saved document is kept within a single Sub User account, specify their username here")
/** @var string|null */
public ?string $subUserName=null,
/** @description The ID of the document to retrieve */
// @ApiMember(Description="The ID of the document to retrieve")
/** @var int */
public int $id=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['subUserName'])) $this->subUserName = $o['subUserName'];
if (isset($o['id'])) $this->id = $o['id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->subUserName)) $o['subUserName'] = $this->subUserName;
if (isset($this->id)) $o['id'] = $this->id;
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetPdf extends BaseRequest implements JsonSerializable
{
/**
* @param Authentication|null $authentication
*/
public function __construct(
?Authentication $authentication=null,
/** @description The request data */
// @DataMember
// @ApiMember(Description="The request data", ParameterType="body")
/** @var GetPdfRequest|null */
public ?GetPdfRequest $request=null
) {
parent::__construct($authentication);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['request'])) $this->request = JsonConverters::from('GetPdfRequest', $o['request']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->request)) $o['request'] = JsonConverters::to('GetPdfRequest', $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: GetPdf
<?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>
<GetPdf xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Authentication>
<ApiUserId>String</ApiUserId>
<ApiUserKey>String</ApiUserKey>
</Authentication>
<Request>
<Id>0</Id>
<SubUserName>String</SubUserName>
</Request>
</GetPdf>
</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> <GetPdfResponse 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> <Document> <CompanyLookupSearchId>0</CompanyLookupSearchId> <DateCreated>0001-01-01T00:00:00</DateCreated> <DateExpires>0001-01-01T00:00:00</DateExpires> <FileName>String</FileName> <Id>0</Id> <IsReady>false</IsReady> <Name>String</Name> <PepSearchId>0</PepSearchId> <SanctionsSearchId>0</SanctionsSearchId> <Type>String</Type> <ValidIdSearchId>0</ValidIdSearchId> <DocumentBytes>AA==</DocumentBytes> </Document> </Data> </GetPdfResponse> </soap:Body> </soap:Envelope>