# ssb-issues Issue tracking built on secure-scuttlebutt ## Schema #### type: issue An issue. Represents something that should be fixed. ```js { type: 'issue', project: Link?, title: string?, text: string? } ``` #### type: issue-edit An edit to an issue. Only considered valid if its author is the author of the issue (`issue.author`) or of the project of the issue (`issue.projectAuthor`). ```js { type: 'issue-edit', issue: IssueRef, open: boolean?, title: string? } ``` ## API ```js var Issues = require('ssb-issues') var issues = Issues.init(sbot) ``` #### get: async Get an issue by its id ```js issues.get(issueId, cb) ``` The resulting issue object is as follows: ```js { id: MsgRef, author: FeedRef, project: Ref?, projectAuthor: FeedRef?, created_at: number, updated_at: number, open: boolean } ``` - `id`: id of the issue - `author`: author of the issue - `created_at` (timestamp): when the issue was created - `updated_at` (timestamp): when the issue was last updated - `title`: title of the issue - `open`: whether the issue is open (true) or closed (false) - `project`: the project that the issue is for - `projectAuthor`: the author of the project #### createFeedStream: source Get a stream of issues ```js issues.createFeedStream({ project:, open:, live:, gt:, gte:, lt:, lte:, reverse:, limit:, }, cb) ``` - `project` (Ref): get only issues for the given target - `open` (boolean): get only open or closed issues - `author` (FeedRef): get only issues from the given feed - `live` (boolean, default: `false`): Keep the stream open and emit new messages as they are received. - `gt` (greater than), `gte` (greater than or equal): maximum `[timestamp, id]` - `lt` (less than), `lte` (less than or equal): minimum `[timestamp, id]` - `reverse` (boolean, default: `false`): reverse the order of results #### new: async Create a new issue ```js issues.new({ project:, title:, text: }, cb) ``` - `project` (Ref): id of an ssb object representing the target of the issue - `title` (string): title of the issue - `text` (string): text describing the issue #### close: async ```js issues.close(id, cb) ``` Mark an issue as closed. `id` (MsgRef): id of the issue to reopen #### reopen: async ```js issues.reopen(id, cb)` ``` Mark an issue as open. `id` (MsgRef): id of the issue to reopen `text` (string): text to accompany the open action #### edit: async ```js issues.edit(id, opts, cb)` ``` Edit an issue. `id` (MsgRef): id of the issue to reopen `opts.open` (boolean): set open/closed status `opts.title` (string): set title ### schemas ```js var issueSchemas = Issues.schemas ``` #### `issueSchemas.new(project, title, text)` Create a new issue. - `project` (Ref): id of project to associate the issue with - `title` (string): title to give the issue - `text` (string): text body for the issue #### `issueSchemas.edit(id, opts)` Edit an issue. - `opts.open` (boolean): open or close the issue - `opts.title` (string): set the title of the issue #### `issueSchemas.close(id)` Close an issue. - `id` (MsgRef): id of an issue to mark as closed #### `issueSchemas.reopen(id)` Reopen an issue. - `id` (MsgRef): id of an issue to mark as open ## License Copyright (c) 2016 Charles Lehner Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument. DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.