Skip to content

Commit ce01cfe

Browse files
committed
MINOR: import from project route (#664)
* feat: clone project route * renaming route, reverse pk and project_id * renaming * simpler help text
1 parent 7374fee commit ce01cfe

File tree

9 files changed

+352
-6
lines changed

9 files changed

+352
-6
lines changed

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ docs/Project.md
145145
docs/ProjectAccessToken.md
146146
docs/ProjectAccessTokenRequest.md
147147
docs/ProjectFolderTree.md
148+
docs/ProjectImportRequest.md
148149
docs/ProjectInvitation.md
149150
docs/ProjectInvitationRequest.md
150151
docs/ProjectRequest.md
@@ -389,6 +390,7 @@ src/model/Project.js
389390
src/model/ProjectAccessToken.js
390391
src/model/ProjectAccessTokenRequest.js
391392
src/model/ProjectFolderTree.js
393+
src/model/ProjectImportRequest.js
392394
src/model/ProjectInvitation.js
393395
src/model/ProjectInvitationRequest.js
394396
src/model/ProjectRequest.js
@@ -627,6 +629,7 @@ test/model/Project.spec.js
627629
test/model/ProjectAccessToken.spec.js
628630
test/model/ProjectAccessTokenRequest.spec.js
629631
test/model/ProjectFolderTree.spec.js
632+
test/model/ProjectImportRequest.spec.js
630633
test/model/ProjectInvitation.spec.js
631634
test/model/ProjectInvitationRequest.spec.js
632635
test/model/ProjectRequest.spec.js

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ Class | Method | HTTP request | Description
286286
*bimdata.CollaborationApi* | [**getVisaComment**](docs/CollaborationApi.md#getVisaComment) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment/{id} | Retrieve a comment
287287
*bimdata.CollaborationApi* | [**getVisaComments**](docs/CollaborationApi.md#getVisaComments) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment | List all comment of a visa
288288
*bimdata.CollaborationApi* | [**getVisas**](docs/CollaborationApi.md#getVisas) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa | List all visas of a document
289+
*bimdata.CollaborationApi* | [**importFromProject**](docs/CollaborationApi.md#importFromProject) | **POST** /cloud/{cloud_pk}/project/{id}/import_from | Import data from a project
289290
*bimdata.CollaborationApi* | [**importManageGroup**](docs/CollaborationApi.md#importManageGroup) | **POST** /cloud/{cloud_pk}/project/{project_pk}/group/import | Import a group from another project
290291
*bimdata.CollaborationApi* | [**inviteCloudUser**](docs/CollaborationApi.md#inviteCloudUser) | **POST** /cloud/{cloud_pk}/invitation | Invite a cloud administrator
291292
*bimdata.CollaborationApi* | [**inviteProjectUser**](docs/CollaborationApi.md#inviteProjectUser) | **POST** /cloud/{cloud_pk}/project/{project_pk}/invitation | Invite a project member
@@ -758,6 +759,7 @@ Class | Method | HTTP request | Description
758759
- [bimdata.ProjectAccessToken](docs/ProjectAccessToken.md)
759760
- [bimdata.ProjectAccessTokenRequest](docs/ProjectAccessTokenRequest.md)
760761
- [bimdata.ProjectFolderTree](docs/ProjectFolderTree.md)
762+
- [bimdata.ProjectImportRequest](docs/ProjectImportRequest.md)
761763
- [bimdata.ProjectInvitation](docs/ProjectInvitation.md)
762764
- [bimdata.ProjectInvitationRequest](docs/ProjectInvitationRequest.md)
763765
- [bimdata.ProjectRequest](docs/ProjectRequest.md)

docs/CollaborationApi.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Method | HTTP request | Description
8787
[**getVisaComment**](CollaborationApi.md#getVisaComment) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment/{id} | Retrieve a comment
8888
[**getVisaComments**](CollaborationApi.md#getVisaComments) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment | List all comment of a visa
8989
[**getVisas**](CollaborationApi.md#getVisas) | **GET** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa | List all visas of a document
90+
[**importFromProject**](CollaborationApi.md#importFromProject) | **POST** /cloud/{cloud_pk}/project/{id}/import_from | Import data from a project
9091
[**importManageGroup**](CollaborationApi.md#importManageGroup) | **POST** /cloud/{cloud_pk}/project/{project_pk}/group/import | Import a group from another project
9192
[**inviteCloudUser**](CollaborationApi.md#inviteCloudUser) | **POST** /cloud/{cloud_pk}/invitation | Invite a cloud administrator
9293
[**inviteProjectUser**](CollaborationApi.md#inviteProjectUser) | **POST** /cloud/{cloud_pk}/project/{project_pk}/invitation | Invite a project member
@@ -955,7 +956,7 @@ Name | Type | Description | Notes
955956
956957
Create a document
957958

958-
Create a document. If the document is one of {'DXF', 'OBJ', 'IFC', 'POINT_CLOUD', 'GLTF', 'DWG'}, a model will be created and attached to this document Required scopes: document:write
959+
Create a document. If the document is one of {'GLTF', 'POINT_CLOUD', 'DWG', 'OBJ', 'IFC', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
959960

960961
### Example
961962

@@ -5471,13 +5472,78 @@ Name | Type | Description | Notes
54715472
- **Accept**: application/json
54725473

54735474

5475+
## importFromProject
5476+
5477+
> Project importFromProject(cloudPk, id, projectImportRequest)
5478+
5479+
Import data from a project
5480+
5481+
Import dms tree and/or the groups from a project Required scopes: org:manage
5482+
5483+
### Example
5484+
5485+
```javascript
5486+
import bimdata from '@bimdata/bimdata-api-client';
5487+
let defaultClient = bimdata.ApiClient.instance;
5488+
// Configure API key authorization: ApiKey
5489+
let ApiKey = defaultClient.authentications['ApiKey'];
5490+
ApiKey.apiKey = 'YOUR API KEY';
5491+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
5492+
//ApiKey.apiKeyPrefix = 'Token';
5493+
// Configure OAuth2 access token for authorization: BIMData_Connect
5494+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
5495+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
5496+
// Configure OAuth2 access token for authorization: BIMData_Connect
5497+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
5498+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
5499+
// Configure API key authorization: Bearer
5500+
let Bearer = defaultClient.authentications['Bearer'];
5501+
Bearer.apiKey = 'YOUR API KEY';
5502+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
5503+
//Bearer.apiKeyPrefix = 'Token';
5504+
5505+
let apiInstance = new bimdata.CollaborationApi();
5506+
let cloudPk = 56; // Number |
5507+
let id = 56; // Number | A unique integer value identifying this project.
5508+
let projectImportRequest = new bimdata.ProjectImportRequest(); // ProjectImportRequest |
5509+
apiInstance.importFromProject(cloudPk, id, projectImportRequest).then((data) => {
5510+
console.log('API called successfully. Returned data: ' + data);
5511+
}, (error) => {
5512+
console.error(error);
5513+
});
5514+
5515+
```
5516+
5517+
### Parameters
5518+
5519+
5520+
Name | Type | Description | Notes
5521+
------------- | ------------- | ------------- | -------------
5522+
**cloudPk** | **Number**| |
5523+
**id** | **Number**| A unique integer value identifying this project. |
5524+
**projectImportRequest** | [**ProjectImportRequest**](ProjectImportRequest.md)| |
5525+
5526+
### Return type
5527+
5528+
[**Project**](Project.md)
5529+
5530+
### Authorization
5531+
5532+
[ApiKey](../README.md#ApiKey), [BIMData_Connect](../README.md#BIMData_Connect), [BIMData_Connect](../README.md#BIMData_Connect), [Bearer](../README.md#Bearer)
5533+
5534+
### HTTP request headers
5535+
5536+
- **Content-Type**: application/json, application/x-www-form-urlencoded, multipart/form-data
5537+
- **Accept**: application/json
5538+
5539+
54745540
## importManageGroup
54755541

54765542
> [Group] importManageGroup(cloudPk, projectPk, importGroupRequest)
54775543
54785544
Import a group from another project
54795545

5480-
Import a group from another project. Must be an admin of the project Required scopes: org:manage
5546+
DEPECRATED: Use ImportFromProject instead Required scopes: org:manage
54815547

54825548
### Example
54835549

docs/ProjectImportRequest.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# bimdata.ProjectImportRequest
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**projectId** | **Number** | The source project_id |
8+
**importDms** | **Boolean** | | [optional] [default to true]
9+
**importUsers** | **Boolean** | | [optional] [default to true]
10+
**importGroups** | **Boolean** | | [optional] [default to true]
11+
12+

src/api/CollaborationApi.js

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import Project from '../model/Project';
4848
import ProjectAccessToken from '../model/ProjectAccessToken';
4949
import ProjectAccessTokenRequest from '../model/ProjectAccessTokenRequest';
5050
import ProjectFolderTree from '../model/ProjectFolderTree';
51+
import ProjectImportRequest from '../model/ProjectImportRequest';
5152
import ProjectInvitation from '../model/ProjectInvitation';
5253
import ProjectInvitationRequest from '../model/ProjectInvitationRequest';
5354
import ProjectRequest from '../model/ProjectRequest';
@@ -858,7 +859,7 @@ export default class CollaborationApi {
858859

859860
/**
860861
* Create a document
861-
* Create a document. If the document is one of {'DXF', 'OBJ', 'IFC', 'POINT_CLOUD', 'GLTF', 'DWG'}, a model will be created and attached to this document Required scopes: document:write
862+
* Create a document. If the document is one of {'GLTF', 'POINT_CLOUD', 'DWG', 'OBJ', 'IFC', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
862863
* @param {Number} cloudPk A unique integer value identifying this cloud.
863864
* @param {Number} projectPk A unique integer value identifying this project.
864865
* @param {String} name Shown name of the file
@@ -924,7 +925,7 @@ export default class CollaborationApi {
924925

925926
/**
926927
* Create a document
927-
* Create a document. If the document is one of {'DXF', 'OBJ', 'IFC', 'POINT_CLOUD', 'GLTF', 'DWG'}, a model will be created and attached to this document Required scopes: document:write
928+
* Create a document. If the document is one of {'GLTF', 'POINT_CLOUD', 'DWG', 'OBJ', 'IFC', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
928929
* @param {Number} cloudPk A unique integer value identifying this cloud.
929930
* @param {Number} projectPk A unique integer value identifying this project.
930931
* @param {String} name Shown name of the file
@@ -5034,9 +5035,70 @@ export default class CollaborationApi {
50345035
}
50355036

50365037

5038+
/**
5039+
* Import data from a project
5040+
* Import dms tree and/or the groups from a project Required scopes: org:manage
5041+
* @param {Number} cloudPk
5042+
* @param {Number} id A unique integer value identifying this project.
5043+
* @param {module:model/ProjectImportRequest} projectImportRequest
5044+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Project} and HTTP response
5045+
*/
5046+
importFromProjectWithHttpInfo(cloudPk, id, projectImportRequest) {
5047+
let postBody = projectImportRequest;
5048+
// verify the required parameter 'cloudPk' is set
5049+
if (cloudPk === undefined || cloudPk === null) {
5050+
throw new Error("Missing the required parameter 'cloudPk' when calling importFromProject");
5051+
}
5052+
// verify the required parameter 'id' is set
5053+
if (id === undefined || id === null) {
5054+
throw new Error("Missing the required parameter 'id' when calling importFromProject");
5055+
}
5056+
// verify the required parameter 'projectImportRequest' is set
5057+
if (projectImportRequest === undefined || projectImportRequest === null) {
5058+
throw new Error("Missing the required parameter 'projectImportRequest' when calling importFromProject");
5059+
}
5060+
5061+
let pathParams = {
5062+
'cloud_pk': cloudPk,
5063+
'id': id
5064+
};
5065+
let queryParams = {
5066+
};
5067+
let headerParams = {
5068+
};
5069+
let formParams = {
5070+
};
5071+
5072+
let authNames = ['ApiKey', 'BIMData_Connect', 'BIMData_Connect', 'Bearer'];
5073+
let contentTypes = ['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'];
5074+
let accepts = ['application/json'];
5075+
let returnType = Project;
5076+
return this.apiClient.callApi(
5077+
'/cloud/{cloud_pk}/project/{id}/import_from', 'POST',
5078+
pathParams, queryParams, headerParams, formParams, postBody,
5079+
authNames, contentTypes, accepts, returnType, null
5080+
);
5081+
}
5082+
5083+
/**
5084+
* Import data from a project
5085+
* Import dms tree and/or the groups from a project Required scopes: org:manage
5086+
* @param {Number} cloudPk
5087+
* @param {Number} id A unique integer value identifying this project.
5088+
* @param {module:model/ProjectImportRequest} projectImportRequest
5089+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Project}
5090+
*/
5091+
importFromProject(cloudPk, id, projectImportRequest) {
5092+
return this.importFromProjectWithHttpInfo(cloudPk, id, projectImportRequest)
5093+
.then(function(response_and_data) {
5094+
return response_and_data.data;
5095+
});
5096+
}
5097+
5098+
50375099
/**
50385100
* Import a group from another project
5039-
* Import a group from another project. Must be an admin of the project Required scopes: org:manage
5101+
* DEPECRATED: Use ImportFromProject instead Required scopes: org:manage
50405102
* @param {Number} cloudPk A unique integer value identifying this cloud.
50415103
* @param {Number} projectPk A unique integer value identifying this project.
50425104
* @param {module:model/ImportGroupRequest} importGroupRequest
@@ -5081,7 +5143,7 @@ export default class CollaborationApi {
50815143

50825144
/**
50835145
* Import a group from another project
5084-
* Import a group from another project. Must be an admin of the project Required scopes: org:manage
5146+
* DEPECRATED: Use ImportFromProject instead Required scopes: org:manage
50855147
* @param {Number} cloudPk A unique integer value identifying this cloud.
50865148
* @param {Number} projectPk A unique integer value identifying this project.
50875149
* @param {module:model/ImportGroupRequest} importGroupRequest

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ import Project from './model/Project';
152152
import ProjectAccessToken from './model/ProjectAccessToken';
153153
import ProjectAccessTokenRequest from './model/ProjectAccessTokenRequest';
154154
import ProjectFolderTree from './model/ProjectFolderTree';
155+
import ProjectImportRequest from './model/ProjectImportRequest';
155156
import ProjectInvitation from './model/ProjectInvitation';
156157
import ProjectInvitationRequest from './model/ProjectInvitationRequest';
157158
import ProjectRequest from './model/ProjectRequest';
@@ -1125,6 +1126,12 @@ export {
11251126
*/
11261127
ProjectFolderTree,
11271128

1129+
/**
1130+
* The ProjectImportRequest model constructor.
1131+
* @property {module:model/ProjectImportRequest}
1132+
*/
1133+
ProjectImportRequest,
1134+
11281135
/**
11291136
* The ProjectInvitation model constructor.
11301137
* @property {module:model/ProjectInvitation}

src/model/ProjectImportRequest.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/**
2+
* BIMData API
3+
* BIMData API is a tool to interact with your models stored on BIMData’s servers. Through the API, you can manage your projects, the clouds, upload your IFC files and manage them through endpoints.
4+
*
5+
* The version of the OpenAPI document: v1 (v1)
6+
* Contact: support@bimdata.io
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*
12+
*/
13+
14+
import ApiClient from '../ApiClient';
15+
16+
/**
17+
* The ProjectImportRequest model module.
18+
* @module model/ProjectImportRequest
19+
* @version 0.0.0
20+
*/
21+
class ProjectImportRequest {
22+
/**
23+
* Constructs a new <code>ProjectImportRequest</code>.
24+
* @alias module:model/ProjectImportRequest
25+
* @param projectId {Number} The source project_id
26+
*/
27+
constructor(projectId) {
28+
29+
ProjectImportRequest.initialize(this, projectId);
30+
}
31+
32+
/**
33+
* Initializes the fields of this object.
34+
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
35+
* Only for internal use.
36+
*/
37+
static initialize(obj, projectId) {
38+
obj['project_id'] = projectId;
39+
}
40+
41+
/**
42+
* Constructs a <code>ProjectImportRequest</code> from a plain JavaScript object, optionally creating a new instance.
43+
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
44+
* @param {Object} data The plain JavaScript object bearing properties of interest.
45+
* @param {module:model/ProjectImportRequest} obj Optional instance to populate.
46+
* @return {module:model/ProjectImportRequest} The populated <code>ProjectImportRequest</code> instance.
47+
*/
48+
static constructFromObject(data, obj) {
49+
if (data) {
50+
obj = obj || new ProjectImportRequest();
51+
52+
if (data.hasOwnProperty('project_id')) {
53+
obj['project_id'] = ApiClient.convertToType(data['project_id'], 'Number');
54+
}
55+
if (data.hasOwnProperty('import_dms')) {
56+
obj['import_dms'] = ApiClient.convertToType(data['import_dms'], 'Boolean');
57+
}
58+
if (data.hasOwnProperty('import_users')) {
59+
obj['import_users'] = ApiClient.convertToType(data['import_users'], 'Boolean');
60+
}
61+
if (data.hasOwnProperty('import_groups')) {
62+
obj['import_groups'] = ApiClient.convertToType(data['import_groups'], 'Boolean');
63+
}
64+
}
65+
return obj;
66+
}
67+
68+
69+
}
70+
71+
/**
72+
* The source project_id
73+
* @member {Number} project_id
74+
*/
75+
ProjectImportRequest.prototype['project_id'] = undefined;
76+
77+
/**
78+
* @member {Boolean} import_dms
79+
* @default true
80+
*/
81+
ProjectImportRequest.prototype['import_dms'] = true;
82+
83+
/**
84+
* @member {Boolean} import_users
85+
* @default true
86+
*/
87+
ProjectImportRequest.prototype['import_users'] = true;
88+
89+
/**
90+
* @member {Boolean} import_groups
91+
* @default true
92+
*/
93+
ProjectImportRequest.prototype['import_groups'] = true;
94+
95+
96+
97+
98+
99+
100+
export default ProjectImportRequest;
101+

test/api/CollaborationApi.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,16 @@
878878
done();
879879
});
880880
});
881+
describe('importFromProject', function() {
882+
it('should call importFromProject successfully', function(done) {
883+
//uncomment below and update the code to test importFromProject
884+
//instance.importFromProject(function(error) {
885+
// if (error) throw error;
886+
//expect().to.be();
887+
//});
888+
done();
889+
});
890+
});
881891
describe('importManageGroup', function() {
882892
it('should call importManageGroup successfully', function(done) {
883893
//uncomment below and update the code to test importManageGroup

0 commit comments

Comments
 (0)