GET | /subusers/list | Get all sub users |
---|
<?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;
}
}
/**
* @template array of String
*/
class ArrayOfUserNames 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 SubUser implements JsonSerializable
{
public function __construct(
/** @description Is this user the main user (i.e. the user who created the account) */
// @ApiMember(Description="Is this user the main user (i.e. the user who created the account)")
/** @var bool|null */
public ?bool $isMainUser=null,
/** @description The sub user's id (GUID) */
// @ApiMember(Description="The sub user's id (GUID)")
/** @var string */
public string $userId='',
/** @description The sub user's UserName (i.e. the sign-in username) */
// @ApiMember(Description="The sub user's UserName (i.e. the sign-in username)")
/** @var string|null */
public ?string $userName=null,
/** @description The sub user's name */
// @ApiMember(Description="The sub user's name")
/** @var string|null */
public ?string $name=null,
/** @description The sub user's email address */
// @ApiMember(Description="The sub user's email address")
/** @var string|null */
public ?string $email=null,
/** @description Does this sub user have admin privileges, such as managing purchases and sub users */
// @ApiMember(Description="Does this sub user have admin privileges, such as managing purchases and sub users")
/** @var bool|null */
public ?bool $isAdmin=null,
/** @description Can this sub user resolve searches (UpdateSearch) they have access to */
// @ApiMember(Description="Can this sub user resolve searches (UpdateSearch) they have access to")
/** @var bool|null */
public ?bool $canResolveSearches=null,
/** @description Can this sub user delete searches (DeleteSearch) they have access to */
// @ApiMember(Description="Can this sub user delete searches (DeleteSearch) they have access to")
/** @var bool|null */
public ?bool $canDeleteSearches=null,
/** @description The user names for which searches will be made available to the sub user */
// @ApiMember(Description="The user names for which searches will be made available to the sub user")
/** @var ArrayOfUserNames|null */
public ?ArrayOfUserNames $permissions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['isMainUser'])) $this->isMainUser = $o['isMainUser'];
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['userName'])) $this->userName = $o['userName'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['isAdmin'])) $this->isAdmin = $o['isAdmin'];
if (isset($o['canResolveSearches'])) $this->canResolveSearches = $o['canResolveSearches'];
if (isset($o['canDeleteSearches'])) $this->canDeleteSearches = $o['canDeleteSearches'];
if (isset($o['permissions'])) $this->permissions = JsonConverters::from('ArrayOfUserNames', $o['permissions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->isMainUser)) $o['isMainUser'] = $this->isMainUser;
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->userName)) $o['userName'] = $this->userName;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->isAdmin)) $o['isAdmin'] = $this->isAdmin;
if (isset($this->canResolveSearches)) $o['canResolveSearches'] = $this->canResolveSearches;
if (isset($this->canDeleteSearches)) $o['canDeleteSearches'] = $this->canDeleteSearches;
if (isset($this->permissions)) $o['permissions'] = JsonConverters::to('ArrayOfUserNames', $this->permissions);
return empty($o) ? new class(){} : $o;
}
}
class GetSubUsersData extends BaseResponse implements JsonSerializable
{
/**
* @param ResponseStatus|null $responseStatus
*/
public function __construct(
?ResponseStatus $responseStatus=null,
/** @description The list of sub users */
// @ApiMember(Description="The list of sub users")
/** @var array<SubUser>|null */
public ?array $subUsers=null
) {
parent::__construct($responseStatus);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['subUsers'])) $this->subUsers = JsonConverters::fromArray('SubUser', $o['subUsers']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->subUsers)) $o['subUsers'] = JsonConverters::toArray('SubUser', $this->subUsers);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetSubUsersResponse implements JsonSerializable
{
public function __construct(
/** @description The response data */
// @DataMember
// @ApiMember(Description="The response data")
/** @var GetSubUsersData|null */
public ?GetSubUsersData $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['data'])) $this->data = JsonConverters::from('GetSubUsersData', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->data)) $o['data'] = JsonConverters::to('GetSubUsersData', $this->data);
return empty($o) ? new class(){} : $o;
}
}
// @DataContract
class GetSubUsers extends BaseRequest implements JsonSerializable
{
/**
* @param Authentication|null $authentication
*/
public function __construct(
?Authentication $authentication=null,
/** @description If this is 'True' the main user will be included in the list of sub users */
// @DataMember
// @ApiMember(Description="If this is 'True' the main user will be included in the list of sub users", ParameterType="query")
/** @var bool|null */
public ?bool $includeMainUser=null
) {
parent::__construct($authentication);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['includeMainUser'])) $this->includeMainUser = $o['includeMainUser'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->includeMainUser)) $o['includeMainUser'] = $this->includeMainUser;
return empty($o) ? new class(){} : $o;
}
}
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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /subusers/list HTTP/1.1 Host: api.sanctionssearch.com Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"data":{"subUsers":[{"isMainUser":false,"userName":"String","name":"String","email":"String","isAdmin":false,"canResolveSearches":false,"canDeleteSearches":false,"permissions":["String"]}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}}