logworks

7.0.0 • Public • Published

Logworks node.js bindings

Node library to access the Logworks API using Immutable collections Expects Fetch and Promise.

Installation

$ npm install logworks

Usage

See https://github.com/logworks/logworks-test

Overview

Every resource is accessed via your logworks instance:

var logworks = require('logworks')('logworks_api_url');
// logworks.{ RESOURCE NAME }.{ METHOD NAME }

Every resource method accepts an optional callback as the last argument:

logworks.logs.create(function(err, log) {
  err; // null if no error ocurred
  log; // Immutable Map with 'id', 'data' and 'entries' where 'data' is an Immutable Map and 'entries' is an Immutable List
}

Additionally, every resource method returns a promise, so you don't have to use the regular callback, e.g:

// Create a new log and then a new entry in that log:
logworks.logs.create().then(function(log) {
  return logworks.entries.create(log.id, {type:'text', data:'Hello World'});
}).then(function(entry) {
  entry; // Immutable map with 'id', 'type', 'data', 'created' and 'updated'
  // New entry was created
}, function(err) {
  // Deal with the error
}); 

Available resources & methods

  • logs

    • create()
    • show(logurl)
    • edit(logid, data)
    • del(logid)
    • generateSignedURL(logid)
  • entries

    • create(logid, {type: "type", data: "data"})
    • edit(logid, entryid, {type: "type", data: "newdata"})
    • del(logid, entryid)

Notes

generateSignedURL generates URLs that can be used to upload images. The response looks like {signedURL: 'foo', url: 'bar'} where url is the url that the image will be accessible on, and signedURL is the url that you should use to upload the image.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 7.0.0
    0
    • latest

Version History

Package Sidebar

Install

npm i logworks

Weekly Downloads

0

Version

7.0.0

License

MIT

Last publish

Collaborators

  • arpith