| GET | /users/search |
|---|
<?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 UserSummary implements JsonSerializable
{
public function __construct(
/** @var string */
public string $UserId='',
/** @var string|null */
public ?string $UserName=null,
/** @var string|null */
public ?string $Email=null,
/** @var DateTime|null */
public ?DateTime $CreatedUtc=null,
/** @var DateTime|null */
public ?DateTime $LastActivityUtc=null,
/** @var string|null */
public ?string $FirstName=null,
/** @var string|null */
public ?string $LastName=null,
/** @var string|null */
public ?string $DisplayName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['CreatedUtc'])) $this->CreatedUtc = JsonConverters::from('DateTime', $o['CreatedUtc']);
if (isset($o['LastActivityUtc'])) $this->LastActivityUtc = JsonConverters::from('DateTime', $o['LastActivityUtc']);
if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
if (isset($o['LastName'])) $this->LastName = $o['LastName'];
if (isset($o['DisplayName'])) $this->DisplayName = $o['DisplayName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->CreatedUtc)) $o['CreatedUtc'] = JsonConverters::to('DateTime', $this->CreatedUtc);
if (isset($this->LastActivityUtc)) $o['LastActivityUtc'] = JsonConverters::to('DateTime', $this->LastActivityUtc);
if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
if (isset($this->LastName)) $o['LastName'] = $this->LastName;
if (isset($this->DisplayName)) $o['DisplayName'] = $this->DisplayName;
return empty($o) ? new class(){} : $o;
}
}
class SearchUsersResponse implements JsonSerializable
{
public function __construct(
/** @var array<UserSummary>|null */
public ?array $Results=null,
/** @var int */
public int $Page=0,
/** @var int */
public int $PageSize=0,
/** @var int */
public int $Total=0,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Results'])) $this->Results = JsonConverters::fromArray('UserSummary', $o['Results']);
if (isset($o['Page'])) $this->Page = $o['Page'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
if (isset($o['Total'])) $this->Total = $o['Total'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Results)) $o['Results'] = JsonConverters::toArray('UserSummary', $this->Results);
if (isset($this->Page)) $o['Page'] = $this->Page;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
if (isset($this->Total)) $o['Total'] = $this->Total;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
class SearchUsers implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Q=null,
/** @var int|null */
public ?int $Page=null,
/** @var int|null */
public ?int $PageSize=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Q'])) $this->Q = $o['Q'];
if (isset($o['Page'])) $this->Page = $o['Page'];
if (isset($o['PageSize'])) $this->PageSize = $o['PageSize'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Q)) $o['Q'] = $this->Q;
if (isset($this->Page)) $o['Page'] = $this->Page;
if (isset($this->PageSize)) $o['PageSize'] = $this->PageSize;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /users/search HTTP/1.1 Host: api.dev.dynamics.trendsic.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Results:
[
{
UserId: 00000000000000000000000000000000,
UserName: String,
Email: String,
CreatedUtc: 0001-01-01,
LastActivityUtc: 0001-01-01,
FirstName: String,
LastName: String,
DisplayName: String String
}
],
Page: 0,
PageSize: 0,
Total: 0,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}