Unwalled.Garden

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

Follows API

Follows are subscriptions to sites. Following a site causes the user to download and see their content.


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

// read
await follows.list({
  filters: {authors, topics, visibility},
  sortBy,
  offset,
  limit,
  reverse
})
await follows.get(author, topic)

// write
await follows.add(topic, {visibility})
await follows.edit(topic, {visibility})
await follows.remove(topic)

Follow

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

Attribute Type Usage
author Object The site doing the following
 url string
 title string
 description string
 type string[]
topic Object The site being followed
 url string
 title string
 description string
 type string[]
visibility string The visibility of the “follow” record

list(opts)

List follows by authors and/or topics.

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

get(author, topic)

Get a follow by author and topic.

Param Type Default Usage
author string Site URL (required)
topic string Site URL (required)
Returns
Promise<Follow>

add(topic, opts)

Add a follow to the current user’s site.

Param Type Default Usage
topic string Site URL (required)
opts Object
visibility string 'public' One of: 'public', 'private'
Returns
Promise<void>

edit(topic, opts)

Edit a follow on the current user’s site.

Param Type Default Usage
topic string Site URL (required)
opts Object
visibility string 'public' One of: 'public', 'private'
Returns
Promise<void>

remove(topic)

Remove a follow from the current user’s site.

Param Type Default Usage
topic string Site URL (required)
Returns
Promise<void>