Requires any of the roles: | SystemAdministrator, Manager |
PATCH | /users/{userId} |
---|
<?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 Update the specified login */
// @Api(Description="Update the specified login")
class PatchUser implements IPatch, JsonSerializable
{
public function __construct(
/** @description The account IDs that this user has access to */
// @ApiMember(Description="The account IDs that this user has access to")
/** @var array<string>|null */
public ?array $accountIds=null,
/** @description The ID of the user */
// @ApiMember(Description="The ID of the user")
/** @var string|null */
public ?string $userId=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 new password for the user (leave null to not change) */
// @ApiMember(Description="The new password for the user (leave null to not change)")
/** @var string|null */
public ?string $newPassword=null,
/** @description The roles to associate with the login. Can only specify if system admin */
// @ApiMember(Description="The roles to associate with the login. Can only specify if system admin")
/** @var array<string>|null */
public ?array $roles=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['accountIds'])) $this->accountIds = JsonConverters::fromArray('string', $o['accountIds']);
if (isset($o['userId'])) $this->userId = $o['userId'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['newPassword'])) $this->newPassword = $o['newPassword'];
if (isset($o['roles'])) $this->roles = JsonConverters::fromArray('string', $o['roles']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->accountIds)) $o['accountIds'] = JsonConverters::toArray('string', $this->accountIds);
if (isset($this->userId)) $o['userId'] = $this->userId;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->newPassword)) $o['newPassword'] = $this->newPassword;
if (isset($this->roles)) $o['roles'] = JsonConverters::toArray('string', $this->roles);
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.
PATCH /users/{userId} HTTP/1.1
Host: team.evovoice.io
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PatchUser 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>
<FirstName>String</FirstName>
<LastName>String</LastName>
<NewPassword>String</NewPassword>
<Roles xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</Roles>
<UserId>String</UserId>
</PatchUser>
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>