1 module fcm.FCMResponse; 2 3 import vibe.data.json; 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 @name("multicast_id") 16 real multicastId; 17 18 /** 19 * Number of messages that were processed without an error. 20 */ 21 @name("success") 22 int success; 23 24 /** 25 * Number of messages that could not be processed. 26 */ 27 @name("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 @name("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 @name("results") 46 Result[] results; 47 48 struct Result 49 { 50 /** 51 * String specifying a unique ID for each successfully 52 * processed message. 53 */ 54 @optional 55 @name("message_id") 56 string messageId; 57 58 /** 59 * Optional string specifying the canonical registration token 60 * for the client app that the message was processed and sent 61 * to. Sender should use this value as the registration token 62 * for future requests. Otherwise, the messages might be 63 * rejected. 64 * 65 * Optional 66 */ 67 @optional 68 @name("registration_id") 69 string registrationId; 70 71 /** 72 * String specifying the error that occurred when processing 73 * the message for the recipient. The possible values can be 74 * found in: 75 * https://firebase.google.com/docs/cloud-messaging/http-server-ref#table9 76 */ 77 @optional 78 @name("error") 79 string error; 80 } 81 }