<?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. Can be provided in the request body, or as a header parameter (X-Api-User) */
// @DataMember
// @ApiMember(Description="The API User ID provided by us when you signed up to use our API. Can be provided in the request body, or as a header parameter (X-Api-User)", 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. Can be provided in the request body, or as a header parameter (X-Api-Key) */
// @DataMember
// @ApiMember(Description="The API User Key provided by us when you signed up to use our API. Can be provided in the request body, or as a header parameter (X-Api-Key)", IsRequired=true, ParameterType="header, body")
/** @var string */
public string $apiUserKey='',
/** @description The User ID of the user making the request (e.g. a sub user). This is optional but can be used to associate API requests with a specific user, thereby allowing user permissions to be enforced. Can be provided in the body, or as a header parameter (X-User-Id). */
// @DataMember
// @ApiMember(Description="The User ID of the user making the request (e.g. a sub user). This is optional but can be used to associate API requests with a specific user, thereby allowing user permissions to be enforced. Can be provided in the body, or as a header parameter (X-User-Id).", ParameterType="header, body")
/** @var string|null */
public ?string $userId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['apiUserId'])) $this->apiUserId = $o['apiUserId'];
if (isset($o['apiUserKey'])) $this->apiUserKey = $o['apiUserKey'];
if (isset($o['userId'])) $this->userId = $o['userId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->apiUserId)) $o['apiUserId'] = $this->apiUserId;
if (isset($this->apiUserKey)) $o['apiUserKey'] = $this->apiUserKey;
if (isset($this->userId)) $o['userId'] = $this->userId;
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 AccountStatus implements JsonSerializable
{
public function __construct(
/** @description The account status (e.g. Unpaid, Active, Expired) */
// @ApiMember(Description="The account status (e.g. Unpaid, Active, Expired)")
/** @var string|null */
public ?string $status=null,
/** @description The account type (e.g. live, developer, demo) */
// @ApiMember(Description="The account type (e.g. live, developer, demo)")
/** @var string|null */
public ?string $type=null,
/** @description The account Expiry Date */
// @ApiMember(Description="The account Expiry Date")
/** @var DateTime|null */
public ?DateTime $expiryDate=null,
/** @description The account Expiry Date as a string in ISO 8601 format */
// @ApiMember(Description="The account Expiry Date as a string in ISO 8601 format")
/** @var string|null */
public ?string $expiryDateUniversal=null,
/** @description The account balance */
// @ApiMember(Description="The account balance")
/** @var float */
public float $balance=0.0,
/** @description The account search credit balance */
// @ApiMember(Description="The account search credit balance")
/** @var int */
public int $creditBalance=0,
/** @description The account DBS credit balance */
// @ApiMember(Description="The account DBS credit balance")
/** @var int */
public int $dbsBasicCreditBalance=0,
/** @description The list of enabled products for this account */
// @ApiMember(Description="The list of enabled products for this account")
/** @var array<string>|null */
public ?array $products=null,
/** @description The list of enabled capabilities for this account */
// @ApiMember(Description="The list of enabled capabilities for this account")
/** @var array<string>|null */
public ?array $capabilities=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['status'])) $this->status = $o['status'];
if (isset($o['type'])) $this->type = $o['type'];
if (isset($o['expiryDate'])) $this->expiryDate = JsonConverters::from('DateTime', $o['expiryDate']);
if (isset($o['expiryDateUniversal'])) $this->expiryDateUniversal = $o['expiryDateUniversal'];
if (isset($o['balance'])) $this->balance = $o['balance'];
if (isset($o['creditBalance'])) $this->creditBalance = $o['creditBalance'];
if (isset($o['dbsBasicCreditBalance'])) $this->dbsBasicCreditBalance = $o['dbsBasicCreditBalance'];
if (isset($o['products'])) $this->products = JsonConverters::fromArray('string', $o['products']);
if (isset($o['capabilities'])) $this->capabilities = JsonConverters::fromArray('string', $o['capabilities']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->status)) $o['status'] = $this->status;
if (isset($this->type)) $o['type'] = $this->type;
if (isset($this->expiryDate)) $o['expiryDate'] = JsonConverters::to('DateTime', $this->expiryDate);
if (isset($this->expiryDateUniversal)) $o['expiryDateUniversal'] = $this->expiryDateUniversal;
if (isset($this->balance)) $o['balance'] = $this->balance;
if (isset($this->creditBalance)) $o['creditBalance'] = $this->creditBalance;
if (isset($this->dbsBasicCreditBalance)) $o['dbsBasicCreditBalance'] = $this->dbsBasicCreditBalance;
if (isset($this->products)) $o['products'] = JsonConverters::toArray('string', $this->products);
if (isset($this->capabilities)) $o['capabilities'] = JsonConverters::toArray('string', $this->capabilities);
return empty($o) ? new class(){} : $o;
}
}
class GetAccountStatusData extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
/** @description The account status information */
// @ApiMember(Description="The account status information")
/** @var AccountStatus|null */
public ?AccountStatus $accountStatus=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['accountStatus'])) $this->accountStatus = JsonConverters::from('AccountStatus', $o['accountStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->accountStatus)) $o['accountStatus'] = JsonConverters::to('AccountStatus', $this->accountStatus);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetAccountStatusResponse implements JsonSerializable
{
public function __construct(
/** @description The response data */
// @DataMember
// @ApiMember(Description="The response data")
/** @var GetAccountStatusData|null */
public ?GetAccountStatusData $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::from('GetAccountStatusData', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::to('GetAccountStatusData', $this->data);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetAccountStatus 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;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .soap12 suffix or ?format=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.simplified.id
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>
<GetAccountStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Authentication>
<ApiUserId>String</ApiUserId>
<ApiUserKey>String</ApiUserKey>
<UserId>String</UserId>
</Authentication>
</GetAccountStatus>
</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>
<GetAccountStatusResponse 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>
<AccountStatus>
<Balance>0</Balance>
<Capabilities xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>String</d4p1:string>
</Capabilities>
<CreditBalance>0</CreditBalance>
<DBSBasicCreditBalance>0</DBSBasicCreditBalance>
<ExpiryDate>0001-01-01T00:00:00</ExpiryDate>
<ExpiryDateUniversal>String</ExpiryDateUniversal>
<Products xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d4p1:string>String</d4p1:string>
</Products>
<Status>String</Status>
<Type>String</Type>
</AccountStatus>
</Data>
</GetAccountStatusResponse>
</soap12:Body>
</soap12:Envelope>