Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Asana/asana-node-openapi-generator

Repository files navigation

asana

Asana - JavaScript client for asana This is the interface for interacting with the Asana Platform. Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/developer-docs/master/defs/asana_oas.yaml). This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.JavascriptClientCodegen For more information, please visit https://asana.com/support

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install asana --save

Finally, you need to build the module:

npm run build
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

To use the link you just defined in your project, switch to the directory you want to use your asana from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

Finally, you need to build the module:

npm run build

git

If the library is hosted at a git repository, e.g.https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var Asana = require('asana');

var defaultClient = Asana.ApiClient.instance;
// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = "YOUR ACCESS TOKEN"
// Configure Bearer access token for authorization: personalAccessToken
var personalAccessToken = defaultClient.authentications['personalAccessToken'];
personalAccessToken.accessToken = "YOUR ACCESS TOKEN"

var api = new Asana.AttachmentsApi()
var opts = {
  'optPretty': true, // {Boolean} Provides “pretty” output. Provides the response in a “pretty” format. In the case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable only to use this during debugging.
  'optFields': ["followers","assignee"], // {[String]} Defines fields to return. Some requests return *compact* representations of objects in order to conserve resources and complete the request more efficiently. Other times requests return more information than you may need. This option allows you to list the exact set of fields that the API should be sure to return for the objects. The field names should be provided as paths, described below. The id of included objects will always be returned, regardless of the field options.
  'resourceSubtype': "resourceSubtype_example", // {String} The type of the attachment. Must be one of the [given values](/docs/attachment). If not specified, a file attachment of type `asana` will be assumed. Note that if the value of `resource_subtype` is `external`, a `parent`, `name`, and `url` must also be provided. 
  'file': "/path/to/file", // {File} Required for `asana` attachments. 
  'parent': "parent_example", // {String} Required identifier of the parent task, project, or project_brief, as a string. 
  'url': "url_example", // {String} The URL of the external resource being attached. Required for attachments of type `external`. 
  'name': "name_example" // {String} The name of the external resource being attached. Required for attachments of type `external`. 
};
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createAttachmentForObject(opts, callback);

Documentation for API Endpoints

All URIs are relative to https://app.asana.com/api/1.0

