Skip to content

Commit 8855d1c

Browse files
committed
PATCH: add head_id field to Document serializer (#669)
1 parent ce01cfe commit 8855d1c

File tree

5 files changed

+34
-16
lines changed

5 files changed

+34
-16
lines changed

docs/CollaborationApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ Name | Type | Description | Notes
956956
957957
Create a document
958958

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

961961
### Example
962962

docs/Document.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ Name | Type | Description | Notes
2020
**modelId** | **Number** | | [readonly]
2121
**modelType** | **String** | Model's type. Values can be IFC, DWG, DXF, GLTF, PDF, JPEG, PNG, OBJ, POINT_CLOUD | [readonly]
2222
**ifcId** | **Number** | DEPRECATED: Use 'model_id' instead. | [readonly]
23-
**userPermission** | **Number** | Aggregate of group user permissions and folder default permission | [readonly]
23+
**headId** | **Number** | Document id of head version | [readonly]
2424
**isHeadVersion** | **Boolean** | Document is a head of version or is owned by another document | [readonly]
25+
**userPermission** | **Number** | Aggregate of group user permissions and folder default permission | [readonly]
2526
**officePreview** | **String** | Office files will be converted as pdf to provide a web preview. Supported extensions are .ppt, .pptx, .odp, .xls, .xlsx, .ods, .doc, .docx, .odt | [readonly]
2627

2728

src/api/CollaborationApi.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ export default class CollaborationApi {
859859

860860
/**
861861
* Create a document
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
862+
* Create a document. If the document is one of {'GLTF', 'DXF', 'POINT_CLOUD', 'OBJ', 'IFC', 'DWG'}, a model will be created and attached to this document Required scopes: document:write
863863
* @param {Number} cloudPk A unique integer value identifying this cloud.
864864
* @param {Number} projectPk A unique integer value identifying this project.
865865
* @param {String} name Shown name of the file
@@ -925,7 +925,7 @@ export default class CollaborationApi {
925925

926926
/**
927927
* Create a document
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
928+
* Create a document. If the document is one of {'GLTF', 'DXF', 'POINT_CLOUD', 'OBJ', 'IFC', 'DWG'}, a model will be created and attached to this document Required scopes: document:write
929929
* @param {Number} cloudPk A unique integer value identifying this cloud.
930930
* @param {Number} projectPk A unique integer value identifying this project.
931931
* @param {String} name Shown name of the file

src/model/Document.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,22 @@ class Document {
3838
* @param modelId {Number}
3939
* @param modelType {module:model/Document.ModelTypeEnum} Model's type. Values can be IFC, DWG, DXF, GLTF, PDF, JPEG, PNG, OBJ, POINT_CLOUD
4040
* @param ifcId {Number} DEPRECATED: Use 'model_id' instead.
41-
* @param userPermission {module:model/Document.UserPermissionEnum} Aggregate of group user permissions and folder default permission
41+
* @param headId {Number} Document id of head version
4242
* @param isHeadVersion {Boolean} Document is a head of version or is owned by another document
43+
* @param userPermission {module:model/Document.UserPermissionEnum} Aggregate of group user permissions and folder default permission
4344
* @param officePreview {String} Office files will be converted as pdf to provide a web preview. Supported extensions are .ppt, .pptx, .odp, .xls, .xlsx, .ods, .doc, .docx, .odt
4445
*/
45-
constructor(id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, userPermission, isHeadVersion, officePreview) {
46+
constructor(id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, headId, isHeadVersion, userPermission, officePreview) {
4647

47-
Document.initialize(this, id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, userPermission, isHeadVersion, officePreview);
48+
Document.initialize(this, id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, headId, isHeadVersion, userPermission, officePreview);
4849
}
4950

5051
/**
5152
* Initializes the fields of this object.
5253
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
5354
* Only for internal use.
5455
*/
55-
static initialize(obj, id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, userPermission, isHeadVersion, officePreview) {
56+
static initialize(obj, id, createdBy, project, name, file, size, tags, visas, createdAt, updatedAt, modelId, modelType, ifcId, headId, isHeadVersion, userPermission, officePreview) {
5657
obj['id'] = id;
5758
obj['created_by'] = createdBy;
5859
obj['project'] = project;
@@ -66,8 +67,9 @@ class Document {
6667
obj['model_id'] = modelId;
6768
obj['model_type'] = modelType;
6869
obj['ifc_id'] = ifcId;
69-
obj['user_permission'] = userPermission;
70+
obj['head_id'] = headId;
7071
obj['is_head_version'] = isHeadVersion;
72+
obj['user_permission'] = userPermission;
7173
obj['office_preview'] = officePreview;
7274
}
7375

@@ -130,12 +132,15 @@ class Document {
130132
if (data.hasOwnProperty('ifc_id')) {
131133
obj['ifc_id'] = ApiClient.convertToType(data['ifc_id'], 'Number');
132134
}
133-
if (data.hasOwnProperty('user_permission')) {
134-
obj['user_permission'] = ApiClient.convertToType(data['user_permission'], 'Number');
135+
if (data.hasOwnProperty('head_id')) {
136+
obj['head_id'] = ApiClient.convertToType(data['head_id'], 'Number');
135137
}
136138
if (data.hasOwnProperty('is_head_version')) {
137139
obj['is_head_version'] = ApiClient.convertToType(data['is_head_version'], 'Boolean');
138140
}
141+
if (data.hasOwnProperty('user_permission')) {
142+
obj['user_permission'] = ApiClient.convertToType(data['user_permission'], 'Number');
143+
}
139144
if (data.hasOwnProperty('office_preview')) {
140145
obj['office_preview'] = ApiClient.convertToType(data['office_preview'], 'String');
141146
}
@@ -235,17 +240,23 @@ Document.prototype['model_type'] = undefined;
235240
Document.prototype['ifc_id'] = undefined;
236241

237242
/**
238-
* Aggregate of group user permissions and folder default permission
239-
* @member {module:model/Document.UserPermissionEnum} user_permission
243+
* Document id of head version
244+
* @member {Number} head_id
240245
*/
241-
Document.prototype['user_permission'] = undefined;
246+
Document.prototype['head_id'] = undefined;
242247

243248
/**
244249
* Document is a head of version or is owned by another document
245250
* @member {Boolean} is_head_version
246251
*/
247252
Document.prototype['is_head_version'] = undefined;
248253

254+
/**
255+
* Aggregate of group user permissions and folder default permission
256+
* @member {module:model/Document.UserPermissionEnum} user_permission
257+
*/
258+
Document.prototype['user_permission'] = undefined;
259+
249260
/**
250261
* Office files will be converted as pdf to provide a web preview. Supported extensions are .ppt, .pptx, .odp, .xls, .xlsx, .ods, .doc, .docx, .odt
251262
* @member {String} office_preview

test/model/Document.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@
150150
//expect(instance).to.be();
151151
});
152152

153-
it('should have the property userPermission (base name: "user_permission")', function() {
154-
// uncomment below and update the code to test the property userPermission
153+
it('should have the property headId (base name: "head_id")', function() {
154+
// uncomment below and update the code to test the property headId
155155
//var instance = new bimdata.Document();
156156
//expect(instance).to.be();
157157
});
@@ -162,6 +162,12 @@
162162
//expect(instance).to.be();
163163
});
164164

165+
it('should have the property userPermission (base name: "user_permission")', function() {
166+
// uncomment below and update the code to test the property userPermission
167+
//var instance = new bimdata.Document();
168+
//expect(instance).to.be();
169+
});
170+
165171
it('should have the property officePreview (base name: "office_preview")', function() {
166172
// uncomment below and update the code to test the property officePreview
167173
//var instance = new bimdata.Document();

0 commit comments

Comments
 (0)