UNPKG

@magicbell/react-headless

Version:

Hooks to build a notification inbox

26 lines (25 loc) 1.17 kB
import INotificationRepository from '../../types/INotificationRepository.js'; import { QueryParams } from '../../types/INotificationsStoresCollection.js'; import INotificationStore from '../../types/INotificationStore.js'; import IRemoteNotification from '../../types/IRemoteNotification.js'; import RemoteRepository from '../repository/RemoteRepository.js'; interface IWrappedNotification { notification: IRemoteNotification; } /** * Class to interact with the notification API endpoints. * * @example * const repo = new NotificationRepository(); * const notifications = repo.findBy({ unseen: true }); */ export default class NotificationRepository extends RemoteRepository<IWrappedNotification, INotificationStore> implements INotificationRepository { constructor(remotePathOrUrl?: string); archive(id: string): Promise<boolean>; unarchive(id: string): Promise<boolean>; markAsRead(id: string): Promise<boolean>; markAsUnread(id: string): Promise<boolean>; markAllAsSeen(params?: Omit<QueryParams, 'page' | 'per_page'>): Promise<boolean>; markAllAsRead(params?: Omit<QueryParams, 'page' | 'per_page'>): Promise<boolean>; } export {};