Enhance Notification Management with New Endpoints and Response Structures
- Added new endpoints for retrieving notifications for both admins and users, improving the flexibility of the notification system. - Implemented query parameters for filtering notifications by status, method, event type, type, and recipient, enhancing usability. - Introduced new response structures for notifications, including pagination information, to provide better data handling in API responses. - Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers. - Refactored notification handling logic to support the new features, promoting a more robust notification management system.
This commit is contained in:
@@ -74,6 +74,11 @@ func (s *SDK) SendOTP(ctx context.Context, model Model) (*NotificationResponse,
|
||||
return s.service.SendOTP(ctx, model)
|
||||
}
|
||||
|
||||
// GetNotifications retrieves a list of notifications from the notification service
|
||||
func (s *SDK) GetNotifications(ctx context.Context, req *GetNotificationsRequest) (*NotificationListResponse, error) {
|
||||
return s.service.GetNotifications(ctx, req)
|
||||
}
|
||||
|
||||
// NewBuilder creates a new notification builder for fluent API usage
|
||||
func (s *SDK) NewBuilder() Builder {
|
||||
return s.service.(*Service).NewBuilder()
|
||||
@@ -115,6 +120,35 @@ func (s *SDK) QuickOTP(ctx context.Context, model Model) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// QuickGetNotifications retrieves notifications with simple parameters
|
||||
func (s *SDK) QuickGetNotifications(ctx context.Context, userID, status string) (*NotificationListResponse, error) {
|
||||
req := &GetNotificationsRequest{
|
||||
UserID: userID,
|
||||
Status: status,
|
||||
}
|
||||
return s.GetNotifications(ctx, req)
|
||||
}
|
||||
|
||||
// GetNotificationsByUser retrieves notifications for a specific user
|
||||
func (s *SDK) GetNotificationsByUser(ctx context.Context, userID string, page, perPage int) (*NotificationListResponse, error) {
|
||||
req := &GetNotificationsRequest{
|
||||
UserID: userID,
|
||||
Page: page,
|
||||
PerPage: perPage,
|
||||
}
|
||||
return s.GetNotifications(ctx, req)
|
||||
}
|
||||
|
||||
// GetNotificationsByStatus retrieves notifications by status
|
||||
func (s *SDK) GetNotificationsByStatus(ctx context.Context, status string, page, perPage int) (*NotificationListResponse, error) {
|
||||
req := &GetNotificationsRequest{
|
||||
Status: status,
|
||||
Page: page,
|
||||
PerPage: perPage,
|
||||
}
|
||||
return s.GetNotifications(ctx, req)
|
||||
}
|
||||
|
||||
// Batch operations for sending multiple notifications
|
||||
|
||||
// BatchRequest represents a batch notification request
|
||||
|
||||
Reference in New Issue
Block a user