How to use asana - 10 common examples

To help you get started, we’ve selected a few asana examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / asana / asana-tests.ts View on Github external
import * as asana from 'asana';
declare var console: { log(x: any): void };
declare var process: { env: { ASANA_API_KEY: string } };

let version: string = asana.VERSION;

// https://github.com/Asana/node-asana#usage
// Usage

var client = asana.Client.create().useAccessToken('my_access_token');
client.users.me().then(function(me) {
  console.log(me);
});

client = asana.Client.create({
  clientId: 123,
  clientSecret: 'my_client_secret',
  redirectUri: 'my_redirect_uri'
});

client.useOauth({
  credentials: 'my_access_token'
});

var credentials = {
  // access_token: 'my_access_token',
  refresh_token: 'my_refresh_token'
};

client.useOauth({
  credentials: credentials
github DefinitelyTyped / DefinitelyTyped / asana / asana-tests.ts View on Github external
/// 
/// 

import * as asana from 'asana';
import * as util from 'util';

let version: string = asana.VERSION;

// https://github.com/Asana/node-asana#usage
// Usage

var client = asana.Client.create().useAccessToken('my_access_token');
client.users.me().then(function(me) {
  console.log(me);
});

client = asana.Client.create({
  clientId: 123,
  clientSecret: 'my_client_secret',
  redirectUri: 'my_redirect_uri'
});

client.useOauth({
  credentials: 'my_access_token'
});

var credentials = {
  // access_token: 'my_access_token',
github DefinitelyTyped / DefinitelyTyped / asana / asana-tests.ts View on Github external
/// 

import * as asana from 'asana';
import * as util from 'util';

let version: string = asana.VERSION;

// https://github.com/Asana/node-asana#usage
// Usage

var client = asana.Client.create().useAccessToken('my_access_token');
client.users.me().then(function(me) {
  console.log(me);
});

client = asana.Client.create({
  clientId: 123,
  clientSecret: 'my_client_secret',
  redirectUri: 'my_redirect_uri'
});

client.useOauth({
  credentials: 'my_access_token'
});

var credentials = {
  // access_token: 'my_access_token',
  refresh_token: 'my_refresh_token'
};

client.useOauth({
  credentials: credentials
github DefinitelyTyped / DefinitelyTyped / types / asana / asana-tests.ts View on Github external
import * as asana from 'asana';
declare var console: { log(x: any): void };
declare var process: { env: { ASANA_API_KEY: string } };

let version: string = asana.VERSION;

// https://github.com/Asana/node-asana#usage
// Usage

var client = asana.Client.create().useAccessToken('my_access_token');
client.users.me().then(function(me) {
  console.log(me);
});

client = asana.Client.create({
  clientId: 123,
  clientSecret: 'my_client_secret',
  redirectUri: 'my_redirect_uri'
});

client.useOauth({
github DefinitelyTyped / DefinitelyTyped / asana / asana-tests.ts View on Github external
/// 
/// 

import * as asana from 'asana';
import * as util from 'util';

let version: string = asana.VERSION;

// https://github.com/Asana/node-asana#usage
// Usage

var client = asana.Client.create().useAccessToken('my_access_token');
client.users.me().then(function(me) {
  console.log(me);
});

client = asana.Client.create({
  clientId: 123,
  clientSecret: 'my_client_secret',
  redirectUri: 'my_redirect_uri'
});

client.useOauth({
github Asana / node-asana / examples / events / events.js View on Github external
/**
 * Usage:
 *
 *   export ASANA_API_KEY=...
 *   node events.js PROJECT_ID
 */
var asana = require('asana');

// Arguments / constants
var accessToken = process.env.ASANA_ACCESS_TOKEN;
var projectId = process.env.ASANA_PROJECT_ID;

// Set up a client using personal access token
var client = asana.Client.create().useAccessToken(accessToken);

console.log('Listening to new stories on project', projectId);

client.events.stream(projectId, {
    periodSeconds: 3
})
    .on('data', function (event) {
        // Here we filter to just the type of event we care about.
        if (event.type === 'story' && event.action === 'added') {
            // Fetch the story and then process it.
            var storyId = event.resource.id;
            return client.stories.findById(storyId)
                .then(function (story) {
                    console.log(
                        'New story on task',
                        '[' + story.target.name + ']:', story.text);
github Asana / node-asana / examples / oauth / script / oauth_script.js View on Github external
/**
 * Usage:
 *
 *   export ASANA_CLIENT_ID=...
 *   export ASANA_CLIENT_SECRET=...
 *   node oauth_script.js
 */
var Asana = require('asana');

// Create a client, getting parameters from the environment.
var client = Asana.Client.create({
  clientId: process.env['ASANA_CLIENT_ID'],
  clientSecret: process.env['ASANA_CLIENT_SECRET']
});

// Configure the way we want to use Oauth. This autodetects that we are
// in a Node process, so uses the `NativeFlow` by default.
client.useOauth();

// When `authorize` is called it will prompt us to perform the authorization
// in a browser and copy in the code we got. It will then exchange that for
// a token.
client.authorize().then(function() {
  // The client is authorized! Make a simple request.
  return client.users.me().then(function(me) {
    console.log('Hello ' + me.name);
  });
github ialexryan / threedots-electron / app / main.js View on Github external
var path = require('path');
var shell = require('shell');
var asana = require('asana');
var options = require('./options');
var ipc = require("ipc");

// Report crashes to our server.
require('crash-reporter').start();

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
var appIcon = null;

// oauth
var client = asana.Client.create({
    clientId: options.client_id,
    clientSecret: options.client_secret,
    redirectUri: options.redirect_uri
});
var access_token_set = false;

function getSavedOrDefaultStateData() {
  // Read in the saved state
  var savedStatePath = app.getPath("userData") + "/saved_state";
  if (fs.existsSync(savedStatePath)) {
      var savedStateData = JSON.parse(fs.readFileSync(savedStatePath));
      validSavedStateData = ('bounds','url' in savedStateData)
                      && (savedStateData.url.startsWith("https://app.asana.com"))
                      && ('x','y','width','height' in savedStateData.bounds);
      if (validSavedStateData) {
          return savedStateData;
github featureready / asana-github-tools / src / services / asana.js View on Github external
import 'dotenv/config';
import Asana from 'asana';
import _ from 'lodash';
import { findTaskId } from '../helpers/tasks';

export const client = Asana.Client.create().useAccessToken(process.env.ASANA_PATOKEN);

export const getMe = async () => {
  const user = await client.users.me();
  console.log(user);
};

export const getWorkspace = async () => {
  const workspace = await client.workspaces.findById(process.env.ASANA_WORKSPACE_ID);
  console.log(workspace);
};

export const getCustomFields = async () => {
  const fields = await client.customFields.findByWorkspace(process.env.ASANA_WORKSPACE_ID);
  console.log(fields.data.length);
};
github EyalRonel / asana-webhooks-manager / helpers / asanaClient.js View on Github external
var client = function(token){

	var client = asana.Client.create({
		clientId:     asanaConfig.getClientId(),
		clientSecret: asanaConfig.getClientSecret(),
		redirectUri:  asanaConfig.getRediectUri()
	});

	if (token) client.useOauth({credentials: token});

	return client;
};

asana

This_is_the_interface_for_interacting_with_the__Asana_Platform_httpsdevelopers_asana_com__Our_API_reference_is_generated_from_our__OpenAPI_spec__httpsraw_githubusercontent_comAsanaopenapimasterdefsasana_oas_yaml_

MIT
Latest version published 2 months ago

Package Health Score

71 / 100
Full package analysis

Popular asana functions