@magicbell/core
Version:
Official MagicBell API wrapper
41 lines (40 loc) • 1.69 kB
TypeScript
import Config from './models/Config/index.js';
import NotificationStoreWithContext from './stores/NotificationStoreWithContext.js';
export type MagicBellConfigOptions = {
apiKey: string;
userEmail?: string;
userExternalId?: string;
userKey?: string;
apiSecret?: string;
_baseURL?: string;
};
export default class MagicBellClient {
config?: Config;
_store: NotificationStoreWithContext;
static createInstance(options: MagicBellConfigOptions): Promise<MagicBellClient>;
static configure(options: MagicBellConfigOptions): void;
/**
* Create a MagicBell instance.
*
* @param apiKey API key of your MagicBell project
* @param userEmail Email of the user whose notifications will be displayed
* @param userExternalId External ID of the user whose notifications will be displayed
* @param userKey Computed HMAC of the user whose notifications will be displayed, compute this with the secret of the magicbell project
* @param apiSecret API secret of your MagicBell project (required to create notifications)
*/
constructor(options: MagicBellConfigOptions);
/**
* @deprecated To create notifications pUse Notification.create() instead
*/
get store(): NotificationStoreWithContext;
/**
* @deprecated To create notifications pUse Notification.create() instead
*/
getStore(): NotificationStoreWithContext;
/**
* Connect to a magicbell websocket to get real-time events.
*
* @return {Function} Function to close the connection and stop the listeners. YOU MUST CALL THIS FUNCTION in order to prevent memory leaks.
*/
startRealTimeListener(): () => void;
}