Skip to content

Commit 31af224

Browse files
committed
Adding DM Commands API
1 parent 8b9accc commit 31af224

File tree

2 files changed

+211
-0
lines changed

2 files changed

+211
-0
lines changed

src/api/CommandsApi.js

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
/**
2+
* Forge SDK
3+
* 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.
4+
*
5+
* OpenAPI spec version: 0.1.0
6+
* Contact: [email protected]
7+
*
8+
* NOTE: This class is auto generated by the swagger code generator program.
9+
* https://github.com/swagger-api/swagger-codegen.git
10+
* Do not edit the class manually.
11+
*
12+
* Licensed under the Apache License, Version 2.0 (the "License");
13+
* you may not use this file except in compliance with the License.
14+
* You may obtain a copy of the License at
15+
*
16+
* http://www.apache.org/licenses/LICENSE-2.0
17+
*
18+
* Unless required by applicable law or agreed to in writing, software
19+
* distributed under the License is distributed on an "AS IS" BASIS,
20+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
* See the License for the specific language governing permissions and
22+
* limitations under the License.
23+
*/
24+
25+
module.exports = (function() {
26+
'use strict';
27+
28+
var ApiClient = require('forge-apis/src/ApiClient'),
29+
Forbidden = require('forge-apis/src/model/Forbidden'),
30+
NotFound = require('forge-apis/src/model/NotFound');
31+
32+
/**
33+
* Commands service.
34+
* @module api/CommandsApi
35+
*/
36+
37+
/**
38+
* Constructs a new CommandsApi.
39+
* @alias module:api/CommandsApi
40+
* @class
41+
* @param {module:ApiClient} apiClient Optional API client implementation to use,
42+
* default to {@link module:ApiClient#instance} if unspecified.
43+
*/
44+
var exports = function(apiClient) {
45+
this.apiClient = apiClient || ApiClient.instance;
46+
47+
/**
48+
* Checks if a user has permission to perform specified actions on specified resources.
49+
* @param {String} projectId the `project id`
50+
* @param {Object} opts Optional parameters
51+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
52+
* @param {Object} body API payload
53+
* @param {Object} oauth2client oauth2client for the call
54+
* @param {Object} credentials credentials for the call
55+
*/
56+
this.checkPermission = function(projectId, body, opts, oauth2client, credentials) {
57+
body.jsonapi.version = '1.0';
58+
59+
body.data.type = 'commands';
60+
body.data.attributes.extension.type = 'commands:autodesk.core:CheckPermission';
61+
62+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
63+
};
64+
65+
/**
66+
* Retrieves the custom relationships between specified versions of items and other resources in the data domain service (folders, items, and versions). You can retrieve the relationships of up to 50 versions.
67+
* @param {String} projectId the `project id`
68+
* @param {Object} opts Optional parameters
69+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
70+
* @param {Object} body API payload
71+
* @param {Object} oauth2client oauth2client for the call
72+
* @param {Object} credentials credentials for the call
73+
*/
74+
this.listRefs = function(projectId, body, opts, oauth2client, credentials) {
75+
body.jsonapi.version = '1.0';
76+
77+
body.data.type = 'commands';
78+
body.data.attributes.extension.type = 'commands:autodesk.core:ListRefs';
79+
80+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
81+
};
82+
83+
/**
84+
* Retrieves metadata for up to 50 specified items. For example, an item name, or the date it was created. It returns the tip (latest) version of the items.
85+
* @param {String} projectId the `project id`
86+
* @param {Object} opts Optional parameters
87+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
88+
* @param {Object} body API payload
89+
* @param {Object} oauth2client oauth2client for the call
90+
* @param {Object} credentials credentials for the call
91+
*/
92+
this.listItems = function(projectId, body, opts, oauth2client, credentials) {
93+
body.jsonapi.version = '1.0';
94+
95+
body.data.type = 'commands';
96+
body.data.attributes.extension.type = 'commands:autodesk.core:ListItems';
97+
98+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
99+
};
100+
101+
/**
102+
* Creates folders in BIM 360 Docs.
103+
* @param {String} projectId the `project id`
104+
* @param {Object} opts Optional parameters
105+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
106+
* @param {Object} body API payload
107+
* @param {Object} oauth2client oauth2client for the call
108+
* @param {Object} credentials credentials for the call
109+
*/
110+
this.createFolder = function(projectId, body, opts, oauth2client, credentials) {
111+
body.jsonapi.version = '1.0';
112+
113+
body.data.type = 'commands';
114+
body.data.attributes.extension.type = 'commands:autodesk.core:CreateFolder';
115+
116+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
117+
};
118+
119+
/**
120+
* Publishes the latest version of a Collaboration for Revit (C4R) model to BIM 360 Docs.
121+
* @param {String} projectId the `project id`
122+
* @param {Object} opts Optional parameters
123+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
124+
* @param {Object} body API payload
125+
* @param {Object} oauth2client oauth2client for the call
126+
* @param {Object} credentials credentials for the call
127+
*/
128+
this.publishModel = function(projectId, body, opts, oauth2client, credentials) {
129+
body.jsonapi.version = '1.0';
130+
131+
body.data.type = 'commands';
132+
body.data.attributes.extension.type = 'commands:autodesk.bim360:C4RModelPublish';
133+
134+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
135+
};
136+
137+
/**
138+
* Verifies whether a Collaboration for Revit (C4R) model needs to be published to BIM 360 Docs.
139+
* @param {String} projectId the `project id`
140+
* @param {Object} opts Optional parameters
141+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
142+
* @param {Object} body API payload
143+
* @param {Object} oauth2client oauth2client for the call
144+
* @param {Object} credentials credentials for the call
145+
*/
146+
this.getPublishModelJob = function(projectId, body, opts, oauth2client, credentials) {
147+
body.jsonapi.version = '1.0';
148+
149+
body.data.type = 'commands';
150+
body.data.attributes.extension.type = 'commands:autodesk.bim360:C4RModelGetPublishJob';
151+
152+
return (this._commandsApiCall(projectId, body, opts, oauth2client, credentials));
153+
};
154+
155+
/**
156+
* private method
157+
* @param {String} projectId the `project id`
158+
* @param {Object} opts Optional parameters
159+
* @param {String} opts.xuserid API call will be limited to act on behalf of only the user specified
160+
* @param {Object} body API payload
161+
* @param {Object} oauth2client oauth2client for the call
162+
* @param {Object} credentials credentials for the call
163+
*/
164+
this._commandsApiCall = function(projectId, body, opts, oauth2client, credentials) {
165+
opts = opts || {};
166+
167+
// verify the required parameter 'projectId' is set
168+
if (projectId == undefined || projectId == null) {
169+
return Promise.reject("Missing the required parameter 'projectId' when calling checkPermission");
170+
}
171+
172+
// verify the required parameter 'body' is set
173+
if (body == undefined || body == null) {
174+
return Promise.reject("Missing the required parameter 'body' when calling checkPermission");
175+
}
176+
177+
var postBody = body;
178+
179+
var pathParams = {
180+
project_id: projectId
181+
};
182+
var queryParams = {
183+
};
184+
185+
var headerParams = {
186+
'x-user-id': opts.xuserid
187+
};
188+
var formParams = {
189+
};
190+
191+
var contentTypes = ['application/vnd.api+json'];
192+
var accepts = ['application/vnd.api+json', 'application/json'];
193+
var returnType = null;
194+
195+
return this.apiClient.callApi(
196+
'/data/v1/projects/{project_id}/commands', 'GET',
197+
pathParams, queryParams, headerParams, formParams, postBody,
198+
contentTypes, accepts, returnType, oauth2client, credentials
199+
);
200+
};
201+
202+
};
203+
204+
return exports;
205+
}());

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ module.exports = (function() {
174174
ActivitiesApi = require('./api/ActivitiesApi'),
175175
AppPackagesApi = require('./api/AppPackagesApi'),
176176
BucketsApi = require('./api/BucketsApi'),
177+
CommandsApi = require('./api/CommandsApi'),
177178
DerivativesApi = require('./api/DerivativesApi'),
178179
EnginesApi = require('./api/EnginesApi'),
179180
FoldersApi = require('./api/FoldersApi'),
@@ -953,6 +954,11 @@ module.exports = (function() {
953954
* @property {module:api/BucketsApi}
954955
*/
955956
BucketsApi: BucketsApi,
957+
/**
958+
* The CommandsApi service constructor.
959+
* @property {module:api/CommandsApi}
960+
*/
961+
CommandsApi: CommandsApi,
956962
/**
957963
* The DerivativesApi service constructor.
958964
* @property {module:api/DerivativesApi}

0 commit comments

Comments
 (0)