Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bluehalo/workamajig-node
A Node SDK for the Workamajig API
https://github.com/bluehalo/workamajig-node
nodejs sdk workamajig-api
Last synced: about 2 months ago
JSON representation
A Node SDK for the Workamajig API
- Host: GitHub
- URL: https://github.com/bluehalo/workamajig-node
- Owner: bluehalo
- License: mit
- Created: 2016-12-15T20:40:38.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-27T21:12:33.000Z (over 7 years ago)
- Last Synced: 2024-04-11T00:42:10.442Z (9 months ago)
- Topics: nodejs, sdk, workamajig-api
- Language: JavaScript
- Size: 23.4 KB
- Stars: 4
- Watchers: 25
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
##A Node Request-based API wrapper for the Workamajig API
*Props to [stripe.js](https://github.com/stripe/stripe-node) for the general structure of this module.*
###Installation
```
npm install workamajig --save
```###Documentation
See http://help.workamajig.com/api-overview for API documentation.
###Configuration
Pass in a config object with the required params:
```
var workamajig = require('workamajig')({
host : WORKAMAJIG_CLIENT_URL,
version : WORKAMAJIG_API_VERSION,
accessToken : WORKAMAJIG_ACCESS_TOKEN,
userToken : WORKAMAJIG_USER_TOKEN,
});
```###API Overview
Every resource is accessed via your workamajig instance:
```
// workamajig.{ RESOURCE_NAME }.{ METHOD_NAME }
```Every resource method accepts an optional callback as the last argument:
```
workamajig.projects.create(
{ someFoo: 'bar' },
function(err, project) {
err; // null if no error occurred
project; // the created project object
}
);
```Additionally, every resource method returns a promise, so you don't have to use the regular callback, E.g.
```
// Create a new project and then a new task for that project:
workamajig.projects.create({
someFoo: 'bar'
}).then(function(project) {
workamajig.task.create(project.id, {
someTask: 'taskFoo'
});
}).then(function(task) {
// Task created on the project
}).catch(function(err){
// Handle some error
});
```###Available resources & methods
Params are passed as plain JavaScript object, e.g. ```{ someFoo: 'bar' }```
- activities
- contacts
- opportunities
- projects
- services
- tasks
- timesheets
- todos
- users###Development
Run all tests:
```
$ npm install
$ npm test
```Run a single test suite:
```
$ npm run mocha -- test/Error.spec.js
```### Example project
There is a simple example project under ```/example```. To run the project,
from the root directory, copy ```config.env.example``` to ```config.env``` and
edit the file to add your host, version, access and user tokens. Then, run:
```
$ node ./example/index.js
```