Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, h1, h2, h3, div, span, p, pre, a { |
| 5 | margin: 0; |
| 6 | padding: 0; |
| 7 | border: 0; |
| 8 | font-weight: inherit; |
| 9 | font-style: inherit; |
| 10 | font-size: 100%; |
| 11 | font-family: inherit; |
| 12 | vertical-align: baseline; |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3 { |
| 50 | border-bottom: solid #CCC 1px; |
| 51 | } |
| 52 | |
| 53 | .toc_element { |
| 54 | margin-top: 0.5em; |
| 55 | } |
| 56 | |
| 57 | .firstline { |
| 58 | margin-left: 2 em; |
| 59 | } |
| 60 | |
| 61 | .method { |
| 62 | margin-top: 1em; |
| 63 | border: solid 1px #CCC; |
| 64 | padding: 1em; |
| 65 | background: #EEE; |
| 66 | } |
| 67 | |
| 68 | .details { |
| 69 | font-weight: bold; |
| 70 | font-size: 14px; |
| 71 | } |
| 72 | |
| 73 | </style> |
| 74 | |
| 75 | <h1><a href="fcm_v1.html">Firebase Cloud Messaging API</a> . <a href="fcm_v1.projects.html">projects</a> . <a href="fcm_v1.projects.messages.html">messages</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 78 | <code><a href="#send">send(parent, body=None, x__xgafv=None)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 79 | <p class="firstline">Send a message to specified target (a registration token, topic</p> |
| 80 | <h3>Method Details</h3> |
| 81 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 82 | <code class="details" id="send">send(parent, body=None, x__xgafv=None)</code> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 83 | <pre>Send a message to specified target (a registration token, topic |
| 84 | or condition). |
| 85 | |
| 86 | Args: |
| 87 | parent: string, Required. It contains the Firebase project id (i.e. the unique identifier |
| 88 | for your Firebase project), in the format of `projects/{project_id}`. |
| 89 | For legacy support, the numeric project number with no padding is also |
| 90 | supported in the format of `projects/{project_number}`. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 91 | body: object, The request body. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 92 | The object takes the form of: |
| 93 | |
| 94 | { # Request to send a message to specified target. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 95 | "message": { # Message to send by Firebase Cloud Messaging Service. # Required. Message to send. |
| 96 | "topic": "A String", # Topic name to send a message to, e.g. "weather". |
| 97 | # Note: "/topics/" prefix should not be provided. |
| 98 | "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms. |
| 99 | "body": "A String", # The notification's body text. |
| 100 | "title": "A String", # The notification's title. |
| 101 | "image": "A String", # Contains the URL of an image that is going to be downloaded on the device |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 102 | # and displayed in a notification. |
| 103 | # JPEG, PNG, BMP have full support across platforms. Animated GIF and video |
| 104 | # only work on iOS. WebP and HEIF have varying levels of support across |
| 105 | # platforms and platform versions. |
| 106 | # Android has 1MB image size limit. |
| 107 | # Quota usage and implications/costs for hosting image on Firebase Storage: |
| 108 | # https://firebase.google.com/pricing |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 109 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 110 | "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all |
| 111 | # platforms. |
| 112 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 113 | }, |
| 114 | "data": { # Input only. Arbitrary key/value payload. The key should not be a reserved |
| 115 | # word ("from", "message_type", or any word starting with "google" or "gcm"). |
| 116 | "a_key": "A String", |
| 117 | }, |
| 118 | "token": "A String", # Registration token to send a message to. |
| 119 | "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through |
| 120 | # [FCM connection server](https://goo.gl/4GLdUl). |
| 121 | # [FCM connection server](https://goo.gl/4GLdUl). |
| 122 | "data": { # Arbitrary key/value payload. If present, it will override |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 123 | # google.firebase.fcm.v1.Message.data. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 124 | "a_key": "A String", |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 125 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 126 | "priority": "A String", # Message priority. Can take "normal" and "high" values. |
| 127 | # For more information, see [Setting the priority of a |
| 128 | # message](https://goo.gl/GjONJv). |
| 129 | "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only |
| 130 | # the last message gets sent when delivery can be resumed. A maximum of 4 |
| 131 | # different collapse keys is allowed at any given time. |
| 132 | "directBootOk": True or False, # If set to true, messages will be allowed to be delivered to the app while |
| 133 | # the device is in direct boot mode. See [Support Direct Boot |
| 134 | # mode](https://developer.android.com/training/articles/direct-boot). |
| 135 | "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android. |
| 136 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 137 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 138 | "notification": { # Notification to send to android devices. # Notification to send to android devices. |
| 139 | "tag": "A String", # Identifier used to replace existing notifications in the notification |
| 140 | # drawer. |
| 141 | # If not specified, each request creates a new notification. |
| 142 | # If specified and a notification with the same tag is already being shown, |
| 143 | # the new notification replaces the existing one in the notification drawer. |
| 144 | "titleLocKey": "A String", # The key to the title string in the app's string resources to use to |
| 145 | # localize the title text to the user's current localization. |
| 146 | # See [String Resources](https://goo.gl/NdFZGI) for more information. |
| 147 | "image": "A String", # Contains the URL of an image that is going to be displayed in a |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 148 | # notification. If present, it will override |
| 149 | # google.firebase.fcm.v1.Notification.image. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 150 | "visibility": "A String", # Set the |
| 151 | # [Notification.visibility](https://developer.android.com/reference/android/app/Notification.html#visibility) |
| 152 | # of the notification. |
| 153 | "ticker": "A String", # Sets the "ticker" text, which is sent to accessibility services. |
| 154 | # Prior to API level 21 (`Lollipop`), sets the text that is displayed in the |
| 155 | # status bar when the notification first arrives. |
| 156 | "title": "A String", # The notification's title. If present, it will override |
| 157 | # google.firebase.fcm.v1.Notification.title. |
| 158 | "defaultSound": True or False, # If set to true, use the Android framework's default sound for the |
| 159 | # notification. Default values are specified in |
| 160 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 161 | "sticky": True or False, # When set to false or unset, the notification is automatically |
| 162 | # dismissed when the user clicks it in the panel. When set to true, the |
| 163 | # notification persists even when the user clicks it. |
| 164 | "titleLocArgs": [ # Variable string values to be used in place of the format specifiers in |
| 165 | # title_loc_key to use to localize the title text to the user's current |
| 166 | # localization. |
| 167 | # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. |
| 168 | "A String", |
| 169 | ], |
| 170 | "channelId": "A String", # The [notification's channel |
| 171 | # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels) |
| 172 | # (new in Android O). The app must create a channel with this channel ID |
| 173 | # before any notification with this channel ID is received. If you don't send |
| 174 | # this channel ID in the request, or if the channel ID provided has not yet |
| 175 | # been created by the app, FCM uses the channel ID specified in the app |
| 176 | # manifest. |
| 177 | "defaultVibrateTimings": True or False, # If set to true, use the Android framework's default vibrate pattern for the |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 178 | # notification. Default values are specified in |
| 179 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 180 | # If `default_vibrate_timings` is set to true and `vibrate_timings` is also |
| 181 | # set, the default value is used instead of the user-specified |
| 182 | # `vibrate_timings`. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 183 | "clickAction": "A String", # The action associated with a user click on the notification. |
| 184 | # If specified, an activity with a matching intent filter is launched when |
| 185 | # a user clicks on the notification. |
| 186 | "eventTime": "A String", # Set the time that the event in the notification occurred. Notifications in |
| 187 | # the panel are sorted by this time. A point in time is represented using |
| 188 | # [protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Timestamp). |
| 189 | "defaultLightSettings": True or False, # If set to true, use the Android framework's default LED light settings for |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 190 | # the notification. Default values are specified in |
| 191 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 192 | # If `default_light_settings` is set to true and `light_settings` is also |
| 193 | # set, the user-specified `light_settings` is used instead of the |
| 194 | # default value. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 195 | "localOnly": True or False, # Set whether or not this notification is relevant only to the current |
| 196 | # device. Some notifications can be bridged to other devices for remote |
| 197 | # display, such as a Wear OS watch. This hint can be set to recommend this |
| 198 | # notification not be bridged. See [Wear OS |
| 199 | # guides](https://developer.android.com/training/wearables/notifications/bridger#existing-method-of-preventing-bridging) |
| 200 | "notificationPriority": "A String", # Set the relative priority for this notification. Priority is an indication |
| 201 | # of how much of the user's attention should be consumed by this |
| 202 | # notification. Low-priority notifications may be hidden from the user in |
| 203 | # certain situations, while the user might be interrupted for a |
| 204 | # higher-priority notification. The effect of setting the same priorities may |
| 205 | # differ slightly on different platforms. Note this priority differs from |
| 206 | # `AndroidMessagePriority`. This priority is processed by the client after |
| 207 | # the message has been delivered, whereas |
| 208 | # [AndroidMessagePriority](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidmessagepriority) |
| 209 | # is an FCM concept that controls when the message is delivered. |
| 210 | "vibrateTimings": [ # Set the vibration pattern to use. Pass in an array of |
| 211 | # [protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 212 | # to turn on or off the vibrator. The first value indicates the `Duration` to |
| 213 | # wait before turning the vibrator on. The next value indicates the |
| 214 | # `Duration` to keep the vibrator on. Subsequent values alternate between |
| 215 | # `Duration` to turn the vibrator off and to turn the vibrator on. |
| 216 | # If `vibrate_timings` is set and `default_vibrate_timings` is set to `true`, |
| 217 | # the default value is used instead of the user-specified `vibrate_timings`. |
| 218 | "A String", |
| 219 | ], |
| 220 | "sound": "A String", # The sound to play when the device receives the notification. |
| 221 | # Supports "default" or the filename of a sound resource bundled in the app. |
| 222 | # Sound files must reside in /res/raw/. |
| 223 | "bodyLocKey": "A String", # The key to the body string in the app's string resources to use to localize |
| 224 | # the body text to the user's current localization. |
| 225 | # See [String Resources](https://goo.gl/NdFZGI) for more information. |
| 226 | "notificationCount": 42, # Sets the number of items this notification represents. May be displayed as |
| 227 | # a badge count for launchers that support badging.See [Notification |
| 228 | # Badge](https://developer.android.com/training/notify-user/badges). |
| 229 | # For example, this might be useful if you're using just one notification to |
| 230 | # represent multiple new messages but you want the count here to represent |
| 231 | # the number of total new messages. |
| 232 | # If zero or unspecified, systems that support badging use the default, which |
| 233 | # is to increment a number displayed on the long-press menu each time a new |
| 234 | # notification arrives. |
| 235 | "bodyLocArgs": [ # Variable string values to be used in place of the format specifiers in |
| 236 | # body_loc_key to use to localize the body text to the user's current |
| 237 | # localization. |
| 238 | # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. |
| 239 | "A String", |
| 240 | ], |
| 241 | "body": "A String", # The notification's body text. If present, it will override |
| 242 | # google.firebase.fcm.v1.Notification.body. |
| 243 | "lightSettings": { # Settings to control notification LED. # Settings to control the notification's LED blinking rate and color if LED |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 244 | # is available on the device. The total blinking time is controlled by the |
| 245 | # OS. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 246 | "lightOffDuration": "A String", # Required. Along with `light_on_duration `, define the blink rate of LED |
| 247 | # flashes. Resolution defined by |
| 248 | # [proto.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 249 | "color": { # Represents a color in the RGBA color space. This representation is designed # Required. Set `color` of the LED with |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 250 | # [google.type.Color](https://github.com/googleapis/googleapis/blob/master/google/type/color.proto). |
| 251 | # for simplicity of conversion to/from color representations in various |
| 252 | # languages over compactness; for example, the fields of this representation |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 253 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it |
| 254 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 255 | # method in iOS; and, with just a little work, it can be easily formatted into |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 256 | # a CSS "rgba()" string in JavaScript, as well. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 257 | # |
| 258 | # Note: this proto does not carry information about the absolute color space |
| 259 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, |
| 260 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color |
| 261 | # space. |
| 262 | # |
| 263 | # Example (Java): |
| 264 | # |
| 265 | # import com.google.type.Color; |
| 266 | # |
| 267 | # // ... |
| 268 | # public static java.awt.Color fromProto(Color protocolor) { |
| 269 | # float alpha = protocolor.hasAlpha() |
| 270 | # ? protocolor.getAlpha().getValue() |
| 271 | # : 1.0; |
| 272 | # |
| 273 | # return new java.awt.Color( |
| 274 | # protocolor.getRed(), |
| 275 | # protocolor.getGreen(), |
| 276 | # protocolor.getBlue(), |
| 277 | # alpha); |
| 278 | # } |
| 279 | # |
| 280 | # public static Color toProto(java.awt.Color color) { |
| 281 | # float red = (float) color.getRed(); |
| 282 | # float green = (float) color.getGreen(); |
| 283 | # float blue = (float) color.getBlue(); |
| 284 | # float denominator = 255.0; |
| 285 | # Color.Builder resultBuilder = |
| 286 | # Color |
| 287 | # .newBuilder() |
| 288 | # .setRed(red / denominator) |
| 289 | # .setGreen(green / denominator) |
| 290 | # .setBlue(blue / denominator); |
| 291 | # int alpha = color.getAlpha(); |
| 292 | # if (alpha != 255) { |
| 293 | # result.setAlpha( |
| 294 | # FloatValue |
| 295 | # .newBuilder() |
| 296 | # .setValue(((float) alpha) / denominator) |
| 297 | # .build()); |
| 298 | # } |
| 299 | # return resultBuilder.build(); |
| 300 | # } |
| 301 | # // ... |
| 302 | # |
| 303 | # Example (iOS / Obj-C): |
| 304 | # |
| 305 | # // ... |
| 306 | # static UIColor* fromProto(Color* protocolor) { |
| 307 | # float red = [protocolor red]; |
| 308 | # float green = [protocolor green]; |
| 309 | # float blue = [protocolor blue]; |
| 310 | # FloatValue* alpha_wrapper = [protocolor alpha]; |
| 311 | # float alpha = 1.0; |
| 312 | # if (alpha_wrapper != nil) { |
| 313 | # alpha = [alpha_wrapper value]; |
| 314 | # } |
| 315 | # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; |
| 316 | # } |
| 317 | # |
| 318 | # static Color* toProto(UIColor* color) { |
| 319 | # CGFloat red, green, blue, alpha; |
| 320 | # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { |
| 321 | # return nil; |
| 322 | # } |
| 323 | # Color* result = [[Color alloc] init]; |
| 324 | # [result setRed:red]; |
| 325 | # [result setGreen:green]; |
| 326 | # [result setBlue:blue]; |
| 327 | # if (alpha <= 0.9999) { |
| 328 | # [result setAlpha:floatWrapperWithValue(alpha)]; |
| 329 | # } |
| 330 | # [result autorelease]; |
| 331 | # return result; |
| 332 | # } |
| 333 | # // ... |
| 334 | # |
| 335 | # Example (JavaScript): |
| 336 | # |
| 337 | # // ... |
| 338 | # |
| 339 | # var protoToCssColor = function(rgb_color) { |
| 340 | # var redFrac = rgb_color.red || 0.0; |
| 341 | # var greenFrac = rgb_color.green || 0.0; |
| 342 | # var blueFrac = rgb_color.blue || 0.0; |
| 343 | # var red = Math.floor(redFrac * 255); |
| 344 | # var green = Math.floor(greenFrac * 255); |
| 345 | # var blue = Math.floor(blueFrac * 255); |
| 346 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 347 | # if (!('alpha' in rgb_color)) { |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 348 | # return rgbToCssColor_(red, green, blue); |
| 349 | # } |
| 350 | # |
| 351 | # var alphaFrac = rgb_color.alpha.value || 0.0; |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 352 | # var rgbParams = [red, green, blue].join(','); |
| 353 | # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 354 | # }; |
| 355 | # |
| 356 | # var rgbToCssColor_ = function(red, green, blue) { |
| 357 | # var rgbNumber = new Number((red << 16) | (green << 8) | blue); |
| 358 | # var hexString = rgbNumber.toString(16); |
| 359 | # var missingZeros = 6 - hexString.length; |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 360 | # var resultBuilder = ['#']; |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 361 | # for (var i = 0; i < missingZeros; i++) { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 362 | # resultBuilder.push('0'); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 363 | # } |
| 364 | # resultBuilder.push(hexString); |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 365 | # return resultBuilder.join(''); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 366 | # }; |
| 367 | # |
| 368 | # // ... |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 369 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. |
| 370 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. |
| 371 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. |
| 372 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 373 | # the final pixel color is defined by the equation: |
| 374 | # |
| 375 | # pixel color = alpha * (this color) + (1.0 - alpha) * (background color) |
| 376 | # |
| 377 | # This means that a value of 1.0 corresponds to a solid color, whereas |
| 378 | # a value of 0.0 corresponds to a completely transparent color. This |
| 379 | # uses a wrapper message rather than a simple float scalar so that it is |
| 380 | # possible to distinguish between a default value and the value being unset. |
| 381 | # If omitted, this color object is to be rendered as a solid color |
| 382 | # (as if the alpha value had been explicitly given with a value of 1.0). |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 383 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 384 | "lightOnDuration": "A String", # Required. Along with `light_off_duration`, define the blink rate of LED |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 385 | # flashes. Resolution defined by |
| 386 | # [proto.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 387 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 388 | "icon": "A String", # The notification's icon. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 389 | # Sets the notification icon to myicon for drawable resource myicon. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 390 | # If you don't send this key in the request, FCM displays the launcher icon |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 391 | # specified in your app manifest. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 392 | "color": "A String", # The notification's icon color, expressed in #rrggbb format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 393 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 394 | "restrictedPackageName": "A String", # Package name of the application where the registration token must match in |
| 395 | # order to receive the message. |
| 396 | "ttl": "A String", # How long (in seconds) the message should be kept in FCM storage if the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 397 | # device is offline. The maximum time to live supported is 4 weeks, and the |
| 398 | # default value is 4 weeks if not set. Set it to 0 if want to send the |
| 399 | # message immediately. |
| 400 | # In JSON format, the Duration type is encoded as a string rather than an |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 401 | # object, where the string ends in the suffix "s" (indicating seconds) and |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 402 | # is preceded by the number of seconds, with nanoseconds expressed as |
| 403 | # fractional seconds. For example, 3 seconds with 0 nanoseconds should be |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 404 | # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should |
| 405 | # be expressed in JSON format as "3.000000001s". The ttl will be rounded down |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 406 | # to the nearest second. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 407 | }, |
| 408 | "condition": "A String", # Condition to send a message to, |
| 409 | # e.g. "'foo' in topics && 'bar' in topics". |
| 410 | "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa) |
| 411 | # specific options. |
| 412 | "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom |
| 413 | # payload. See [Payload Key |
| 414 | # Reference](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification). |
| 415 | # If present, it overrides google.firebase.fcm.v1.Notification.title |
| 416 | # and google.firebase.fcm.v1.Notification.body. |
| 417 | "a_key": "", # Properties of the object. |
| 418 | }, |
| 419 | "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS. |
| 420 | "image": "A String", # Contains the URL of an image that is going to be displayed in a |
| 421 | # notification. If present, it will override |
| 422 | # google.firebase.fcm.v1.Notification.image. |
| 423 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 424 | }, |
| 425 | "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to |
| 426 | # [APNs request |
| 427 | # headers](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns) |
| 428 | # for supported headers, e.g. "apns-priority": "10". |
| 429 | "a_key": "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 430 | }, |
| 431 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 432 | "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030) |
| 433 | # options. |
| 434 | "notification": { # Web Notification options as a JSON object. Supports Notification instance |
| 435 | # properties as defined in [Web Notification |
| 436 | # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If |
| 437 | # present, "title" and "body" fields override |
| 438 | # [google.firebase.fcm.v1.Notification.title] and |
| 439 | # [google.firebase.fcm.v1.Notification.body]. |
| 440 | "a_key": "", # Properties of the object. |
| 441 | }, |
| 442 | "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web. |
| 443 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 444 | "link": "A String", # The link to open when the user clicks on the notification. |
| 445 | # For all URL values, HTTPS is required. |
| 446 | }, |
| 447 | "headers": { # HTTP headers defined in webpush protocol. Refer to |
| 448 | # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for |
| 449 | # supported headers, e.g. "TTL": "15". |
| 450 | "a_key": "A String", |
| 451 | }, |
| 452 | "data": { # Arbitrary key/value payload. If present, it will override |
| 453 | # google.firebase.fcm.v1.Message.data. |
| 454 | "a_key": "A String", |
| 455 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 456 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 457 | "name": "A String", # Output Only. The identifier of the message sent, in the format of |
| 458 | # `projects/*/messages/{message_id}`. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 459 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 460 | "validateOnly": True or False, # Flag for testing the request without actually delivering the message. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | x__xgafv: string, V1 error format. |
| 464 | Allowed values |
| 465 | 1 - v1 error format |
| 466 | 2 - v2 error format |
| 467 | |
| 468 | Returns: |
| 469 | An object of the form: |
| 470 | |
| 471 | { # Message to send by Firebase Cloud Messaging Service. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 472 | "topic": "A String", # Topic name to send a message to, e.g. "weather". |
| 473 | # Note: "/topics/" prefix should not be provided. |
| 474 | "notification": { # Basic notification template to use across all platforms. # Input only. Basic notification template to use across all platforms. |
| 475 | "body": "A String", # The notification's body text. |
| 476 | "title": "A String", # The notification's title. |
| 477 | "image": "A String", # Contains the URL of an image that is going to be downloaded on the device |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 478 | # and displayed in a notification. |
| 479 | # JPEG, PNG, BMP have full support across platforms. Animated GIF and video |
| 480 | # only work on iOS. WebP and HEIF have varying levels of support across |
| 481 | # platforms and platform versions. |
| 482 | # Android has 1MB image size limit. |
| 483 | # Quota usage and implications/costs for hosting image on Firebase Storage: |
| 484 | # https://firebase.google.com/pricing |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 485 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 486 | "fcmOptions": { # Platform independent options for features provided by the FCM SDKs. # Input only. Template for FCM SDK feature options to use across all |
| 487 | # platforms. |
| 488 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 489 | }, |
| 490 | "data": { # Input only. Arbitrary key/value payload. The key should not be a reserved |
| 491 | # word ("from", "message_type", or any word starting with "google" or "gcm"). |
| 492 | "a_key": "A String", |
| 493 | }, |
| 494 | "token": "A String", # Registration token to send a message to. |
| 495 | "android": { # Android specific options for messages sent through # Input only. Android specific options for messages sent through |
| 496 | # [FCM connection server](https://goo.gl/4GLdUl). |
| 497 | # [FCM connection server](https://goo.gl/4GLdUl). |
| 498 | "data": { # Arbitrary key/value payload. If present, it will override |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 499 | # google.firebase.fcm.v1.Message.data. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 500 | "a_key": "A String", |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 501 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 502 | "priority": "A String", # Message priority. Can take "normal" and "high" values. |
| 503 | # For more information, see [Setting the priority of a |
| 504 | # message](https://goo.gl/GjONJv). |
| 505 | "collapseKey": "A String", # An identifier of a group of messages that can be collapsed, so that only |
| 506 | # the last message gets sent when delivery can be resumed. A maximum of 4 |
| 507 | # different collapse keys is allowed at any given time. |
| 508 | "directBootOk": True or False, # If set to true, messages will be allowed to be delivered to the app while |
| 509 | # the device is in direct boot mode. See [Support Direct Boot |
| 510 | # mode](https://developer.android.com/training/articles/direct-boot). |
| 511 | "fcmOptions": { # Options for features provided by the FCM SDK for Android. # Options for features provided by the FCM SDK for Android. |
| 512 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 513 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 514 | "notification": { # Notification to send to android devices. # Notification to send to android devices. |
| 515 | "tag": "A String", # Identifier used to replace existing notifications in the notification |
| 516 | # drawer. |
| 517 | # If not specified, each request creates a new notification. |
| 518 | # If specified and a notification with the same tag is already being shown, |
| 519 | # the new notification replaces the existing one in the notification drawer. |
| 520 | "titleLocKey": "A String", # The key to the title string in the app's string resources to use to |
| 521 | # localize the title text to the user's current localization. |
| 522 | # See [String Resources](https://goo.gl/NdFZGI) for more information. |
| 523 | "image": "A String", # Contains the URL of an image that is going to be displayed in a |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 524 | # notification. If present, it will override |
| 525 | # google.firebase.fcm.v1.Notification.image. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 526 | "visibility": "A String", # Set the |
| 527 | # [Notification.visibility](https://developer.android.com/reference/android/app/Notification.html#visibility) |
| 528 | # of the notification. |
| 529 | "ticker": "A String", # Sets the "ticker" text, which is sent to accessibility services. |
| 530 | # Prior to API level 21 (`Lollipop`), sets the text that is displayed in the |
| 531 | # status bar when the notification first arrives. |
| 532 | "title": "A String", # The notification's title. If present, it will override |
| 533 | # google.firebase.fcm.v1.Notification.title. |
| 534 | "defaultSound": True or False, # If set to true, use the Android framework's default sound for the |
| 535 | # notification. Default values are specified in |
| 536 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 537 | "sticky": True or False, # When set to false or unset, the notification is automatically |
| 538 | # dismissed when the user clicks it in the panel. When set to true, the |
| 539 | # notification persists even when the user clicks it. |
| 540 | "titleLocArgs": [ # Variable string values to be used in place of the format specifiers in |
| 541 | # title_loc_key to use to localize the title text to the user's current |
| 542 | # localization. |
| 543 | # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. |
| 544 | "A String", |
| 545 | ], |
| 546 | "channelId": "A String", # The [notification's channel |
| 547 | # id](https://developer.android.com/guide/topics/ui/notifiers/notifications#ManageChannels) |
| 548 | # (new in Android O). The app must create a channel with this channel ID |
| 549 | # before any notification with this channel ID is received. If you don't send |
| 550 | # this channel ID in the request, or if the channel ID provided has not yet |
| 551 | # been created by the app, FCM uses the channel ID specified in the app |
| 552 | # manifest. |
| 553 | "defaultVibrateTimings": True or False, # If set to true, use the Android framework's default vibrate pattern for the |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 554 | # notification. Default values are specified in |
| 555 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 556 | # If `default_vibrate_timings` is set to true and `vibrate_timings` is also |
| 557 | # set, the default value is used instead of the user-specified |
| 558 | # `vibrate_timings`. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 559 | "clickAction": "A String", # The action associated with a user click on the notification. |
| 560 | # If specified, an activity with a matching intent filter is launched when |
| 561 | # a user clicks on the notification. |
| 562 | "eventTime": "A String", # Set the time that the event in the notification occurred. Notifications in |
| 563 | # the panel are sorted by this time. A point in time is represented using |
| 564 | # [protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/Timestamp). |
| 565 | "defaultLightSettings": True or False, # If set to true, use the Android framework's default LED light settings for |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 566 | # the notification. Default values are specified in |
| 567 | # [config.xml](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml). |
| 568 | # If `default_light_settings` is set to true and `light_settings` is also |
| 569 | # set, the user-specified `light_settings` is used instead of the |
| 570 | # default value. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 571 | "localOnly": True or False, # Set whether or not this notification is relevant only to the current |
| 572 | # device. Some notifications can be bridged to other devices for remote |
| 573 | # display, such as a Wear OS watch. This hint can be set to recommend this |
| 574 | # notification not be bridged. See [Wear OS |
| 575 | # guides](https://developer.android.com/training/wearables/notifications/bridger#existing-method-of-preventing-bridging) |
| 576 | "notificationPriority": "A String", # Set the relative priority for this notification. Priority is an indication |
| 577 | # of how much of the user's attention should be consumed by this |
| 578 | # notification. Low-priority notifications may be hidden from the user in |
| 579 | # certain situations, while the user might be interrupted for a |
| 580 | # higher-priority notification. The effect of setting the same priorities may |
| 581 | # differ slightly on different platforms. Note this priority differs from |
| 582 | # `AndroidMessagePriority`. This priority is processed by the client after |
| 583 | # the message has been delivered, whereas |
| 584 | # [AndroidMessagePriority](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidmessagepriority) |
| 585 | # is an FCM concept that controls when the message is delivered. |
| 586 | "vibrateTimings": [ # Set the vibration pattern to use. Pass in an array of |
| 587 | # [protobuf.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 588 | # to turn on or off the vibrator. The first value indicates the `Duration` to |
| 589 | # wait before turning the vibrator on. The next value indicates the |
| 590 | # `Duration` to keep the vibrator on. Subsequent values alternate between |
| 591 | # `Duration` to turn the vibrator off and to turn the vibrator on. |
| 592 | # If `vibrate_timings` is set and `default_vibrate_timings` is set to `true`, |
| 593 | # the default value is used instead of the user-specified `vibrate_timings`. |
| 594 | "A String", |
| 595 | ], |
| 596 | "sound": "A String", # The sound to play when the device receives the notification. |
| 597 | # Supports "default" or the filename of a sound resource bundled in the app. |
| 598 | # Sound files must reside in /res/raw/. |
| 599 | "bodyLocKey": "A String", # The key to the body string in the app's string resources to use to localize |
| 600 | # the body text to the user's current localization. |
| 601 | # See [String Resources](https://goo.gl/NdFZGI) for more information. |
| 602 | "notificationCount": 42, # Sets the number of items this notification represents. May be displayed as |
| 603 | # a badge count for launchers that support badging.See [Notification |
| 604 | # Badge](https://developer.android.com/training/notify-user/badges). |
| 605 | # For example, this might be useful if you're using just one notification to |
| 606 | # represent multiple new messages but you want the count here to represent |
| 607 | # the number of total new messages. |
| 608 | # If zero or unspecified, systems that support badging use the default, which |
| 609 | # is to increment a number displayed on the long-press menu each time a new |
| 610 | # notification arrives. |
| 611 | "bodyLocArgs": [ # Variable string values to be used in place of the format specifiers in |
| 612 | # body_loc_key to use to localize the body text to the user's current |
| 613 | # localization. |
| 614 | # See [Formatting and Styling](https://goo.gl/MalYE3) for more information. |
| 615 | "A String", |
| 616 | ], |
| 617 | "body": "A String", # The notification's body text. If present, it will override |
| 618 | # google.firebase.fcm.v1.Notification.body. |
| 619 | "lightSettings": { # Settings to control notification LED. # Settings to control the notification's LED blinking rate and color if LED |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 620 | # is available on the device. The total blinking time is controlled by the |
| 621 | # OS. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 622 | "lightOffDuration": "A String", # Required. Along with `light_on_duration `, define the blink rate of LED |
| 623 | # flashes. Resolution defined by |
| 624 | # [proto.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 625 | "color": { # Represents a color in the RGBA color space. This representation is designed # Required. Set `color` of the LED with |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 626 | # [google.type.Color](https://github.com/googleapis/googleapis/blob/master/google/type/color.proto). |
| 627 | # for simplicity of conversion to/from color representations in various |
| 628 | # languages over compactness; for example, the fields of this representation |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 629 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it |
| 630 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 631 | # method in iOS; and, with just a little work, it can be easily formatted into |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 632 | # a CSS "rgba()" string in JavaScript, as well. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 633 | # |
| 634 | # Note: this proto does not carry information about the absolute color space |
| 635 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, |
| 636 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color |
| 637 | # space. |
| 638 | # |
| 639 | # Example (Java): |
| 640 | # |
| 641 | # import com.google.type.Color; |
| 642 | # |
| 643 | # // ... |
| 644 | # public static java.awt.Color fromProto(Color protocolor) { |
| 645 | # float alpha = protocolor.hasAlpha() |
| 646 | # ? protocolor.getAlpha().getValue() |
| 647 | # : 1.0; |
| 648 | # |
| 649 | # return new java.awt.Color( |
| 650 | # protocolor.getRed(), |
| 651 | # protocolor.getGreen(), |
| 652 | # protocolor.getBlue(), |
| 653 | # alpha); |
| 654 | # } |
| 655 | # |
| 656 | # public static Color toProto(java.awt.Color color) { |
| 657 | # float red = (float) color.getRed(); |
| 658 | # float green = (float) color.getGreen(); |
| 659 | # float blue = (float) color.getBlue(); |
| 660 | # float denominator = 255.0; |
| 661 | # Color.Builder resultBuilder = |
| 662 | # Color |
| 663 | # .newBuilder() |
| 664 | # .setRed(red / denominator) |
| 665 | # .setGreen(green / denominator) |
| 666 | # .setBlue(blue / denominator); |
| 667 | # int alpha = color.getAlpha(); |
| 668 | # if (alpha != 255) { |
| 669 | # result.setAlpha( |
| 670 | # FloatValue |
| 671 | # .newBuilder() |
| 672 | # .setValue(((float) alpha) / denominator) |
| 673 | # .build()); |
| 674 | # } |
| 675 | # return resultBuilder.build(); |
| 676 | # } |
| 677 | # // ... |
| 678 | # |
| 679 | # Example (iOS / Obj-C): |
| 680 | # |
| 681 | # // ... |
| 682 | # static UIColor* fromProto(Color* protocolor) { |
| 683 | # float red = [protocolor red]; |
| 684 | # float green = [protocolor green]; |
| 685 | # float blue = [protocolor blue]; |
| 686 | # FloatValue* alpha_wrapper = [protocolor alpha]; |
| 687 | # float alpha = 1.0; |
| 688 | # if (alpha_wrapper != nil) { |
| 689 | # alpha = [alpha_wrapper value]; |
| 690 | # } |
| 691 | # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; |
| 692 | # } |
| 693 | # |
| 694 | # static Color* toProto(UIColor* color) { |
| 695 | # CGFloat red, green, blue, alpha; |
| 696 | # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { |
| 697 | # return nil; |
| 698 | # } |
| 699 | # Color* result = [[Color alloc] init]; |
| 700 | # [result setRed:red]; |
| 701 | # [result setGreen:green]; |
| 702 | # [result setBlue:blue]; |
| 703 | # if (alpha <= 0.9999) { |
| 704 | # [result setAlpha:floatWrapperWithValue(alpha)]; |
| 705 | # } |
| 706 | # [result autorelease]; |
| 707 | # return result; |
| 708 | # } |
| 709 | # // ... |
| 710 | # |
| 711 | # Example (JavaScript): |
| 712 | # |
| 713 | # // ... |
| 714 | # |
| 715 | # var protoToCssColor = function(rgb_color) { |
| 716 | # var redFrac = rgb_color.red || 0.0; |
| 717 | # var greenFrac = rgb_color.green || 0.0; |
| 718 | # var blueFrac = rgb_color.blue || 0.0; |
| 719 | # var red = Math.floor(redFrac * 255); |
| 720 | # var green = Math.floor(greenFrac * 255); |
| 721 | # var blue = Math.floor(blueFrac * 255); |
| 722 | # |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 723 | # if (!('alpha' in rgb_color)) { |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 724 | # return rgbToCssColor_(red, green, blue); |
| 725 | # } |
| 726 | # |
| 727 | # var alphaFrac = rgb_color.alpha.value || 0.0; |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 728 | # var rgbParams = [red, green, blue].join(','); |
| 729 | # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 730 | # }; |
| 731 | # |
| 732 | # var rgbToCssColor_ = function(red, green, blue) { |
| 733 | # var rgbNumber = new Number((red << 16) | (green << 8) | blue); |
| 734 | # var hexString = rgbNumber.toString(16); |
| 735 | # var missingZeros = 6 - hexString.length; |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 736 | # var resultBuilder = ['#']; |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 737 | # for (var i = 0; i < missingZeros; i++) { |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 738 | # resultBuilder.push('0'); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 739 | # } |
| 740 | # resultBuilder.push(hexString); |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 741 | # return resultBuilder.join(''); |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 742 | # }; |
| 743 | # |
| 744 | # // ... |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 745 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. |
| 746 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. |
| 747 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. |
| 748 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 749 | # the final pixel color is defined by the equation: |
| 750 | # |
| 751 | # pixel color = alpha * (this color) + (1.0 - alpha) * (background color) |
| 752 | # |
| 753 | # This means that a value of 1.0 corresponds to a solid color, whereas |
| 754 | # a value of 0.0 corresponds to a completely transparent color. This |
| 755 | # uses a wrapper message rather than a simple float scalar so that it is |
| 756 | # possible to distinguish between a default value and the value being unset. |
| 757 | # If omitted, this color object is to be rendered as a solid color |
| 758 | # (as if the alpha value had been explicitly given with a value of 1.0). |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 759 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 760 | "lightOnDuration": "A String", # Required. Along with `light_off_duration`, define the blink rate of LED |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 761 | # flashes. Resolution defined by |
| 762 | # [proto.Duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration) |
| 763 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 764 | "icon": "A String", # The notification's icon. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 765 | # Sets the notification icon to myicon for drawable resource myicon. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 766 | # If you don't send this key in the request, FCM displays the launcher icon |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 767 | # specified in your app manifest. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 768 | "color": "A String", # The notification's icon color, expressed in #rrggbb format. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 769 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 770 | "restrictedPackageName": "A String", # Package name of the application where the registration token must match in |
| 771 | # order to receive the message. |
| 772 | "ttl": "A String", # How long (in seconds) the message should be kept in FCM storage if the |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 773 | # device is offline. The maximum time to live supported is 4 weeks, and the |
| 774 | # default value is 4 weeks if not set. Set it to 0 if want to send the |
| 775 | # message immediately. |
| 776 | # In JSON format, the Duration type is encoded as a string rather than an |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 777 | # object, where the string ends in the suffix "s" (indicating seconds) and |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 778 | # is preceded by the number of seconds, with nanoseconds expressed as |
| 779 | # fractional seconds. For example, 3 seconds with 0 nanoseconds should be |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 780 | # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should |
| 781 | # be expressed in JSON format as "3.000000001s". The ttl will be rounded down |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 782 | # to the nearest second. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 783 | }, |
| 784 | "condition": "A String", # Condition to send a message to, |
| 785 | # e.g. "'foo' in topics && 'bar' in topics". |
| 786 | "apns": { # [Apple Push Notification Service](https://goo.gl/MXRTPa) specific options. # Input only. [Apple Push Notification Service](https://goo.gl/MXRTPa) |
| 787 | # specific options. |
| 788 | "payload": { # APNs payload as a JSON object, including both `aps` dictionary and custom |
| 789 | # payload. See [Payload Key |
| 790 | # Reference](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification). |
| 791 | # If present, it overrides google.firebase.fcm.v1.Notification.title |
| 792 | # and google.firebase.fcm.v1.Notification.body. |
| 793 | "a_key": "", # Properties of the object. |
| 794 | }, |
| 795 | "fcmOptions": { # Options for features provided by the FCM SDK for iOS. # Options for features provided by the FCM SDK for iOS. |
| 796 | "image": "A String", # Contains the URL of an image that is going to be displayed in a |
| 797 | # notification. If present, it will override |
| 798 | # google.firebase.fcm.v1.Notification.image. |
| 799 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 800 | }, |
| 801 | "headers": { # HTTP request headers defined in Apple Push Notification Service. Refer to |
| 802 | # [APNs request |
| 803 | # headers](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns) |
| 804 | # for supported headers, e.g. "apns-priority": "10". |
| 805 | "a_key": "A String", |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 806 | }, |
| 807 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 808 | "webpush": { # [Webpush protocol](https://tools.ietf.org/html/rfc8030) options. # Input only. [Webpush protocol](https://tools.ietf.org/html/rfc8030) |
| 809 | # options. |
| 810 | "notification": { # Web Notification options as a JSON object. Supports Notification instance |
| 811 | # properties as defined in [Web Notification |
| 812 | # API](https://developer.mozilla.org/en-US/docs/Web/API/Notification). If |
| 813 | # present, "title" and "body" fields override |
| 814 | # [google.firebase.fcm.v1.Notification.title] and |
| 815 | # [google.firebase.fcm.v1.Notification.body]. |
| 816 | "a_key": "", # Properties of the object. |
| 817 | }, |
| 818 | "fcmOptions": { # Options for features provided by the FCM SDK for Web. # Options for features provided by the FCM SDK for Web. |
| 819 | "analyticsLabel": "A String", # Label associated with the message's analytics data. |
| 820 | "link": "A String", # The link to open when the user clicks on the notification. |
| 821 | # For all URL values, HTTPS is required. |
| 822 | }, |
| 823 | "headers": { # HTTP headers defined in webpush protocol. Refer to |
| 824 | # [Webpush protocol](https://tools.ietf.org/html/rfc8030#section-5) for |
| 825 | # supported headers, e.g. "TTL": "15". |
| 826 | "a_key": "A String", |
| 827 | }, |
| 828 | "data": { # Arbitrary key/value payload. If present, it will override |
| 829 | # google.firebase.fcm.v1.Message.data. |
| 830 | "a_key": "A String", |
| 831 | }, |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 832 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 833 | "name": "A String", # Output Only. The identifier of the message sent, in the format of |
| 834 | # `projects/*/messages/{message_id}`. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 835 | }</pre> |
| 836 | </div> |
| 837 | |
| 838 | </body></html> |