| GET | /users | Get a list of 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};
class GetUserResponse implements JsonSerializable
{
public function __construct(
/** @description Unique Identifier of a User */
// @ApiMember(Description="Unique Identifier of a User", IsRequired=true)
/** @var string */
public string $userId='',
/** @description User's Email address */
// @ApiMember(Description="User's Email address", IsRequired=true)
/** @var string */
public string $emailAddress='',
/** @description First Name */
// @ApiMember(Description="First Name", IsRequired=true)
/** @var string */
public string $firstName='',
/** @description Last Name */
// @ApiMember(Description="Last Name", IsRequired=true)
/** @var string */
public string $lastName='',
/** @description User's Password Expiration Date */
// @ApiMember(Description="User's Password Expiration Date")
/** @var string|null */
public ?string $passwordExpirationDate=null,
/** @description If the User must change the password */
// @ApiMember(Description="If the User must change the password", IsRequired=true)
/** @var bool|null */
public ?bool $passwordMustBeChanged=null,
/** @description User Type of the User */
// @ApiMember(Description="User Type of the User", IsRequired=true)
/** @var string */
public string $userType='',
/** @description Culture ID of the User */
// @ApiMember(Description="Culture ID of the User", IsRequired=true)
/** @var string */
public string $culture='',
/** @description If the User account is locked */
// @ApiMember(Description="If the User account is locked", IsRequired=true)
/** @var bool|null */
public ?bool $accountLocked=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['emailAddress'])) $this->emailAddress = $o['emailAddress'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['passwordExpirationDate'])) $this->passwordExpirationDate = $o['passwordExpirationDate'];
if (isset($o['passwordMustBeChanged'])) $this->passwordMustBeChanged = $o['passwordMustBeChanged'];
if (isset($o['userType'])) $this->userType = $o['userType'];
if (isset($o['culture'])) $this->culture = $o['culture'];
if (isset($o['accountLocked'])) $this->accountLocked = $o['accountLocked'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->emailAddress)) $o['emailAddress'] = $this->emailAddress;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->passwordExpirationDate)) $o['passwordExpirationDate'] = $this->passwordExpirationDate;
if (isset($this->passwordMustBeChanged)) $o['passwordMustBeChanged'] = $this->passwordMustBeChanged;
if (isset($this->userType)) $o['userType'] = $this->userType;
if (isset($this->culture)) $o['culture'] = $this->culture;
if (isset($this->accountLocked)) $o['accountLocked'] = $this->accountLocked;
return empty($o) ? new class(){} : $o;
}
}
class GetUsersResponse implements JsonSerializable
{
public function __construct(
/** @description Index of the result set returnedr */
// @ApiMember(Description="Index of the result set returnedr", IsRequired=true)
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned", IsRequired=true)
/** @var int */
public int $items=0,
/** @description Total amount of pages / result sets */
// @ApiMember(Description="Total amount of pages / result sets", IsRequired=true)
/** @var int */
public int $totalPages=0,
/** @description Total amount of results */
// @ApiMember(Description="Total amount of results", IsRequired=true)
/** @var int */
public int $totalResults=0,
/** @description List of Users */
// @ApiMember(Description="List of Users", IsRequired=true)
/** @var array<GetUserResponse>|null */
public ?array $elements=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['totalPages'])) $this->totalPages = $o['totalPages'];
if (isset($o['totalResults'])) $this->totalResults = $o['totalResults'];
if (isset($o['elements'])) $this->elements = JsonConverters::fromArray('GetUserResponse', $o['elements']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->totalPages)) $o['totalPages'] = $this->totalPages;
if (isset($this->totalResults)) $o['totalResults'] = $this->totalResults;
if (isset($this->elements)) $o['elements'] = JsonConverters::toArray('GetUserResponse', $this->elements);
return empty($o) ? new class(){} : $o;
}
}
class GetUsers implements IPagedRequest, JsonSerializable
{
public function __construct(
/** @description Index of the result set returned */
// @ApiMember(Description="Index of the result set returned", IsRequired=true)
/** @var int */
public int $page=0,
/** @description Size of the result set returned */
// @ApiMember(Description="Size of the result set returned", IsRequired=true)
/** @var int */
public int $items=0,
/** @description Omit precise record count - save on performance */
// @ApiMember(Description="Omit precise record count - save on performance")
/** @var bool|null */
public ?bool $noCount=null,
/** @description Sorting expression */
// @ApiMember(Description="Sorting expression")
/** @var string|null */
public ?string $sortBy=null,
/** @description Email address */
// @ApiMember(Description="Email address")
/** @var string|null */
public ?string $email=null,
/** @description Also retreive users with locked account */
// @ApiMember(Description="Also retreive users with locked account")
/** @var bool|null */
public ?bool $includeLockedAccounts=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['page'])) $this->page = $o['page'];
if (isset($o['items'])) $this->items = $o['items'];
if (isset($o['noCount'])) $this->noCount = $o['noCount'];
if (isset($o['sortBy'])) $this->sortBy = $o['sortBy'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['includeLockedAccounts'])) $this->includeLockedAccounts = $o['includeLockedAccounts'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->page)) $o['page'] = $this->page;
if (isset($this->items)) $o['items'] = $this->items;
if (isset($this->noCount)) $o['noCount'] = $this->noCount;
if (isset($this->sortBy)) $o['sortBy'] = $this->sortBy;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->includeLockedAccounts)) $o['includeLockedAccounts'] = $this->includeLockedAccounts;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /users HTTP/1.1 Host: dev-api-booster.richemont.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"page":0,"items":0,"totalPages":0,"totalResults":0}