Endpoint
client.bookmark.list(input)
Defined in: server/procedures/bookmarks.ts:28
Authentication
This endpoint requires authentication. See Authentication for details.
Request
Filter bookmarks by a specific group ID. If omitted, returns all bookmarks for the user.
Input Schema
Defined in lib/schema.ts:118.
Response
Returns an array of bookmark objects ordered by updatedAt (most recent first).
Unique identifier for the bookmark
Display title of the bookmark
The bookmark URL (null for color/text type bookmarks)
URL to the site’s favicon (automatically fetched for link bookmarks)
type
'link' | 'color' | 'text'
required
Type of bookmark
Hex color code for color-type bookmarks
Canonicalized version of the URL for duplicate detection
Whether the bookmark is publicly visible
ID of the group this bookmark belongs to
ID of the user who owns this bookmark
Timestamp when the bookmark was created
Timestamp when the bookmark was last updated
Examples
Using React Query (Client Component)
import { orpc } from '@/lib/orpc';
function BookmarkList({ groupId }: { groupId?: string }) {
const { data: bookmarks, isLoading } = orpc.bookmark.list.useQuery({
groupId,
});
if (isLoading) return <div>Loading...</div>;
return (
<div>
{bookmarks?.map(bookmark => (
<div key={bookmark.id}>
{bookmark.favicon && <img src={bookmark.favicon} alt="" />}
<a href={bookmark.url || '#'}>{bookmark.title}</a>
</div>
))}
</div>
);
}
Using Server Client (Server Component)
import { serverClient } from '@/lib/orpc.server';
async function BookmarksPage() {
// Get all bookmarks
const allBookmarks = await serverClient.bookmark.list({});
// Get bookmarks for a specific group
const groupBookmarks = await serverClient.bookmark.list({
groupId: 'clx123456',
});
return (
<div>
<h2>All Bookmarks ({allBookmarks.length})</h2>
{/* Render bookmarks */}
</div>
);
}
Direct Client Call
import { client } from '@/lib/orpc';
const bookmarks = await client.bookmark.list({
groupId: 'clx123456',
});
console.log(`Found ${bookmarks.length} bookmarks`);
Implementation Details
The procedure implementation (from server/procedures/bookmarks.ts:28):
export const listBookmarks = authed
.input(listBookmarksInputSchema)
.handler(async ({ context, input }) => {
const bookmarks = await db.bookmark.findMany({
where: {
userId: context.user.id,
...(input.groupId && { groupId: input.groupId }),
},
orderBy: { updatedAt: "desc" },
});
return bookmarks;
});
Notes
- Results are automatically filtered by the authenticated user’s ID
- Bookmarks are ordered by most recently updated first
- The
groupId filter is optional and can be omitted to get all bookmarks
- Returns an empty array if no bookmarks are found