mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-08 01:43:13 +00:00
33 lines
832 B
Dart
33 lines
832 B
Dart
import 'package:equatable/equatable.dart';
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
import 'package:selfprivacy/logic/api_maps/graphql_maps/schema/server_api.graphql.dart';
|
|
|
|
part 'api_token.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class ApiToken extends Equatable {
|
|
factory ApiToken.fromJson(final Map<String, dynamic> json) =>
|
|
_$ApiTokenFromJson(json);
|
|
const ApiToken({
|
|
required this.name,
|
|
required this.date,
|
|
required this.isCaller,
|
|
});
|
|
|
|
ApiToken.fromGraphQL(
|
|
final Query$GetApiTokens$api$devices device,
|
|
) : this(
|
|
name: device.name,
|
|
date: device.creationDate,
|
|
isCaller: device.isCaller,
|
|
);
|
|
|
|
final String name;
|
|
final DateTime date;
|
|
@JsonKey(name: 'is_caller')
|
|
final bool isCaller;
|
|
|
|
@override
|
|
List<Object?> get props => [name, date, isCaller];
|
|
}
|