Trendsic Platform Service

<back to all web services

CreateRoleRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/Roles
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 CreateRoleRequest implements IConvertible
{
    String? Code;
    String? Name;
    String? Description;
    List<int>? PermissionIds = [];

    CreateRoleRequest({this.Code,this.Name,this.Description,this.PermissionIds});
    CreateRoleRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Code = json['Code'];
        Name = json['Name'];
        Description = json['Description'];
        PermissionIds = JsonConverters.fromJson(json['PermissionIds'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Code': Code,
        'Name': Name,
        'Description': Description,
        'PermissionIds': JsonConverters.toJson(PermissionIds,'List<int>',context!)
    };

    getTypeName() => "CreateRoleRequest";
    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>[]),
    'CreateRoleRequest': TypeInfo(TypeOf.Class, create:() => CreateRoleRequest()),
});

Dart CreateRoleRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/Roles HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateRoleRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <Code>String</Code>
  <Description>String</Description>
  <Name>String</Name>
  <PermissionIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:int>0</d2p1:int>
  </PermissionIds>
</CreateRoleRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<Role xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal.Models">
  <Code>String</Code>
  <CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
  <Description>String</Description>
  <IsActive>false</IsActive>
  <IsSystem>false</IsSystem>
  <Name>String</Name>
  <Permissions>
    <Permission>
      <Action>String</Action>
      <Code>String</Code>
      <CreatedUtc>0001-01-01T00:00:00</CreatedUtc>
      <Description>String</Description>
      <IsActive>false</IsActive>
      <Module>String</Module>
      <Name>String</Name>
      <PermissionId>0</PermissionId>
      <Resource>String</Resource>
      <SortOrder>0</SortOrder>
      <Tags>String</Tags>
    </Permission>
  </Permissions>
  <RoleId>0</RoleId>
  <TenantId>00000000-0000-0000-0000-000000000000</TenantId>
</Role>