Feed + Log API
Types
// store any valid primitive JS type.
// Maintains type on retrieval.
type Content = string | number | boolean | object | Content[]
interface FeedlogEntry = {
id: string
createdAt: number
updatedAt: number
createdBy: string
updatedBy: string
content: Content
links: object // authors as keys, Content as values
}Feedlog Methods
post
postfeedlog.post(content: Content)
Params: content to post to the feedlog.
Returns: A promise resolving to a string (the post ID) on success or undefined on failure.
Add a new post to the feedlog. Automatically stores the creation time and author.
edit
editfeedlog.edit(id: string, newContent: Content)
Params: The id of the post to edit, and newContent to replace it with.
Returns: A promise resolving to a string (the post ID) on success or undefined on failure.
Edit a post in the feedlog. Automatically stores the updated time and author.
delete
deletefeedlog.delete(id: string)
Params: The id of the post to delete.
Returns: A promise resolving to true on success or false on failure.
Delete a post from the feedlog. If the post with id does not exist, returns true.
clear
clearfeedlog.clear()
Returns: A promise resolving to true on success or false on failure.
Clear all posts from the feedlog.
get
getfeedlog.get(id: string, allowCachedValue: boolean = true)
Params: The id of the post to retrieve. If allowCachedValue is true, we will check the cache before querying Urbit.
Returns: A promise resolving to a FeedlogEntry or undefined if the post does not exist.
Get the post from the feedlog with the given id.
all
allfeedlog.all(useCache: boolean = false)
Params: If useCache is true, return the current cache instead of querying Urbit. Only relevant if preload was set to false.
Returns: A promise resolving to a FeedlogEntry[]
Retrieve all posts from the feedlog, sorted by newest first.
Feed Methods
setLink
setLinkfeed.setLink(id: string, content: Content)
Params: The id of the post to link to, and the content to associate with it.
Returns: A promise resolving to true on success or false on failure.
Associate a "link" (comment, reaction, etc.) with the feed post corresponding to id. Post links are stored as an object where keys are ship names and values are content. setLink will overwrite the link for the current ship, so call get first if you would like to append.
removeLink
removeLinkfeed.removeLink(id: string)
Params: The id of the post to remove the link from.
Returns: A promise resolving to true on success or false on failure.
Remove the current ship's link to the feed post corresponding to id. If the post with id does not exist, returns true.
Last updated