Files
workavia-mail-front/fcm/lib/method/set/firebase_registration_set_response.dart
T
dab246 f5d878012d TF-2298 Update expires time when old token has expired
Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit fb26afe8f52df6e16476aea8a68f9f92c5c4b001)
2024-01-08 14:25:26 +01:00

59 lines
2.2 KiB
Dart

import 'package:fcm/model/firebase_registration.dart';
import 'package:jmap_dart_client/http/converter/id_converter.dart';
import 'package:jmap_dart_client/jmap/core/error/set_error.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:jmap_dart_client/jmap/core/method/response/set_response.dart';
class FirebaseRegistrationSetResponse extends SetResponseNoAccount<FirebaseRegistration> {
FirebaseRegistrationSetResponse({
Map<Id, FirebaseRegistration>? created,
Map<Id, FirebaseRegistration?>? updated,
Set<Id>? destroyed,
Map<Id, SetError>? notCreated,
Map<Id, SetError>? notUpdated,
Map<Id, SetError>? notDestroyed
}) : super(
created: created,
updated: updated,
destroyed: destroyed,
notCreated: notCreated,
notUpdated: notUpdated,
notDestroyed: notDestroyed
);
static FirebaseRegistrationSetResponse deserialize(Map<String, dynamic> json) {
return FirebaseRegistrationSetResponse(
created: (json['created'] as Map<String, dynamic>?)?.map((key, value) => MapEntry(
const IdConverter().fromJson(key),
FirebaseRegistration.fromJson(value as Map<String, dynamic>)
)),
updated: (json['updated'] as Map<String, dynamic>?)?.map((key, value) => MapEntry(
const IdConverter().fromJson(key),
value != null ? FirebaseRegistration.fromJson(value as Map<String, dynamic>) : null
)),
destroyed: (json['destroyed'] as List<dynamic>?)?.map((id) => const IdConverter().fromJson(id)).toSet(),
notCreated: (json['notCreated'] as Map<String, dynamic>?)?.map((key, value) => MapEntry(
const IdConverter().fromJson(key),
SetError.fromJson(value)
)),
notUpdated: (json['notUpdated'] as Map<String, dynamic>?)?.map((key, value) => MapEntry(
const IdConverter().fromJson(key),
SetError.fromJson(value)
)),
notDestroyed: (json['notDestroyed'] as Map<String, dynamic>?)?.map((key, value) => MapEntry(
const IdConverter().fromJson(key),
SetError.fromJson(value)
)),
);
}
@override
List<Object?> get props => [
created,
updated,
destroyed,
notCreated,
notUpdated,
notDestroyed
];
}