NeahNew/lib/services/notifications/notification-adapter.interface.ts
2025-05-04 11:01:30 +02:00

45 lines
1.3 KiB
TypeScript

import { Notification, NotificationCount } from '@/lib/types/notification';
export interface NotificationAdapter {
/**
* The source name of this notification adapter
*/
readonly sourceName: string;
/**
* Fetch all notifications for a user
* @param userId The user ID
* @param page Page number for pagination
* @param limit Number of items per page
* @returns Promise with notification data
*/
getNotifications(userId: string, page?: number, limit?: number): Promise<Notification[]>;
/**
* Get count of notifications for a user
* @param userId The user ID
* @returns Promise with notification count data
*/
getNotificationCount(userId: string): Promise<NotificationCount>;
/**
* Mark a specific notification as read
* @param userId The user ID
* @param notificationId The notification ID
* @returns Promise with success status
*/
markAsRead(userId: string, notificationId: string): Promise<boolean>;
/**
* Mark all notifications as read
* @param userId The user ID
* @returns Promise with success status
*/
markAllAsRead(userId: string): Promise<boolean>;
/**
* Check if this adapter is configured and ready to use
* @returns Promise with boolean indicating if adapter is ready
*/
isConfigured(): Promise<boolean>;
}