Activity Feeds v3 is in beta β€” try it out!

Bookmarks

Overview

The API includes built-in support for bookmarking activities. Here’s a quick example of how to use the bookmark API.

Adding Bookmarks

// Adding a bookmark to a new folder final bookmark = await feed.addBookmark(activityId: 'activity_123'); // Adding to an existing folder final bookmarkWithFolder = await feed.addBookmark(  activityId: 'activity_123',  request: const AddBookmarkRequest(folderId: 'folder_456'), ); // Update a bookmark (without a folder initially) - add custom data and move it to a new folder final updatedBookmark = await feed.updateBookmark(  activityId: 'activity_123',  request: const UpdateBookmarkRequest(  custom: {'color': 'blue'},  newFolder: AddFolderRequest(  custom: {'icon': 'πŸ“'},  name: 'New folder name',  ),  ), ); // Update a bookmark - move it from one existing folder to another existing folder final movedBookmark = await feed.updateBookmark(  activityId: 'activity_123',  request: const UpdateBookmarkRequest(  folderId: 'folder_456',  newFolderId: 'folder_789',  ), );

Removing Bookmarks

// Removing a bookmark await feed.deleteBookmark(activityId: 'activity_123', folderId: 'folder_456'); // When you read a feed we include the bookmark final feedData = await feed.getOrCreate(); print(feed.state.activities[0].ownBookmarks);

Querying Bookmarks

// Query bookmarks const query = BookmarksQuery(limit: 5); final bookmarkList = client.bookmarkList(query); final page1 = await bookmarkList.get(); // Get next page final page2 = await bookmarkList.queryMoreBookmarks(limit: 3); // Query by activity ID final activityBookmarkList = client.bookmarkList(  const BookmarksQuery(  filter: Filter.equal(BookmarksFilterField.activityId, 'activity_123'),  ), ); final activityBookmarks = await activityBookmarkList.get(); // Query by folder ID final folderBookmarkList = client.bookmarkList(  const BookmarksQuery(  filter: Filter.equal(BookmarksFilterField.folderId, 'folder_456'),  ), ); final folderBookmarks = await folderBookmarkList.get();

Bookmarks Queryable Built-In Fields

nametypedescriptionsupported operationsexample
user_idstring or list of stringsThe ID of the user who owns the bookmark$in, $eq{ user_id: { $eq: 'user_123' } }
activity_idstring or list of stringsThe ID of the activity that was bookmarked$in, $eq{ activity_id: { $eq: 'activity_123' } }
folder_idstring or list of stringsThe ID of the folder containing the bookmark$eq, $in, $exists{ folder_id: { $exists: true } }
created_atstring, must be formatted as an RFC3339 timestampThe time the bookmark was created$eq, $gt, $gte, $lt, $lte{ created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_atstring, must be formatted as an RFC3339 timestampThe time the bookmark was last updated$eq, $gt, $gte, $lt, $lte{ updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }

Querying Bookmark Folders

// Query bookmark folders const query = BookmarkFoldersQuery(limit: 5); final bookmarkFolderList = client.bookmarkFolderList(query); final page1 = await bookmarkFolderList.get(); // Get next page final page2 = await bookmarkFolderList.queryMoreBookmarkFolders(limit: 3); // Query by folder name (partial matching) final projectFolderList = client.bookmarkFolderList(  const BookmarkFoldersQuery(  filter: Filter.contains(BookmarkFoldersFilterField.name, 'project'),  ), ); final projectFolders = await projectFolderList.get();

Bookmark Folders Queryable Built-In Fields

nametypedescriptionsupported operationsexample
user_idstring or list of stringsThe ID of the user who owns the folder$in, $eq{ user_id: { $eq: 'user_123' } }
folder_namestring or list of stringsThe name of the bookmark folder$eq, $in, $contains{ folder_name: { $contains: 'work' } }
created_atstring, must be formatted as an RFC3339 timestampThe time the folder was created$eq, $gt, $gte, $lt, $lte{ created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_atstring, must be formatted as an RFC3339 timestampThe time the folder was last updated$eq, $gt, $gte, $lt, $lte{ updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }
Β© Getstream.io, Inc. All Rights Reserved.