@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
61 lines (60 loc) • 1.79 kB
TypeScript
import { MapStringTo, Nullable } from "../../base-types";
import { NotificationLevel } from "./notification-level";
/**
* Interface for real-time notification requests.
*/
export interface IRealtimeRequest {
/**
* Gets or sets the title of the notification.
*/
title: string;
/**
* Gets or sets the target when the notification is clicked.
*/
link: string;
/**
* Gets or sets the notification level.
*/
notificationLevel: NotificationLevel;
/**
* Gets or sets the notification options. This directly maps to the notification API standard used by browsers.
* See https://developer.mozilla.org/en-US/docs/Web/API/notification for more information.
*/
options: MapStringTo<unknown>;
/**
* Gets the notification body from the options object.
*/
getBody(): Nullable<string>;
/**
* Sets the notification body on the options object.
* @param body - The notification body
*/
setBody(body: string): void;
/**
* Gets the notification icon from the options object.
*/
getIcon(): Nullable<string>;
/**
* Sets the notification icon on the options object.
* @param icon - The notification icon
*/
setIcon(icon: string): void;
/**
* Validates the real-time request.
*/
validate(): void;
}
/**
* Base class for real-time notification (browser notification) requests.
*/
export declare abstract class RealtimeRequest implements IRealtimeRequest {
title: string;
link: string;
notificationLevel: NotificationLevel;
options: MapStringTo<unknown>;
getBody(): Nullable<string>;
setBody(body: string): void;
getIcon(): Nullable<string>;
setIcon(icon: string): void;
abstract validate(): void;
}