tvpl.api

<back to all web services

GetHeadOfDeparment

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

class UserLogin implements IConvertible
{
    // @required()
    String? name;

    UserLogin({this.name});
    UserLogin.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name
    };

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

class UserProfile extends UserLogin implements IConvertible
{
    int? id;
    String? fullName;
    String? email;
    int? departmentId;
    int? partyGroupId;
    String? avatar;
    String? telephone;
    DateTime? birthday;
    DateTime? createdAt;
    DateTime? updatedAt;
    int? failedLoginCount;
    // @ignore()
    List<int>? roles;

    DateTime? lastLoginDate;

    UserProfile({this.id,this.fullName,this.email,this.departmentId,this.partyGroupId,this.avatar,this.telephone,this.birthday,this.createdAt,this.updatedAt,this.failedLoginCount,this.roles,this.lastLoginDate});
    UserProfile.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        fullName = json['fullName'];
        email = json['email'];
        departmentId = json['departmentId'];
        partyGroupId = json['partyGroupId'];
        avatar = json['avatar'];
        telephone = json['telephone'];
        birthday = JsonConverters.fromJson(json['birthday'],'DateTime',context!);
        createdAt = JsonConverters.fromJson(json['createdAt'],'DateTime',context!);
        updatedAt = JsonConverters.fromJson(json['updatedAt'],'DateTime',context!);
        failedLoginCount = json['failedLoginCount'];
        roles = JsonConverters.fromJson(json['roles'],'List<int>',context!);
        lastLoginDate = JsonConverters.fromJson(json['lastLoginDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'fullName': fullName,
        'email': email,
        'departmentId': departmentId,
        'partyGroupId': partyGroupId,
        'avatar': avatar,
        'telephone': telephone,
        'birthday': JsonConverters.toJson(birthday,'DateTime',context!),
        'createdAt': JsonConverters.toJson(createdAt,'DateTime',context!),
        'updatedAt': JsonConverters.toJson(updatedAt,'DateTime',context!),
        'failedLoginCount': failedLoginCount,
        'roles': JsonConverters.toJson(roles,'List<int>',context!),
        'lastLoginDate': JsonConverters.toJson(lastLoginDate,'DateTime',context!)
    });

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

class AllUserResponse implements IConvertible
{
    List<UserProfile>? users;
    int? code;
    String? message;
    int? totalCount;

    AllUserResponse({this.users,this.code,this.message,this.totalCount});
    AllUserResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

class GetHeadOfDeparment implements IConvertible
{
    bool? isParty;

    GetHeadOfDeparment({this.isParty});
    GetHeadOfDeparment.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        isParty = json['isParty'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'isParty': isParty
    };

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

TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
    'UserLogin': TypeInfo(TypeOf.Class, create:() => UserLogin()),
    'UserProfile': TypeInfo(TypeOf.Class, create:() => UserProfile()),
    'AllUserResponse': TypeInfo(TypeOf.Class, create:() => AllUserResponse()),
    'List<UserProfile>': TypeInfo(TypeOf.Class, create:() => <UserProfile>[]),
    'GetHeadOfDeparment': TypeInfo(TypeOf.Class, create:() => GetHeadOfDeparment()),
});

Dart GetHeadOfDeparment 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/head-of-department HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"users":[{"id":0,"fullName":"String","email":"String","departmentId":0,"partyGroupId":0,"avatar":"String","telephone":"String","birthday":"0001-01-01T00:00:00.0000000+07:06","createdAt":"0001-01-01T00:00:00.0000000+07:06","updatedAt":"0001-01-01T00:00:00.0000000+07:06","failedLoginCount":0,"roles":[0],"lastLoginDate":"0001-01-01T00:00:00.0000000+07:06","name":"String"}],"code":0,"message":"String","totalCount":0}