tvpl.api

<back to all web services

UserCurrentRequest

Requires Authentication
The following routes are available for this service:
GET/users/current
import 'package:servicestack/servicestack.dart';

class UserCurrentRequest implements IConvertible
{
    UserCurrentRequest();
    UserCurrentRequest.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "UserCurrentRequest";
    TypeContext? context = _ctx;
}

enum CategoryTypes
{
    Department,
    PartyGroup,
    DocGroup,
    DocType,
    IssuingAgency,
    Status,
    Subjects,
    Workflow,
}

class CreateCategoryModel implements IConvertible
{
    String? name;
    String? description;
    CategoryTypes? type;
    bool? isParty;
    // @ignore()
    List<int>? childList;

    CreateCategoryModel({this.name,this.description,this.type,this.isParty,this.childList});
    CreateCategoryModel.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        description = json['description'];
        type = JsonConverters.fromJson(json['type'],'CategoryTypes',context!);
        isParty = json['isParty'];
        childList = JsonConverters.fromJson(json['childList'],'List<int>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'description': description,
        'type': JsonConverters.toJson(type,'CategoryTypes',context!),
        'isParty': isParty,
        'childList': JsonConverters.toJson(childList,'List<int>',context!)
    };

    getTypeName() => "CreateCategoryModel";
    TypeContext? context = _ctx;
}

class Category extends CreateCategoryModel implements IConvertible
{
    int? id;
    int? level;
    int? sortOrder;
    DateTime? lastUpdate;
    // @ignore()
    List<Category>? children;

    Category({this.id,this.level,this.sortOrder,this.lastUpdate,this.children});
    Category.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        level = json['level'];
        sortOrder = json['sortOrder'];
        lastUpdate = JsonConverters.fromJson(json['lastUpdate'],'DateTime',context!);
        children = JsonConverters.fromJson(json['children'],'List<Category>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'level': level,
        'sortOrder': sortOrder,
        'lastUpdate': JsonConverters.toJson(lastUpdate,'DateTime',context!),
        'children': JsonConverters.toJson(children,'List<Category>',context!)
    });

    getTypeName() => "Category";
    TypeContext? context = _ctx;
}

class BaseResponse<List> implements IResponseRequest, IConvertible
{
    int? code;
    String? message;
    List<Category>? data;

    BaseResponse({this.code,this.message,this.data});
    BaseResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        code = json['code'];
        message = json['message'];
        data = JsonConverters.fromJson(json['data'],'List<Category>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'code': code,
        'message': message,
        'data': JsonConverters.toJson(data,'List<Category>',context!)
    };

    getTypeName() => "BaseResponse<$List`1>";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
    'UserCurrentRequest': TypeInfo(TypeOf.Class, create:() => UserCurrentRequest()),
    'CategoryTypes': TypeInfo(TypeOf.Enum, enumValues:CategoryTypes.values),
    'CreateCategoryModel': TypeInfo(TypeOf.Class, create:() => CreateCategoryModel()),
    'Category': TypeInfo(TypeOf.Class, create:() => Category()),
    'List<Category>': TypeInfo(TypeOf.Class, create:() => <Category>[]),
    'BaseResponse<List>': TypeInfo(TypeOf.Class, create:() => BaseResponse<List>()),
});

Dart UserCurrentRequest DTOs

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

HTTP + JSON

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

GET /users/current HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"code":0,"message":"String","data":{"id":0,"userName":"String","fullName":"String","name":"String","email":"String","departmentId":0,"phoneNumber":"String","partyGroupId":0,"hrmsId":0,"avatar":"String","birthday":"0001-01-01T00:00:00.0000000+07:06","isDelete":0}}