0.1.3 • Published 6 years ago

@jogral/tigris-nodejs-sdk v0.1.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 years ago

Jogral Tigris NodeJS SDK

Build Status

This is the official NodeJS SDK for Jogral Tigris. This SDK will let you execute most of the functionality you would from the API, and is an alternative to the stock UI.

Why use this?

Suppose you want to extend the functionality/features of Tigris, e.g. integrating with your company intranet or with a third party service. This SDK is a layer around the REST-like API powering Tigris, leaving you to write software and not worry about forming your HTTP requests--just use native features!

We at Jogral are already using this API inside of Tigris. Must of the interaction between the UI and the API uses this SDK as a layer between the two, so you should be able to use this on the client and server side.

Installation

Starting a 0.1.0, you can install via npm:

npm i @jogral/tigris-nodejs-sdk --save

Usage

Coming soon!

To get started:

import { Client } from 'tigris-nodejs-sdk'

const baseURL = 'http://localhost/api'
let client = Client.create(username, password, baseURL)
client.then(client => {
  console.log('My Username: ' + client.session().user().shortname)
})

Getting courses:

// Get all courses
client.then(client => client.courses())

// You can use a dict as query params
client.then(client => client.courses({slug: 'test'}))

// You can create/retrieve/update, too
const courseObj = {title: 'title', ...}
client.then(client => {
  //// New course
  let course = client.course(courseObj) // Course is not created yet, but object is.
  course = course.save(true) // Now course is added to Tigris, and has an ID.
  console.log(course.id())
  return course
}).then(course => {
  //// Get/edit course
  course = client.course({id: 1}).get()
  course.status = 1
  let updatedCourse = course.save()
})

More coming soon.

Contributing

You should be able to git started by cloning our repo. Once you've cloned your repo, go to the repo path and run

npm install

NOTE: You should be sure to have some flavor of NodeJS 8. Anything earlier might work, but we've only tested against NodeJS 8+.

Testing

Test coverage is still largely in progress. We use Mocha for testings, and Istanbul for code coverage.

You can test by running npm test and check coverage via npm run test:coverage.

Support

Development, support, etc. is managed directly by Jogral. If you want to contact us directly, drop us a line at code@jogral.io. We welcome you to open issues directly through GitHub and to use email for questions.

License

The Tigris NodeJS SDK is licensed under the Apache License 2.0. See LICENSE for details.

TODO

  • Increase test coverage to 100%.
  • Make it clearer when sessions are expired.
  • Create documentation from docstrings.
  • Incorporate upcoming authorization updates to API into SDK.
  • Flesh out roadmap.