git ssb

0+

Josiah / scuttle-tag



Tree: 073f7adfddd31252faca6d3c503e202ad1aef088

Files: 073f7adfddd31252faca6d3c503e202ad1aef088 / README.md

1970 bytesRaw

patch-tag

Tags depject plugin for secure scuttlebutt which uses patchcore.

gives observables and async methods for getting and publishing tags on secure scuttlebutt.

Needs

exports.needs = nest({
  'sbot.async.publish': 'first',
  'sbot.pull.stream': 'first',
})

Gives

exports.gives = nest({
  'tag.async': [
    'apply',
    'create',
    'name'
  ],
  'tag.obs': [
    'taggedMessages',
    'messageTags',
    'allTagsFrom'
  ]
})

Message Schema

{
  type: 'tag',
  tagged: true | false,
  message: %msg_id, //the message being tagged
  root: %tag_id, //unless this message is the first message in this tag
  branch: %tag_id //ditto
}

API

tag.async.create({}, cb)

Creates a new tag message and calls cb when done.

tag.async.apply({ tag, message, tagged }, cb)

Creates a new tag message which applies the tag tag to the message message if tagged is true. (TODO: default tagged to true)

tag.async.name({ tag, name }, cb)

Sets the name of a tag and calls cb when done.

tag.obs.taggedMessages(author, tagId)

Returns a Mutant observable array of ids of messages. This array is messages that have had the tag tagId applied by author.

tag.obs.messageTags(msgId, tagId)

Returns a Mutant observable dictionary of user ids to timestamps. This dictionary is users that have applied tag tagId to message msgId at the specified time.

tag.obs.allTagsFrom(author)

Returns a Mutant observable array of all tag messages published by an user.

Built with git-ssb-web