autodesk.forge.designautomation
TypeScript icon, indicating that this package has built-in type declarations

3.0.5 • Public • Published

autodesk.forge.designautomation

Design-Automation SDK Node.js

Overview

AutodeskForgeDesignAutomation - Asynchronous Node.js library for the Autodesk Forge Design Automation v3 implementation.

Requirements

Contributions

Contributions are welcome! Please open a Pull Request.

Support

Please ask questions on StackOverflow with tag autodesk-designautomation tag. If it turns out that you may have found a bug, please open an issue

Tutorials

Please visit Learn Forge tutorial.

Installation

For Node.js

npm

npm package is published on npm. Install this package using following command

npm install autodesk.forge.designautomation --save

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
      }
    }
  ]
}

Configuring ApiClient

User can use default settings or change following properties of ApiClient.

  1. CircuitBreaker : Configure the threshold failure count and failure interval of circuit breaker.

    Default :

    • Failure Count : 10
    • Failure interval : 10000 ms
        let AutodeskForgeDesignAutomation = require('autodesk.forge.designautomation');
        let config = {
          "circuitBreaker": {
              "threshold": 11,
              "interval": 1200
          }
        };
        let apiClient = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationClient(config);
        let api = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationApi(apiClient)
  2. Retry : Autodesk resiliency library provides 3 types of retry policies.

    • WAIT : Retry after fixed delay interval.
    • EXPONENTIAL : Retry after exponential delay interval.
    • JITTER : Retry after exponential delay with jitter interval.

    User can specify number of retry count and retry policy.

      let AutodeskForgeDesignAutomation = require('autodesk.forge.designautomation');
      let config = {
          "retry" : {
              "maxNumberOfRetries" :  7,
              "backoffDelay" : 4000,
              "backoffPolicy" : "exponentialBackoffWithJitter"
          }
      };
      let apiClient = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationClient(config);
      let api = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationApi(apiClient)
  3. Timeout : Set request timeout.

    	  let AutodeskForgeDesignAutomation = require('autodesk.forge.designautomation');
    	
        let config = {
            "requestTimeout" : 13000
        };
        let apiClient = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationClient(config);
        let api = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationApi(apiClient)

Getting Started

Please follow the installation instruction and execute the following code:

  1. Default api client
let AutodeskForgeDesignAutomation = require('autodesk.forge.designautomation');

let defaultClient = AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationClient.instance;

// Configure OAuth2 access token for authorization: 2-legged
let oauth = defaultClient.authManager.authentications['2-legged'];
oauth.accessToken = "YOUR ACCESS TOKEN";

// And/Or you can pass fetchToken and refreshToken to manage the token
oauth.fetchToken = function() { return Promise.resolve({accessToken: "token", expiresIn: 300000}) }
oauth.refreshToken = function() { return Promise.resolve({accessToken: "token", expiresIn: 300000}) }

let api = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationApi()

let item = new AutodeskForgeDesignAutomation.Activity(); // {Activity} 

api.createActivity(item).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});
  1. ApiClient configuration
let AutodeskForgeDesignAutomation = require('autodesk.forge.designautomation');

let config = {
		        "retry" : {
		            "maxNumberOfRetries" :  7,
		            "backoffDelay" : 4000,
		            "backoffPolicy" : "exponentialBackoffWithJitter"
		        },
		        "circuitBreaker": {
		            "threshold": 11,
		            "interval": 1200
		        },
		        "requestTimeout" : 13000
		    };
    
let client = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationClient(config); 


// Configure OAuth2 access token for authorization: 2-legged
let oauth = client.authManager.authentications['2-legged'];
oauth.accessToken = "YOUR ACCESS TOKEN";

// And/Or you can pass fetchToken and refreshToken to manage the token
oauth.fetchToken = function() { return Promise.resolve({accessToken: "token", expiresIn: 300000}) }
oauth.refreshToken = function() { return Promise.resolve({accessToken: "token", expiresIn: 300000}) }


let api = new AutodeskForgeDesignAutomation.AutodeskForgeDesignAutomationApi(client)

