Unwalled.Garden

Status: DRAFT. Part of the upcoming Beaker Browser 0.9 release.

Bookmarks API

Bookmarks are links which you have saved and will want to reference in the future.


import {bookmarks} from 'dat://unwalled.garden/index.js'

// read
await bookmarks.list({
  filters: {authors, tags, visibility},
  sortBy,
  offset,
  limit,
  reverse
})
await bookmarks.get(author, href)

// write
await bookmarks.add({href, title, description, tags, visibility})
await bookmarks.edit(href, {href, title, description, tags, visibility})
await bookmarks.remove(href)

Bookmark

The values returned by bookmark functions will fit the following object shape:

Attribute Type Usage
href string The bookmark URL
title string The bookmark title
description string The bookmark description
tags string[] The bookmark tags
createdAt number The timestamp of when the bookmark claims it was created
author Object The site that authored the bookmark
 url string
 title string
 description string
 type string[]
visibility string The visibility of the bookmark

list(opts)

List bookmarks on the network.

Param Type Default Usage
opts Object
 filters Object
  authors string|string[] Site URLs
  tags string|string[]
  visibility string 'all' See visibility
 sortBy string 'title' One of: 'title', 'createdAt'
 offset number 0
 limit number
 reverse boolean false
Returns
Promise<Bookmark[]>

get(author, href)

Get a bookmark by author and href.

Param Type Default Usage
author string Site URL (required)
href string Site URL (required)
Returns
Promise<Bookmark>

add(bookmark)

Add a bookmark to the current user’s site.

Param Type Default Usage
bookmark Object
 href string The bookmark URL (required)
 title string The bookmark title (required)
 description string The bookmark description
 tags string[] The bookmark tags
 visibility string 'private' See visibility
Returns
Promise<Bookmark>

edit(href, bookmark)

Edit a bookmark on the current user’s site.

Param Type Default Usage
href string The bookmark URL (required)
bookmark Object
 href string The bookmark URL (required)
 title string The bookmark title (required)
 description string The bookmark description
 tags string[] The bookmark tags
 visibility string 'private' See visibility
Returns
Promise<Bookmark>

remove(href)

Remove a bookmark from the current user’s site.

Param Type Default Usage
href string The bookmark URL (required)
Returns
Promise<void>