Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
API reference for notification management
trpc.notifications.list.query({ unreadOnly?: boolean, // Filter to unread only (default: false) limit?: number, // Max results (1-100, default: 50) offset?: number // Pagination offset (default: 0) })
{ id: string; type: 'pr_comment' | 'pr_review' | 'pr_merged' | 'issue_comment' | 'mention' | 'access_granted'; title: string; message: string; repoId: string; resourceId?: string; // PR/Issue ID if applicable resourceType?: string; // 'pull_request' | 'issue' isRead: boolean; createdAt: Date; }[]
const notifications = await trpc.notifications.list.query({ unreadOnly: true, limit: 20 }); for (const n of notifications) { console.log(`${n.isRead ? '○' : '●'} ${n.title}`); }
trpc.notifications.unreadCount.query()
{ count: number; }
const { count } = await trpc.notifications.unreadCount.query(); console.log(`You have ${count} unread notifications`);
trpc.notifications.markAsRead.mutate({ id: string // Notification UUID })
{ id: string; isRead: true; readAt: Date; }
await trpc.notifications.markAsRead.mutate({ id: 'a1b2c3d4-...' });
trpc.notifications.markAllAsRead.mutate()
{ count: number; // Number of notifications marked }
const { count } = await trpc.notifications.markAllAsRead.mutate(); console.log(`Marked ${count} notifications as read`);
trpc.notifications.delete.mutate({ id: string // Notification UUID })
{ success: boolean; }
trpc.notifications.deleteAll.mutate()
{ count: number; // Number deleted }
pr_comment
pr_review
pr_merged
pr_closed
issue_comment
issue_closed
mention
access_granted
access_revoked
import { trpc } from '@/lib/trpc'; function NotificationBell() { const { data: count } = trpc.notifications.unreadCount.useQuery(); const { data: notifications } = trpc.notifications.list.useQuery({ unreadOnly: true, limit: 5 }); const markRead = trpc.notifications.markAsRead.useMutation(); const markAllRead = trpc.notifications.markAllAsRead.useMutation(); return ( <div> <button> 🔔 {count?.count > 0 && <span>{count.count}</span>} </button> <div className="dropdown"> {notifications?.map(n => ( <div key={n.id} onClick={() => markRead.mutate({ id: n.id })} > {n.title} </div> ))} <button onClick={() => markAllRead.mutate()}> Mark all as read </button> </div> </div> ); }
import { createTRPCClient } from './api/client'; async function showNotifications() { const client = createTRPCClient(); const notifications = await client.notifications.list.query({ unreadOnly: true }); if (notifications.length === 0) { console.log('No unread notifications'); return; } console.log(`\n📬 ${notifications.length} unread notifications:\n`); for (const n of notifications) { const icon = n.type.startsWith('pr_') ? '🔀' : n.type.startsWith('issue_') ? '📋' : '💬'; console.log(` ${icon} ${n.title}`); console.log(` ${n.message}`); console.log(); } }
UNAUTHORIZED
NOT_FOUND
FORBIDDEN
try { await trpc.notifications.markAsRead.mutate({ id: 'invalid' }); } catch (error) { if (error.code === 'NOT_FOUND') { console.log('Notification not found'); } }