Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bump-version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

current_version="0.9.5"
current_version="0.9.6"
new_version=$1
if [ "$new_version" == "" ]; then
[[ "$current_version" =~ ([0-9]+).+([0-9]+).+([0-9]+)$ ]] && new_version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.$((${BASH_REMATCH[3]} + 1))"
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forge-apis",
"version": "0.9.5",
"version": "0.9.6",
"description": "The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering.",
"license": "Apache-2.0",
"main": "src/index.js",
Expand All @@ -27,12 +27,12 @@
"api"
],
"scripts": {
"test": "./node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 ./test",
"test-oauth": "./node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 ./test/auth",
"test-api": "./node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 ./test/api",
"test-model": "./node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 ./test/model",
"test-hubs": "./node_modules/mocha/bin/mocha --colors --timeout 10000 ./test/api/HubsApi.spec",
"test-oss": "./node_modules/mocha/bin/mocha --colors --timeout 10000 ./test/api/ObjectsApi.spec",
"test": "node node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 test",
"test-oauth": "node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 test/auth",
"test-api": "node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 test/api",
"test-model": "node_modules/mocha/bin/mocha --colors --recursive --timeout 10000 test/model",
"test-hubs": "node_modules/mocha/bin/mocha --colors --timeout 10000 test/api/HubsApi.spec",
"test-oss": "node_modules/mocha/bin/mocha --colors --timeout 10000 test/api/ObjectsApi.spec",
"coverage": "nyc npm run test"
},
"dependencies": {
Expand Down
8 changes: 4 additions & 4 deletions samples/oauthSample.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const FORGE_CLIENT_ID = process.env.FORGE_CLIENT_ID || 'your forge client id';
const FORGE_CLIENT_SECRET = process.env.FORGE_CLIENT_SECRET || 'your forge client secret';

// Initialize the 2-legged oauth2 client
const oAuth2TwoLegged = new ForgeSDK.AuthClientTwoLegged(FORGE_CLIENT_ID, FORGE_CLIENT_SECRET,
['data:write', 'data:read', 'bucket:read', 'bucket:update', 'bucket:create'], true);
const oAuth2TwoLeggedV2 = new ForgeSDK.AuthClientTwoLeggedV2(FORGE_CLIENT_ID, FORGE_CLIENT_SECRET,
['data:read'], true);

// oAuth2TwoLegged.authenticate()
// .then((credentials) => {
Expand All @@ -41,10 +41,10 @@ const oAuth2TwoLegged = new ForgeSDK.AuthClientTwoLegged(FORGE_CLIENT_ID, FORGE_

(async () => {
try {
let credentials = await oAuth2TwoLegged.authenticate();
let credentials = await oAuth2TwoLeggedV2.authenticate();
console.log("**** Got Credentials", JSON.stringify(credentials, null, 4));

const result = await oAuth2TwoLegged.verifyToken(credentials.access_token);
const result = await oAuth2TwoLeggedV2.verifyToken(credentials.access_token);
console.log("**** Credentials verified", JSON.stringify(result, null, 4));
} catch (ex) {
console.error('\x1b[31m Error:', ex, '\x1b[0m');
Expand Down
9 changes: 6 additions & 3 deletions src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,12 @@ module.exports = (function () {
* constructor for a complex type.
* @param {Object} oauth2client oauth2client for the call
* @param {Object} credentials credentials for the call
* @param {String} responseType The type of the response data
* @returns {Object} A Promise object.
*/
exports.prototype.callApi = function callApi (path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, contentTypes, accepts,
returnType, oauth2client, credentials
returnType, oauth2client, credentials, responseType
) {

const _this = this;
Expand All @@ -349,6 +350,7 @@ module.exports = (function () {
const headers = {};
requestParams.qs = this.normalizeParams(queryParams);
requestParams.timeout = this.timeout;
requestParams.responseType = responseType;

const contentType = this.jsonPreferredMime(contentTypes);
if (contentType)
Expand All @@ -373,7 +375,7 @@ module.exports = (function () {
}
if (headerParams['Accept-Encoding'] === 'gzip, deflate')
requestParams.encoding = null;
headerParams['User-Agent'] = 'forge-apis/0.9.5 (nodejs)';
headerParams['User-Agent'] = 'forge-apis/0.9.6 (nodejs)';
_this.debug('request params were', requestParams);

return new Promise(function (resolve, reject) {
Expand All @@ -399,6 +401,7 @@ module.exports = (function () {
maxContentLength: Infinity,
maxBodyLength: Infinity,
data: requestParams.body,
responseType: requestParams.responseType
})
.then((response) => {
if (response.statusCode >= 400) {
Expand Down Expand Up @@ -499,7 +502,7 @@ module.exports = (function () {
}
};

exports.version = '0.9.5';
exports.version = '0.9.6';

exports.userAgentHeaders = {
'User-Agent': `forge-apis/${exports.version} nodejs api wrappers library`,
Expand Down
3 changes: 2 additions & 1 deletion src/api/DerivativesApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ module.exports = (function () {
var contentTypes = ['application/json'];
var accepts = ['application/octet-stream'];
var returnType = Object;
var responseType = 'arraybuffer';

return this.apiClient.callApi(
this.regionPaths[this.region] + '/designdata/{urn}/thumbnail', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType, oauth2client, credentials
contentTypes, accepts, returnType, oauth2client, credentials, responseType
);
};

Expand Down
Loading