fcm_device_group/raw.rs
1use serde::{Deserialize, Serialize};
2
3/// Represents a POST operation to fcm. See <https://firebase.google.com/docs/cloud-messaging/android/device-group>
4#[derive(Debug, Serialize, Deserialize)]
5#[serde(tag = "operation", rename_all = "lowercase")]
6pub enum Operation {
7 /// Create a new device group with the following name
8 /// See <https://firebase.google.com/docs/cloud-messaging/android/device-group#creating_a_device_group>
9 Create {
10 /// Name of the dev device group
11 notification_key_name: String,
12 /// registration IDS to create the device group with
13 registration_ids: Vec<String>,
14 },
15 /// Add a devices to the device group
16 /// See <https://firebase.google.com/docs/cloud-messaging/android/device-group#adding_and_removing_devices_from_a_device_group>
17 Add {
18 /// Key name of the device group.
19 /// notification_key_name is not required for adding/removing registration tokens, but including it protects you against
20 /// accidentally using the incorrect notification_key.
21 #[serde(skip_serializing_if = "Option::is_none")]
22 notification_key_name: Option<String>,
23 /// Device group notification key
24 notification_key: String,
25 /// Registration IDS to add
26 registration_ids: Vec<String>,
27 },
28 /// Remove a device from a device group
29 /// See <https://firebase.google.com/docs/cloud-messaging/android/device-group#adding_and_removing_devices_from_a_device_group>
30 Remove {
31 /// Key name of the device group.
32 /// notification_key_name is not required for adding/removing registration tokens, but including it protects you against
33 /// accidentally using the incorrect notification_key.
34 #[serde(skip_serializing_if = "Option::is_none")]
35 notification_key_name: Option<String>,
36 /// Device group notification key
37 notification_key: String,
38 /// Registration IDS to add
39 registration_ids: Vec<String>,
40 },
41}
42
43/// Response from a POST Operation
44#[derive(Debug, Deserialize, PartialEq, Eq, Hash)]
45pub struct OperationResponse {
46 /// Key of the effected device group
47 pub notification_key: String,
48}