mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update
This commit is contained in:
27
lib/api/token.dart
Normal file
27
lib/api/token.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'token.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class Token {
|
||||
const Token ({
|
||||
required this.id,
|
||||
required this.uid,
|
||||
required this.token,
|
||||
required this.expired,
|
||||
required this.httpOnly,
|
||||
required this.secure,
|
||||
});
|
||||
final int id;
|
||||
final int uid;
|
||||
final String token;
|
||||
@JsonKey(fromJson: _fromJson, toJson: _toJson)
|
||||
final DateTime expired;
|
||||
@JsonKey(name: 'http_only')
|
||||
final bool httpOnly;
|
||||
final bool secure;
|
||||
static DateTime _fromJson(String d) => DateTime.parse(d);
|
||||
static String _toJson(DateTime d) => d.toIso8601String();
|
||||
factory Token.fromJson(Map<String, dynamic> json) => _$TokenFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TokenToJson(this);
|
||||
}
|
||||
Reference in New Issue
Block a user