add generic attribute field to NotificationPayload
Signed-off-by: Frank Ye <franky@spotify.com>
This commit is contained in:
@@ -31,7 +31,9 @@ export type NewNotificationSignal = {
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
type Notification_2 = {
|
||||
type Notification_2<
|
||||
T extends Record<string, unknown> = Record<string, unknown>,
|
||||
> = {
|
||||
id: string;
|
||||
user: string | null;
|
||||
created: Date;
|
||||
@@ -39,12 +41,14 @@ type Notification_2 = {
|
||||
read?: Date;
|
||||
updated?: Date;
|
||||
origin: string;
|
||||
payload: NotificationPayload;
|
||||
payload: NotificationPayload<T>;
|
||||
};
|
||||
export { Notification_2 as Notification };
|
||||
|
||||
// @public (undocumented)
|
||||
export type NotificationPayload = {
|
||||
export type NotificationPayload<
|
||||
T extends Record<string, unknown> = Record<string, unknown>,
|
||||
> = {
|
||||
title: string;
|
||||
description?: string;
|
||||
link?: string;
|
||||
@@ -52,6 +56,7 @@ export type NotificationPayload = {
|
||||
topic?: string;
|
||||
scope?: string;
|
||||
icon?: string;
|
||||
attributes?: T;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
export type NotificationSeverity = 'critical' | 'high' | 'normal' | 'low';
|
||||
|
||||
/** @public */
|
||||
export type NotificationPayload = {
|
||||
export type NotificationPayload<
|
||||
T extends Record<string, unknown> = Record<string, unknown>,
|
||||
> = {
|
||||
/**
|
||||
* Notification title
|
||||
*/
|
||||
@@ -50,10 +52,16 @@ export type NotificationPayload = {
|
||||
* Optional notification icon
|
||||
*/
|
||||
icon?: string;
|
||||
/**
|
||||
* Optional additional customizable attributes.
|
||||
*/
|
||||
attributes?: T;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type Notification = {
|
||||
export type Notification<
|
||||
T extends Record<string, unknown> = Record<string, unknown>,
|
||||
> = {
|
||||
/**
|
||||
* Unique identifier for the notification
|
||||
*/
|
||||
@@ -87,7 +95,7 @@ export type Notification = {
|
||||
/**
|
||||
* Actual notification payload
|
||||
*/
|
||||
payload: NotificationPayload;
|
||||
payload: NotificationPayload<T>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
|
||||
Reference in New Issue
Block a user