-
public interface FeedA feed represents a collection of activities and provides methods to interact with them.
The
Feedclass is the primary interface for working with feeds in the Stream Feeds SDK. It provides functionality for:Creating and managing feed data
Adding, updating, and deleting activities
Managing comments, reactions, and bookmarks
Handling follows and feed memberships
Creating polls and managing poll interactions
Pagination and querying of feed content
Each feed instance is associated with a specific feed ID and maintains its own state that can be observed for real-time updates. The feed state includes activities, followers, members, and other feed-related data.
-
-
Method Summary
Modifier and Type Method Description abstract Result<FeedData>getOrCreate()Fetches or creates the feed based on the current feed query. abstract Result<Unit>stopWatching()Stops watching the feed. abstract Result<FeedData>updateFeed(UpdateFeedRequest request)Updates the feed with the provided request data. abstract Result<Unit>deleteFeed(Boolean hardDelete)Deletes the feed. abstract Result<ActivityData>addActivity(FeedAddActivityRequest request, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)Adds a new activity to the feed. abstract Result<ActivityData>updateActivity(String id, UpdateActivityRequest request)Updates an existing activity in the feed. abstract Result<ActivityData>updateActivityPartial(String id, UpdateActivityPartialRequest request)Partially updates an existing activity in the feed. abstract Result<Unit>deleteActivity(String id, Boolean hardDelete, Boolean deleteNotificationActivity)Deletes an activity from the feed. abstract Result<ActivityData>restoreActivity(String id)Restores a soft-deleted activity. abstract Result<Unit>markActivity(MarkActivityRequest request)Marks an activity as read or unread. abstract Result<ActivityData>repost(String activityId, String text)Creates a repost of an existing activity. abstract Result<List<ActivityData>>queryMoreActivities(Integer limit)Loads more activities using the next page token from the previous query. abstract Result<BookmarkData>addBookmark(String activityId, AddBookmarkRequest request)Adds an activity to the user's bookmarks. abstract Result<BookmarkData>updateBookmark(String activityId, UpdateBookmarkRequest request)Updates an existing bookmark for an activity. abstract Result<BookmarkData>deleteBookmark(String activityId, String folderId)Removes an activity from the user's bookmarks. abstract Result<CommentData>getComment(String commentId)Gets a specific comment by its identifier. abstract Result<CommentData>addComment(ActivityAddCommentRequest request, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)Adds a new comment to activity with id. abstract Result<CommentData>updateComment(String commentId, UpdateCommentRequest request)Updates an existing comment with the provided request data. abstract Result<Unit>deleteComment(String commentId, Boolean hardDelete, Boolean deleteNotificationActivity)Removes a comment for id. abstract Result<List<FeedSuggestionData>>queryFollowSuggestions(Integer limit)Queries for feed suggestions that the current user might want to follow. abstract Result<FollowData>follow(FeedId targetFid, Boolean createNotificationActivity, Map<String, Object> custom, FollowRequest.PushPreference pushPreference)Follows another feed. abstract Result<FollowData>updateFollow(FeedId targetFid, Map<String, Object> custom, UpdateFollowRequest.PushPreference pushPreference)Updates a follow relationship with new custom data or push preferences. abstract Result<Unit>unfollow(FeedId targetFid, Boolean deleteNotificationActivity)Unfollows another feed. abstract Result<FollowData>acceptFollow(FeedId sourceFid, String role)Accepts a follow request from another feed. abstract Result<FollowData>rejectFollow(FeedId sourceFid)Rejects a follow request from another feed. abstract Result<List<FeedMemberData>>queryFeedMembers()Fetches the initial list of members based on the current query configuration. abstract Result<List<FeedMemberData>>queryMoreFeedMembers(Integer limit)Loads the next page of members if more are available. abstract Result<ModelUpdates<FeedMemberData>>updateFeedMembers(UpdateFeedMembersRequest request)Updates feed members based on the provided request. abstract Result<FeedMemberData>acceptFeedMember()Accepts a feed member invitation. abstract Result<FeedMemberData>rejectFeedMember()Rejects a feed member invitation. abstract Result<FeedsReactionData>addActivityReaction(String activityId, AddReactionRequest request)Adds a reaction to an activity. abstract Result<FeedsReactionData>deleteActivityReaction(String activityId, String type, Boolean deleteNotificationActivity)Deletes a reaction from an activity. abstract Result<FeedsReactionData>addCommentReaction(String commentId, AddCommentReactionRequest request)Adds a reaction to a comment. abstract Result<FeedsReactionData>deleteCommentReaction(String commentId, String type, Boolean deleteNotificationActivity)Deletes a reaction from a comment. abstract Result<ActivityData>createPoll(CreatePollRequest request, String activityType)Creates a new poll and adds it as an activity to the feed. abstract FeedIdgetFid()The unique identifier for this feed. abstract FeedStategetState()An observable object representing the current state of the feed. -
-
Method Detail
-
getOrCreate
abstract Result<FeedData> getOrCreate()
Fetches or creates the feed based on the current feed query.
This method will either retrieve an existing feed, or create a new one if it doesn't exist. The feed state will be updated with the fetched data including activities, followers, and other feed information.
-
stopWatching
abstract Result<Unit> stopWatching()
Stops watching the feed. When this method is called, you will not receive any web socket events for the feed anymore.
-
updateFeed
abstract Result<FeedData> updateFeed(UpdateFeedRequest request)
Updates the feed with the provided request data.
- Parameters:
request- The update request containing the new feed data.
-
deleteFeed
abstract Result<Unit> deleteFeed(Boolean hardDelete)
Deletes the feed.
- Parameters:
hardDelete- Iftrue, the feed will be permanently deleted.
-
addActivity
abstract Result<ActivityData> addActivity(FeedAddActivityRequest request, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)
Adds a new activity to the feed.
- Parameters:
request- The request containing the activity data to add.
-
updateActivity
abstract Result<ActivityData> updateActivity(String id, UpdateActivityRequest request)
Updates an existing activity in the feed.
This is a full update: the activity is replaced with the data in request, and any field left unset is cleared, except
feeds, which is kept. For example, updating only the text also removes the activity's attachments and custom data. To change specific fields and keep the rest, use updateActivityPartial.- Parameters:
id- The unique identifier of the activity to update.request- The request containing the updated activity data.
-
updateActivityPartial
abstract Result<ActivityData> updateActivityPartial(String id, UpdateActivityPartialRequest request)
Partially updates an existing activity in the feed.
Use 'set' to update specific fields and 'unset' to remove fields. This allows you to update only the fields you need without replacing the entire activity.
- Parameters:
id- The unique identifier of the activity to update.request- The request containing the fields to set or unset.
-
deleteActivity
abstract Result<Unit> deleteActivity(String id, Boolean hardDelete, Boolean deleteNotificationActivity)
Deletes an activity from the feed.
- Parameters:
id- The unique identifier of the activity to delete.hardDelete- Iftrue, the activity will be permanently deleted.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
restoreActivity
abstract Result<ActivityData> restoreActivity(String id)
Restores a soft-deleted activity.
Only the activity owner can restore their own activities (for client-side requests). Hard-deleted activities cannot be restored.
- Parameters:
id- The unique identifier of the activity to restore.
-
markActivity
abstract Result<Unit> markActivity(MarkActivityRequest request)
Marks an activity as read or unread.
- Parameters:
request- The request containing the mark activity data.
-
repost
abstract Result<ActivityData> repost(String activityId, String text)
Creates a repost of an existing activity.
- Parameters:
activityId- The unique identifier of the activity to repost.text- Optional text to add to the repost.
-
queryMoreActivities
abstract Result<List<ActivityData>> queryMoreActivities(Integer limit)
Loads more activities using the next page token from the previous query.
- Parameters:
limit- Optional limit for the number of activities to load.
-
addBookmark
abstract Result<BookmarkData> addBookmark(String activityId, AddBookmarkRequest request)
Adds an activity to the user's bookmarks.
- Parameters:
activityId- The unique identifier of the activity to bookmark.request- Additional details of for the bookmark.
-
updateBookmark
abstract Result<BookmarkData> updateBookmark(String activityId, UpdateBookmarkRequest request)
Updates an existing bookmark for an activity.
This method allows you to modify the properties of an existing bookmark, such as changing the folder it belongs to or updating custom data associated with the bookmark.
Example:
// Move a bookmark to a different folder val updateRequest = UpdateBookmarkRequest(folderId = "new-folder-id") val updatedBookmark = feed.updateBookmark("activity-123", updateRequest) // Update bookmark with custom data val customUpdateRequest = UpdateBookmarkRequest( folderId = "favorites", custom = mapOf("note" to "Important article") ) val bookmark = feed.updateBookmark("activity-456", customUpdateRequest)- Parameters:
activityId- The unique identifier of the activity whose bookmark should be updated.request- The update request containing the new bookmark properties to apply.
-
deleteBookmark
abstract Result<BookmarkData> deleteBookmark(String activityId, String folderId)
Removes an activity from the user's bookmarks.
- Parameters:
activityId- The unique identifier of the activity to remove from bookmarks.folderId- Optional folder identifier.
-
getComment
abstract Result<CommentData> getComment(String commentId)
Gets a specific comment by its identifier.
- Parameters:
commentId- The unique identifier of the comment to retrieve.
-
addComment
abstract Result<CommentData> addComment(ActivityAddCommentRequest request, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)
Adds a new comment to activity with id.
- Parameters:
request- The request containing the comment data to add.
-
updateComment
abstract Result<CommentData> updateComment(String commentId, UpdateCommentRequest request)
Updates an existing comment with the provided request data.
This method allows you to modify the content and properties of an existing comment. You can update the comment text, attachments, or other comment-specific data.
- Parameters:
commentId- The unique identifier of the comment to update.request- The request containing the updated comment data.
-
deleteComment
abstract Result<Unit> deleteComment(String commentId, Boolean hardDelete, Boolean deleteNotificationActivity)
Removes a comment for id.
- Parameters:
commentId- The unique identifier of the comment to remove.hardDelete- Iftrue, the comment will be permanently deleted.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
queryFollowSuggestions
abstract Result<List<FeedSuggestionData>> queryFollowSuggestions(Integer limit)
Queries for feed suggestions that the current user might want to follow.
- Parameters:
limit- Optional limit for the number of suggestions to return.
-
follow
abstract Result<FollowData> follow(FeedId targetFid, Boolean createNotificationActivity, Map<String, Object> custom, FollowRequest.PushPreference pushPreference)
Follows another feed.
- Parameters:
targetFid- The target feed identifier.createNotificationActivity- Whether the action is added to the notification feed.custom- Additional data for the request.pushPreference- Push notification preferences for the follow request.
-
updateFollow
abstract Result<FollowData> updateFollow(FeedId targetFid, Map<String, Object> custom, UpdateFollowRequest.PushPreference pushPreference)
Updates a follow relationship with new custom data or push preferences.
- Parameters:
targetFid- The target feed identifier of the follow to update.custom- Additional data for the follow relationship.pushPreference- Push notification preferences for the follow.
-
unfollow
abstract Result<Unit> unfollow(FeedId targetFid, Boolean deleteNotificationActivity)
Unfollows another feed.
- Parameters:
targetFid- The target feed identifier to unfollow.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
acceptFollow
abstract Result<FollowData> acceptFollow(FeedId sourceFid, String role)
Accepts a follow request from another feed.
- Parameters:
sourceFid- The feed identifier of the requested feed.role- The role for the requesting feed.
-
rejectFollow
abstract Result<FollowData> rejectFollow(FeedId sourceFid)
Rejects a follow request from another feed.
- Parameters:
sourceFid- The feed identifier of the requested feed.
-
queryFeedMembers
abstract Result<List<FeedMemberData>> queryFeedMembers()
Fetches the initial list of members based on the current query configuration.
This method loads the first page of members according to the query's filters, sorting, and limit parameters. The results are stored in the state and can be accessed through the state.members property.
-
queryMoreFeedMembers
abstract Result<List<FeedMemberData>> queryMoreFeedMembers(Integer limit)
Loads the next page of members if more are available.
This method fetches additional members using the pagination information from the previous request. If no more members are available, an empty list is returned.
- Parameters:
limit- Optional limit for the number of members to fetch.
-
updateFeedMembers
abstract Result<ModelUpdates<FeedMemberData>> updateFeedMembers(UpdateFeedMembersRequest request)
Updates feed members based on the provided request.
- Parameters:
request- The update request containing the member changes to apply.
-
acceptFeedMember
abstract Result<FeedMemberData> acceptFeedMember()
Accepts a feed member invitation.
-
rejectFeedMember
abstract Result<FeedMemberData> rejectFeedMember()
Rejects a feed member invitation.
-
addActivityReaction
abstract Result<FeedsReactionData> addActivityReaction(String activityId, AddReactionRequest request)
Adds a reaction to an activity.
- Parameters:
activityId- The unique identifier of the activity to react to.request- The request containing the reaction data.
-
deleteActivityReaction
abstract Result<FeedsReactionData> deleteActivityReaction(String activityId, String type, Boolean deleteNotificationActivity)
Deletes a reaction from an activity.
- Parameters:
activityId- The unique identifier of the activity from which to delete the reaction.type- The type of reaction to delete.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
addCommentReaction
abstract Result<FeedsReactionData> addCommentReaction(String commentId, AddCommentReactionRequest request)
Adds a reaction to a comment.
- Parameters:
commentId- The unique identifier of the comment to react to.request- The request containing the reaction data.
-
deleteCommentReaction
abstract Result<FeedsReactionData> deleteCommentReaction(String commentId, String type, Boolean deleteNotificationActivity)
Deletes a reaction from a comment.
- Parameters:
commentId- The unique identifier of the comment from which to delete the reaction.type- The type of reaction to delete.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
createPoll
abstract Result<ActivityData> createPoll(CreatePollRequest request, String activityType)
Creates a new poll and adds it as an activity to the feed.
- Parameters:
request- The request containing the poll data to create.activityType- The type of activity to create for the poll.
-
getFid
abstract FeedId getFid()
The unique identifier for this feed.
This property provides access to the feed's identifier, which is used to distinguish this feed from other feeds in the system. The feed ID is composed of a group and an ID component that together form a unique reference to this specific feed.
-
-
-
-