mirror of
https://github.com/git-touch/git-touch
synced 2024-12-24 14:51:28 +01:00
38 lines
845 B
Dart
38 lines
845 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:meta/meta.dart';
|
|
|
|
part 'account.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class Account {
|
|
String platform;
|
|
String domain;
|
|
String token;
|
|
String login;
|
|
String avatarUrl;
|
|
|
|
equals(Account a) {
|
|
final uri = Uri.parse(domain);
|
|
final uriA = Uri.parse(a.domain);
|
|
|
|
// Treat domains as the same if they have the same hosts and ports
|
|
return a.platform == platform &&
|
|
a.login == login &&
|
|
uri.host == uriA.host &&
|
|
uri.port == uriA.port;
|
|
}
|
|
|
|
Account({
|
|
@required this.platform,
|
|
@required this.domain,
|
|
@required this.token,
|
|
@required this.login,
|
|
@required this.avatarUrl,
|
|
});
|
|
|
|
factory Account.fromJson(Map<String, dynamic> json) =>
|
|
_$AccountFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$AccountToJson(this);
|
|
}
|