From 16ba83a278c0ad00ec2c870903f2c166324b30a4 Mon Sep 17 00:00:00 2001 From: Doris Ge Date: Mon, 27 Feb 2023 23:42:13 -0800 Subject: [PATCH] Deprecate sendToDevice and sendToDeviceGroup and their response classes 1. Deprecate sendToDevice and its response class, MessagingDeviceResponse 2. Deprecate sendToDeviceGroup and its response class, MessagingDeviceGroupResponse --- etc/firebase-admin.messaging.api.md | 8 +++++--- src/messaging/messaging-api.ts | 10 +++++++++- src/messaging/messaging.ts | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/etc/firebase-admin.messaging.api.md b/etc/firebase-admin.messaging.api.md index c37466734c..c2f95d4744 100644 --- a/etc/firebase-admin.messaging.api.md +++ b/etc/firebase-admin.messaging.api.md @@ -187,7 +187,9 @@ export class Messaging { sendAll(messages: Message[], dryRun?: boolean): Promise; sendMulticast(message: MulticastMessage, dryRun?: boolean): Promise; sendToCondition(condition: string, payload: MessagingPayload, options?: MessagingOptions): Promise; + // @deprecated sendToDevice(registrationTokenOrTokens: string | string[], payload: MessagingPayload, options?: MessagingOptions): Promise; + // @deprecated sendToDeviceGroup(notificationKey: string, payload: MessagingPayload, options?: MessagingOptions): Promise; sendToTopic(topic: string, payload: MessagingPayload, options?: MessagingOptions): Promise; subscribeToTopic(registrationTokenOrTokens: string | string[], topic: string): Promise; @@ -199,14 +201,14 @@ export interface MessagingConditionResponse { messageId: number; } -// @public +// @public @deprecated export interface MessagingDeviceGroupResponse { failedRegistrationTokens: string[]; failureCount: number; successCount: number; } -// @public (undocumented) +// @public @deprecated export interface MessagingDeviceResult { canonicalRegistrationToken?: string; // Warning: (ae-forgotten-export) The symbol "FirebaseError" needs to be exported by the entry point index.d.ts @@ -214,7 +216,7 @@ export interface MessagingDeviceResult { messageId?: string; } -// @public +// @public @deprecated export interface MessagingDevicesResponse { // (undocumented) canonicalRegistrationTokenCount: number; diff --git a/src/messaging/messaging-api.ts b/src/messaging/messaging-api.ts index d41e6a61c2..29f7f1fdc9 100644 --- a/src/messaging/messaging-api.ts +++ b/src/messaging/messaging-api.ts @@ -940,7 +940,11 @@ export interface MessagingOptions { [key: string]: any | undefined; } -/* Individual status response payload from single devices */ +/** + * Individual status response payload from single devices + * + * @deprecated Returned by {@link Messaging#sendToDevice}, which is also deprecated. + */ export interface MessagingDeviceResult { /** * The error that occurred when processing the message for the recipient. @@ -967,6 +971,8 @@ export interface MessagingDeviceResult { * See * {@link https://firebase.google.com/docs/cloud-messaging/admin/send-messages#send_to_individual_devices | * Send to individual devices} for code samples and detailed documentation. + * + * @deprecated Returned by {@link Messaging.sendToDevice}, which is also deprecated. */ export interface MessagingDevicesResponse { canonicalRegistrationTokenCount: number; @@ -983,6 +989,8 @@ export interface MessagingDevicesResponse { * See * {@link https://firebase.google.com/docs/cloud-messaging/send-message?authuser=0#send_messages_to_device_groups | * Send messages to device groups} for code samples and detailed documentation. + * + * @deprecated Returned by {@link Messaging.sendToDeviceGroup}, which is also deprecated. */ export interface MessagingDeviceGroupResponse { diff --git a/src/messaging/messaging.ts b/src/messaging/messaging.ts index c208a34a79..2090e099c5 100644 --- a/src/messaging/messaging.ts +++ b/src/messaging/messaging.ts @@ -376,6 +376,8 @@ export class Messaging { * * @returns A promise fulfilled with the server's response after the message * has been sent. + * + * @deprecated Use {@link Messaging.send} instead. */ public sendToDevice( registrationTokenOrTokens: string | string[], @@ -445,6 +447,8 @@ export class Messaging { * * @returns A promise fulfilled with the server's response after the message * has been sent. + * + * @deprecated Use {@link Messaging.send} instead. */ public sendToDeviceGroup( notificationKey: string,