Requires any of the roles: | SystemAdministrator, Manager |
PATCH | /users/{userId} |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
enum DashboardPermissions
{
ViewFiles,
ViewNotifications,
ViewSessions,
ViewEndpoints,
ViewReports,
ViewCustomers,
ViewFlows,
}
class UserInfo implements IConvertible
{
String? id;
bool? isAuthenticated;
String? firstName;
String? lastName;
String? name;
String? avatarUrl;
String? emailAddress;
List<String>? roles;
List<String>? accountIds;
List<String>? accountNames;
List<DashboardPermissions>? dashboardPermissions;
UserInfo({this.id,this.isAuthenticated,this.firstName,this.lastName,this.name,this.avatarUrl,this.emailAddress,this.roles,this.accountIds,this.accountNames,this.dashboardPermissions});
UserInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
isAuthenticated = json['isAuthenticated'];
firstName = json['firstName'];
lastName = json['lastName'];
name = json['name'];
avatarUrl = json['avatarUrl'];
emailAddress = json['emailAddress'];
roles = JsonConverters.fromJson(json['roles'],'List<String>',context!);
accountIds = JsonConverters.fromJson(json['accountIds'],'List<String>',context!);
accountNames = JsonConverters.fromJson(json['accountNames'],'List<String>',context!);
dashboardPermissions = JsonConverters.fromJson(json['dashboardPermissions'],'List<DashboardPermissions>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'isAuthenticated': isAuthenticated,
'firstName': firstName,
'lastName': lastName,
'name': name,
'avatarUrl': avatarUrl,
'emailAddress': emailAddress,
'roles': JsonConverters.toJson(roles,'List<String>',context!),
'accountIds': JsonConverters.toJson(accountIds,'List<String>',context!),
'accountNames': JsonConverters.toJson(accountNames,'List<String>',context!),
'dashboardPermissions': JsonConverters.toJson(dashboardPermissions,'List<DashboardPermissions>',context!)
};
getTypeName() => "UserInfo";
TypeContext? context = _ctx;
}
/**
* Update the specified login
*/
// @Api(Description="Update the specified login")
class PatchUser implements IPatch, IConvertible
{
/**
* The account IDs that this user has access to
*/
// @ApiMember(Description="The account IDs that this user has access to")
List<String>? accountIds;
/**
* The ID of the user
*/
// @ApiMember(Description="The ID of the user")
String? userId;
/**
* The user's first name
*/
// @ApiMember(Description="The user's first name")
String? firstName;
/**
* The user's last name
*/
// @ApiMember(Description="The user's last name")
String? lastName;
/**
* The new password for the user (leave null to not change)
*/
// @ApiMember(Description="The new password for the user (leave null to not change)")
String? newPassword;
/**
* 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")
List<String>? roles;
PatchUser({this.accountIds,this.userId,this.firstName,this.lastName,this.newPassword,this.roles});
PatchUser.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
accountIds = JsonConverters.fromJson(json['accountIds'],'List<String>',context!);
userId = json['userId'];
firstName = json['firstName'];
lastName = json['lastName'];
newPassword = json['newPassword'];
roles = JsonConverters.fromJson(json['roles'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'accountIds': JsonConverters.toJson(accountIds,'List<String>',context!),
'userId': userId,
'firstName': firstName,
'lastName': lastName,
'newPassword': newPassword,
'roles': JsonConverters.toJson(roles,'List<String>',context!)
};
getTypeName() => "PatchUser";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'team.evovoice.io', types: <String, TypeInfo> {
'DashboardPermissions': TypeInfo(TypeOf.Enum, enumValues:DashboardPermissions.values),
'UserInfo': TypeInfo(TypeOf.Class, create:() => UserInfo()),
'List<DashboardPermissions>': TypeInfo(TypeOf.Class, create:() => <DashboardPermissions>[]),
'PatchUser': TypeInfo(TypeOf.Class, create:() => PatchUser()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
Content-Type: text/csv
Content-Length: length
{"accountIds":["String"],"userId":"String","firstName":"String","lastName":"String","newPassword":"String","roles":["String"]}
HTTP/1.1 200 OK Content-Type: text/csv 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"]}