-
public interface ActivityA class representing a single activity in a feed.
This class provides methods to interact with an activity including fetching its data, managing comments, handling reactions, and working with polls. It maintains an observable state that automatically updates when WebSocket events are received.
-
-
Method Summary
Modifier and Type Method Description abstract Result<ActivityData>get()Fetches the current state of the activity. abstract Result<List<ThreadedCommentData>>queryComments()Queries comments for this activity. abstract Result<List<ThreadedCommentData>>queryMoreComments(Integer limit)Loads the next page of comments if more are available. abstract Result<CommentData>getComment(String commentId)Retrieves a specific comment by its identifier. abstract Result<CommentData>addComment(ActivityAddCommentRequest request, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)Adds a new comment to the activity. abstract Result<List<CommentData>>addCommentsBatch(List<ActivityAddCommentRequest> requests, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)Adds multiple comments to the activity in a single batch operation. abstract Result<Unit>deleteComment(String commentId, Boolean hardDelete, Boolean deleteNotificationActivity)Deletes a comment from the activity. abstract Result<CommentData>updateComment(String commentId, UpdateCommentRequest request)Updates an existing comment in the 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)Removes a reaction from a comment. abstract Result<Unit>activityFeedback(ActivityFeedbackRequest request)Submits feedback for this activity. abstract Result<Unit>pin()Pins an activity in the feed. abstract Result<Unit>unpin()Unpins an activity from the feed. abstract Result<PollData>closePoll()Closes a poll, preventing further votes. abstract Result<Unit>deletePoll(String userId)Deletes the activity from the feed. abstract Result<PollData>getPoll(String userId)Gets a specific poll by its identifier. abstract Result<PollData>updatePollPartial(UpdatePollPartialRequest request)Updates a poll with partial data. abstract Result<PollData>updatePoll(UpdatePollRequest request)Updates a poll. abstract Result<PollOptionData>createPollOption(CreatePollOptionRequest request)Creates a new option for a poll. abstract Result<Unit>deletePollOption(String optionId, String userId)Removes a poll option. abstract Result<PollOptionData>getPollOption(String optionId, String userId)Retrieves a specific poll option by its identifier. abstract Result<PollOptionData>updatePollOption(UpdatePollOptionRequest request)Updates a poll option. abstract Result<PollVoteData>castPollVote(CastPollVoteRequest request)Casts a vote in a poll. abstract Result<PollVoteData>deletePollVote(String voteId, String userId)Removes a vote from a poll. abstract StringgetActivityId()The unique identifier of this activity. abstract FeedIdgetFid()The feed id for the activity. abstract ActivityStategetState()An observable object representing the current state of the activity. -
-
Method Detail
-
get
abstract Result<ActivityData> get()
Fetches the current state of the activity. This method retrieves the latest activity data from the server and updates the local state.
-
queryComments
abstract Result<List<ThreadedCommentData>> queryComments()
Queries comments for this activity.
-
queryMoreComments
abstract Result<List<ThreadedCommentData>> queryMoreComments(Integer limit)
Loads the next page of comments if more are available.
This method fetches additional comments using the pagination information from the previous request. If no more comments are available, an empty array is returned.
- Parameters:
limit- Optional limit for the number of comments to fetch.
-
getComment
abstract Result<CommentData> getComment(String commentId)
Retrieves 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 the activity.
- Parameters:
request- The request object containing the details of the comment to be added.
-
addCommentsBatch
abstract Result<List<CommentData>> addCommentsBatch(List<ActivityAddCommentRequest> requests, Function2<UploadPayload<FeedUploadContext>, Double, Unit> attachmentUploadProgress)
Adds multiple comments to the activity in a single batch operation.
- Parameters:
requests- A list of ActivityAddCommentRequest objects, each representing a comment to be added.
-
deleteComment
abstract Result<Unit> deleteComment(String commentId, Boolean hardDelete, Boolean deleteNotificationActivity)
Deletes a comment from the activity.
- Parameters:
commentId- The unique identifier of the comment to be deleted.hardDelete- If true, the comment will be permanently deleted.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
updateComment
abstract Result<CommentData> updateComment(String commentId, UpdateCommentRequest request)
Updates an existing comment in the activity.
- Parameters:
commentId- The unique identifier of the comment to be updated.request- The request object containing the updated details of the comment.
-
addCommentReaction
abstract Result<FeedsReactionData> addCommentReaction(String commentId, AddCommentReactionRequest request)
Adds a reaction to a comment.
- Parameters:
commentId- The unique identifier of the comment to which the reaction is added.request- The request object containing the details of the reaction to be added.
-
deleteCommentReaction
abstract Result<FeedsReactionData> deleteCommentReaction(String commentId, String type, Boolean deleteNotificationActivity)
Removes a reaction from a comment.
- Parameters:
commentId- The unique identifier of the comment from which the reaction is removed.type- The type of the reaction to be removed.deleteNotificationActivity- Iftrue, removes the corresponding notification activity.
-
activityFeedback
abstract Result<Unit> activityFeedback(ActivityFeedbackRequest request)
Submits feedback for this activity.
Example:
// Hide an activity activity.activityFeedback(ActivityFeedbackRequest(hide = true)) // Unhide an activity activity.activityFeedback(ActivityFeedbackRequest(hide = false))- Parameters:
request- The feedback request to be submitted.
-
deletePoll
abstract Result<Unit> deletePoll(String userId)
Deletes the activity from the feed.
- Parameters:
userId- Optional user identifier for authorization.
-
getPoll
abstract Result<PollData> getPoll(String userId)
Gets a specific poll by its identifier.
- Parameters:
userId- Optional user identifier for user-specific poll data.
-
updatePollPartial
abstract Result<PollData> updatePollPartial(UpdatePollPartialRequest request)
Updates a poll with partial data.
- Parameters:
request- The request containing the partial update data.
-
updatePoll
abstract Result<PollData> updatePoll(UpdatePollRequest request)
Updates a poll.
- Parameters:
request- The request containing the update data.
-
createPollOption
abstract Result<PollOptionData> createPollOption(CreatePollOptionRequest request)
Creates a new option for a poll.
- Parameters:
request- The request containing the details of the poll option to be created.
-
deletePollOption
abstract Result<Unit> deletePollOption(String optionId, String userId)
Removes a poll option.
- Parameters:
optionId- The unique identifier of the poll option to be removed.userId- Optional user identifier for authorization.
-
getPollOption
abstract Result<PollOptionData> getPollOption(String optionId, String userId)
Retrieves a specific poll option by its identifier.
- Parameters:
optionId- The unique identifier of the poll option to retrieve.userId- Optional user identifier for user-specific poll option data.
-
updatePollOption
abstract Result<PollOptionData> updatePollOption(UpdatePollOptionRequest request)
Updates a poll option.
- Parameters:
request- The request containing the updated details of the poll option.
-
castPollVote
abstract Result<PollVoteData> castPollVote(CastPollVoteRequest request)
Casts a vote in a poll.
- Parameters:
request- The request containing the vote data.
-
deletePollVote
abstract Result<PollVoteData> deletePollVote(String voteId, String userId)
Removes a vote from a poll.
- Parameters:
voteId- The unique identifier of the vote to be removed.userId- Optional user identifier for authorization.
-
getActivityId
abstract String getActivityId()
The unique identifier of this activity.
-
getState
abstract ActivityState getState()
An observable object representing the current state of the activity.
-
-
-
-