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 .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.

GET /users/head-of-department HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AllUserResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <Code>0</Code>
  <Message>String</Message>
  <TotalCount>0</TotalCount>
  <Users xmlns:d2p1="http://schemas.datacontract.org/2004/07/tvpl.data.Models">
    <d2p1:UserProfile>
      <d2p1:Name>String</d2p1:Name>
      <d2p1:Password>String</d2p1:Password>
      <d2p1:Avatar>String</d2p1:Avatar>
      <d2p1:Birthday>0001-01-01T00:00:00</d2p1:Birthday>
      <d2p1:CreatedAt>0001-01-01T00:00:00</d2p1:CreatedAt>
      <d2p1:CreatedBy>String</d2p1:CreatedBy>
      <d2p1:DeletedAt>0001-01-01T00:00:00</d2p1:DeletedAt>
      <d2p1:DeletedBy>String</d2p1:DeletedBy>
      <d2p1:DepartmentId>0</d2p1:DepartmentId>
      <d2p1:Email>String</d2p1:Email>
      <d2p1:FailedLoginCount>0</d2p1:FailedLoginCount>
      <d2p1:FullName>String</d2p1:FullName>
      <d2p1:Id>0</d2p1:Id>
      <d2p1:IsDeleted>false</d2p1:IsDeleted>
      <d2p1:LastLoginDate>0001-01-01T00:00:00</d2p1:LastLoginDate>
      <d2p1:PartyGroupId>0</d2p1:PartyGroupId>
      <d2p1:Roles xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:int>0</d4p1:int>
      </d2p1:Roles>
      <d2p1:Telephone>String</d2p1:Telephone>
      <d2p1:UpdatedAt>0001-01-01T00:00:00</d2p1:UpdatedAt>
      <d2p1:UpdatedBy>String</d2p1:UpdatedBy>
    </d2p1:UserProfile>
  </Users>
</AllUserResponse>