createPush method
Create push notification
Create a new push notification.
Implementation
Future<models.Message> createPush(
{required String messageId,
required String title,
required String body,
List<String>? topics,
List<String>? users,
List<String>? targets,
Map? data,
String? action,
String? image,
String? icon,
String? sound,
String? color,
String? tag,
String? badge,
bool? draft,
String? scheduledAt}) async {
final String apiPath = '/messaging/messages/push';
final Map<String, dynamic> apiParams = {
'messageId': messageId,
'title': title,
'body': body,
'topics': topics,
'users': users,
'targets': targets,
'data': data,
'action': action,
'image': image,
'icon': icon,
'sound': sound,
'color': color,
'tag': tag,
'badge': badge,
'draft': draft,
'scheduledAt': scheduledAt,
};
final Map<String, String> apiHeaders = {
'content-type': 'application/json',
};
final res = await client.call(HttpMethod.post,
path: apiPath, params: apiParams, headers: apiHeaders);
return models.Message.fromMap(res.data);
}