feat: allow broadcast notifications

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-01-25 10:12:31 +02:00
parent 6a79f9f1ee
commit a3d42153d1
6 changed files with 45 additions and 13 deletions
+14 -3
View File
@@ -22,18 +22,29 @@ export class DefaultNotificationService implements NotificationService {
send(options: NotificationSendOptions): Promise<Notification_2[]>;
}
// @public (undocumented)
export type NotificationReceivers =
| {
type: 'entity';
entityRef: string | string[];
}
| {
type: 'broadcast';
};
// @public (undocumented)
export type NotificationSendOptions = {
entityRef: string | string[];
receivers: NotificationReceivers;
title: string;
description: string;
link: string;
};
// @public (undocumented)
export type NotificationService = {
export interface NotificationService {
// (undocumented)
send(options: NotificationSendOptions): Promise<Notification_2[]>;
};
}
// @public (undocumented)
export const notificationService: ServiceRef<NotificationService, 'plugin'>;
@@ -27,9 +27,14 @@ export type NotificationServiceOptions = {
signalService: SignalService;
};
/** @public */
export type NotificationReceivers =
| { type: 'entity'; entityRef: string | string[] }
| { type: 'broadcast' };
/** @public */
export type NotificationSendOptions = {
entityRef: string | string[];
receivers: NotificationReceivers;
title: string;
description: string;
link: string;
@@ -18,6 +18,6 @@ import { NotificationSendOptions } from './DefaultNotificationService';
import { Notification } from '@backstage/plugin-notifications-common';
/** @public */
export type NotificationService = {
export interface NotificationService {
send(options: NotificationSendOptions): Promise<Notification[]>;
};
}