comments module lets you create, fetch, update, and delete comments, and manage reactions on them. All actions are performed on behalf of the logged-in user.
createComment
Creates a comment on an entity. Optionally a reply, with a GIF, mentions, attachments, or metadata.The Sublay entity ID the comment belongs to.
Your application’s identifier for this comment.
The comment’s text content.
An optional GIF attached to the comment.
User mentions embedded in the comment.
The ID of the parent comment when this is a reply.
The ID of another comment this comment references.
File or media attachments.
Arbitrary public metadata.
Promise<Comment>
fetchComment
Fetches a single comment by its ID.The Sublay comment ID.
Comma-separated list of associations to populate.
Promise<Comment>
fetchCommentByForeignId
Fetches a comment by your application’s own identifier.Your application’s comment identifier.
Comma-separated list of associations to populate.
Promise<Comment>
updateComment
Updates a comment’s content.The Sublay comment ID to update.
The new content for the comment.
Promise<Comment>
deleteComment
Deletes a comment.The Sublay comment ID to delete.
Promise<void>
fetchManyComments
Fetches a paginated list of comments, filterable by entity, user, or parent.Filter to comments on a specific entity.
Filter to comments authored by a given user.
Filter to replies of a specific parent comment.
Page number (1-indexed).
Results per page.
Sort order:
"new", "old", "top", or "controversial".Comma-separated list of associations to populate.
Filter by source ID.
Promise<PaginatedResponse<Comment>>
addReaction
Adds the logged-in user’s reaction to a comment and returns the full populated comment.The Sublay comment ID.
One of:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".Promise<Comment>
removeReaction
Removes the logged-in user’s reaction from a comment and returns the full populated comment.The Sublay comment ID.
Promise<Comment>
fetchReactions
Fetches a paginated list of reactions on a comment, optionally filtered by reaction type.The Sublay comment ID.
Filter to a specific reaction type.
Page number (1-indexed).
Results per page.
Sort direction:
"asc" or "desc".Promise<{ data: Reaction[]; pagination: { page: number; limit: number; total: number; totalPages: number; hasMore: boolean } }>
getUserReaction
Gets the logged-in user’s reaction on a comment. Returnsnull if there is no reaction.
The Sublay comment ID.
Promise<{ reactionType: ReactionType | null }>
