Requires any of the roles: | SystemAdministrator, Manager |
POST | /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};
enum DashboardPermissions : string
{
case ViewFiles = 'ViewFiles';
case ViewNotifications = 'ViewNotifications';
case ViewSessions = 'ViewSessions';
case ViewEndpoints = 'ViewEndpoints';
case ViewReports = 'ViewReports';
case ViewCustomers = 'ViewCustomers';
case ViewFlows = 'ViewFlows';
}
class UserInfo implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $id=null,
/** @var bool|null */
public ?bool $isAuthenticated=null,
/** @var string|null */
public ?string $firstName=null,
/** @var string|null */
public ?string $lastName=null,
/** @var string|null */
public ?string $name=null,
/** @var string|null */
public ?string $avatarUrl=null,
/** @var string|null */
public ?string $emailAddress=null,
/** @var array<string>|null */
public ?array $roles=null,
/** @var array<string>|null */
public ?array $accountIds=null,
/** @var array<string>|null */
public ?array $accountNames=null,
/** @var array<DashboardPermissions>|null */
public ?array $dashboardPermissions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['isAuthenticated'])) $this->isAuthenticated = $o['isAuthenticated'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['avatarUrl'])) $this->avatarUrl = $o['avatarUrl'];
if (isset($o['emailAddress'])) $this->emailAddress = $o['emailAddress'];
if (isset($o['roles'])) $this->roles = JsonConverters::fromArray('string', $o['roles']);
if (isset($o['accountIds'])) $this->accountIds = JsonConverters::fromArray('string', $o['accountIds']);
if (isset($o['accountNames'])) $this->accountNames = JsonConverters::fromArray('string', $o['accountNames']);
if (isset($o['dashboardPermissions'])) $this->dashboardPermissions = JsonConverters::fromArray('DashboardPermissions', $o['dashboardPermissions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->isAuthenticated)) $o['isAuthenticated'] = $this->isAuthenticated;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->avatarUrl)) $o['avatarUrl'] = $this->avatarUrl;
if (isset($this->emailAddress)) $o['emailAddress'] = $this->emailAddress;
if (isset($this->roles)) $o['roles'] = JsonConverters::toArray('string', $this->roles);
if (isset($this->accountIds)) $o['accountIds'] = JsonConverters::toArray('string', $this->accountIds);
if (isset($this->accountNames)) $o['accountNames'] = JsonConverters::toArray('string', $this->accountNames);
if (isset($this->dashboardPermissions)) $o['dashboardPermissions'] = JsonConverters::toArray('DashboardPermissions', $this->dashboardPermissions);
return empty($o) ? new class(){} : $o;
}
}
/** @description Creates a new login with the specified email address and password. Note: Any given email address can only exist once in the entire Evo Voice system. */
// @Api(Description="Creates a new login with the specified email address and password. Note: Any given email address can only exist once in the entire Evo Voice system.")
class NewUser implements IPost, JsonSerializable
{
public function __construct(
/** @description The account ID you want to create this user under */
// @ApiMember(Description="The account ID you want to create this user under")
/** @var string|null */
public ?string $accountId=null,
/** @description The email address of the new user */
// @ApiMember(Description="The email address of the new user")
/** @var string|null */
public ?string $emailAddress=null,
/** @description The user's first name */
// @ApiMember(Description="The user's first name")
/** @var string|null */
public ?string $firstName=null,
/** @description The user's last name */
// @ApiMember(Description="The user's last name")
/** @var string|null */
public ?string $lastName=null,
/** @description The password for the new user */
// @ApiMember(Description="The password for the new user")
/** @var string|null */
public ?string $password=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountId'])) $this->accountId = $o['accountId'];
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['password'])) $this->password = $o['password'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountId)) $o['accountId'] = $this->accountId;
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->password)) $o['password'] = $this->password;
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.
POST /users HTTP/1.1
Host: team.evovoice.io
Accept: application/json
Content-Type: application/json
Content-Length: length
{"accountId":"String","emailAddress":"String","firstName":"String","lastName":"String","password":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"id":"String","isAuthenticated":false,"firstName":"String","lastName":"String","name":"String","avatarUrl":"String","emailAddress":"String","roles":["String"],"accountIds":["String"],"accountNames":["String"],"dashboardPermissions":["ViewFiles"]}