3.0.5 • Published 2 years ago

autodesk.forge.designautomation v3.0.5

Weekly downloads
78
License
Apache-2.0
Repository
github
Last release
2 years ago

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

```javascript
    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)
```
  1. 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.
    ```javascript
      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)
    ```
  2. 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

ClassMethodHTTP requestDescription
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateActivityPOST /v3/activitiesCreates a new Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateActivityAliasPOST /v3/activities/{id}/aliasesCreates a new alias for this Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateActivityVersionPOST /v3/activities/{id}/versionsCreates a new version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateAppBundlePOST /v3/appbundlesCreates a new AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateAppBundleAliasPOST /v3/appbundles/{id}/aliasesCreates a new alias for this AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateAppBundleVersionPOST /v3/appbundles/{id}/versionsCreates a new version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateNicknamePATCH /v3/forgeapps/{id}Creates/updates the nickname for the current Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateWorkItemPOST /v3/workitemsCreates a new WorkItem and queues it for processing.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApicreateWorkItemsBatchPOST /v3/workitems/batchCreates new WorkItems and queues them for processing.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteActivityDELETE /v3/activities/{id}Deletes the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteActivityAliasDELETE /v3/activities/{id}/aliases/{aliasId}Deletes the alias.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteActivityVersionDELETE /v3/activities/{id}/versions/{version}Deletes the specified version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteAppBundleDELETE /v3/appbundles/{id}Deletes the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteAppBundleAliasDELETE /v3/appbundles/{id}/aliases/{aliasId}Deletes the alias.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteAppBundleVersionDELETE /v3/appbundles/{id}/versions/{version}Deletes the specified version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteForgeAppDELETE /v3/forgeapps/{id}Delete all data associated with this Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteServiceLimitsDELETE /v3/servicelimits/{owner}Deletes user service limits.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApideleteWorkitemDELETE /v3/workitems/{id}Cancels a specific WorkItem.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivitiesGET /v3/activitiesLists all available Activities.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivityGET /v3/activities/{id}Gets the details of the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivityAliasGET /v3/activities/{id}/aliases/{aliasId}Get alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivityAliasesGET /v3/activities/{id}/aliasesLists all aliases for the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivityVersionGET /v3/activities/{id}/versions/{version}Gets the details of the specified version of the Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetActivityVersionsGET /v3/activities/{id}/versionsLists all versions of the specified Activity.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundleGET /v3/appbundles/{id}Gets the details of the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundleAliasGET /v3/appbundles/{id}/aliases/{aliasId}Get alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundleAliasesGET /v3/appbundles/{id}/aliasesLists all aliases for the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundleVersionGET /v3/appbundles/{id}/versions/{version}Gets the details of the specified version of the AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundleVersionsGET /v3/appbundles/{id}/versionsLists all versions of the specified AppBundle.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetAppBundlesGET /v3/appbundlesLists all available AppBundles.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetEngineGET /v3/engines/{id}Gets the details of the specified Engine.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetEnginesGET /v3/enginesLists all available Engines.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetNicknameGET /v3/forgeapps/{id}Returns the user's (app) nickname.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetServiceLimitGET /v3/servicelimits/{owner}Get the service limit configuration.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetSharesGET /v3/sharesGets all Shares (AppBundles and Activities) shared by this Forge app.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApigetWorkitemStatusGET /v3/workitems/{id}Gets the status of a specific WorkItem.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApihealthStatusGET /v3/health/{engine}
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApimodifyActivityAliasPATCH /v3/activities/{id}/aliases/{aliasId}Modify alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApimodifyAppBundleAliasPATCH /v3/appbundles/{id}/aliases/{aliasId}Modify alias details.
AutodeskForgeDesignAutomation.AutodeskForgeDesignautomationApimodifyServiceLimitsPUT /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.