2019-02-21 18:51:49 +08:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
|
|
|
|
part 'account.g.dart';
|
|
|
|
|
2020-02-01 17:57:51 +08:00
|
|
|
@JsonSerializable(includeIfNull: false)
|
2019-09-27 20:52:38 +08:00
|
|
|
class Account {
|
2019-02-21 22:36:19 +08:00
|
|
|
String platform;
|
2019-02-21 18:51:49 +08:00
|
|
|
String domain;
|
2019-09-26 22:14:14 +08:00
|
|
|
String token;
|
2019-02-21 22:36:19 +08:00
|
|
|
String login;
|
2019-09-26 22:14:14 +08:00
|
|
|
String avatarUrl;
|
2020-02-02 14:08:58 +08:00
|
|
|
int gitlabId; // For GitLab
|
|
|
|
String appPassword; // For Bitbucket
|
2020-05-11 18:27:18 +05:30
|
|
|
String accountId; // For Bitbucket
|
2019-09-26 22:14:14 +08:00
|
|
|
|
2020-02-02 14:08:58 +08:00
|
|
|
// equals(Account a) {
|
|
|
|
// final uri = Uri.parse(domain);
|
|
|
|
// final uriA = Uri.parse(a.domain);
|
2019-09-26 22:40:53 +08:00
|
|
|
|
2020-02-02 14:08:58 +08:00
|
|
|
// // Treat domains as the same if they have the same hosts and ports
|
|
|
|
// return a.platform == platform &&
|
|
|
|
// a.login == login &&
|
|
|
|
// a.gitlabId == gitlabId &&
|
|
|
|
// uri.host == uriA.host &&
|
|
|
|
// uri.port == uriA.port;
|
|
|
|
// }
|
2019-02-21 18:51:49 +08:00
|
|
|
|
2019-09-27 20:52:38 +08:00
|
|
|
Account({
|
2019-09-26 22:14:14 +08:00
|
|
|
@required this.platform,
|
|
|
|
@required this.domain,
|
2019-02-21 18:51:49 +08:00
|
|
|
@required this.token,
|
2019-09-26 22:14:14 +08:00
|
|
|
@required this.login,
|
|
|
|
@required this.avatarUrl,
|
2019-12-30 20:50:31 +08:00
|
|
|
this.gitlabId,
|
2020-02-02 14:08:58 +08:00
|
|
|
this.appPassword,
|
2020-05-11 18:27:18 +05:30
|
|
|
this.accountId,
|
2019-02-21 18:51:49 +08:00
|
|
|
});
|
|
|
|
|
2019-09-27 20:52:38 +08:00
|
|
|
factory Account.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AccountFromJson(json);
|
2019-02-21 18:51:49 +08:00
|
|
|
|
2019-09-27 20:52:38 +08:00
|
|
|
Map<String, dynamic> toJson() => _$AccountToJson(this);
|
2019-02-21 18:51:49 +08:00
|
|
|
}
|