Package 

Interface Activity


  • 
    public interface Activity
    
                        

    A 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 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.

      • 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.
      • 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 - If true, 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 - If true, 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.
      • getFid

         abstract FeedId getFid()

        The feed id for the activity.

      • getState

         abstract ActivityState getState()

        An observable object representing the current state of the activity.