| PUT,OPTIONS | /v1/Roles/{RoleId} |
|---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
class Permission implements IConvertible
{
int? PermissionId;
String? Module;
String? Resource;
String? Action;
String? Name;
String? Description;
String? Tags;
int? SortOrder;
bool? IsActive;
DateTime? CreatedUtc;
String? Code;
Permission({this.PermissionId,this.Module,this.Resource,this.Action,this.Name,this.Description,this.Tags,this.SortOrder,this.IsActive,this.CreatedUtc,this.Code});
Permission.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
PermissionId = json['PermissionId'];
Module = json['Module'];
Resource = json['Resource'];
Action = json['Action'];
Name = json['Name'];
Description = json['Description'];
Tags = json['Tags'];
SortOrder = json['SortOrder'];
IsActive = json['IsActive'];
CreatedUtc = JsonConverters.fromJson(json['CreatedUtc'],'DateTime',context!);
Code = json['Code'];
return this;
}
Map<String, dynamic> toJson() => {
'PermissionId': PermissionId,
'Module': Module,
'Resource': Resource,
'Action': Action,
'Name': Name,
'Description': Description,
'Tags': Tags,
'SortOrder': SortOrder,
'IsActive': IsActive,
'CreatedUtc': JsonConverters.toJson(CreatedUtc,'DateTime',context!),
'Code': Code
};
getTypeName() => "Permission";
TypeContext? context = _ctx;
}
class Role implements IConvertible
{
int? RoleId;
String? TenantId;
String? Code;
String? Name;
String? Description;
bool? IsSystem;
bool? IsActive;
DateTime? CreatedUtc;
List<Permission>? Permissions = [];
Role({this.RoleId,this.TenantId,this.Code,this.Name,this.Description,this.IsSystem,this.IsActive,this.CreatedUtc,this.Permissions});
Role.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleId = json['RoleId'];
TenantId = json['TenantId'];
Code = json['Code'];
Name = json['Name'];
Description = json['Description'];
IsSystem = json['IsSystem'];
IsActive = json['IsActive'];
CreatedUtc = JsonConverters.fromJson(json['CreatedUtc'],'DateTime',context!);
Permissions = JsonConverters.fromJson(json['Permissions'],'List<Permission>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'RoleId': RoleId,
'TenantId': TenantId,
'Code': Code,
'Name': Name,
'Description': Description,
'IsSystem': IsSystem,
'IsActive': IsActive,
'CreatedUtc': JsonConverters.toJson(CreatedUtc,'DateTime',context!),
'Permissions': JsonConverters.toJson(Permissions,'List<Permission>',context!)
};
getTypeName() => "Role";
TypeContext? context = _ctx;
}
class UpdateRoleRequest implements IConvertible
{
int? RoleId;
String? Code;
String? Name;
String? Description;
List<int>? PermissionIds = [];
UpdateRoleRequest({this.RoleId,this.Code,this.Name,this.Description,this.PermissionIds});
UpdateRoleRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
RoleId = json['RoleId'];
Code = json['Code'];
Name = json['Name'];
Description = json['Description'];
PermissionIds = JsonConverters.fromJson(json['PermissionIds'],'List<int>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'RoleId': RoleId,
'Code': Code,
'Name': Name,
'Description': Description,
'PermissionIds': JsonConverters.toJson(PermissionIds,'List<int>',context!)
};
getTypeName() => "UpdateRoleRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.dev.dynamics.trendsic.com', types: <String, TypeInfo> {
'Permission': TypeInfo(TypeOf.Class, create:() => Permission()),
'Role': TypeInfo(TypeOf.Class, create:() => Role()),
'List<Permission>': TypeInfo(TypeOf.Class, create:() => <Permission>[]),
'UpdateRoleRequest': TypeInfo(TypeOf.Class, create:() => UpdateRoleRequest()),
});
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.
PUT /v1/Roles/{RoleId} HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"RoleId":0,"Code":"String","Name":"String","Description":"String","PermissionIds":[0]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"RoleId":0,"TenantId":"00000000000000000000000000000000","Code":"String","Name":"String","Description":"String","IsSystem":false,"IsActive":false,"CreatedUtc":"0001-01-01T00:00:00.0000000","Permissions":[{"PermissionId":0,"Module":"String","Resource":"String","Action":"String","Name":"String","Description":"String","Tags":"String","SortOrder":0,"IsActive":false,"CreatedUtc":"0001-01-01T00:00:00.0000000","Code":"String"}]}