firebase-admin 9.3.0 → 9.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/auth/action-code-settings-builder.js +1 -1
- package/lib/auth/auth-api-request.js +98 -25
- package/lib/auth/auth-config.js +15 -15
- package/lib/auth/auth.js +82 -61
- package/lib/auth/identifier.js +3 -2
- package/lib/auth/index.d.ts +1868 -0
- package/lib/{credential/credential-interfaces.js → auth/index.js} +1 -1
- package/lib/auth/tenant-manager.js +1 -1
- package/lib/auth/tenant.js +7 -1
- package/lib/auth/token-generator.js +6 -4
- package/lib/auth/token-verifier.js +32 -36
- package/lib/auth/user-import-builder.js +18 -15
- package/lib/auth/user-record.js +4 -4
- package/lib/credential/credential-internal.js +1 -2
- package/lib/credential/credential.js +8 -122
- package/lib/credential/index.d.ts +169 -0
- package/lib/credential/index.js +5 -17
- package/lib/database/database-internal.js +19 -26
- package/lib/database/index.d.ts +89 -0
- package/lib/database/index.js +12 -28
- package/lib/default-namespace.js +2 -1
- package/lib/firebase-app.js +26 -48
- package/lib/firebase-namespace-api.d.ts +238 -0
- package/lib/{firebase-service.js → firebase-namespace-api.js} +2 -2
- package/lib/{database/database.js → firebase-namespace.d.ts} +14 -7
- package/lib/firebase-namespace.js +22 -92
- package/lib/firestore/firestore-internal.js +2 -19
- package/lib/firestore/index.d.ts +50 -0
- package/lib/firestore/index.js +28 -43
- package/lib/index.d.ts +3 -932
- package/lib/index.js +2 -1
- package/lib/instance-id/index.d.ts +81 -0
- package/lib/instance-id/index.js +1 -10
- package/lib/instance-id/instance-id-request-internal.js +2 -1
- package/lib/instance-id/instance-id.js +1 -19
- package/lib/machine-learning/index.d.ts +249 -0
- package/lib/{messaging/messaging-types.js → machine-learning/index.js} +2 -2
- package/lib/machine-learning/machine-learning-api-client.js +1 -1
- package/lib/machine-learning/machine-learning-utils.js +1 -1
- package/lib/machine-learning/machine-learning.js +3 -22
- package/lib/messaging/batch-request-internal.js +1 -1
- package/lib/messaging/index.d.ts +1174 -0
- package/lib/messaging/index.js +1 -24
- package/lib/messaging/messaging-api-request-internal.js +2 -1
- package/lib/messaging/messaging-errors-internal.js +1 -1
- package/lib/messaging/messaging-internal.js +1 -1
- package/lib/messaging/messaging.js +21 -25
- package/lib/project-management/android-app.js +7 -6
- package/lib/project-management/index.d.ts +363 -0
- package/lib/project-management/index.js +23 -25
- package/lib/project-management/ios-app.js +5 -4
- package/lib/project-management/project-management-api-request-internal.js +5 -5
- package/lib/project-management/project-management.js +9 -26
- package/lib/remote-config/index.d.ts +359 -0
- package/lib/remote-config/index.js +1 -26
- package/lib/remote-config/remote-config-api-client-internal.js +3 -3
- package/lib/remote-config/remote-config.js +15 -32
- package/lib/security-rules/index.d.ts +216 -0
- package/lib/security-rules/index.js +1 -24
- package/lib/security-rules/security-rules-api-client-internal.js +1 -1
- package/lib/security-rules/security-rules-internal.js +1 -1
- package/lib/security-rules/security-rules.js +6 -15
- package/lib/storage/index.d.ts +60 -0
- package/lib/storage/index.js +1 -10
- package/lib/storage/storage.js +2 -19
- package/lib/utils/api-request.js +10 -3
- package/lib/utils/deep-copy.js +2 -1
- package/lib/utils/error.js +2 -1
- package/lib/utils/index.js +6 -5
- package/lib/utils/validator.js +2 -1
- package/package.json +15 -12
- package/lib/auth.d.ts +0 -2016
- package/lib/credential.d.ts +0 -150
- package/lib/database.d.ts +0 -1663
- package/lib/instance-id.d.ts +0 -37
- package/lib/messaging.d.ts +0 -1341
- package/lib/project-management/app-metadata.js +0 -37
- package/lib/project-management.d.ts +0 -361
- package/lib/remote-config/remote-config-api-client.js +0 -36
- package/lib/remote-config.d.ts +0 -350
- package/lib/security-rules.d.ts +0 -192
- package/lib/storage.d.ts +0 -40
package/lib/messaging.d.ts
DELETED
|
@@ -1,1341 +0,0 @@
|
|
|
1
|
-
/*! firebase-admin v9.3.0 */
|
|
2
|
-
import * as _admin from './index.d';
|
|
3
|
-
|
|
4
|
-
type BaseMessage = {
|
|
5
|
-
data?: { [key: string]: string };
|
|
6
|
-
notification?: admin.messaging.Notification;
|
|
7
|
-
android?: admin.messaging.AndroidConfig;
|
|
8
|
-
webpush?: admin.messaging.WebpushConfig;
|
|
9
|
-
apns?: admin.messaging.ApnsConfig;
|
|
10
|
-
fcmOptions?: admin.messaging.FcmOptions;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
interface TokenMessage extends BaseMessage {
|
|
14
|
-
token: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface TopicMessage extends BaseMessage {
|
|
18
|
-
topic: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ConditionMessage extends BaseMessage {
|
|
22
|
-
condition: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export namespace admin.messaging {
|
|
26
|
-
type Message = TokenMessage | TopicMessage | ConditionMessage;
|
|
27
|
-
|
|
28
|
-
interface MulticastMessage extends BaseMessage {
|
|
29
|
-
tokens: string[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Represents the Android-specific options that can be included in an
|
|
34
|
-
* {@link admin.messaging.Message}.
|
|
35
|
-
*/
|
|
36
|
-
interface AndroidConfig {
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Collapse key for the message. Collapse key serves as an identifier for a
|
|
40
|
-
* group of messages that can be collapsed, so that only the last message gets
|
|
41
|
-
* sent when delivery can be resumed. A maximum of four different collapse keys
|
|
42
|
-
* may be active at any given time.
|
|
43
|
-
*/
|
|
44
|
-
collapseKey?: string;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Priority of the message. Must be either `normal` or `high`.
|
|
48
|
-
*/
|
|
49
|
-
priority?: ('high' | 'normal');
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Time-to-live duration of the message in milliseconds.
|
|
53
|
-
*/
|
|
54
|
-
ttl?: number;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Package name of the application where the registration tokens must match
|
|
58
|
-
* in order to receive the message.
|
|
59
|
-
*/
|
|
60
|
-
restrictedPackageName?: string;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* A collection of data fields to be included in the message. All values must
|
|
64
|
-
* be strings. When provided, overrides any data fields set on the top-level
|
|
65
|
-
* `admin.messaging.Message`.}
|
|
66
|
-
*/
|
|
67
|
-
data?: { [key: string]: string };
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Android notification to be included in the message.
|
|
71
|
-
*/
|
|
72
|
-
notification?: AndroidNotification;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Options for features provided by the FCM SDK for Android.
|
|
76
|
-
*/
|
|
77
|
-
fcmOptions?: AndroidFcmOptions;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Represents the Android-specific notification options that can be included in
|
|
82
|
-
* {@link admin.messaging.AndroidConfig}.
|
|
83
|
-
*/
|
|
84
|
-
interface AndroidNotification {
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Title of the Android notification. When provided, overrides the title set via
|
|
88
|
-
* `admin.messaging.Notification`.
|
|
89
|
-
*/
|
|
90
|
-
title?: string;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Body of the Android notification. When provided, overrides the body set via
|
|
94
|
-
* `admin.messaging.Notification`.
|
|
95
|
-
*/
|
|
96
|
-
body?: string;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Icon resource for the Android notification.
|
|
100
|
-
*/
|
|
101
|
-
icon?: string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Notification icon color in `#rrggbb` format.
|
|
105
|
-
*/
|
|
106
|
-
color?: string;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* File name of the sound to be played when the device receives the
|
|
110
|
-
* notification.
|
|
111
|
-
*/
|
|
112
|
-
sound?: string;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Notification tag. This is an identifier used to replace existing
|
|
116
|
-
* notifications in the notification drawer. If not specified, each request
|
|
117
|
-
* creates a new notification.
|
|
118
|
-
*/
|
|
119
|
-
tag?: string;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* URL of an image to be displayed in the notification.
|
|
123
|
-
*/
|
|
124
|
-
imageUrl?: string;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Action associated with a user click on the notification. If specified, an
|
|
128
|
-
* activity with a matching Intent Filter is launched when a user clicks on the
|
|
129
|
-
* notification.
|
|
130
|
-
*/
|
|
131
|
-
clickAction?: string;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Key of the body string in the app's string resource to use to localize the
|
|
135
|
-
* body text.
|
|
136
|
-
*
|
|
137
|
-
*/
|
|
138
|
-
bodyLocKey?: string;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* An array of resource keys that will be used in place of the format
|
|
142
|
-
* specifiers in `bodyLocKey`.
|
|
143
|
-
*/
|
|
144
|
-
bodyLocArgs?: string[];
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Key of the title string in the app's string resource to use to localize the
|
|
148
|
-
* title text.
|
|
149
|
-
*/
|
|
150
|
-
titleLocKey?: string;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* An array of resource keys that will be used in place of the format
|
|
154
|
-
* specifiers in `titleLocKey`.
|
|
155
|
-
*/
|
|
156
|
-
titleLocArgs?: string[];
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* The Android notification channel ID (new in Android O). The app must create
|
|
160
|
-
* a channel with this channel ID before any notification with this channel ID
|
|
161
|
-
* can be received. If you don't send this channel ID in the request, or if the
|
|
162
|
-
* channel ID provided has not yet been created by the app, FCM uses the channel
|
|
163
|
-
* ID specified in the app manifest.
|
|
164
|
-
*/
|
|
165
|
-
channelId?: string;
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Sets the "ticker" text, which is sent to accessibility services. Prior to
|
|
169
|
-
* API level 21 (Lollipop), sets the text that is displayed in the status bar
|
|
170
|
-
* when the notification first arrives.
|
|
171
|
-
*/
|
|
172
|
-
ticker?: string;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* When set to `false` or unset, the notification is automatically dismissed when
|
|
176
|
-
* the user clicks it in the panel. When set to `true`, the notification persists
|
|
177
|
-
* even when the user clicks it.
|
|
178
|
-
*/
|
|
179
|
-
sticky?: boolean;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* For notifications that inform users about events with an absolute time reference, sets
|
|
183
|
-
* the time that the event in the notification occurred. Notifications
|
|
184
|
-
* in the panel are sorted by this time.
|
|
185
|
-
*/
|
|
186
|
-
eventTimestamp?: Date;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Sets whether or not this notification is relevant only to the current device.
|
|
190
|
-
* Some notifications can be bridged to other devices for remote display, such as
|
|
191
|
-
* a Wear OS watch. This hint can be set to recommend this notification not be bridged.
|
|
192
|
-
* See [Wear OS guides](https://developer.android.com/training/wearables/notifications/bridger#existing-method-of-preventing-bridging)
|
|
193
|
-
*/
|
|
194
|
-
localOnly?: boolean;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Sets the relative priority for this notification. Low-priority notifications
|
|
198
|
-
* may be hidden from the user in certain situations. Note this priority differs
|
|
199
|
-
* from `AndroidMessagePriority`. This priority is processed by the client after
|
|
200
|
-
* the message has been delivered. Whereas `AndroidMessagePriority` is an FCM concept
|
|
201
|
-
* that controls when the message is delivered.
|
|
202
|
-
*/
|
|
203
|
-
priority?: ('min' | 'low' | 'default' | 'high' | 'max');
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Sets the vibration pattern to use. Pass in an array of milliseconds to
|
|
207
|
-
* turn the vibrator on or off. The first value indicates the duration to wait before
|
|
208
|
-
* turning the vibrator on. The next value indicates the duration to keep the
|
|
209
|
-
* vibrator on. Subsequent values alternate between duration to turn the vibrator
|
|
210
|
-
* off and to turn the vibrator on. If `vibrate_timings` is set and `default_vibrate_timings`
|
|
211
|
-
* is set to `true`, the default value is used instead of the user-specified `vibrate_timings`.
|
|
212
|
-
*/
|
|
213
|
-
vibrateTimingsMillis?: number[];
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* If set to `true`, use the Android framework's default vibrate pattern for the
|
|
217
|
-
* notification. Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
|
|
218
|
-
* If `default_vibrate_timings` is set to `true` and `vibrate_timings` is also set,
|
|
219
|
-
* the default value is used instead of the user-specified `vibrate_timings`.
|
|
220
|
-
*/
|
|
221
|
-
defaultVibrateTimings?: boolean;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* If set to `true`, use the Android framework's default sound for the notification.
|
|
225
|
-
* Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
|
|
226
|
-
*/
|
|
227
|
-
defaultSound?: boolean;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Settings to control the notification's LED blinking rate and color if LED is
|
|
231
|
-
* available on the device. The total blinking time is controlled by the OS.
|
|
232
|
-
*/
|
|
233
|
-
lightSettings?: LightSettings;
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* If set to `true`, use the Android framework's default LED light settings
|
|
237
|
-
* for the notification. Default values are specified in [`config.xml`](https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/values/config.xml).
|
|
238
|
-
* If `default_light_settings` is set to `true` and `light_settings` is also set,
|
|
239
|
-
* the user-specified `light_settings` is used instead of the default value.
|
|
240
|
-
*/
|
|
241
|
-
defaultLightSettings?: boolean;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Sets the visibility of the notification. Must be either `private`, `public`,
|
|
245
|
-
* or `secret`. If unspecified, defaults to `private`.
|
|
246
|
-
*/
|
|
247
|
-
visibility?: ('private' | 'public' | 'secret');
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Sets the number of items this notification represents. May be displayed as a
|
|
251
|
-
* badge count for Launchers that support badging. See [`NotificationBadge`(https://developer.android.com/training/notify-user/badges).
|
|
252
|
-
* For example, this might be useful if you're using just one notification to
|
|
253
|
-
* represent multiple new messages but you want the count here to represent
|
|
254
|
-
* the number of total new messages. If zero or unspecified, systems
|
|
255
|
-
* that support badging use the default, which is to increment a number
|
|
256
|
-
* displayed on the long-press menu each time a new notification arrives.
|
|
257
|
-
*/
|
|
258
|
-
notificationCount?: number;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Represents settings to control notification LED that can be included in
|
|
263
|
-
* {@link admin.messaging.AndroidNotification}.
|
|
264
|
-
*/
|
|
265
|
-
interface LightSettings {
|
|
266
|
-
/**
|
|
267
|
-
* Required. Sets color of the LED in `#rrggbb` or `#rrggbbaa` format.
|
|
268
|
-
*/
|
|
269
|
-
color: string;
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Required. Along with `light_off_duration`, defines the blink rate of LED flashes.
|
|
273
|
-
*/
|
|
274
|
-
lightOnDurationMillis: number;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Required. Along with `light_on_duration`, defines the blink rate of LED flashes.
|
|
278
|
-
*/
|
|
279
|
-
lightOffDurationMillis: number;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Represents options for features provided by the FCM SDK for Android.
|
|
284
|
-
*/
|
|
285
|
-
interface AndroidFcmOptions {
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* The label associated with the message's analytics data.
|
|
289
|
-
*/
|
|
290
|
-
analyticsLabel?: string;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Represents the APNs-specific options that can be included in an
|
|
295
|
-
* {@link admin.messaging.Message}. Refer to
|
|
296
|
-
* [Apple documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html)
|
|
297
|
-
* for various headers and payload fields supported by APNs.
|
|
298
|
-
*/
|
|
299
|
-
interface ApnsConfig {
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* A collection of APNs headers. Header values must be strings.
|
|
303
|
-
*/
|
|
304
|
-
headers?: { [key: string]: string };
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* An APNs payload to be included in the message.
|
|
308
|
-
*/
|
|
309
|
-
payload?: ApnsPayload;
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Options for features provided by the FCM SDK for iOS.
|
|
313
|
-
*/
|
|
314
|
-
fcmOptions?: ApnsFcmOptions;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Represents the payload of an APNs message. Mainly consists of the `aps`
|
|
318
|
-
* dictionary. But may also contain other arbitrary custom keys.
|
|
319
|
-
*/
|
|
320
|
-
interface ApnsPayload {
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* The `aps` dictionary to be included in the message.
|
|
324
|
-
*/
|
|
325
|
-
aps: Aps;
|
|
326
|
-
[customData: string]: object;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Represents the [aps dictionary](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html)
|
|
330
|
-
* that is part of APNs messages.
|
|
331
|
-
*/
|
|
332
|
-
interface Aps {
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Alert to be included in the message. This may be a string or an object of
|
|
336
|
-
* type `admin.messaging.ApsAlert`.
|
|
337
|
-
*/
|
|
338
|
-
alert?: string | ApsAlert;
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Badge to be displayed with the message. Set to 0 to remove the badge. When
|
|
342
|
-
* not specified, the badge will remain unchanged.
|
|
343
|
-
*/
|
|
344
|
-
badge?: number;
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Sound to be played with the message.
|
|
348
|
-
*/
|
|
349
|
-
sound?: string | CriticalSound;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Specifies whether to configure a background update notification.
|
|
353
|
-
*/
|
|
354
|
-
contentAvailable?: boolean;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Specifies whether to set the `mutable-content` property on the message
|
|
358
|
-
* so the clients can modify the notification via app extensions.
|
|
359
|
-
*/
|
|
360
|
-
mutableContent?: boolean;
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Type of the notification.
|
|
364
|
-
*/
|
|
365
|
-
category?: string;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* An app-specific identifier for grouping notifications.
|
|
369
|
-
*/
|
|
370
|
-
threadId?: string;
|
|
371
|
-
[customData: string]: any;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
interface ApsAlert {
|
|
375
|
-
title?: string;
|
|
376
|
-
subtitle?: string;
|
|
377
|
-
body?: string;
|
|
378
|
-
locKey?: string;
|
|
379
|
-
locArgs?: string[];
|
|
380
|
-
titleLocKey?: string;
|
|
381
|
-
titleLocArgs?: string[];
|
|
382
|
-
subtitleLocKey?: string;
|
|
383
|
-
subtitleLocArgs?: string[];
|
|
384
|
-
actionLocKey?: string;
|
|
385
|
-
launchImage?: string;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Represents a critical sound configuration that can be included in the
|
|
390
|
-
* `aps` dictionary of an APNs payload.
|
|
391
|
-
*/
|
|
392
|
-
interface CriticalSound {
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* The critical alert flag. Set to `true` to enable the critical alert.
|
|
396
|
-
*/
|
|
397
|
-
critical?: boolean;
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* The name of a sound file in the app's main bundle or in the `Library/Sounds`
|
|
401
|
-
* folder of the app's container directory. Specify the string "default" to play
|
|
402
|
-
* the system sound.
|
|
403
|
-
*/
|
|
404
|
-
name: string;
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* The volume for the critical alert's sound. Must be a value between 0.0
|
|
408
|
-
* (silent) and 1.0 (full volume).
|
|
409
|
-
*/
|
|
410
|
-
volume?: number;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Represents options for features provided by the FCM SDK for iOS.
|
|
415
|
-
*/
|
|
416
|
-
interface ApnsFcmOptions {
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* The label associated with the message's analytics data.
|
|
420
|
-
*/
|
|
421
|
-
analyticsLabel?: string;
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* URL of an image to be displayed in the notification.
|
|
425
|
-
*/
|
|
426
|
-
imageUrl?: string;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Represents platform-independent options for features provided by the FCM SDKs.
|
|
431
|
-
*/
|
|
432
|
-
interface FcmOptions {
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* The label associated with the message's analytics data.
|
|
436
|
-
*/
|
|
437
|
-
analyticsLabel?: string;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* A notification that can be included in {@link admin.messaging.Message}.
|
|
443
|
-
*/
|
|
444
|
-
interface Notification {
|
|
445
|
-
/**
|
|
446
|
-
* The title of the notification.
|
|
447
|
-
*/
|
|
448
|
-
title?: string;
|
|
449
|
-
/**
|
|
450
|
-
* The notification body
|
|
451
|
-
*/
|
|
452
|
-
body?: string;
|
|
453
|
-
/**
|
|
454
|
-
* URL of an image to be displayed in the notification.
|
|
455
|
-
*/
|
|
456
|
-
imageUrl?: string;
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Represents the WebPush protocol options that can be included in an
|
|
460
|
-
* {@link admin.messaging.Message}.
|
|
461
|
-
*/
|
|
462
|
-
interface WebpushConfig {
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* A collection of WebPush headers. Header values must be strings.
|
|
466
|
-
*
|
|
467
|
-
* See [WebPush specification](https://tools.ietf.org/html/rfc8030#section-5)
|
|
468
|
-
* for supported headers.
|
|
469
|
-
*/
|
|
470
|
-
headers?: { [key: string]: string };
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* A collection of data fields.
|
|
474
|
-
*/
|
|
475
|
-
data?: { [key: string]: string };
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* A WebPush notification payload to be included in the message.
|
|
479
|
-
*/
|
|
480
|
-
notification?: WebpushNotification;
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Options for features provided by the FCM SDK for Web.
|
|
484
|
-
*/
|
|
485
|
-
fcmOptions?: WebpushFcmOptions;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/** Represents options for features provided by the FCM SDK for Web
|
|
489
|
-
* (which are not part of the Webpush standard).
|
|
490
|
-
*/
|
|
491
|
-
interface WebpushFcmOptions {
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* The link to open when the user clicks on the notification.
|
|
495
|
-
* For all URL values, HTTPS is required.
|
|
496
|
-
*/
|
|
497
|
-
link?: string;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Represents the WebPush-specific notification options that can be included in
|
|
502
|
-
* {@link admin.messaging.WebpushConfig}. This supports most of the standard
|
|
503
|
-
* options as defined in the Web Notification
|
|
504
|
-
* [specification](https://developer.mozilla.org/en-US/docs/Web/API/notification/Notification).
|
|
505
|
-
*/
|
|
506
|
-
interface WebpushNotification {
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Title text of the notification.
|
|
510
|
-
*/
|
|
511
|
-
title?: string;
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* An array of notification actions representing the actions
|
|
515
|
-
* available to the user when the notification is presented.
|
|
516
|
-
*/
|
|
517
|
-
actions?: Array<{
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* An action available to the user when the notification is presented
|
|
521
|
-
*/
|
|
522
|
-
action: string;
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Optional icon for a notification action.
|
|
526
|
-
*/
|
|
527
|
-
icon?: string;
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* Title of the notification action.
|
|
531
|
-
*/
|
|
532
|
-
title: string;
|
|
533
|
-
}>;
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* URL of the image used to represent the notification when there is
|
|
537
|
-
* not enough space to display the notification itself.
|
|
538
|
-
*/
|
|
539
|
-
badge?: string;
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Body text of the notification.
|
|
543
|
-
*/
|
|
544
|
-
body?: string;
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Arbitrary data that you want associated with the notification.
|
|
548
|
-
* This can be of any data type.
|
|
549
|
-
*/
|
|
550
|
-
data?: any;
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* The direction in which to display the notification. Must be one
|
|
554
|
-
* of `auto`, `ltr` or `rtl`.
|
|
555
|
-
*/
|
|
556
|
-
dir?: 'auto' | 'ltr' | 'rtl';
|
|
557
|
-
|
|
558
|
-
/**
|
|
559
|
-
* URL to the notification icon.
|
|
560
|
-
*/
|
|
561
|
-
icon?: string;
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* URL of an image to be displayed in the notification.
|
|
565
|
-
*/
|
|
566
|
-
image?: string;
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* The notification's language as a BCP 47 language tag.
|
|
570
|
-
*/
|
|
571
|
-
lang?: string;
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* A boolean specifying whether the user should be notified after a
|
|
575
|
-
* new notification replaces an old one. Defaults to false.
|
|
576
|
-
*/
|
|
577
|
-
renotify?: boolean;
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Indicates that a notification should remain active until the user
|
|
581
|
-
* clicks or dismisses it, rather than closing automatically.
|
|
582
|
-
* Defaults to false.
|
|
583
|
-
*/
|
|
584
|
-
requireInteraction?: boolean;
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* A boolean specifying whether the notification should be silent.
|
|
588
|
-
* Defaults to false.
|
|
589
|
-
*/
|
|
590
|
-
silent?: boolean;
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* An identifying tag for the notification.
|
|
594
|
-
*/
|
|
595
|
-
tag?: string;
|
|
596
|
-
|
|
597
|
-
/**
|
|
598
|
-
* Timestamp of the notification. Refer to
|
|
599
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/notification/timestamp
|
|
600
|
-
* for details.
|
|
601
|
-
*/
|
|
602
|
-
timestamp?: number;
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* A vibration pattern for the device's vibration hardware to emit
|
|
606
|
-
* when the notification fires.
|
|
607
|
-
*/
|
|
608
|
-
vibrate?: number | number[];
|
|
609
|
-
[key: string]: any;
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
* Interface representing an FCM legacy API data message payload. Data
|
|
613
|
-
* messages let developers send up to 4KB of custom key-value pairs. The
|
|
614
|
-
* keys and values must both be strings. Keys can be any custom string,
|
|
615
|
-
* except for the following reserved strings:
|
|
616
|
-
*
|
|
617
|
-
* * `"from"`
|
|
618
|
-
* * Anything starting with `"google."`.
|
|
619
|
-
*
|
|
620
|
-
* See [Build send requests](/docs/cloud-messaging/send-message)
|
|
621
|
-
* for code samples and detailed documentation.
|
|
622
|
-
*/
|
|
623
|
-
interface DataMessagePayload {
|
|
624
|
-
[key: string]: string;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Interface representing an FCM legacy API notification message payload.
|
|
629
|
-
* Notification messages let developers send up to 4KB of predefined
|
|
630
|
-
* key-value pairs. Accepted keys are outlined below.
|
|
631
|
-
*
|
|
632
|
-
* See [Build send requests](/docs/cloud-messaging/send-message)
|
|
633
|
-
* for code samples and detailed documentation.
|
|
634
|
-
*/
|
|
635
|
-
interface NotificationMessagePayload {
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Identifier used to replace existing notifications in the notification drawer.
|
|
639
|
-
*
|
|
640
|
-
* If not specified, each request creates a new notification.
|
|
641
|
-
*
|
|
642
|
-
* If specified and a notification with the same tag is already being shown,
|
|
643
|
-
* the new notification replaces the existing one in the notification drawer.
|
|
644
|
-
*
|
|
645
|
-
* **Platforms:** Android
|
|
646
|
-
*/
|
|
647
|
-
tag?: string;
|
|
648
|
-
|
|
649
|
-
/**
|
|
650
|
-
* The notification's body text.
|
|
651
|
-
*
|
|
652
|
-
* **Platforms:** iOS, Android, Web
|
|
653
|
-
*/
|
|
654
|
-
body?: string;
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* The notification's icon.
|
|
658
|
-
*
|
|
659
|
-
* **Android:** Sets the notification icon to `myicon` for drawable resource
|
|
660
|
-
* `myicon`. If you don't send this key in the request, FCM displays the
|
|
661
|
-
* launcher icon specified in your app manifest.
|
|
662
|
-
*
|
|
663
|
-
* **Web:** The URL to use for the notification's icon.
|
|
664
|
-
*
|
|
665
|
-
* **Platforms:** Android, Web
|
|
666
|
-
*/
|
|
667
|
-
icon?: string;
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* The value of the badge on the home screen app icon.
|
|
671
|
-
*
|
|
672
|
-
* If not specified, the badge is not changed.
|
|
673
|
-
*
|
|
674
|
-
* If set to `0`, the badge is removed.
|
|
675
|
-
*
|
|
676
|
-
* **Platforms:** iOS
|
|
677
|
-
*/
|
|
678
|
-
badge?: string;
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* The notification icon's color, expressed in `#rrggbb` format.
|
|
682
|
-
*
|
|
683
|
-
* **Platforms:** Android
|
|
684
|
-
*/
|
|
685
|
-
color?: string;
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* The sound to be played when the device receives a notification. Supports
|
|
689
|
-
* "default" for the default notification sound of the device or the filename of a
|
|
690
|
-
* sound resource bundled in the app.
|
|
691
|
-
* Sound files must reside in `/res/raw/`.
|
|
692
|
-
*
|
|
693
|
-
* **Platforms:** Android
|
|
694
|
-
*/
|
|
695
|
-
sound?: string;
|
|
696
|
-
|
|
697
|
-
/**
|
|
698
|
-
* The notification's title.
|
|
699
|
-
*
|
|
700
|
-
* **Platforms:** iOS, Android, Web
|
|
701
|
-
*/
|
|
702
|
-
title?: string;
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* The key to the body string in the app's string resources to use to localize
|
|
706
|
-
* the body text to the user's current localization.
|
|
707
|
-
*
|
|
708
|
-
* **iOS:** Corresponds to `loc-key` in the APNs payload. See
|
|
709
|
-
* [Payload Key Reference](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html)
|
|
710
|
-
* and
|
|
711
|
-
* [Localizing the Content of Your Remote Notifications](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9)
|
|
712
|
-
* for more information.
|
|
713
|
-
*
|
|
714
|
-
* **Android:** See
|
|
715
|
-
* [String Resources](http://developer.android.com/guide/topics/resources/string-resource.html) * for more information.
|
|
716
|
-
*
|
|
717
|
-
* **Platforms:** iOS, Android
|
|
718
|
-
*/
|
|
719
|
-
bodyLocKey?: string;
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* Variable string values to be used in place of the format specifiers in
|
|
723
|
-
* `body_loc_key` to use to localize the body text to the user's current
|
|
724
|
-
* localization.
|
|
725
|
-
*
|
|
726
|
-
* The value should be a stringified JSON array.
|
|
727
|
-
*
|
|
728
|
-
* **iOS:** Corresponds to `loc-args` in the APNs payload. See
|
|
729
|
-
* [Payload Key Reference](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html)
|
|
730
|
-
* and
|
|
731
|
-
* [Localizing the Content of Your Remote Notifications](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9)
|
|
732
|
-
* for more information.
|
|
733
|
-
*
|
|
734
|
-
* **Android:** See
|
|
735
|
-
* [Formatting and Styling](http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling)
|
|
736
|
-
* for more information.
|
|
737
|
-
*
|
|
738
|
-
* **Platforms:** iOS, Android
|
|
739
|
-
*/
|
|
740
|
-
bodyLocArgs?: string;
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Action associated with a user click on the notification. If specified, an
|
|
744
|
-
* activity with a matching Intent Filter is launched when a user clicks on the
|
|
745
|
-
* notification.
|
|
746
|
-
*
|
|
747
|
-
* * **Platforms:** Android
|
|
748
|
-
*/
|
|
749
|
-
clickAction?: string;
|
|
750
|
-
|
|
751
|
-
/**
|
|
752
|
-
* The key to the title string in the app's string resources to use to localize
|
|
753
|
-
* the title text to the user's current localization.
|
|
754
|
-
*
|
|
755
|
-
* **iOS:** Corresponds to `title-loc-key` in the APNs payload. See
|
|
756
|
-
* [Payload Key Reference](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html)
|
|
757
|
-
* and
|
|
758
|
-
* [Localizing the Content of Your Remote Notifications](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9)
|
|
759
|
-
* for more information.
|
|
760
|
-
*
|
|
761
|
-
* **Android:** See
|
|
762
|
-
* [String Resources](http://developer.android.com/guide/topics/resources/string-resource.html)
|
|
763
|
-
* for more information.
|
|
764
|
-
*
|
|
765
|
-
* **Platforms:** iOS, Android
|
|
766
|
-
*/
|
|
767
|
-
titleLocKey?: string;
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* Variable string values to be used in place of the format specifiers in
|
|
771
|
-
* `title_loc_key` to use to localize the title text to the user's current
|
|
772
|
-
* localization.
|
|
773
|
-
*
|
|
774
|
-
* The value should be a stringified JSON array.
|
|
775
|
-
*
|
|
776
|
-
* **iOS:** Corresponds to `title-loc-args` in the APNs payload. See
|
|
777
|
-
* [Payload Key Reference](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html)
|
|
778
|
-
* and
|
|
779
|
-
* [Localizing the Content of Your Remote Notifications](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html#//apple_ref/doc/uid/TP40008194-CH10-SW9)
|
|
780
|
-
* for more information.
|
|
781
|
-
*
|
|
782
|
-
* **Android:** See
|
|
783
|
-
* [Formatting and Styling](http://developer.android.com/guide/topics/resources/string-resource.html#FormattingAndStyling)
|
|
784
|
-
* for more information.
|
|
785
|
-
*
|
|
786
|
-
* **Platforms:** iOS, Android
|
|
787
|
-
*/
|
|
788
|
-
titleLocArgs?: string;
|
|
789
|
-
[key: string]: string | undefined;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* Interface representing a Firebase Cloud Messaging message payload. One or
|
|
794
|
-
* both of the `data` and `notification` keys are required.
|
|
795
|
-
*
|
|
796
|
-
* See
|
|
797
|
-
* [Build send requests](/docs/cloud-messaging/send-message)
|
|
798
|
-
* for code samples and detailed documentation.
|
|
799
|
-
*/
|
|
800
|
-
interface MessagingPayload {
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* The data message payload.
|
|
804
|
-
*/
|
|
805
|
-
data?: admin.messaging.DataMessagePayload;
|
|
806
|
-
|
|
807
|
-
/**
|
|
808
|
-
* The notification message payload.
|
|
809
|
-
*/
|
|
810
|
-
notification?: admin.messaging.NotificationMessagePayload;
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Interface representing the options that can be provided when sending a
|
|
814
|
-
* message via the FCM legacy APIs.
|
|
815
|
-
*
|
|
816
|
-
* See [Build send requests](/docs/cloud-messaging/send-message)
|
|
817
|
-
* for code samples and detailed documentation.
|
|
818
|
-
*/
|
|
819
|
-
interface MessagingOptions {
|
|
820
|
-
|
|
821
|
-
/**
|
|
822
|
-
* Whether or not the message should actually be sent. When set to `true`,
|
|
823
|
-
* allows developers to test a request without actually sending a message. When
|
|
824
|
-
* set to `false`, the message will be sent.
|
|
825
|
-
*
|
|
826
|
-
* **Default value:** `false`
|
|
827
|
-
*/
|
|
828
|
-
dryRun?: boolean;
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* The priority of the message. Valid values are `"normal"` and `"high".` On
|
|
832
|
-
* iOS, these correspond to APNs priorities `5` and `10`.
|
|
833
|
-
*
|
|
834
|
-
* By default, notification messages are sent with high priority, and data
|
|
835
|
-
* messages are sent with normal priority. Normal priority optimizes the client
|
|
836
|
-
* app's battery consumption and should be used unless immediate delivery is
|
|
837
|
-
* required. For messages with normal priority, the app may receive the message
|
|
838
|
-
* with unspecified delay.
|
|
839
|
-
*
|
|
840
|
-
* When a message is sent with high priority, it is sent immediately, and the
|
|
841
|
-
* app can wake a sleeping device and open a network connection to your server.
|
|
842
|
-
*
|
|
843
|
-
* For more information, see
|
|
844
|
-
* [Setting the priority of a message](/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message).
|
|
845
|
-
*
|
|
846
|
-
* **Default value:** `"high"` for notification messages, `"normal"` for data
|
|
847
|
-
* messages
|
|
848
|
-
*/
|
|
849
|
-
priority?: string;
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* How long (in seconds) the message should be kept in FCM storage if the device
|
|
853
|
-
* is offline. The maximum time to live supported is four weeks, and the default
|
|
854
|
-
* value is also four weeks. For more information, see
|
|
855
|
-
* [Setting the lifespan of a message](/docs/cloud-messaging/concept-options#ttl).
|
|
856
|
-
*
|
|
857
|
-
* **Default value:** `2419200` (representing four weeks, in seconds)
|
|
858
|
-
*/
|
|
859
|
-
timeToLive?: number;
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* String identifying a group of messages (for example, "Updates Available")
|
|
863
|
-
* that can be collapsed, so that only the last message gets sent when delivery
|
|
864
|
-
* can be resumed. This is used to avoid sending too many of the same messages
|
|
865
|
-
* when the device comes back online or becomes active.
|
|
866
|
-
*
|
|
867
|
-
* There is no guarantee of the order in which messages get sent.
|
|
868
|
-
*
|
|
869
|
-
* A maximum of four different collapse keys is allowed at any given time. This
|
|
870
|
-
* means FCM server can simultaneously store four different
|
|
871
|
-
* send-to-sync messages per client app. If you exceed this number, there is no
|
|
872
|
-
* guarantee which four collapse keys the FCM server will keep.
|
|
873
|
-
*
|
|
874
|
-
* **Default value:** None
|
|
875
|
-
*/
|
|
876
|
-
collapseKey?: string;
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* On iOS, use this field to represent `mutable-content` in the APNs payload.
|
|
880
|
-
* When a notification is sent and this is set to `true`, the content of the
|
|
881
|
-
* notification can be modified before it is displayed, using a
|
|
882
|
-
* [Notification Service app extension](https://developer.apple.com/reference/usernotifications/unnotificationserviceextension)
|
|
883
|
-
*
|
|
884
|
-
* On Android and Web, this parameter will be ignored.
|
|
885
|
-
*
|
|
886
|
-
* **Default value:** `false`
|
|
887
|
-
*/
|
|
888
|
-
mutableContent?: boolean;
|
|
889
|
-
|
|
890
|
-
/**
|
|
891
|
-
* On iOS, use this field to represent `content-available` in the APNs payload.
|
|
892
|
-
* When a notification or data message is sent and this is set to `true`, an
|
|
893
|
-
* inactive client app is awoken. On Android, data messages wake the app by
|
|
894
|
-
* default. On Chrome, this flag is currently not supported.
|
|
895
|
-
*
|
|
896
|
-
* **Default value:** `false`
|
|
897
|
-
*/
|
|
898
|
-
contentAvailable?: boolean;
|
|
899
|
-
|
|
900
|
-
/**
|
|
901
|
-
* The package name of the application which the registration tokens must match
|
|
902
|
-
* in order to receive the message.
|
|
903
|
-
*
|
|
904
|
-
* **Default value:** None
|
|
905
|
-
*/
|
|
906
|
-
restrictedPackageName?: string;
|
|
907
|
-
[key: string]: any | undefined;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
/**
|
|
911
|
-
* Interface representing the status of a message sent to an individual device
|
|
912
|
-
* via the FCM legacy APIs.
|
|
913
|
-
*
|
|
914
|
-
* See
|
|
915
|
-
* [Send to individual devices](/docs/cloud-messaging/admin/send-messages#send_to_individual_devices)
|
|
916
|
-
* for code samples and detailed documentation.
|
|
917
|
-
*/
|
|
918
|
-
interface MessagingDeviceResult {
|
|
919
|
-
|
|
920
|
-
/**
|
|
921
|
-
* The error that occurred when processing the message for the recipient.
|
|
922
|
-
*/
|
|
923
|
-
error?: _admin.FirebaseError;
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* A unique ID for the successfully processed message.
|
|
927
|
-
*/
|
|
928
|
-
messageId?: string;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* The canonical registration token for the client app that the message was
|
|
932
|
-
* processed and sent to. You should use this value as the registration token
|
|
933
|
-
* for future requests. Otherwise, future messages might be rejected.
|
|
934
|
-
*/
|
|
935
|
-
canonicalRegistrationToken?: string;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/**
|
|
939
|
-
* Interface representing the server response from the legacy
|
|
940
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendToDevice `sendToDevice()`} method.
|
|
941
|
-
*
|
|
942
|
-
* See
|
|
943
|
-
* [Send to individual devices](/docs/cloud-messaging/admin/send-messages#send_to_individual_devices)
|
|
944
|
-
* for code samples and detailed documentation.
|
|
945
|
-
*/
|
|
946
|
-
interface MessagingDevicesResponse {
|
|
947
|
-
|
|
948
|
-
/**
|
|
949
|
-
* The number of results that contain a canonical registration token. A
|
|
950
|
-
* canonical registration token is the registration token corresponding to the
|
|
951
|
-
* last registration requested by the client app. This is the token that you
|
|
952
|
-
* should use when sending future messages to the device.
|
|
953
|
-
*
|
|
954
|
-
* You can access the canonical registration tokens within the
|
|
955
|
-
* [`results`](#results) property.
|
|
956
|
-
*/
|
|
957
|
-
canonicalRegistrationTokenCount: number;
|
|
958
|
-
|
|
959
|
-
/**
|
|
960
|
-
* The number of messages that could not be processed and resulted in an error.
|
|
961
|
-
*/
|
|
962
|
-
failureCount: number;
|
|
963
|
-
|
|
964
|
-
/**
|
|
965
|
-
* The unique ID number identifying this multicast message.
|
|
966
|
-
*/
|
|
967
|
-
multicastId: number;
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* An array of `MessagingDeviceResult` objects representing the status of the
|
|
971
|
-
* processed messages. The objects are listed in the same order as in the
|
|
972
|
-
* request. That is, for each registration token in the request, its result has
|
|
973
|
-
* the same index in this array. If only a single registration token is
|
|
974
|
-
* provided, this array will contain a single object.
|
|
975
|
-
*/
|
|
976
|
-
results: admin.messaging.MessagingDeviceResult[];
|
|
977
|
-
|
|
978
|
-
/**
|
|
979
|
-
* The number of messages that were successfully processed and sent.
|
|
980
|
-
*/
|
|
981
|
-
successCount: number;
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Interface representing the server response from the
|
|
985
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendToDeviceGroup `sendToDeviceGroup()`}
|
|
986
|
-
* method.
|
|
987
|
-
*
|
|
988
|
-
* See
|
|
989
|
-
* [Send messages to device groups](/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups)
|
|
990
|
-
* for code samples and detailed documentation.
|
|
991
|
-
*/
|
|
992
|
-
interface MessagingDeviceGroupResponse {
|
|
993
|
-
|
|
994
|
-
/**
|
|
995
|
-
* The number of messages that could not be processed and resulted in an error.
|
|
996
|
-
*/
|
|
997
|
-
successCount: number;
|
|
998
|
-
|
|
999
|
-
/**
|
|
1000
|
-
* The number of messages that could not be processed and resulted in an error.
|
|
1001
|
-
*/
|
|
1002
|
-
failureCount: number;
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* An array of registration tokens that failed to receive the message.
|
|
1006
|
-
*/
|
|
1007
|
-
failedRegistrationTokens: string[];
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* Interface representing the server response from the legacy
|
|
1012
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendToTopic `sendToTopic()`} method.
|
|
1013
|
-
*
|
|
1014
|
-
* See
|
|
1015
|
-
* [Send to a topic](/docs/cloud-messaging/admin/send-messages#send_to_a_topic)
|
|
1016
|
-
* for code samples and detailed documentation.
|
|
1017
|
-
*/
|
|
1018
|
-
interface MessagingTopicResponse {
|
|
1019
|
-
|
|
1020
|
-
/**
|
|
1021
|
-
* The message ID for a successfully received request which FCM will attempt to
|
|
1022
|
-
* deliver to all subscribed devices.
|
|
1023
|
-
*/
|
|
1024
|
-
messageId: number;
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
/**
|
|
1028
|
-
* Interface representing the server response from the legacy
|
|
1029
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendToCondition `sendToCondition()`} method.
|
|
1030
|
-
*
|
|
1031
|
-
* See
|
|
1032
|
-
* [Send to a condition](/docs/cloud-messaging/admin/send-messages#send_to_a_condition)
|
|
1033
|
-
* for code samples and detailed documentation.
|
|
1034
|
-
*/
|
|
1035
|
-
interface MessagingConditionResponse {
|
|
1036
|
-
|
|
1037
|
-
/**
|
|
1038
|
-
* The message ID for a successfully received request which FCM will attempt to
|
|
1039
|
-
* deliver to all subscribed devices.
|
|
1040
|
-
*/
|
|
1041
|
-
messageId: number;
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
/**
|
|
1045
|
-
* Interface representing the server response from the
|
|
1046
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#subscribeToTopic `subscribeToTopic()`} and
|
|
1047
|
-
* {@link
|
|
1048
|
-
* admin.messaging.Messaging#unsubscribeFromTopic
|
|
1049
|
-
* `unsubscribeFromTopic()`}
|
|
1050
|
-
* methods.
|
|
1051
|
-
*
|
|
1052
|
-
* See
|
|
1053
|
-
* [Manage topics from the server](/docs/cloud-messaging/manage-topics)
|
|
1054
|
-
* for code samples and detailed documentation.
|
|
1055
|
-
*/
|
|
1056
|
-
interface MessagingTopicManagementResponse {
|
|
1057
|
-
|
|
1058
|
-
/**
|
|
1059
|
-
* The number of registration tokens that could not be subscribed to the topic
|
|
1060
|
-
* and resulted in an error.
|
|
1061
|
-
*/
|
|
1062
|
-
failureCount: number;
|
|
1063
|
-
|
|
1064
|
-
/**
|
|
1065
|
-
* The number of registration tokens that were successfully subscribed to the
|
|
1066
|
-
* topic.
|
|
1067
|
-
*/
|
|
1068
|
-
successCount: number;
|
|
1069
|
-
|
|
1070
|
-
/**
|
|
1071
|
-
* An array of errors corresponding to the provided registration token(s). The
|
|
1072
|
-
* length of this array will be equal to [`failureCount`](#failureCount).
|
|
1073
|
-
*/
|
|
1074
|
-
errors: _admin.FirebaseArrayIndexError[];
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
/**
|
|
1078
|
-
* Interface representing the server response from the
|
|
1079
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendAll `sendAll()`} and
|
|
1080
|
-
* {@link https://firebase.google.com/docs/reference/admin/node/admin.messaging.Messaging#sendMulticast `sendMulticast()`} methods.
|
|
1081
|
-
*/
|
|
1082
|
-
interface BatchResponse {
|
|
1083
|
-
|
|
1084
|
-
/**
|
|
1085
|
-
* An array of responses, each corresponding to a message.
|
|
1086
|
-
*/
|
|
1087
|
-
responses: admin.messaging.SendResponse[];
|
|
1088
|
-
|
|
1089
|
-
/**
|
|
1090
|
-
* The number of messages that were successfully handed off for sending.
|
|
1091
|
-
*/
|
|
1092
|
-
successCount: number;
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* The number of messages that resulted in errors when sending.
|
|
1096
|
-
*/
|
|
1097
|
-
failureCount: number;
|
|
1098
|
-
}
|
|
1099
|
-
/**
|
|
1100
|
-
* Interface representing the status of an individual message that was sent as
|
|
1101
|
-
* part of a batch request.
|
|
1102
|
-
*/
|
|
1103
|
-
interface SendResponse {
|
|
1104
|
-
|
|
1105
|
-
/**
|
|
1106
|
-
* A boolean indicating if the message was successfully handed off to FCM or
|
|
1107
|
-
* not. When true, the `messageId` attribute is guaranteed to be set. When
|
|
1108
|
-
* false, the `error` attribute is guaranteed to be set.
|
|
1109
|
-
*/
|
|
1110
|
-
success: boolean;
|
|
1111
|
-
|
|
1112
|
-
/**
|
|
1113
|
-
* A unique message ID string, if the message was handed off to FCM for
|
|
1114
|
-
* delivery.
|
|
1115
|
-
*
|
|
1116
|
-
*/
|
|
1117
|
-
messageId?: string;
|
|
1118
|
-
|
|
1119
|
-
/**
|
|
1120
|
-
* An error, if the message was not handed off to FCM successfully.
|
|
1121
|
-
*/
|
|
1122
|
-
error?: _admin.FirebaseError;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
/**
|
|
1126
|
-
* Gets the {@link admin.messaging.Messaging `Messaging`} service for the
|
|
1127
|
-
* current app.
|
|
1128
|
-
*
|
|
1129
|
-
* @example
|
|
1130
|
-
* ```javascript
|
|
1131
|
-
* var messaging = app.messaging();
|
|
1132
|
-
* // The above is shorthand for:
|
|
1133
|
-
* // var messaging = admin.messaging(app);
|
|
1134
|
-
* ```
|
|
1135
|
-
*
|
|
1136
|
-
* @return The `Messaging` service for the current app.
|
|
1137
|
-
*/
|
|
1138
|
-
interface Messaging {
|
|
1139
|
-
/**
|
|
1140
|
-
* The {@link admin.app.App app} associated with the current `Messaging` service
|
|
1141
|
-
* instance.
|
|
1142
|
-
*
|
|
1143
|
-
* @example
|
|
1144
|
-
* ```javascript
|
|
1145
|
-
* var app = messaging.app;
|
|
1146
|
-
* ```
|
|
1147
|
-
*/
|
|
1148
|
-
app: _admin.app.App;
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* Sends the given message via FCM.
|
|
1152
|
-
*
|
|
1153
|
-
* @param message The message payload.
|
|
1154
|
-
* @param dryRun Whether to send the message in the dry-run
|
|
1155
|
-
* (validation only) mode.
|
|
1156
|
-
* @return A promise fulfilled with a unique message ID
|
|
1157
|
-
* string after the message has been successfully handed off to the FCM
|
|
1158
|
-
* service for delivery.
|
|
1159
|
-
*/
|
|
1160
|
-
send(message: admin.messaging.Message, dryRun?: boolean): Promise<string>;
|
|
1161
|
-
|
|
1162
|
-
/**
|
|
1163
|
-
* Sends all the messages in the given array via Firebase Cloud Messaging.
|
|
1164
|
-
* Employs batching to send the entire list as a single RPC call. Compared
|
|
1165
|
-
* to the `send()` method, this method is a significantly more efficient way
|
|
1166
|
-
* to send multiple messages.
|
|
1167
|
-
*
|
|
1168
|
-
* The responses list obtained from the return value
|
|
1169
|
-
* corresponds to the order of tokens in the `MulticastMessage`. An error
|
|
1170
|
-
* from this method indicates a total failure -- i.e. none of the messages in
|
|
1171
|
-
* the list could be sent. Partial failures are indicated by a `BatchResponse`
|
|
1172
|
-
* return value.
|
|
1173
|
-
*
|
|
1174
|
-
* @param messages A non-empty array
|
|
1175
|
-
* containing up to 500 messages.
|
|
1176
|
-
* @param dryRun Whether to send the messages in the dry-run
|
|
1177
|
-
* (validation only) mode.
|
|
1178
|
-
* @return A Promise fulfilled with an object representing the result of the
|
|
1179
|
-
* send operation.
|
|
1180
|
-
*/
|
|
1181
|
-
sendAll(
|
|
1182
|
-
messages: Array<admin.messaging.Message>,
|
|
1183
|
-
dryRun?: boolean
|
|
1184
|
-
): Promise<admin.messaging.BatchResponse>;
|
|
1185
|
-
|
|
1186
|
-
/**
|
|
1187
|
-
* Sends the given multicast message to all the FCM registration tokens
|
|
1188
|
-
* specified in it.
|
|
1189
|
-
*
|
|
1190
|
-
* This method uses the `sendAll()` API under the hood to send the given
|
|
1191
|
-
* message to all the target recipients. The responses list obtained from the
|
|
1192
|
-
* return value corresponds to the order of tokens in the `MulticastMessage`.
|
|
1193
|
-
* An error from this method indicates a total failure -- i.e. the message was
|
|
1194
|
-
* not sent to any of the tokens in the list. Partial failures are indicated by
|
|
1195
|
-
* a `BatchResponse` return value.
|
|
1196
|
-
*
|
|
1197
|
-
* @param message A multicast message
|
|
1198
|
-
* containing up to 500 tokens.
|
|
1199
|
-
* @param dryRun Whether to send the message in the dry-run
|
|
1200
|
-
* (validation only) mode.
|
|
1201
|
-
* @return A Promise fulfilled with an object representing the result of the
|
|
1202
|
-
* send operation.
|
|
1203
|
-
*/
|
|
1204
|
-
sendMulticast(
|
|
1205
|
-
message: admin.messaging.MulticastMessage,
|
|
1206
|
-
dryRun?: boolean
|
|
1207
|
-
): Promise<admin.messaging.BatchResponse>;
|
|
1208
|
-
|
|
1209
|
-
/**
|
|
1210
|
-
* Sends an FCM message to a single device corresponding to the provided
|
|
1211
|
-
* registration token.
|
|
1212
|
-
*
|
|
1213
|
-
* See
|
|
1214
|
-
* [Send to individual devices](/docs/cloud-messaging/admin/legacy-fcm#send_to_individual_devices)
|
|
1215
|
-
* for code samples and detailed documentation. Takes either a
|
|
1216
|
-
* `registrationToken` to send to a single device or a
|
|
1217
|
-
* `registrationTokens` parameter containing an array of tokens to send
|
|
1218
|
-
* to multiple devices.
|
|
1219
|
-
*
|
|
1220
|
-
* @param registrationToken A device registration token or an array of
|
|
1221
|
-
* device registration tokens to which the message should be sent.
|
|
1222
|
-
* @param payload The message payload.
|
|
1223
|
-
* @param options Optional options to
|
|
1224
|
-
* alter the message.
|
|
1225
|
-
*
|
|
1226
|
-
* @return A promise fulfilled with the server's response after the message
|
|
1227
|
-
* has been sent.
|
|
1228
|
-
*/
|
|
1229
|
-
sendToDevice(
|
|
1230
|
-
registrationToken: string | string[],
|
|
1231
|
-
payload: admin.messaging.MessagingPayload,
|
|
1232
|
-
options?: admin.messaging.MessagingOptions
|
|
1233
|
-
): Promise<admin.messaging.MessagingDevicesResponse>;
|
|
1234
|
-
|
|
1235
|
-
/**
|
|
1236
|
-
* Sends an FCM message to a device group corresponding to the provided
|
|
1237
|
-
* notification key.
|
|
1238
|
-
*
|
|
1239
|
-
* See
|
|
1240
|
-
* [Send to a device group](/docs/cloud-messaging/admin/legacy-fcm#send_to_a_device_group)
|
|
1241
|
-
* for code samples and detailed documentation.
|
|
1242
|
-
*
|
|
1243
|
-
* @param notificationKey The notification key for the device group to
|
|
1244
|
-
* which to send the message.
|
|
1245
|
-
* @param payload The message payload.
|
|
1246
|
-
* @param options Optional options to
|
|
1247
|
-
* alter the message.
|
|
1248
|
-
*
|
|
1249
|
-
* @return A promise fulfilled with the server's response after the message
|
|
1250
|
-
* has been sent.
|
|
1251
|
-
*/
|
|
1252
|
-
sendToDeviceGroup(
|
|
1253
|
-
notificationKey: string,
|
|
1254
|
-
payload: admin.messaging.MessagingPayload,
|
|
1255
|
-
options?: admin.messaging.MessagingOptions
|
|
1256
|
-
): Promise<admin.messaging.MessagingDeviceGroupResponse>;
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* Sends an FCM message to a topic.
|
|
1260
|
-
*
|
|
1261
|
-
* See
|
|
1262
|
-
* [Send to a topic](/docs/cloud-messaging/admin/legacy-fcm#send_to_a_topic)
|
|
1263
|
-
* for code samples and detailed documentation.
|
|
1264
|
-
*
|
|
1265
|
-
* @param topic The topic to which to send the message.
|
|
1266
|
-
* @param payload The message payload.
|
|
1267
|
-
* @param options Optional options to
|
|
1268
|
-
* alter the message.
|
|
1269
|
-
*
|
|
1270
|
-
* @return A promise fulfilled with the server's response after the message
|
|
1271
|
-
* has been sent.
|
|
1272
|
-
*/
|
|
1273
|
-
sendToTopic(
|
|
1274
|
-
topic: string,
|
|
1275
|
-
payload: admin.messaging.MessagingPayload,
|
|
1276
|
-
options?: admin.messaging.MessagingOptions
|
|
1277
|
-
): Promise<admin.messaging.MessagingTopicResponse>;
|
|
1278
|
-
|
|
1279
|
-
/**
|
|
1280
|
-
* Sends an FCM message to a condition.
|
|
1281
|
-
*
|
|
1282
|
-
* See
|
|
1283
|
-
* [Send to a condition](/docs/cloud-messaging/admin/legacy-fcm#send_to_a_condition)
|
|
1284
|
-
* for code samples and detailed documentation.
|
|
1285
|
-
*
|
|
1286
|
-
* @param condition The condition determining to which topics to send
|
|
1287
|
-
* the message.
|
|
1288
|
-
* @param payload The message payload.
|
|
1289
|
-
* @param options Optional options to
|
|
1290
|
-
* alter the message.
|
|
1291
|
-
*
|
|
1292
|
-
* @return A promise fulfilled with the server's response after the message
|
|
1293
|
-
* has been sent.
|
|
1294
|
-
*/
|
|
1295
|
-
sendToCondition(
|
|
1296
|
-
condition: string,
|
|
1297
|
-
payload: admin.messaging.MessagingPayload,
|
|
1298
|
-
options?: admin.messaging.MessagingOptions
|
|
1299
|
-
): Promise<admin.messaging.MessagingConditionResponse>;
|
|
1300
|
-
|
|
1301
|
-
/**
|
|
1302
|
-
* Subscribes a device to an FCM topic.
|
|
1303
|
-
*
|
|
1304
|
-
* See [Subscribe to a
|
|
1305
|
-
* topic](/docs/cloud-messaging/manage-topics#suscribe_and_unsubscribe_using_the)
|
|
1306
|
-
* for code samples and detailed documentation. Optionally, you can provide an
|
|
1307
|
-
* array of tokens to subscribe multiple devices.
|
|
1308
|
-
*
|
|
1309
|
-
* @param registrationTokens A token or array of registration tokens
|
|
1310
|
-
* for the devices to subscribe to the topic.
|
|
1311
|
-
* @param topic The topic to which to subscribe.
|
|
1312
|
-
*
|
|
1313
|
-
* @return A promise fulfilled with the server's response after the device has been
|
|
1314
|
-
* subscribed to the topic.
|
|
1315
|
-
*/
|
|
1316
|
-
subscribeToTopic(
|
|
1317
|
-
registrationTokens: string | string[],
|
|
1318
|
-
topic: string
|
|
1319
|
-
): Promise<admin.messaging.MessagingTopicManagementResponse>;
|
|
1320
|
-
|
|
1321
|
-
/**
|
|
1322
|
-
* Unsubscribes a device from an FCM topic.
|
|
1323
|
-
*
|
|
1324
|
-
* See [Unsubscribe from a
|
|
1325
|
-
* topic](/docs/cloud-messaging/admin/manage-topic-subscriptions#unsubscribe_from_a_topic)
|
|
1326
|
-
* for code samples and detailed documentation. Optionally, you can provide an
|
|
1327
|
-
* array of tokens to unsubscribe multiple devices.
|
|
1328
|
-
*
|
|
1329
|
-
* @param registrationTokens A device registration token or an array of
|
|
1330
|
-
* device registration tokens to unsubscribe from the topic.
|
|
1331
|
-
* @param topic The topic from which to unsubscribe.
|
|
1332
|
-
*
|
|
1333
|
-
* @return A promise fulfilled with the server's response after the device has been
|
|
1334
|
-
* unsubscribed from the topic.
|
|
1335
|
-
*/
|
|
1336
|
-
unsubscribeFromTopic(
|
|
1337
|
-
registrationTokens: string | string[],
|
|
1338
|
-
topic: string
|
|
1339
|
-
): Promise<admin.messaging.MessagingTopicManagementResponse>;
|
|
1340
|
-
}
|
|
1341
|
-
}
|