npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

asana-nick

v0.0.1

Published

A node.js client for the Asana API

Downloads

3

Readme

Asana Build Status NPM Version

A node.js client for the 1.0 version of the Asana API.

Design Decisions

  • Thin Wrapper This client is a thin wrapper which means that the client makes little attempt to verify the validity of the arguments locally. All errors are reported by the server. We include custom Error types which will contain the response from the server.
  • Promises Promises with bluebird seem like the most neutral way to support node's various async paradigms. If you want promises, you get them by default. If you want callbacks, bluebird promises support nodeify which takes a callback as parameter. For generators and streams, co and highland also support promises respectively. Beyond that, other major libraries such as mongoose, mocha, and elastic search (which uses bluebird) also support promises.

Examples

Various examples are in the repository under examples/, but some basic concepts are illustrated here.

Find some incomplete tasks assigned to me that are new or marked for today in my default workspace

var Asana = require('asana');
var util = require('util');

// Using the API key for basic authentication. This is reasonable to get
// started with, but Oauth is more secure and provides more features.
var client = Asana.Client.create().useBasicAuth(process.env.ASANA_API_KEY);

client.users.me()
  .then(function(user) {
    var userId = user.id;
    // The user's "default" workspace is the first one in the list, though
    // any user can have multiple workspaces so you can't always assume this
    // is the one you want to work with.
    var workspaceId = user.workspaces[0].id;
    return client.tasks.findAll({
      assignee: userId,
      workspace: workspaceId,
      completed_since: 'now',
      opt_fields: 'id,name,assignee_status,completed'
    });
  })
  .then(function(response)) {
    // There may be more pages of data, we could stream or return a promise
    // to request those here - for now, let's just return the first page
    // of items.
    return response.data;
  });
  .filter(function(task) {
    return task.assignee_status === 'today' ||
      task.assignee_status === 'new';
  })
  .then(function(list) {
    console.log(util.inspect(list, {
      colors: true,
      depth: null
    }));
  });

Installation

Install with npm:

npm install asana --save

Documentation

The code is thoroughly documented with JsDoc tags, and online documentation can be found on the wiki. Also, the Official Asana Documentation is a great resource since this is just a thin wrapper for the API.

Contributing

Feel free to fork and submit pull requests for the code! Please follow the existing code as an example of style and make sure that all your code passes lint and tests. For a sanity check:

git clone [email protected]:Asana/node-asana.git
cd node-asana
npm install
npm test