git-touch-android-ios-app/lib/models/account.dart

45 lines
1.1 KiB
Dart
Raw Normal View History

import 'package:json_annotation/json_annotation.dart';
import 'package:meta/meta.dart';
part 'account.g.dart';
2020-02-01 10:57:51 +01:00
@JsonSerializable(includeIfNull: false)
2019-09-27 14:52:38 +02:00
class Account {
String platform;
String domain;
2019-09-26 16:14:14 +02:00
String token;
String login;
2019-09-26 16:14:14 +02:00
String avatarUrl;
2021-05-16 09:16:35 +02:00
int? gitlabId; // For GitLab
String? appPassword; // For Bitbucket
String? accountId; // 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-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,
this.accountId,
});
2019-09-27 14:52:38 +02:00
factory Account.fromJson(Map<String, dynamic> json) =>
_$AccountFromJson(json);
2019-09-27 14:52:38 +02:00
Map<String, dynamic> toJson() => _$AccountToJson(this);
}