Skip to content

Commit 59336cc

Browse files
committed
MINOR: add logging for documents, folder and user invitations (#712)
* first implementation with documents * implement and test documents and folders * aborted try to test folder permission propagation * fix test get_path * add project invitation logs * improve admin * typo * add log view test and scope * fix check_access test * commit app migrations
1 parent 412aa98 commit 59336cc

File tree

9 files changed

+411
-3
lines changed

9 files changed

+411
-3
lines changed

.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ docs/LayerElementRequest.md
7676
docs/LayerRequest.md
7777
docs/Line.md
7878
docs/LineRequest.md
79+
docs/LogEntry.md
7980
docs/MarketplaceAppImage.md
8081
docs/MarketplaceAppLight.md
8182
docs/MarketplaceAppLightRequest.md
@@ -329,6 +330,7 @@ src/model/LayerElementRequest.js
329330
src/model/LayerRequest.js
330331
src/model/Line.js
331332
src/model/LineRequest.js
333+
src/model/LogEntry.js
332334
src/model/MarketplaceAppImage.js
333335
src/model/MarketplaceAppLight.js
334336
src/model/MarketplaceAppLightRequest.js
@@ -575,6 +577,7 @@ test/model/LayerElementRequest.spec.js
575577
test/model/LayerRequest.spec.js
576578
test/model/Line.spec.js
577579
test/model/LineRequest.spec.js
580+
test/model/LogEntry.spec.js
578581
test/model/MarketplaceAppImage.spec.js
579582
test/model/MarketplaceAppLight.spec.js
580583
test/model/MarketplaceAppLightRequest.spec.js

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ Class | Method | HTTP request | Description
260260
*bimdata.CollaborationApi* | [**getFolders**](docs/CollaborationApi.md#getFolders) | **GET** /cloud/{cloud_pk}/project/{project_pk}/folder | Retrieve all folders
261261
*bimdata.CollaborationApi* | [**getGroup**](docs/CollaborationApi.md#getGroup) | **GET** /cloud/{cloud_pk}/project/{project_pk}/me/group/{id} | Retrieve a group
262262
*bimdata.CollaborationApi* | [**getGroups**](docs/CollaborationApi.md#getGroups) | **GET** /cloud/{cloud_pk}/project/{project_pk}/me/group | Retrieve all groups
263+
*bimdata.CollaborationApi* | [**getLogs**](docs/CollaborationApi.md#getLogs) | **GET** /cloud/{cloud_pk}/project/{project_pk}/logs | Retrieve all logs of the project
263264
*bimdata.CollaborationApi* | [**getManageGroup**](docs/CollaborationApi.md#getManageGroup) | **GET** /cloud/{cloud_pk}/project/{project_pk}/group/{id} | Retrieve a group
264265
*bimdata.CollaborationApi* | [**getManageGroups**](docs/CollaborationApi.md#getManageGroups) | **GET** /cloud/{cloud_pk}/project/{project_pk}/group | Retrieve all groups
265266
*bimdata.CollaborationApi* | [**getProject**](docs/CollaborationApi.md#getProject) | **GET** /cloud/{cloud_pk}/project/{id} | Retrieve a project
@@ -704,6 +705,7 @@ Class | Method | HTTP request | Description
704705
- [bimdata.LayerRequest](docs/LayerRequest.md)
705706
- [bimdata.Line](docs/Line.md)
706707
- [bimdata.LineRequest](docs/LineRequest.md)
708+
- [bimdata.LogEntry](docs/LogEntry.md)
707709
- [bimdata.MarketplaceAppImage](docs/MarketplaceAppImage.md)
708710
- [bimdata.MarketplaceAppLight](docs/MarketplaceAppLight.md)
709711
- [bimdata.MarketplaceAppLightRequest](docs/MarketplaceAppLightRequest.md)

docs/CollaborationApi.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Method | HTTP request | Description
6161
[**getFolders**](CollaborationApi.md#getFolders) | **GET** /cloud/{cloud_pk}/project/{project_pk}/folder | Retrieve all folders
6262
[**getGroup**](CollaborationApi.md#getGroup) | **GET** /cloud/{cloud_pk}/project/{project_pk}/me/group/{id} | Retrieve a group
6363
[**getGroups**](CollaborationApi.md#getGroups) | **GET** /cloud/{cloud_pk}/project/{project_pk}/me/group | Retrieve all groups
64+
[**getLogs**](CollaborationApi.md#getLogs) | **GET** /cloud/{cloud_pk}/project/{project_pk}/logs | Retrieve all logs of the project
6465
[**getManageGroup**](CollaborationApi.md#getManageGroup) | **GET** /cloud/{cloud_pk}/project/{project_pk}/group/{id} | Retrieve a group
6566
[**getManageGroups**](CollaborationApi.md#getManageGroups) | **GET** /cloud/{cloud_pk}/project/{project_pk}/group | Retrieve all groups
6667
[**getProject**](CollaborationApi.md#getProject) | **GET** /cloud/{cloud_pk}/project/{id} | Retrieve a project
@@ -960,7 +961,7 @@ Name | Type | Description | Notes
960961
961962
Create a document
962963

963-
Create a document. If the document is one of {'DWG', 'IFC', 'GLTF', 'POINT_CLOUD', 'OBJ', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
964+
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
964965

965966
### Example
966967

@@ -3928,6 +3929,69 @@ Name | Type | Description | Notes
39283929
- **Accept**: application/json
39293930

39303931

3932+
## getLogs
3933+
3934+
> [LogEntry] getLogs(cloudPk, projectPk)
3935+
3936+
Retrieve all logs of the project
3937+
3938+
Retrieve all logs of the project Required scopes: logs:read
3939+
3940+
### Example
3941+
3942+
```javascript
3943+
import bimdata from '@bimdata/bimdata-api-client';
3944+
let defaultClient = bimdata.ApiClient.instance;
3945+
// Configure API key authorization: ApiKey
3946+
let ApiKey = defaultClient.authentications['ApiKey'];
3947+
ApiKey.apiKey = 'YOUR API KEY';
3948+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
3949+
//ApiKey.apiKeyPrefix = 'Token';
3950+
// Configure OAuth2 access token for authorization: BIMData_Connect
3951+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
3952+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
3953+
// Configure OAuth2 access token for authorization: BIMData_Connect
3954+
let BIMData_Connect = defaultClient.authentications['BIMData_Connect'];
3955+
BIMData_Connect.accessToken = 'YOUR ACCESS TOKEN';
3956+
// Configure API key authorization: Bearer
3957+
let Bearer = defaultClient.authentications['Bearer'];
3958+
Bearer.apiKey = 'YOUR API KEY';
3959+
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
3960+
//Bearer.apiKeyPrefix = 'Token';
3961+
3962+
let apiInstance = new bimdata.CollaborationApi();
3963+
let cloudPk = 56; // Number |
3964+
let projectPk = 56; // Number |
3965+
apiInstance.getLogs(cloudPk, projectPk).then((data) => {
3966+
console.log('API called successfully. Returned data: ' + data);
3967+
}, (error) => {
3968+
console.error(error);
3969+
});
3970+
3971+
```
3972+
3973+
### Parameters
3974+
3975+
3976+
Name | Type | Description | Notes
3977+
------------- | ------------- | ------------- | -------------
3978+
**cloudPk** | **Number**| |
3979+
**projectPk** | **Number**| |
3980+
3981+
### Return type
3982+
3983+
[**[LogEntry]**](LogEntry.md)
3984+
3985+
### Authorization
3986+
3987+
[ApiKey](../README.md#ApiKey), [BIMData_Connect](../README.md#BIMData_Connect), [BIMData_Connect](../README.md#BIMData_Connect), [Bearer](../README.md#Bearer)
3988+
3989+
### HTTP request headers
3990+
3991+
- **Content-Type**: Not defined
3992+
- **Accept**: application/json
3993+
3994+
39313995
## getManageGroup
39323996

39333997
> Group getManageGroup(cloudPk, id, projectPk)

docs/LogEntry.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# bimdata.LogEntry
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**id** | **Number** | | [readonly]
8+
**userId** | **Number** | | [readonly]
9+
**userEmail** | **String** | |
10+
**appName** | **String** | |
11+
**projectName** | **String** | |
12+
**date** | **Date** | | [readonly]
13+
**action** | **String** | |
14+
**description** | **{String: Object}** | |
15+
16+

src/api/CollaborationApi.js

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Group from '../model/Group';
3131
import GroupFolder from '../model/GroupFolder';
3232
import GroupRequest from '../model/GroupRequest';
3333
import ImportGroupRequest from '../model/ImportGroupRequest';
34+
import LogEntry from '../model/LogEntry';
3435
import PatchedClassificationRequest from '../model/PatchedClassificationRequest';
3536
import PatchedCloudRequest from '../model/PatchedCloudRequest';
3637
import PatchedDocumentRequest from '../model/PatchedDocumentRequest';
@@ -865,7 +866,7 @@ export default class CollaborationApi {
865866

866867
/**
867868
* Create a document
868-
* Create a document. If the document is one of {'DWG', 'IFC', 'GLTF', 'POINT_CLOUD', 'OBJ', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
869+
* 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
869870
* @param {Number} cloudPk A unique integer value identifying this cloud.
870871
* @param {Number} projectPk A unique integer value identifying this project.
871872
* @param {String} name Shown name of the file
@@ -931,7 +932,7 @@ export default class CollaborationApi {
931932

932933
/**
933934
* Create a document
934-
* Create a document. If the document is one of {'DWG', 'IFC', 'GLTF', 'POINT_CLOUD', 'OBJ', 'DXF'}, a model will be created and attached to this document Required scopes: document:write
935+
* 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
935936
* @param {Number} cloudPk A unique integer value identifying this cloud.
936937
* @param {Number} projectPk A unique integer value identifying this project.
937938
* @param {String} name Shown name of the file
@@ -3717,6 +3718,61 @@ export default class CollaborationApi {
37173718
}
37183719

37193720

3721+
/**
3722+
* Retrieve all logs of the project
3723+
* Retrieve all logs of the project Required scopes: logs:read
3724+
* @param {Number} cloudPk
3725+
* @param {Number} projectPk
3726+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<module:model/LogEntry>} and HTTP response
3727+
*/
3728+
getLogsWithHttpInfo(cloudPk, projectPk) {
3729+
let postBody = null;
3730+
// verify the required parameter 'cloudPk' is set
3731+
if (cloudPk === undefined || cloudPk === null) {
3732+
throw new Error("Missing the required parameter 'cloudPk' when calling getLogs");
3733+
}
3734+
// verify the required parameter 'projectPk' is set
3735+
if (projectPk === undefined || projectPk === null) {
3736+
throw new Error("Missing the required parameter 'projectPk' when calling getLogs");
3737+
}
3738+
3739+
let pathParams = {
3740+
'cloud_pk': cloudPk,
3741+
'project_pk': projectPk
3742+
};
3743+
let queryParams = {
3744+
};
3745+
let headerParams = {
3746+
};
3747+
let formParams = {
3748+
};
3749+
3750+
let authNames = ['ApiKey', 'BIMData_Connect', 'BIMData_Connect', 'Bearer'];
3751+
let contentTypes = [];
3752+
let accepts = ['application/json'];
3753+
let returnType = [LogEntry];
3754+
return this.apiClient.callApi(
3755+
'/cloud/{cloud_pk}/project/{project_pk}/logs', 'GET',
3756+
pathParams, queryParams, headerParams, formParams, postBody,
3757+
authNames, contentTypes, accepts, returnType, null
3758+
);
3759+
}
3760+
3761+
/**
3762+
* Retrieve all logs of the project
3763+
* Retrieve all logs of the project Required scopes: logs:read
3764+
* @param {Number} cloudPk
3765+
* @param {Number} projectPk
3766+
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<module:model/LogEntry>}
3767+
*/
3768+
getLogs(cloudPk, projectPk) {
3769+
return this.getLogsWithHttpInfo(cloudPk, projectPk)
3770+
.then(function(response_and_data) {
3771+
return response_and_data.data;
3772+
});
3773+
}
3774+
3775+
37203776
/**
37213777
* Retrieve a group
37223778
* Retrieve a group. Must be an admin of the project Required scopes: org:manage

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import LayerElementRequest from './model/LayerElementRequest';
8484
import LayerRequest from './model/LayerRequest';
8585
import Line from './model/Line';
8686
import LineRequest from './model/LineRequest';
87+
import LogEntry from './model/LogEntry';
8788
import MarketplaceAppImage from './model/MarketplaceAppImage';
8889
import MarketplaceAppLight from './model/MarketplaceAppLight';
8990
import MarketplaceAppLightRequest from './model/MarketplaceAppLightRequest';
@@ -725,6 +726,12 @@ export {
725726
*/
726727
LineRequest,
727728

729+
/**
730+
* The LogEntry model constructor.
731+
* @property {module:model/LogEntry}
732+
*/
733+
LogEntry,
734+
728735
/**
729736
* The MarketplaceAppImage model constructor.
730737
* @property {module:model/MarketplaceAppImage}

src/model/LogEntry.js

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
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 LogEntry model module.
18+
* @module model/LogEntry
19+
* @version 0.0.0
20+
*/
21+
class LogEntry {
22+
/**
23+
* Constructs a new <code>LogEntry</code>.
24+
* @alias module:model/LogEntry
25+
* @param id {Number}
26+
* @param userId {Number}
27+
* @param userEmail {String}
28+
* @param appName {String}
29+
* @param projectName {String}
30+
* @param date {Date}
31+
* @param action {String}
32+
* @param description {Object.<String, Object>}
33+
*/
34+
constructor(id, userId, userEmail, appName, projectName, date, action, description) {
35+
36+
LogEntry.initialize(this, id, userId, userEmail, appName, projectName, date, action, description);
37+
}
38+
39+
/**
40+
* Initializes the fields of this object.
41+
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
42+
* Only for internal use.
43+
*/
44+
static initialize(obj, id, userId, userEmail, appName, projectName, date, action, description) {
45+
obj['id'] = id;
46+
obj['user_id'] = userId;
47+
obj['user_email'] = userEmail;
48+
obj['app_name'] = appName;
49+
obj['project_name'] = projectName;
50+
obj['date'] = date;
51+
obj['action'] = action;
52+
obj['description'] = description;
53+
}
54+
55+
/**
56+
* Constructs a <code>LogEntry</code> from a plain JavaScript object, optionally creating a new instance.
57+
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
58+
* @param {Object} data The plain JavaScript object bearing properties of interest.
59+
* @param {module:model/LogEntry} obj Optional instance to populate.
60+
* @return {module:model/LogEntry} The populated <code>LogEntry</code> instance.
61+
*/
62+
static constructFromObject(data, obj) {
63+
if (data) {
64+
obj = obj || new LogEntry();
65+
66+
if (data.hasOwnProperty('id')) {
67+
obj['id'] = ApiClient.convertToType(data['id'], 'Number');
68+
}
69+
if (data.hasOwnProperty('user_id')) {
70+
obj['user_id'] = ApiClient.convertToType(data['user_id'], 'Number');
71+
}
72+
if (data.hasOwnProperty('user_email')) {
73+
obj['user_email'] = ApiClient.convertToType(data['user_email'], 'String');
74+
}
75+
if (data.hasOwnProperty('app_name')) {
76+
obj['app_name'] = ApiClient.convertToType(data['app_name'], 'String');
77+
}
78+
if (data.hasOwnProperty('project_name')) {
79+
obj['project_name'] = ApiClient.convertToType(data['project_name'], 'String');
80+
}
81+
if (data.hasOwnProperty('date')) {
82+
obj['date'] = ApiClient.convertToType(data['date'], 'Date');
83+
}
84+
if (data.hasOwnProperty('action')) {
85+
obj['action'] = ApiClient.convertToType(data['action'], 'String');
86+
}
87+
if (data.hasOwnProperty('description')) {
88+
obj['description'] = ApiClient.convertToType(data['description'], {'String': Object});
89+
}
90+
}
91+
return obj;
92+
}
93+
94+
95+
}
96+
97+
/**
98+
* @member {Number} id
99+
*/
100+
LogEntry.prototype['id'] = undefined;
101+
102+
/**
103+
* @member {Number} user_id
104+
*/
105+
LogEntry.prototype['user_id'] = undefined;
106+
107+
/**
108+
* @member {String} user_email
109+
*/
110+
LogEntry.prototype['user_email'] = undefined;
111+
112+
/**
113+
* @member {String} app_name
114+
*/
115+
LogEntry.prototype['app_name'] = undefined;
116+
117+
/**
118+
* @member {String} project_name
119+
*/
120+
LogEntry.prototype['project_name'] = undefined;
121+
122+
/**
123+
* @member {Date} date
124+
*/
125+
LogEntry.prototype['date'] = undefined;
126+
127+
/**
128+
* @member {String} action
129+
*/
130+
LogEntry.prototype['action'] = undefined;
131+
132+
/**
133+
* @member {Object.<String, Object>} description
134+
*/
135+
LogEntry.prototype['description'] = undefined;
136+
137+
138+
139+
140+
141+
142+
export default LogEntry;
143+

0 commit comments

Comments
 (0)