Skip to content

Commit

Permalink
Deprecate sendToDevice and sendToDeviceGroup and their response classes
Browse files Browse the repository at this point in the history
1. Deprecate sendToDevice and its response class, MessagingDeviceResponse
2. Deprecate sendToDeviceGroup and its response class, MessagingDeviceGroupResponse
  • Loading branch information
Doris-Ge committed Mar 1, 2023
1 parent 49251a8 commit e84d85f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 5 additions & 3 deletions etc/firebase-admin.messaging.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ export class Messaging {
sendAll(messages: Message[], dryRun?: boolean): Promise<BatchResponse>;
sendMulticast(message: MulticastMessage, dryRun?: boolean): Promise<BatchResponse>;
sendToCondition(condition: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingConditionResponse>;
// @deprecated
sendToDevice(registrationTokenOrTokens: string | string[], payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDevicesResponse>;
// @deprecated
sendToDeviceGroup(notificationKey: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingDeviceGroupResponse>;
sendToTopic(topic: string, payload: MessagingPayload, options?: MessagingOptions): Promise<MessagingTopicResponse>;
subscribeToTopic(registrationTokenOrTokens: string | string[], topic: string): Promise<MessagingTopicManagementResponse>;
Expand All @@ -199,22 +201,22 @@ 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
error?: FirebaseError;
messageId?: string;
}

// @public
// @public @deprecated
export interface MessagingDevicesResponse {
// (undocumented)
canonicalRegistrationTokenCount: number;
Expand Down
10 changes: 9 additions & 1 deletion src/messaging/messaging-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -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 {

Expand Down
4 changes: 4 additions & 0 deletions src/messaging/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[],
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit e84d85f

Please sign in to comment.