GiteaClient/lib/model/user.dart

102 lines
2.7 KiB
Dart

import 'dart:convert';
import 'package:gitea_client/model/ApiAccess.dart';
class User {
int? id;
String? login;
String? fullName;
String? email;
String? avatarUrl;
String? language;
bool? isAdmin;
String? lastLogin;
String? created;
bool? restricted;
bool? active;
bool? prohibitLogin;
String? location;
String? website;
String? description;
String? visibility;
int? followersCount;
int? followingCount;
int? starredReposCount;
String? username;
User(
{this.id,
this.login,
this.fullName,
this.email,
this.avatarUrl,
this.language,
this.isAdmin,
this.lastLogin,
this.created,
this.restricted,
this.active,
this.prohibitLogin,
this.location,
this.website,
this.description,
this.visibility,
this.followersCount,
this.followingCount,
this.starredReposCount,
this.username});
User.fromJson(Map<String, dynamic> json) {
id = json['id'];
login = json['login'];
fullName = json['full_name'];
email = json['email'];
avatarUrl = json['avatar_url'];
language = json['language'];
isAdmin = json['is_admin'];
lastLogin = json['last_login'];
created = json['created'];
restricted = json['restricted'];
active = json['active'];
prohibitLogin = json['prohibit_login'];
location = json['location'];
website = json['website'];
description = json['description'];
visibility = json['visibility'];
followersCount = json['followers_count'];
followingCount = json['following_count'];
starredReposCount = json['starred_repos_count'];
username = json['username'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['login'] = this.login;
data['full_name'] = this.fullName;
data['email'] = this.email;
data['avatar_url'] = this.avatarUrl;
data['language'] = this.language;
data['is_admin'] = this.isAdmin;
data['last_login'] = this.lastLogin;
data['created'] = this.created;
data['restricted'] = this.restricted;
data['active'] = this.active;
data['prohibit_login'] = this.prohibitLogin;
data['location'] = this.location;
data['website'] = this.website;
data['description'] = this.description;
data['visibility'] = this.visibility;
data['followers_count'] = this.followersCount;
data['following_count'] = this.followingCount;
data['starred_repos_count'] = this.starredReposCount;
data['username'] = this.username;
return data;
}
}
class SavedUser {
final User authedUser;
final ApiAccess apiAccess;
const SavedUser({required this.authedUser,required this.apiAccess});
}