70 lines
1.7 KiB
Dart
70 lines
1.7 KiB
Dart
class NotificationRequest {
|
|
String? priority;
|
|
List<String>? registrationIds;
|
|
Data? data;
|
|
Notification? notification;
|
|
|
|
NotificationRequest(
|
|
{this.priority, this.registrationIds, this.data, this.notification});
|
|
|
|
NotificationRequest.fromJson(Map<String, dynamic> json) {
|
|
priority = json['priority'];
|
|
registrationIds = json['registration_ids'].cast<String>();
|
|
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
|
|
notification = json['notification'] != null
|
|
? new Notification.fromJson(json['notification'])
|
|
: null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['priority'] = this.priority;
|
|
data['registration_ids'] = this.registrationIds;
|
|
if (this.data != null) {
|
|
data['data'] = this.data!.toJson();
|
|
}
|
|
if (this.notification != null) {
|
|
data['notification'] = this.notification!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Data {
|
|
String? accessid;
|
|
|
|
Data({this.accessid});
|
|
|
|
Data.fromJson(Map<String, dynamic> json) {
|
|
accessid = json['accessid'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['accessid'] = this.accessid;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Notification {
|
|
String? title;
|
|
String? body;
|
|
String? sound;
|
|
|
|
Notification({this.title, this.body, this.sound});
|
|
|
|
Notification.fromJson(Map<String, dynamic> json) {
|
|
title = json['title'];
|
|
body = json['body'];
|
|
sound = json['sound'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['title'] = this.title;
|
|
data['body'] = this.body;
|
|
data['sound'] = this.sound;
|
|
return data;
|
|
}
|
|
}
|