Skip to content

toots/node-asana

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Asana API for node

This module provide a wrapper to the Asana API for nodeJS applications.

Ultimately, a support in the browser, using node-browserify is also planned.

Usage

Asana = require "asana"

asana = new Asana
  key : "deadbeef"

asana.user.fetch
  success : -> ...
  error   : -> ...

users = new asana.Users
users.fetch
  error   : -> ...
  success : -> 
    workspaces = new asana.Workspaces

    workspaces.fetch
      error    : -> ...
      successs : ->
        workspace = workspaces.first 

        task = new asana.Task
          assignee  : users.find (user) ->
            user.get("name") == "John Difool"
          followers : [user]
          name      : "Protect the Incal"
          workspace : workspace

        task.save
          error   : -> ...
          success : -> ...

Get the facts!

  • Base reference: Asana API
  • All asana items are backbone models. You can fetch and save them as is usually done with backbone models. However, asana API does not allow to create or save some items.
  • Backbone models support ID map and modelize as provided by backbone.modelizer
  • All asana attributes are stored as model attributes. Creation arguments are those documented in the Asana API.
  • It is possible to pass models or IDs as attributes values.
  • Items structure is:
    • asana = new Asana key : asanaKey:
      • asana.user : Current asana user
      • asana.Users : Collection of all known users
      • asana.Stories : Collection of all stories
      • asna.Workspace : Basic model for asana workspaces
      • asana.Workspaces : Collection of all asana workspaces
      • asana.Project : Basic model for asana projects
        • project.workspace : Workpace for project
      • asana.Projects : Collection of all asana projects
      • asana.Task : Base task model
      • asana.Tasks : Collection of available tasks.
      • task = new asana.Task params:
        • task.Story : Basic model to create a new story attached to task
        • task.assignee : User assigned to task
        • task.followers : Collection of users following task
        • task.stories : Collection of all stories attached to task
        • task.projects : Collection of all projects to which task belongs

You can use your own copy of Backbone by passing it as an option when instanciating asana's client:

  asana = new Asana
    key      : "deadbeef"
    Backbone : myBackbone

About

Asana API javascript module.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published