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 .xml suffix or ?format=xml
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/xml
Content-Type: application/xml
Content-Length: length
<NewUser xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Authentication">
<AccountId>String</AccountId>
<EmailAddress>String</EmailAddress>
<FirstName>String</FirstName>
<LastName>String</LastName>
<Password>String</Password>
</NewUser>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <UserInfo xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Voice.Api.Authentication"> <AccountIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>String</d2p1:string> </AccountIds> <AccountNames xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>String</d2p1:string> </AccountNames> <AvatarUrl>String</AvatarUrl> <DashboardPermissions> <DashboardPermissions>ViewFiles</DashboardPermissions> </DashboardPermissions> <EmailAddress>String</EmailAddress> <FirstName>String</FirstName> <Id>String</Id> <IsAuthenticated>false</IsAuthenticated> <LastName>String</LastName> <Name>String</Name> <Roles xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>String</d2p1:string> </Roles> </UserInfo>