Skip to content

Instantly share code, notes, and snippets.

@pfrazee
Last active June 15, 2019 19:59
Show Gist options
  • Save pfrazee/27b2f59aa41f66d01439d52785b9dd5c to your computer and use it in GitHub Desktop.
Save pfrazee/27b2f59aa41f66d01439d52785b9dd5c to your computer and use it in GitHub Desktop.

Four new proposed schemas for Unwalled.Garden

This week I created PRs for four new unwalled.garden schemas. The are:

Of these, I'm 99% sure that Discussions and Votes should land. I think Actions and Relationships could be fun additions, but I'm open to disagreements about them.

I'm proposing these schemas so that we can support more kinds of apps out of the box. Not all of the schemas should have a 100% planned usage; the point is to give people a toybox and just let them play. That said- I was inspired to add these because I had a couple quick apps I wanted to write (a forum for discussing beaker development, a place to recommend new apps, a place to recommend sites you should follow) and I'm hopeful these schemas will solve those needs!

Here are the descriptions from the various PRs:

Related issue: beakerbrowser/unwalled.garden#13. cc @zootella.

Adds "actions". Example action:

{
  "type": "unwalled.garden/action",
  "topic": "dat://beakerbrowser.com/docs",
  "action": "visited",
  "createdAt": "2018-12-07T02:52:11.947Z"
}

Actions can be used for all kinds of applications. They can be used to create a webcounter as described in beakerbrowser/unwalled.garden#13. They can be used to inform users that you've updated a project. They can be used to track how many users have installed an app. Etc etc.

This PR adds a schema and API for forum discussions. An example:

{
  "type": "unwalled.garden/discussion",
  "forum": "decentralized-web",
  "title": "What do you think about the Dat protocol?",
  "body": "You can find out about it at www.datprotocol.com. It seems cool to me!",
  "href": "dat://www.datprotocol.com",
  "createdAt": "2018-12-07T02:52:11.947Z"
}

The forum field determines how the discussions are grouped. (It is similar to a subreddit name.) It can be any string but it must be provided.

Both the body and the href are optional. An href should make the discussion act like a link (think Reddit or HN).

Adds "relationships". Example relationship:

{
  "type": "unwalled.garden/relationship",
  "a": "dat://alice.com",
  "rel": "spouse",
  "b": "dat://bob.com",
  "createdAt": "2018-12-07T02:52:11.947Z"
}

Relationships are declarations of a linkage between two resources on the Web. They can be used to declare things such as "Alice is the spouse of Bob" and "Carla is an employee of Foo Inc."

The records take the shape of {a, rel, b}. The way to read relationships is as follows:

{a} is a/an/the {rel} of/to/about/with {b}

For instance, the example above reads as:

dat://alice.com is the spouse of dat://bob.com

I don't have a very specific use-case in mind for relationships, other than fulfilling a natural part of social networking (declaring your relationships with each other and things in the world).

This PR adds "votes." An example looks like this:

{
  "type": "unwalled.garden/vote",
  "topic": "dat://beakerbrowser.com",
  "vote": 1,
  "createdAt": "2018-12-07T02:52:11.947Z"
}

Votes can be 1 (upvote) or -1 (downvote).

@ghiliweld
Copy link

A vote can be an action, wouldn't having a separate type be redundant?

@pfrazee
Copy link
Author

pfrazee commented Jun 15, 2019

There is overlap. My thinking was that votes are a standard pattern while actions are more freeform and open for apps to interpret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment