Notification BLoC
API Contract
REST
/api/v1/notification-events
5 endpoints
GET
/api/v1/notification-events/api/v1/notification-events
List notification events dispatched for a user (audit/history)
Public
Response Example
{
"data": [
{
"id": "evt_001",
"user_id": "user_xyz789",
"role": "peer_mentor",
"event_type": "load_notifications",
"dispatched_at": "2026-03-26T09:00:00Z",
"state_result": "loaded",
"notification_count": 12
},
{
"id": "evt_002",
"user_id": "user_xyz789",
"role": "peer_mentor",
"event_type": "mark_all_read",
"dispatched_at": "2026-03-26T09:46:00Z",
"state_result": "all_read",
"notification_count": 0
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 2
}
}
GET
/api/v1/notification-events/api/v1/notification-events/:id
Get details of a specific dispatched notification event
Public
Response Example
{
"id": "evt_001",
"user_id": "user_xyz789",
"role": "peer_mentor",
"event_type": "load_notifications",
"dispatched_at": "2026-03-26T09:00:00Z",
"state_result": "loaded",
"notification_count": 12,
"filter_applied": {
"is_read": false,
"limit": 20,
"offset": 0
}
}
POST
/api/v1/notification-events/api/v1/notification-events
Dispatch a notification event to trigger state update
Public
Request Example
{
"user_id": "user_xyz789",
"role": "peer_mentor",
"event_type": "load_notifications",
"filter": {
"is_read": false,
"limit": 20,
"offset": 0
}
}
Response Example
{
"id": "evt_003",
"user_id": "user_xyz789",
"role": "peer_mentor",
"event_type": "load_notifications",
"dispatched_at": "2026-03-26T10:10:00Z",
"state_result": "loading",
"notification_count": null
}
PUT
/api/v1/notification-events/api/v1/notification-events/:id
Update the state result of a dispatched event (for testing/admin)
Public
Request Example
{
"state_result": "error",
"error_message": "Supabase timeout"
}
Response Example
{
"id": "evt_003",
"user_id": "user_xyz789",
"event_type": "load_notifications",
"dispatched_at": "2026-03-26T10:10:00Z",
"state_result": "error",
"error_message": "Supabase timeout"
}
DELETE
/api/v1/notification-events/api/v1/notification-events/:id
Remove a dispatched event record
Public
Response Example
{
"success": true,
"deleted_id": "evt_003"
}