119 lines
3.4 KiB
Dart
119 lines
3.4 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.0
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of openapi.api;
|
|
|
|
class TokenDTO {
|
|
/// Returns a new [TokenDTO] instance.
|
|
TokenDTO({
|
|
this.accessToken,
|
|
this.refreshToken,
|
|
this.scope,
|
|
this.tokenType,
|
|
this.expiresIn,
|
|
this.expiration,
|
|
});
|
|
|
|
String accessToken;
|
|
|
|
String refreshToken;
|
|
|
|
String scope;
|
|
|
|
String tokenType;
|
|
|
|
int expiresIn;
|
|
|
|
DateTime expiration;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is TokenDTO &&
|
|
other.accessToken == accessToken &&
|
|
other.refreshToken == refreshToken &&
|
|
other.scope == scope &&
|
|
other.tokenType == tokenType &&
|
|
other.expiresIn == expiresIn &&
|
|
other.expiration == expiration;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
(accessToken == null ? 0 : accessToken.hashCode) +
|
|
(refreshToken == null ? 0 : refreshToken.hashCode) +
|
|
(scope == null ? 0 : scope.hashCode) +
|
|
(tokenType == null ? 0 : tokenType.hashCode) +
|
|
(expiresIn == null ? 0 : expiresIn.hashCode) +
|
|
(expiration == null ? 0 : expiration.hashCode);
|
|
|
|
@override
|
|
String toString() => 'TokenDTO[accessToken=$accessToken, refreshToken=$refreshToken, scope=$scope, tokenType=$tokenType, expiresIn=$expiresIn, expiration=$expiration]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (accessToken != null) {
|
|
json[r'access_token'] = accessToken;
|
|
}
|
|
if (refreshToken != null) {
|
|
json[r'refresh_token'] = refreshToken;
|
|
}
|
|
if (scope != null) {
|
|
json[r'scope'] = scope;
|
|
}
|
|
if (tokenType != null) {
|
|
json[r'token_type'] = tokenType;
|
|
}
|
|
if (expiresIn != null) {
|
|
json[r'expires_in'] = expiresIn;
|
|
}
|
|
if (expiration != null) {
|
|
json[r'expiration'] = expiration.toUtc().toIso8601String();
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [TokenDTO] instance and imports its values from
|
|
/// [json] if it's non-null, null if [json] is null.
|
|
static TokenDTO fromJson(Map<String, dynamic> json) => json == null
|
|
? null
|
|
: TokenDTO(
|
|
accessToken: json[r'access_token'],
|
|
refreshToken: json[r'refresh_token'],
|
|
scope: json[r'scope'],
|
|
tokenType: json[r'token_type'],
|
|
expiresIn: json[r'expires_in'],
|
|
expiration: json[r'expiration'] == null
|
|
? null
|
|
: DateTime.parse(json[r'expiration']),
|
|
);
|
|
|
|
static List<TokenDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
|
json == null || json.isEmpty
|
|
? true == emptyIsNull ? null : <TokenDTO>[]
|
|
: json.map((v) => TokenDTO.fromJson(v)).toList(growable: true == growable);
|
|
|
|
static Map<String, TokenDTO> mapFromJson(Map<String, dynamic> json) {
|
|
final map = <String, TokenDTO>{};
|
|
if (json != null && json.isNotEmpty) {
|
|
json.forEach((String key, dynamic v) => map[key] = TokenDTO.fromJson(v));
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of TokenDTO-objects as value to a dart map
|
|
static Map<String, List<TokenDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
|
|
final map = <String, List<TokenDTO>>{};
|
|
if (json != null && json.isNotEmpty) {
|
|
json.forEach((String key, dynamic v) {
|
|
map[key] = TokenDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
|
|
});
|
|
}
|
|
return map;
|
|
}
|
|
}
|
|
|