Skip to content

Client.API

Phips Peter edited this page Oct 22, 2014 · 9 revisions

Class: Client

Client

A wrapper for the Asana API which is authenticated for one user

new Client(dispatcher)

Constructs a Client with instances of all the resources using the dispatcher. It also keeps a reference to the dispatcher so that way the end user can have access to it.

Parameters:
Name Type Description
dispatcher Dispatcher

The request dispatcher to use

Source:

Members

attachments :Attachments

An instance of the Attachments resource.

Type:
Source:

dispatcher :Dispatcher

The internal dispatcher. This is mostly used by the resources but provided for custom requests to the API or API features that have not yet been added to the client.

Type:
Source:

projects :Projects

An instance of the Projects resource.

Type:
Source:

stories :Stories

An instance of the Stories resource.

Type:
Source:

tags :Tags

An instance of the Tags resource.

Type:
Source:

tasks :Tasks

An instance of the Tasks resource.

Type:
Source:

teams :Teams

An instance of the Teams resource.

Type:
Source:

users :Users

An instance of the Users resource.

Type:
Source:

workspaces :Workspaces

An instance of the Workspaces resource.

Type:
Source:

Methods

<static> basicAuth(apiKey) → {Client}

Creates a Client for a user using that user's API Key and then authenticates through HTTP Basic Authentication. This is probably the easier method for command line scripts or bot like integrations. Handling "real" users should be preferably done with OAuth.

Parameters:
Name Type Description
apiKey String

The Asana Api Key of the user

Source:
Returns:

The instantiated client

Type
Client

<static> oauth(token) → {Client}

Creates a Client for the user using that user's OAuth token that is granted to the application. This library does not support handling the OAuth flow but libraries like passport-asana or others than handle that flow are excellent options.

Parameters:
Name Type Description
token String

The Asana OAuth token of the user

Source:
Returns:

The instantiated client

Type
Client

Generated with wicked.