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.
Opts the returned comment’s author into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context). The empty string and the legacy general / null aliases are rejected. See Reputation.Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.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:
"createdAt" (newest first; honors sortDir), "top", or "controversial". "new" and "old" are deprecated aliases for "createdAt" (removed in v8) — the server still accepts them but responds with a deprecation header.Comma-separated list of associations to populate.
Filter by source ID.
Opts each returned comment’s author into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context — resolved per-row from the space each comment belongs to). The empty string and the legacy general / null aliases are rejected. See Reputation.Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.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".Opts each returned reactor into a
spaceReputation number. Accepts a space <uuid>, "none" (the project-general bucket), or "context" (the space derived from the request context). The empty string and the legacy general / null aliases are rejected. See Reputation.Only honored alongside an explicit space
<uuid>. When true, spaceReputation is the subtree sum — the named space plus all of its descendants.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 }>
