taskforce-api v0.1.0
Taskforce API library for Node
This library provides a handy class to make secure, authenticated requests to the Taskforce API.
It relies on the request HTTP client, thus it's fully async, and written in Coffeescript.
Install
Or from source:
How to use
Create a new Taskforce object per user, providing the username (a Gmail address) and the API key. You won't have to provide the credentials again for any of your API calls.
Taskforce = require "taskforce-api"
tf = new Taskforce userName, apiKey You can use the static method Taskforce.createUser and then create the associated Taskforce instance.
apiKey, tf
post =
email: "user@gmail.com"
password: "rU$f5d1@"
Taskforce.createUser post, (err, res, body) ->
apiKey = body.api_key if body.success
tf = new Taskforce post.email, apiKeyYou can also create a Taskforce object without user credentials, and use the auth method later.
tf = new Taskforce()
# Do some stuff before authenticating
tf.auth "user@gmail.com", "<apikey>"API Methods
All API methods take a callback function. Put the code to process the response in that callback. Note: its three paramaters are JS objects.
tf.getLists (err, res, body) ->
if body.success
localStore.lists = (l.id for l in body.lists)Most methods are POST requests. Pass a single object containing all the parameters, plus the callback function.
tf.createTask {name: "Write README file", list_id: "2654356"}, (err, res, body) ->
localStore.tasks.push body.task_idRequests which require a single parameter can receive this parameter instead of an object.
tf.getTask localStore.tasks[0], cbReference
You should take a look at this page to get a full list of available API methods and their required/optional parameters.
13 years ago