@magicbell/react-headless
Version:
Hooks to build a notification inbox
30 lines (29 loc) • 1.1 kB
TypeScript
import IRemoteNotificationPreferences from '../../types/IRemoteNotificationPreferences.js';
interface IWrappedNotificationPreferences {
notificationPreferences: IRemoteNotificationPreferences;
}
/**
* Class to interact with the notification preferences API endpoints.
*
* @example
* const repo = new NotificationPreferencesRepository();
* const preferences = repo.get();
*/
export default class NotificationPreferencesRepository {
remotePathOrUrl: string;
constructor(remotePathOrUrl?: string);
/**
* Get the user preferences from the API server. Object properties will be camelized.
* Wrapping of message to server is handled for us (Design Principle: The Principle of Least
* Knowledge).
*/
get(): Promise<IWrappedNotificationPreferences>;
/**
* Update user preferences in the API server. Object properties will be decamelized before
* being send to the server.
*
* @param data Preferences to send to the server.
*/
update(data: IRemoteNotificationPreferences): Promise<IWrappedNotificationPreferences>;
}
export {};