Skip to content

Commit 8879fe0

Browse files
authored
Deprecate sendToDevice and sendToDeviceGroup and their response classes (#2090)
1. Deprecate sendToDevice and its response class, MessagingDeviceResponse 2. Deprecate sendToDeviceGroup and its response class, MessagingDeviceGroupResponse
1 parent b9da2a3 commit 8879fe0

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

etc/firebase-admin.messaging.api.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,9 @@ export class Messaging {
187187
sendAll(messages: Message[], dryRun?: boolean): Promise<BatchResponse>;
188188
sendMulticast(message: MulticastMessage, dryRun?: boolean): Promise<BatchResponse>;
189189
sendToCondition(condition: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingConditionResponse>;
190+
// @deprecated
190191
sendToDevice(registrationTokenOrTokens: string | string[], payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDevicesResponse>;
192+
// @deprecated
191193
sendToDeviceGroup(notificationKey: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDeviceGroupResponse>;
192194
sendToTopic(topic: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingTopicResponse>;
193195
subscribeToTopic(registrationTokenOrTokens: string | string[], topic: string): Promise<MessagingTopicManagementResponse>;
@@ -199,22 +201,22 @@ export interface MessagingConditionResponse {
199201
messageId: number;
200202
}
201203

202-
// @public
204+
// @public @deprecated
203205
export interface MessagingDeviceGroupResponse {
204206
failedRegistrationTokens: string[];
205207
failureCount: number;
206208
successCount: number;
207209
}
208210

209-
// @public (undocumented)
211+
// @public @deprecated
210212
export interface MessagingDeviceResult {
211213
canonicalRegistrationToken?: string;
212214
// Warning: (ae-forgotten-export) The symbol "FirebaseError" needs to be exported by the entry point index.d.ts
213215
error?: FirebaseError;
214216
messageId?: string;
215217
}
216218

217-
// @public
219+
// @public @deprecated
218220
export interface MessagingDevicesResponse {
219221
// (undocumented)
220222
canonicalRegistrationTokenCount: number;

src/messaging/messaging-api.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,11 @@ export interface MessagingOptions {
940940
[key: string]: any | undefined;
941941
}
942942

943-
/* Individual status response payload from single devices */
943+
/**
944+
* Individual status response payload from single devices
945+
*
946+
* @deprecated Returned by {@link Messaging#sendToDevice}, which is also deprecated.
947+
*/
944948
export interface MessagingDeviceResult {
945949
/**
946950
* The error that occurred when processing the message for the recipient.
@@ -967,6 +971,8 @@ export interface MessagingDeviceResult {
967971
* See
968972
* {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_individual_devices |
969973
* Send to individual devices} for code samples and detailed documentation.
974+
*
975+
* @deprecated Returned by {@link Messaging.sendToDevice}, which is also deprecated.
970976
*/
971977
export interface MessagingDevicesResponse {
972978
canonicalRegistrationTokenCount: number;
@@ -983,6 +989,8 @@ export interface MessagingDevicesResponse {
983989
* See
984990
* {@link https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups |
985991
* Send messages to device groups} for code samples and detailed documentation.
992+
*
993+
* @deprecated Returned by {@link Messaging.sendToDeviceGroup}, which is also deprecated.
986994
*/
987995
export interface MessagingDeviceGroupResponse {
988996

src/messaging/messaging.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ export class Messaging {
376376
*
377377
* @returns A promise fulfilled with the server's response after the message
378378
* has been sent.
379+
*
380+
* @deprecated Use {@link Messaging.send} instead.
379381
*/
380382
public sendToDevice(
381383
registrationTokenOrTokens: string | string[],
@@ -445,6 +447,8 @@ export class Messaging {
445447
*
446448
* @returns A promise fulfilled with the server's response after the message
447449
* has been sent.
450+
*
451+
* @deprecated Use {@link Messaging.send} instead.
448452
*/
449453
public sendToDeviceGroup(
450454
notificationKey: string,

0 commit comments

Comments
 (0)