| All Verbs | /users/by-email |
|---|
<?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 UserRef implements JsonSerializable
{
public function __construct(
/** @var int|null */
public ?int $id=null,
/** @var string */
public string $userName='',
/** @var string */
public string $email='',
/** @var int|null */
public ?int $refId=null,
/** @var string */
public string $refSource='',
/** @var string */
public string $refUrn=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['userName'])) $this->userName = $o['userName'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['refId'])) $this->refId = $o['refId'];
if (isset($o['refSource'])) $this->refSource = $o['refSource'];
if (isset($o['refUrn'])) $this->refUrn = $o['refUrn'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->userName)) $o['userName'] = $this->userName;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->refId)) $o['refId'] = $this->refId;
if (isset($this->refSource)) $o['refSource'] = $this->refSource;
if (isset($this->refUrn)) $o['refUrn'] = $this->refUrn;
return empty($o) ? new class(){} : $o;
}
}
class GetUsersByEmailsResponse implements JsonSerializable
{
public function __construct(
/** @var array<UserRef>|null */
public ?array $results=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['results'])) $this->results = JsonConverters::fromArray('UserRef', $o['results']);
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('UserRef', $this->results);
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
class GetUsersByEmails implements IGet, JsonSerializable
{
public function __construct(
/** @var string[] */
public array $emails=[]
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['emails'])) $this->emails = JsonConverters::fromArray('string', $o['emails']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->emails)) $o['emails'] = JsonConverters::toArray('string', $this->emails);
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.
POST /users/by-email HTTP/1.1
Host: techstacks.io
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
emails:
[
String
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
results:
[
{
id: 0,
userName: String,
email: String,
refId: 0,
refSource: String,
refUrn: String
}
],
responseStatus:
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}
}