Class Method HTTP request Description
Asana.AttachmentsApi createAttachmentForObject POST /attachments Upload an attachment
Asana.AttachmentsApi deleteAttachment DELETE /attachments/{attachment_gid} Delete an attachment
Asana.AttachmentsApi getAttachment GET /attachments/{attachment_gid} Get an attachment
Asana.AttachmentsApi getAttachmentsForObject GET /attachments Get attachments from an object
Asana.AuditLogAPIApi getAuditLogEvents GET /workspaces/{workspace_gid}/audit_log_events Get audit log events
Asana.BatchAPIApi createBatchRequest POST /batch Submit parallel requests
Asana.CustomFieldSettingsApi getCustomFieldSettingsForPortfolio GET /portfolios/{portfolio_gid}/custom_field_settings Get a portfolio's custom fields
Asana.CustomFieldSettingsApi getCustomFieldSettingsForProject GET /projects/{project_gid}/custom_field_settings Get a project's custom fields
Asana.CustomFieldsApi createCustomField POST /custom_fields Create a custom field
Asana.CustomFieldsApi createEnumOptionForCustomField POST /custom_fields/{custom_field_gid}/enum_options Create an enum option
Asana.CustomFieldsApi deleteCustomField DELETE /custom_fields/{custom_field_gid} Delete a custom field
Asana.CustomFieldsApi getCustomField GET /custom_fields/{custom_field_gid} Get a custom field
Asana.CustomFieldsApi getCustomFieldsForWorkspace GET /workspaces/{workspace_gid}/custom_fields Get a workspace's custom fields
Asana.CustomFieldsApi insertEnumOptionForCustomField POST /custom_fields/{custom_field_gid}/enum_options/insert Reorder a custom field's enum
Asana.CustomFieldsApi updateCustomField PUT /custom_fields/{custom_field_gid} Update a custom field
Asana.CustomFieldsApi updateEnumOption PUT /enum_options/{enum_option_gid} Update an enum option
Asana.EventsApi getEvents GET /events Get events on a resource
Asana.GoalRelationshipsApi addSupportingRelationship POST /goals/{goal_gid}/addSupportingRelationship Add a supporting goal relationship
Asana.GoalRelationshipsApi getGoalRelationship GET /goal_relationships/{goal_relationship_gid} Get a goal relationship
Asana.GoalRelationshipsApi getGoalRelationships GET /goal_relationships Get goal relationships
Asana.GoalRelationshipsApi removeSupportingRelationship POST /goals/{goal_gid}/removeSupportingRelationship Removes a supporting goal relationship
Asana.GoalRelationshipsApi updateGoalRelationship PUT /goal_relationships/{goal_relationship_gid} Update a goal relationship
Asana.GoalsApi addFollowers POST /goals/{goal_gid}/addFollowers Add a collaborator to a goal
Asana.GoalsApi createGoal POST /goals Create a goal
Asana.GoalsApi createGoalMetric POST /goals/{goal_gid}/setMetric Create a goal metric
Asana.GoalsApi deleteGoal DELETE /goals/{goal_gid} Delete a goal
Asana.GoalsApi getGoal GET /goals/{goal_gid} Get a goal
Asana.GoalsApi getGoals GET /goals Get goals
Asana.GoalsApi getParentGoalsForGoal GET /goals/{goal_gid}/parentGoals Get parent goals from a goal
Asana.GoalsApi removeFollowers POST /goals/{goal_gid}/removeFollowers Remove a collaborator from a goal
Asana.GoalsApi updateGoal PUT /goals/{goal_gid} Update a goal
Asana.GoalsApi updateGoalMetric POST /goals/{goal_gid}/setMetricCurrentValue Update a goal metric
Asana.JobsApi getJob GET /jobs/{job_gid} Get a job by id
Asana.OrganizationExportsApi createOrganizationExport POST /organization_exports Create an organization export request
Asana.OrganizationExportsApi getOrganizationExport GET /organization_exports/{organization_export_gid} Get details on an org export request
Asana.PortfolioMembershipsApi getPortfolioMembership GET /portfolio_memberships/{portfolio_membership_gid} Get a portfolio membership
Asana.PortfolioMembershipsApi getPortfolioMemberships GET /portfolio_memberships Get multiple portfolio memberships
Asana.PortfolioMembershipsApi getPortfolioMembershipsForPortfolio GET /portfolios/{portfolio_gid}/portfolio_memberships Get memberships from a portfolio
Asana.PortfoliosApi addCustomFieldSettingForPortfolio POST /portfolios/{portfolio_gid}/addCustomFieldSetting Add a custom field to a portfolio
Asana.PortfoliosApi addItemForPortfolio POST /portfolios/{portfolio_gid}/addItem Add a portfolio item
Asana.PortfoliosApi addMembersForPortfolio POST /portfolios/{portfolio_gid}/addMembers Add users to a portfolio
Asana.PortfoliosApi createPortfolio POST /portfolios Create a portfolio
Asana.PortfoliosApi deletePortfolio DELETE /portfolios/{portfolio_gid} Delete a portfolio
Asana.PortfoliosApi getItemsForPortfolio GET /portfolios/{portfolio_gid}/items Get portfolio items
Asana.PortfoliosApi getPortfolio GET /portfolios/{portfolio_gid} Get a portfolio
Asana.PortfoliosApi getPortfolios GET /portfolios Get multiple portfolios
Asana.PortfoliosApi removeCustomFieldSettingForPortfolio POST /portfolios/{portfolio_gid}/removeCustomFieldSetting Remove a custom field from a portfolio
Asana.PortfoliosApi removeItemForPortfolio POST /portfolios/{portfolio_gid}/removeItem Remove a portfolio item
Asana.PortfoliosApi removeMembersForPortfolio POST /portfolios/{portfolio_gid}/removeMembers Remove users from a portfolio
Asana.PortfoliosApi updatePortfolio PUT /portfolios/{portfolio_gid} Update a portfolio
Asana.ProjectBriefsApi createProjectBrief POST /projects/{project_gid}/project_briefs Create a project brief
Asana.ProjectBriefsApi deleteProjectBrief DELETE /project_briefs/{project_brief_gid} Delete a project brief
Asana.ProjectBriefsApi getProjectBrief GET /project_briefs/{project_brief_gid} Get a project brief
Asana.ProjectBriefsApi updateProjectBrief PUT /project_briefs/{project_brief_gid} Update a project brief
Asana.ProjectMembershipsApi getProjectMembership GET /project_memberships/{project_membership_gid} Get a project membership
Asana.ProjectMembershipsApi getProjectMembershipsForProject GET /projects/{project_gid}/project_memberships Get memberships from a project
Asana.ProjectStatusesApi createProjectStatusForProject POST /projects/{project_gid}/project_statuses Create a project status
Asana.ProjectStatusesApi deleteProjectStatus DELETE /project_statuses/{project_status_gid} Delete a project status
Asana.ProjectStatusesApi getProjectStatus GET /project_statuses/{project_status_gid} Get a project status
Asana.ProjectStatusesApi getProjectStatusesForProject GET /projects/{project_gid}/project_statuses Get statuses from a project
Asana.ProjectTemplatesApi getProjectTemplate GET /project_templates/{project_template_gid} Get a project template
Asana.ProjectTemplatesApi getProjectTemplates GET /project_templates Get multiple project templates
Asana.ProjectTemplatesApi getProjectTemplatesForTeam GET /teams/{team_gid}/project_templates Get a team's project templates
Asana.ProjectTemplatesApi instantiateProject POST /project_templates/{project_template_gid}/instantiateProject Instantiate a project from a project template
Asana.ProjectsApi addCustomFieldSettingForProject POST /projects/{project_gid}/addCustomFieldSetting Add a custom field to a project
Asana.ProjectsApi addFollowersForProject POST /projects/{project_gid}/addFollowers Add followers to a project
Asana.ProjectsApi addMembersForProject POST /projects/{project_gid}/addMembers Add users to a project
Asana.ProjectsApi createProject POST /projects Create a project
Asana.ProjectsApi createProjectForTeam POST /teams/{team_gid}/projects Create a project in a team
Asana.ProjectsApi createProjectForWorkspace POST /workspaces/{workspace_gid}/projects Create a project in a workspace
Asana.ProjectsApi deleteProject DELETE /projects/{project_gid} Delete a project
Asana.ProjectsApi duplicateProject POST /projects/{project_gid}/duplicate Duplicate a project
Asana.ProjectsApi getProject GET /projects/{project_gid} Get a project
Asana.ProjectsApi getProjects GET /projects Get multiple projects
Asana.ProjectsApi getProjectsForTask GET /tasks/{task_gid}/projects Get projects a task is in
Asana.ProjectsApi getProjectsForTeam GET /teams/{team_gid}/projects Get a team's projects
Asana.ProjectsApi getProjectsForWorkspace GET /workspaces/{workspace_gid}/projects Get all projects in a workspace
Asana.ProjectsApi getTaskCountsForProject GET /projects/{project_gid}/task_counts Get task count of a project
Asana.ProjectsApi projectSaveAsTemplate POST /projects/{project_gid}/saveAsTemplate Create a project template from a project
Asana.ProjectsApi removeCustomFieldSettingForProject POST /projects/{project_gid}/removeCustomFieldSetting Remove a custom field from a project
Asana.ProjectsApi removeFollowersForProject POST /projects/{project_gid}/removeFollowers Remove followers from a project
Asana.ProjectsApi removeMembersForProject POST /projects/{project_gid}/removeMembers Remove users from a project
Asana.ProjectsApi updateProject PUT /projects/{project_gid} Update a project
Asana.SectionsApi addTaskForSection POST /sections/{section_gid}/addTask Add task to section
Asana.SectionsApi createSectionForProject POST /projects/{project_gid}/sections Create a section in a project
Asana.SectionsApi deleteSection DELETE /sections/{section_gid} Delete a section
Asana.SectionsApi getSection GET /sections/{section_gid} Get a section
Asana.SectionsApi getSectionsForProject GET /projects/{project_gid}/sections Get sections in a project
Asana.SectionsApi insertSectionForProject POST /projects/{project_gid}/sections/insert Move or Insert sections
Asana.SectionsApi updateSection PUT /sections/{section_gid} Update a section
Asana.StatusUpdatesApi createStatusForObject POST /status_updates Create a status update
Asana.StatusUpdatesApi deleteStatus DELETE /status_updates/{status_gid} Delete a status update
Asana.StatusUpdatesApi getStatus GET /status_updates/{status_gid} Get a status update
Asana.StatusUpdatesApi getStatusesForObject GET /status_updates Get status updates from an object
Asana.StoriesApi createStoryForTask POST /tasks/{task_gid}/stories Create a story on a task
Asana.StoriesApi deleteStory DELETE /stories/{story_gid} Delete a story
Asana.StoriesApi getStoriesForTask GET /tasks/{task_gid}/stories Get stories from a task
Asana.StoriesApi getStory GET /stories/{story_gid} Get a story
Asana.StoriesApi updateStory PUT /stories/{story_gid} Update a story
Asana.TagsApi createTag POST /tags Create a tag
Asana.TagsApi createTagForWorkspace POST /workspaces/{workspace_gid}/tags Create a tag in a workspace
Asana.TagsApi deleteTag DELETE /tags/{tag_gid} Delete a tag
Asana.TagsApi getTag GET /tags/{tag_gid} Get a tag
Asana.TagsApi getTags GET /tags Get multiple tags
Asana.TagsApi getTagsForTask GET /tasks/{task_gid}/tags Get a task's tags
Asana.TagsApi getTagsForWorkspace GET /workspaces/{workspace_gid}/tags Get tags in a workspace
Asana.TagsApi updateTag PUT /tags/{tag_gid} Update a tag
Asana.TasksApi addDependenciesForTask POST /tasks/{task_gid}/addDependencies Set dependencies for a task
Asana.TasksApi addDependentsForTask POST /tasks/{task_gid}/addDependents Set dependents for a task
Asana.TasksApi addFollowersForTask POST /tasks/{task_gid}/addFollowers Add followers to a task
Asana.TasksApi addProjectForTask POST /tasks/{task_gid}/addProject Add a project to a task
Asana.TasksApi addTagForTask POST /tasks/{task_gid}/addTag Add a tag to a task
Asana.TasksApi createSubtaskForTask POST /tasks/{task_gid}/subtasks Create a subtask
Asana.TasksApi createTask POST /tasks Create a task
Asana.TasksApi deleteTask DELETE /tasks/{task_gid} Delete a task
Asana.TasksApi duplicateTask POST /tasks/{task_gid}/duplicate Duplicate a task
Asana.TasksApi getDependenciesForTask GET /tasks/{task_gid}/dependencies Get dependencies from a task
Asana.TasksApi getDependentsForTask GET /tasks/{task_gid}/dependents Get dependents from a task
Asana.TasksApi getSubtasksForTask GET /tasks/{task_gid}/subtasks Get subtasks from a task
Asana.TasksApi getTask GET /tasks/{task_gid} Get a task
Asana.TasksApi getTasks GET /tasks Get multiple tasks
Asana.TasksApi getTasksForProject GET /projects/{project_gid}/tasks Get tasks from a project
Asana.TasksApi getTasksForSection GET /sections/{section_gid}/tasks Get tasks from a section
Asana.TasksApi getTasksForTag GET /tags/{tag_gid}/tasks Get tasks from a tag
Asana.TasksApi getTasksForUserTaskList GET /user_task_lists/{user_task_list_gid}/tasks Get tasks from a user task list
Asana.TasksApi removeDependenciesForTask POST /tasks/{task_gid}/removeDependencies Unlink dependencies from a task
Asana.TasksApi removeDependentsForTask POST /tasks/{task_gid}/removeDependents Unlink dependents from a task
Asana.TasksApi removeFollowerForTask POST /tasks/{task_gid}/removeFollowers Remove followers from a task
Asana.TasksApi removeProjectForTask POST /tasks/{task_gid}/removeProject Remove a project from a task
Asana.TasksApi removeTagForTask POST /tasks/{task_gid}/removeTag Remove a tag from a task
Asana.TasksApi searchTasksForWorkspace GET /workspaces/{workspace_gid}/tasks/search Search tasks in a workspace
Asana.TasksApi setParentForTask POST /tasks/{task_gid}/setParent Set the parent of a task
Asana.TasksApi updateTask PUT /tasks/{task_gid} Update a task
Asana.TeamMembershipsApi getTeamMembership GET /team_memberships/{team_membership_gid} Get a team membership
Asana.TeamMembershipsApi getTeamMemberships GET /team_memberships Get team memberships
Asana.TeamMembershipsApi getTeamMembershipsForTeam GET /teams/{team_gid}/team_memberships Get memberships from a team
Asana.TeamMembershipsApi getTeamMembershipsForUser GET /users/{user_gid}/team_memberships Get memberships from a user
Asana.TeamsApi addUserForTeam POST /teams/{team_gid}/addUser Add a user to a team
Asana.TeamsApi createTeam POST /teams Create a team
Asana.TeamsApi getTeam GET /teams/{team_gid} Get a team
Asana.TeamsApi getTeamsForUser GET /users/{user_gid}/teams Get teams for a user
Asana.TeamsApi getTeamsForWorkspace GET /workspaces/{workspace_gid}/teams Get teams in a workspace
Asana.TeamsApi removeUserForTeam POST /teams/{team_gid}/removeUser Remove a user from a team
Asana.TeamsApi updateTeam PUT /teams Update a team
Asana.TimePeriodsApi getTimePeriod GET /time_periods/{time_period_gid} Get a time period
Asana.TimePeriodsApi getTimePeriods GET /time_periods Get time periods
Asana.TypeaheadApi typeaheadForWorkspace GET /workspaces/{workspace_gid}/typeahead Get objects via typeahead
Asana.UserTaskListsApi getUserTaskList GET /user_task_lists/{user_task_list_gid} Get a user task list
Asana.UserTaskListsApi getUserTaskListForUser GET /users/{user_gid}/user_task_list Get a user's task list
Asana.UsersApi getFavoritesForUser GET /users/{user_gid}/favorites Get a user's favorites
Asana.UsersApi getUser GET /users/{user_gid} Get a user
Asana.UsersApi getUsers GET /users Get multiple users
Asana.UsersApi getUsersForTeam GET /teams/{team_gid}/users Get users in a team
Asana.UsersApi getUsersForWorkspace GET /workspaces/{workspace_gid}/users Get users in a workspace or organization
Asana.WebhooksApi createWebhook POST /webhooks Establish a webhook
Asana.WebhooksApi deleteWebhook DELETE /webhooks/{webhook_gid} Delete a webhook
Asana.WebhooksApi getWebhook GET /webhooks/{webhook_gid} Get a webhook
Asana.WebhooksApi getWebhooks GET /webhooks Get multiple webhooks
Asana.WebhooksApi updateWebhook PUT /webhooks/{webhook_gid} Update a webhook
Asana.WorkspaceMembershipsApi getWorkspaceMembership GET /workspace_memberships/{workspace_membership_gid} Get a workspace membership
Asana.WorkspaceMembershipsApi getWorkspaceMembershipsForUser GET /users/{user_gid}/workspace_memberships Get workspace memberships for a user
Asana.WorkspaceMembershipsApi getWorkspaceMembershipsForWorkspace GET /workspaces/{workspace_gid}/workspace_memberships Get the workspace memberships for a workspace
Asana.WorkspacesApi addUserForWorkspace POST /workspaces/{workspace_gid}/addUser Add a user to a workspace or organization
Asana.WorkspacesApi getWorkspace GET /workspaces/{workspace_gid} Get a workspace
Asana.WorkspacesApi getWorkspaces GET /workspaces Get multiple workspaces
Asana.WorkspacesApi removeUserForWorkspace POST /workspaces/{workspace_gid}/removeUser Remove a user from a workspace or organization
Asana.WorkspacesApi updateWorkspace PUT /workspaces/{workspace_gid} Update a workspace

Documentation for Models

Documentation for Authorization

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://app.asana.com/-/oauth_authorize
  • Scopes:
    • default: Provides access to all endpoints documented in our API reference. If no scopes are requested, this scope is assumed by default.
    • openid: Provides access to OpenID Connect ID tokens and the OpenID Connect user info endpoint.
    • email: Provides access to the user’s email through the OpenID Connect user info endpoint.
    • profile: Provides access to the user’s name and profile photo through the OpenID Connect user info endpoint.

personalAccessToken

  • Type: Bearer authentication

About

JavaScript/Node.js client library generated from OpenAPI Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published