2019-02-21 11:51:49 +01:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
part 'account.g.dart';
|
|
|
|
|
2020-02-01 10:57:51 +01:00
|
|
|
@JsonSerializable(includeIfNull: false)
|
2022-10-03 12:21:22 +02:00
|
|
|
class Account {
|
|
|
|
// For Bitbucket
|
2019-09-26 16:14:14 +02:00
|
|
|
|
2020-02-02 07:08:58 +01:00
|
|
|
// equals(Account a) {
|
|
|
|
// final uri = Uri.parse(domain);
|
|
|
|
// final uriA = Uri.parse(a.domain);
|
2019-09-26 16:40:53 +02:00
|
|
|
|
2020-02-02 07:08:58 +01: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 11:51:49 +01:00
|
|
|
|
2019-09-27 14:52:38 +02:00
|
|
|
Account({
|
2021-05-16 09:16:35 +02:00
|
|
|
required this.platform,
|
|
|
|
required this.domain,
|
|
|
|
required this.token,
|
|
|
|
required this.login,
|
|
|
|
required this.avatarUrl,
|
2019-12-30 13:50:31 +01:00
|
|
|
this.gitlabId,
|
2020-02-02 07:08:58 +01:00
|
|
|
this.appPassword,
|
2020-05-11 14:57:18 +02:00
|
|
|
this.accountId,
|
2019-02-21 11:51:49 +01:00
|
|
|
});
|
|
|
|
|
2019-09-27 14:52:38 +02:00
|
|
|
factory Account.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AccountFromJson(json);
|
2022-09-21 18:28:21 +02:00
|
|
|
String platform;
|
|
|
|
String domain;
|
|
|
|
String token;
|
|
|
|
String login;
|
|
|
|
String avatarUrl;
|
|
|
|
int? gitlabId; // For GitLab
|
|
|
|
String? appPassword; // For Bitbucket
|
|
|
|
String? accountId;
|
2019-02-21 11:51:49 +01:00
|
|
|
|
2019-09-27 14:52:38 +02:00
|
|
|
Map<String, dynamic> toJson() => _$AccountToJson(this);
|
2019-02-21 11:51:49 +01:00
|
|
|
}
|