2024-02-09 11:07:03 +00:00
|
|
|
import 'package:equatable/equatable.dart';
|
2022-05-09 23:16:36 +00:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
2022-10-24 11:39:53 +00:00
|
|
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart';
|
2022-05-09 23:16:36 +00:00
|
|
|
|
|
|
|
part 'api_token.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
2024-02-09 11:07:03 +00:00
|
|
|
class ApiToken extends Equatable {
|
2022-06-05 19:36:32 +00:00
|
|
|
factory ApiToken.fromJson(final Map<String, dynamic> json) =>
|
|
|
|
_$ApiTokenFromJson(json);
|
2024-02-09 11:07:03 +00:00
|
|
|
const ApiToken({
|
2022-05-09 23:16:36 +00:00
|
|
|
required this.name,
|
|
|
|
required this.date,
|
2022-05-24 18:55:39 +00:00
|
|
|
required this.isCaller,
|
2022-05-09 23:16:36 +00:00
|
|
|
});
|
|
|
|
|
2022-10-24 11:39:53 +00:00
|
|
|
ApiToken.fromGraphQL(
|
|
|
|
final Query$GetApiTokens$api$devices device,
|
|
|
|
) : this(
|
|
|
|
name: device.name,
|
|
|
|
date: device.creationDate,
|
|
|
|
isCaller: device.isCaller,
|
|
|
|
);
|
|
|
|
|
2022-05-09 23:16:36 +00:00
|
|
|
final String name;
|
|
|
|
final DateTime date;
|
2022-05-24 18:55:39 +00:00
|
|
|
@JsonKey(name: 'is_caller')
|
|
|
|
final bool isCaller;
|
2024-02-09 11:07:03 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
List<Object?> get props => [name, date, isCaller];
|
2022-05-09 23:16:36 +00:00
|
|
|
}
|