let item = new AutodeskForgeDesignAutomation.Activity(); // {Activity} 

api.createActivity(item).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});

Documentation for API Endpoints

All URIs are relative to https://developer.api.autodesk.com/da/us-east

Class Method HTTP request Description
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createActivity POST /v3/activities Creates a new Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createActivityAlias POST /v3/activities/{id}/aliases Creates a new alias for this Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createActivityVersion POST /v3/activities/{id}/versions Creates a new version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createAppBundle POST /v3/appbundles Creates a new AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createAppBundleAlias POST /v3/appbundles/{id}/aliases Creates a new alias for this AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createAppBundleVersion POST /v3/appbundles/{id}/versions Creates a new version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createNickname PATCH /v3/forgeapps/{id} Creates/updates the nickname for the current Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createWorkItem POST /v3/workitems Creates a new WorkItem and queues it for processing.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi createWorkItemsBatch POST /v3/workitems/batch Creates new WorkItems and queues them for processing.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteActivity DELETE /v3/activities/{id} Deletes the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteActivityAlias DELETE /v3/activities/{id}/aliases/{aliasId} Deletes the alias.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteActivityVersion DELETE /v3/activities/{id}/versions/{version} Deletes the specified version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteAppBundle DELETE /v3/appbundles/{id} Deletes the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteAppBundleAlias DELETE /v3/appbundles/{id}/aliases/{aliasId} Deletes the alias.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteAppBundleVersion DELETE /v3/appbundles/{id}/versions/{version} Deletes the specified version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteForgeApp DELETE /v3/forgeapps/{id} Delete all data associated with this Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteServiceLimits DELETE /v3/servicelimits/{owner} Deletes user service limits.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi deleteWorkitem DELETE /v3/workitems/{id} Cancels a specific WorkItem.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivities GET /v3/activities Lists all available Activities.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivity GET /v3/activities/{id} Gets the details of the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivityAlias GET /v3/activities/{id}/aliases/{aliasId} Get alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivityAliases GET /v3/activities/{id}/aliases Lists all aliases for the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivityVersion GET /v3/activities/{id}/versions/{version} Gets the details of the specified version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getActivityVersions GET /v3/activities/{id}/versions Lists all versions of the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundle GET /v3/appbundles/{id} Gets the details of the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundleAlias GET /v3/appbundles/{id}/aliases/{aliasId} Get alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundleAliases GET /v3/appbundles/{id}/aliases Lists all aliases for the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundleVersion GET /v3/appbundles/{id}/versions/{version} Gets the details of the specified version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundleVersions GET /v3/appbundles/{id}/versions Lists all versions of the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getAppBundles GET /v3/appbundles Lists all available AppBundles.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getEngine GET /v3/engines/{id} Gets the details of the specified Engine.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getEngines GET /v3/engines Lists all available Engines.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getNickname GET /v3/forgeapps/{id} Returns the user's (app) nickname.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getServiceLimit GET /v3/servicelimits/{owner} Get the service limit configuration.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getShares GET /v3/shares Gets all Shares (AppBundles and Activities) shared by this Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi getWorkitemStatus GET /v3/workitems/{id} Gets the status of a specific WorkItem.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi healthStatus GET /v3/health/{engine}
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi modifyActivityAlias PATCH /v3/activities/{id}/aliases/{aliasId} Modify alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi modifyAppBundleAlias PATCH /v3/appbundles/{id}/aliases/{aliasId} Modify alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApi modifyServiceLimits PUT /v3/servicelimits/{owner} Creates a new service limits configuration or updates exiting.

Documentation for Models

Documentation for Authorization

2-legged

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
    • code:all: Author or execute your codes

3-legged

License

This sample is licensed under the terms of the Apache License 2.0. Please see the LICENSE file for full details.

Keywords

none

Install

npm i autodesk.forge.designautomation

DownloadsWeekly Downloads

2,735

Version

3.0.5

License

Apache-2.0

Unpacked Size

693 kB

Total Files

6

Last publish

Collaborators

  • cyrillef1