1 module fcm.FCMResponse;
2 
3 import asdf;
4 
5 /**
6  * Downstream HTTP message response body (JSON).
7  * 
8  * https://firebase.google.com/docs/cloud-messaging/http-server-ref#table5
9  */
10 struct FCMResponse
11 {
12 	/**
13 	 * Unique ID (number) identifying the multicast message.
14 	 */
15 	@serializationKeys("multicast_id")
16 	long multicastId;
17 	
18 	/**
19 	 * Number of messages that were processed without an error.
20 	 */
21 	@serializationKeys("success")
22 	int success;
23 
24 	/**
25 	 * Number of messages that could not be processed.
26 	 */
27 	@serializationKeys("failure")
28 	int failure;
29 	
30 	/**
31 	 * Number of results that contain a canonical registration token.
32 	 * A canonical registration ID is the registration token of the
33 	 * last registration requested by the client app. This is the ID
34 	 * that the server should use when sending messages to the device.
35 	 */
36 	//@serializationKeys("canonical_ids")
37 	//int canonicalIds;
38 
39 	/**
40 	 * Array of objects representing the status of the messages
41 	 * processed. The objects are listed in the same order as the
42 	 * request (i.e., for each registration ID in the request, its
43 	 * result is listed in the same index in the response).
44 	 */
45 	@serializationIgnoreIn
46 	@serializationKeys("results")
47 	Result[] results;
48 	
49 	struct Result
50 	{
51 		/**
52 		 * String specifying a unique ID for each successfully
53 		 * processed message.
54 		 */
55 		@serializationIgnoreIn
56 		@serializationKeys("message_id")
57 		string messageId;
58 		
59 		/**
60 		 * Optional string specifying the canonical registration token
61 		 * for the client app that the message was processed and sent
62 		 * to. Sender should use this value as the registration token
63 		 * for future requests. Otherwise, the messages might be
64 		 * rejected.
65 		 * 
66 		 * Optional
67 		 */
68 		@serializationIgnoreIn
69 		@serializationKeys("registration_id")
70 		string registrationId;
71 		
72 		/**
73 		 * String specifying the error that occurred when processing
74 		 * the message for the recipient. The possible values can be
75 		 * found in:
76 		 * https://firebase.google.com/docs/cloud-messaging/http-server-ref#table9
77 		 */
78 		@serializationIgnoreIn
79 		@serializationKeys("error")
80 		string error;
81 	}
82 }