entities module gives you full server-side control over their lifecycle.
createEntity
Creates a new entity.Your application’s identifier for this entity. Used for idempotent lookups via
fetchEntityByForeignId.An optional secondary identifier for grouping or filtering entities.
The space this entity belongs to.
Title text for the entity.
Body/content text for the entity.
File or media attachments.
Tags or keywords used for filtering and discovery.
Geographic coordinates
{ latitude: number; longitude: number }.Arbitrary public metadata.
The Replyke user ID to set as the entity’s author.
ISO 8601 timestamp to backdate the entity’s creation time.
ISO 8601 timestamp to backdate the entity’s last update time.
Promise<Entity>
fetchEntity
Fetches a single entity by its Replyke ID.The Replyke entity ID.
Promise<Entity>
fetchEntityByForeignId
Fetches an entity by your application’s own identifier. Optionally creates it if not found.Your application’s entity identifier.
When
true, creates a stub entity if no match is found. Defaults to false.Promise<Entity>
fetchEntityByShortId
Fetches an entity by its short, human-readable ID (used in share URLs).The entity’s short ID.
Promise<Entity>
fetchManyEntities
Fetches a filtered, paginated list of entities. Supports rich filtering by metadata, keywords, location, and more.Filter by source ID.
Filter to entities within a specific space.
Sort order:
"hot" (trending), "top" (highest scored), or "controversial".Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Time window for
"top" and "controversial" sorts (e.g., "day", "week", "month", "all").Filter to entities authored by a specific user.
When
true, returns only entities from users the specified userId follows.Filter entities by keyword tags.
Filter entities by metadata fields. Each filter:
{ key, value, operator }.Filter entities by title text.
Filter entities by content text.
Filter by presence or type of media attachments.
Filter entities within a geographic radius.
Promise<PaginatedResponse<Entity>>
updateEntity
Updates fields on an existing entity.The Replyke entity ID to update.
New title.
New content body.
Updated attachments list.
Updated keywords list.
Updated location
{ type: "Point"; coordinates: [longitude, latitude] }.Updated metadata. Merged with existing values.
Updated user mentions list.
Override the creation timestamp (ISO 8601).
Promise<Entity>
deleteEntity
Permanently deletes an entity and its associated data.The Replyke entity ID to delete.
Promise<void>
incrementEntityViews
Increments the view counter on an entity. Call this when a user views content to track engagement.The Replyke entity ID.
Number to add to the view counter. Defaults to
1.Promise<Entity>
fetchDrafts
Fetches a user’s unpublished draft entities.The Replyke user ID whose drafts to fetch.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Promise<PaginatedResponse<Entity>>
publishDraft
Publishes a draft entity, making it publicly visible.The Replyke entity ID of the draft to publish.
Promise<Entity>
fetchTopComment
Fetches the highest-scored (top) comment on an entity. Returnsnull if the entity has no comments.
The Replyke entity ID.
Promise<TopComment | null>
addReaction
Adds a reaction from a user to an entity.The Replyke entity ID.
The Replyke user ID of the reactor.
One of:
"upvote", "downvote", "like", "love", "wow", "sad", "angry", "funny".Promise<Reaction>
removeReaction
Removes a user’s existing reaction from an entity.The Replyke entity ID.
The Replyke user ID whose reaction to remove.
Promise<void>
fetchReactions
Fetches a paginated list of reactions on an entity, optionally filtered by reaction type.The Replyke entity ID.
Filter to a specific reaction type.
Page number (1-indexed). Defaults to
1.Results per page. Defaults to
20.Promise<PaginatedResponse<Reaction>>
getUserReaction
Checks what reaction (if any) a specific user has left on an entity.The Replyke entity ID.
The Replyke user ID to check.
Promise<{ reactionType: ReactionType | null }>
isEntitySaved
Checks whether a user has saved an entity to any of their collections.The Replyke entity ID.
The Replyke user ID to check.
Promise<{ isSaved: boolean }>
