Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.1 kB
5
Indexable
Never
// To parse this JSON data, do
//
//     final authModel = authModelFromJson(jsonString);

import 'dart:convert';

AuthModel authModelFromJson(String str) => AuthModel.fromJson(json.decode(str));

String authModelToJson(AuthModel data) => json.encode(data.toJson());

class AuthModel {
    Data? data;
    bool? success;

    AuthModel({
        this.data,
        this.success,
    });

    factory AuthModel.fromJson(Map<String, dynamic> json) => AuthModel(
        data: json["data"] == null ? null : Data.fromJson(json["data"]),
        success: json["success"],
    );

    Map<String, dynamic> toJson() => {
        "data": data?.toJson(),
        "success": success,
    };
}

class Data {
    String? id;
    String? sessionToken;
    String? refreshToken;
    String? emailAddress;
    String? firstName;
    String? lastName;
    List<String>? roles;
    String? designation;
    String? designationId;
    String? branchId;
    String? stationId;
    String? stationName;
    String? withdrawalLimit;
    String? temporaryPassword;
    String? depositLimit;
    String? temporaryPin;
    String? deviceId;

    Data({
        this.id,
        this.sessionToken,
        this.refreshToken,
        this.emailAddress,
        this.firstName,
        this.lastName,
        this.roles,
        this.designation,
        this.designationId,
        this.branchId,
        this.stationId,
        this.stationName,
        this.withdrawalLimit,
        this.temporaryPassword,
        this.depositLimit,
        this.temporaryPin,
        this.deviceId,
    });

    factory Data.fromJson(Map<String, dynamic> json) => Data(
        id: json["id"],
        sessionToken: json["session_token"],
        refreshToken: json["refresh_token"],
        emailAddress: json["email_address"],
        firstName: json["first_name"],
        lastName: json["last_name"],
        roles: json["roles"] == null ? [] : List<String>.from(json["roles"]!.map((x) => x)),
        designation: json["designation"],
        designationId: json["designation_id"],
        branchId: json["branch_id"],
        stationId: json["station_id"],
        stationName: json["station_name"],
        withdrawalLimit: json["withdrawal_limit"],
        temporaryPassword: json["temporary_password"],
        depositLimit: json["deposit_limit"],
        temporaryPin: json["temporary_pin"],
        deviceId: json["device_id"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "session_token": sessionToken,
        "refresh_token": refreshToken,
        "email_address": emailAddress,
        "first_name": firstName,
        "last_name": lastName,
        "roles": roles == null ? [] : List<dynamic>.from(roles!.map((x) => x)),
        "designation": designation,
        "designation_id": designationId,
        "branch_id": branchId,
        "station_id": stationId,
        "station_name": stationName,
        "withdrawal_limit": withdrawalLimit,
        "temporary_password": temporaryPassword,
        "deposit_limit": depositLimit,
        "temporary_pin": temporaryPin,
        "device_id": deviceId,
    };
}
Leave a Comment