Skip to content

Commit 41b4129

Browse files
committed
MINOR: Feature: Model Transform (#786)
* MINOR: feat(model): add models transform * fix: set transform read_only=True * fix(transform): use 'prefetch_related' instead of 'select_related' for transform in model qs * fix(transform): use select_related and fix model_list tests
1 parent a8643b6 commit 41b4129

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1350
-155
lines changed

.openapi-generator/FILES

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ bimdata_api_client/model/patched_tag_request.py
142142
bimdata_api_client/model/patched_topic_request.py
143143
bimdata_api_client/model/patched_topic_status_request.py
144144
bimdata_api_client/model/patched_topic_type_request.py
145+
bimdata_api_client/model/patched_transform_request.py
145146
bimdata_api_client/model/patched_unit_request.py
146147
bimdata_api_client/model/patched_user_cloud_update_request.py
147148
bimdata_api_client/model/patched_user_project_update_request.py
@@ -232,6 +233,8 @@ bimdata_api_client/model/topic_status.py
232233
bimdata_api_client/model/topic_status_request.py
233234
bimdata_api_client/model/topic_type.py
234235
bimdata_api_client/model/topic_type_request.py
236+
bimdata_api_client/model/transform.py
237+
bimdata_api_client/model/transform_request.py
235238
bimdata_api_client/model/unit.py
236239
bimdata_api_client/model/unit_request.py
237240
bimdata_api_client/model/user.py
@@ -402,6 +405,7 @@ docs/PatchedTagRequest.md
402405
docs/PatchedTopicRequest.md
403406
docs/PatchedTopicStatusRequest.md
404407
docs/PatchedTopicTypeRequest.md
408+
docs/PatchedTransformRequest.md
405409
docs/PatchedUnitRequest.md
406410
docs/PatchedUserCloudUpdateRequest.md
407411
docs/PatchedUserProjectUpdateRequest.md
@@ -493,6 +497,8 @@ docs/TopicStatus.md
493497
docs/TopicStatusRequest.md
494498
docs/TopicType.md
495499
docs/TopicTypeRequest.md
500+
docs/Transform.md
501+
docs/TransformRequest.md
496502
docs/Unit.md
497503
docs/UnitRequest.md
498504
docs/User.md
@@ -665,6 +671,7 @@ test/test_patched_tag_request.py
665671
test/test_patched_topic_request.py
666672
test/test_patched_topic_status_request.py
667673
test/test_patched_topic_type_request.py
674+
test/test_patched_transform_request.py
668675
test/test_patched_unit_request.py
669676
test/test_patched_user_cloud_update_request.py
670677
test/test_patched_user_project_update_request.py
@@ -756,6 +763,8 @@ test/test_topic_status.py
756763
test/test_topic_status_request.py
757764
test/test_topic_type.py
758765
test/test_topic_type_request.py
766+
test/test_transform.py
767+
test/test_transform_request.py
759768
test/test_unit.py
760769
test/test_unit_request.py
761770
test/test_user.py

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ Class | Method | HTTP request | Description
475475
*ModelApi* | [**update_model_files**](docs/ModelApi.md#update_model_files) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{id}/files | Update models file (gltf, svg, structure, etc)
476476
*ModelApi* | [**update_model_property**](docs/ModelApi.md#update_model_property) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{model_pk}/property/{id} | Update some fields of a Property
477477
*ModelApi* | [**update_model_property_definition**](docs/ModelApi.md#update_model_property_definition) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{model_pk}/propertydefinition/{id} | Update some fields of many PropertyDefinitions of a model
478+
*ModelApi* | [**update_model_transform**](docs/ModelApi.md#update_model_transform) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{id}/transform | Update model transform
478479
*ModelApi* | [**update_model_unit**](docs/ModelApi.md#update_model_unit) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{model_pk}/unit/{id} | Update some fields of a Unit of a model
479480
*ModelApi* | [**update_order_building_plan**](docs/ModelApi.md#update_order_building_plan) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{model_pk}/building/{building_uuid}/plan/order | Update order of all plan of a building
480481
*ModelApi* | [**update_order_storey_plan**](docs/ModelApi.md#update_order_storey_plan) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/model/{model_pk}/storey/{storey_uuid}/plan/order | Update order of all plan of a storey
@@ -637,6 +638,7 @@ Class | Method | HTTP request | Description
637638
- [PatchedTopicRequest](docs/PatchedTopicRequest.md)
638639
- [PatchedTopicStatusRequest](docs/PatchedTopicStatusRequest.md)
639640
- [PatchedTopicTypeRequest](docs/PatchedTopicTypeRequest.md)
641+
- [PatchedTransformRequest](docs/PatchedTransformRequest.md)
640642
- [PatchedUnitRequest](docs/PatchedUnitRequest.md)
641643
- [PatchedUserCloudUpdateRequest](docs/PatchedUserCloudUpdateRequest.md)
642644
- [PatchedUserProjectUpdateRequest](docs/PatchedUserProjectUpdateRequest.md)
@@ -727,6 +729,8 @@ Class | Method | HTTP request | Description
727729
- [TopicStatusRequest](docs/TopicStatusRequest.md)
728730
- [TopicType](docs/TopicType.md)
729731
- [TopicTypeRequest](docs/TopicTypeRequest.md)
732+
- [Transform](docs/Transform.md)
733+
- [TransformRequest](docs/TransformRequest.md)
730734
- [Unit](docs/Unit.md)
731735
- [UnitRequest](docs/UnitRequest.md)
732736
- [User](docs/User.md)

bimdata_api_client/api/collaboration_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8815,7 +8815,7 @@ def create_document(
88158815
):
88168816
"""Create a document # noqa: E501
88178817

8818-
Create a document. If the document is one of {'DWG', 'POINT_CLOUD', 'IFC', 'DXF', 'OBJ', 'GLTF'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
8818+
Create a document. If the document is one of {'POINT_CLOUD', 'DWG', 'OBJ', 'DXF', 'IFC', 'GLTF'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
88198819
This method makes a synchronous HTTP request by default. To make an
88208820
asynchronous HTTP request, please pass async_req=True
88218821

bimdata_api_client/api/model_api.py

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
from bimdata_api_client.model.patched_space_request import PatchedSpaceRequest
6767
from bimdata_api_client.model.patched_storey_building_request import PatchedStoreyBuildingRequest
6868
from bimdata_api_client.model.patched_system_request import PatchedSystemRequest
69+
from bimdata_api_client.model.patched_transform_request import PatchedTransformRequest
6970
from bimdata_api_client.model.patched_unit_request import PatchedUnitRequest
7071
from bimdata_api_client.model.patched_zone_request import PatchedZoneRequest
7172
from bimdata_api_client.model.patched_zone_space_request import PatchedZoneSpaceRequest
@@ -86,6 +87,7 @@
8687
from bimdata_api_client.model.storey_model_plan_request import StoreyModelPlanRequest
8788
from bimdata_api_client.model.system import System
8889
from bimdata_api_client.model.system_request import SystemRequest
90+
from bimdata_api_client.model.transform import Transform
8991
from bimdata_api_client.model.unit import Unit
9092
from bimdata_api_client.model.unit_request import UnitRequest
9193
from bimdata_api_client.model.xkt_file import XktFile
@@ -11060,6 +11062,80 @@ def __init__(self, api_client=None):
1106011062
},
1106111063
api_client=api_client
1106211064
)
11065+
self.update_model_transform_endpoint = _Endpoint(
11066+
settings={
11067+
'response_type': (Transform,),
11068+
'auth': [
11069+
'ApiKey',
11070+
'BIMData_Connect',
11071+
'BIMData_Connect',
11072+
'Bearer'
11073+
],
11074+
'endpoint_path': '/cloud/{cloud_pk}/project/{project_pk}/model/{id}/transform',
11075+
'operation_id': 'update_model_transform',
11076+
'http_method': 'PATCH',
11077+
'servers': None,
11078+
},
11079+
params_map={
11080+
'all': [
11081+
'cloud_pk',
11082+
'id',
11083+
'project_pk',
11084+
'patched_transform_request',
11085+
],
11086+
'required': [
11087+
'cloud_pk',
11088+
'id',
11089+
'project_pk',
11090+
],
11091+
'nullable': [
11092+
],
11093+
'enum': [
11094+
],
11095+
'validation': [
11096+
]
11097+
},
11098+
root_map={
11099+
'validations': {
11100+
},
11101+
'allowed_values': {
11102+
},
11103+
'openapi_types': {
11104+
'cloud_pk':
11105+
(int,),
11106+
'id':
11107+
(int,),
11108+
'project_pk':
11109+
(int,),
11110+
'patched_transform_request':
11111+
(PatchedTransformRequest,),
11112+
},
11113+
'attribute_map': {
11114+
'cloud_pk': 'cloud_pk',
11115+
'id': 'id',
11116+
'project_pk': 'project_pk',
11117+
},
11118+
'location_map': {
11119+
'cloud_pk': 'path',
11120+
'id': 'path',
11121+
'project_pk': 'path',
11122+
'patched_transform_request': 'body',
11123+
},
11124+
'collection_format_map': {
11125+
}
11126+
},
11127+
headers_map={
11128+
'accept': [
11129+
'application/json'
11130+
],
11131+
'content_type': [
11132+
'application/json',
11133+
'application/x-www-form-urlencoded',
11134+
'multipart/form-data'
11135+
]
11136+
},
11137+
api_client=api_client
11138+
)
1106311139
self.update_model_unit_endpoint = _Endpoint(
1106411140
settings={
1106511141
'response_type': (Unit,),
@@ -25203,6 +25279,93 @@ def update_model_property_definition(
2520325279
project_pk
2520425280
return self.update_model_property_definition_endpoint.call_with_http_info(**kwargs)
2520525281

25282+
def update_model_transform(
25283+
self,
25284+
cloud_pk,
25285+
id,
25286+
project_pk,
25287+
**kwargs
25288+
):
25289+
"""Update model transform # noqa: E501
25290+
25291+
Update model transform (translate, scale, rotate and opacity) Required scopes: ifc:write, model:write # noqa: E501
25292+
This method makes a synchronous HTTP request by default. To make an
25293+
asynchronous HTTP request, please pass async_req=True
25294+
25295+
>>> thread = api.update_model_transform(cloud_pk, id, project_pk, async_req=True)
25296+
>>> result = thread.get()
25297+
25298+
Args:
25299+
cloud_pk (int):
25300+
id (int): A unique integer value identifying this model.
25301+
project_pk (int):
25302+
25303+
Keyword Args:
25304+
patched_transform_request (PatchedTransformRequest): [optional]
25305+
_return_http_data_only (bool): response data without head status
25306+
code and headers. Default is True.
25307+
_preload_content (bool): if False, the urllib3.HTTPResponse object
25308+
will be returned without reading/decoding response data.
25309+
Default is True.
25310+
_request_timeout (int/float/tuple): timeout setting for this request. If
25311+
one number provided, it will be total request timeout. It can also
25312+
be a pair (tuple) of (connection, read) timeouts.
25313+
Default is None.
25314+
_check_input_type (bool): specifies if type checking
25315+
should be done one the data sent to the server.
25316+
Default is True.
25317+
_check_return_type (bool): specifies if type checking
25318+
should be done one the data received from the server.
25319+
Default is True.
25320+
_spec_property_naming (bool): True if the variable names in the input data
25321+
are serialized names, as specified in the OpenAPI document.
25322+
False if the variable names in the input data
25323+
are pythonic names, e.g. snake case (default)
25324+
_content_type (str/None): force body content-type.
25325+
Default is None and content-type will be predicted by allowed
25326+
content-types and body.
25327+
_host_index (int/None): specifies the index of the server
25328+
that we want to use.
25329+
Default is read from the configuration.
25330+
async_req (bool): execute request asynchronously
25331+
25332+
Returns:
25333+
Transform
25334+
If the method is called asynchronously, returns the request
25335+
thread.
25336+
"""
25337+
kwargs['async_req'] = kwargs.get(
25338+
'async_req', False
25339+
)
25340+
kwargs['_return_http_data_only'] = kwargs.get(
25341+
'_return_http_data_only', True
25342+
)
25343+
kwargs['_preload_content'] = kwargs.get(
25344+
'_preload_content', True
25345+
)
25346+
kwargs['_request_timeout'] = kwargs.get(
25347+
'_request_timeout', None
25348+
)
25349+
kwargs['_check_input_type'] = kwargs.get(
25350+
'_check_input_type', True
25351+
)
25352+
kwargs['_check_return_type'] = kwargs.get(
25353+
'_check_return_type', True
25354+
)
25355+
kwargs['_spec_property_naming'] = kwargs.get(
25356+
'_spec_property_naming', False
25357+
)
25358+
kwargs['_content_type'] = kwargs.get(
25359+
'_content_type')
25360+
kwargs['_host_index'] = kwargs.get('_host_index')
25361+
kwargs['cloud_pk'] = \
25362+
cloud_pk
25363+
kwargs['id'] = \
25364+
id
25365+
kwargs['project_pk'] = \
25366+
project_pk
25367+
return self.update_model_transform_endpoint.call_with_http_info(**kwargs)
25368+
2520625369
def update_model_unit(
2520725370
self,
2520825371
cloud_pk,

bimdata_api_client/model/full_topic.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ def openapi_types():
108108
return {
109109
'modified_date': (datetime, none_type,), # noqa: E501
110110
'title': (str,), # noqa: E501
111-
'project': (int,), # noqa: E501
112111
'guid': (str,), # noqa: E501
113112
'creation_date': (datetime,), # noqa: E501
114113
'creation_author': (str, none_type,), # noqa: E501
@@ -139,7 +138,6 @@ def discriminator():
139138
attribute_map = {
140139
'modified_date': 'modified_date', # noqa: E501
141140
'title': 'title', # noqa: E501
142-
'project': 'project', # noqa: E501
143141
'guid': 'guid', # noqa: E501
144142
'creation_date': 'creation_date', # noqa: E501
145143
'creation_author': 'creation_author', # noqa: E501
@@ -170,13 +168,12 @@ def discriminator():
170168

171169
@classmethod
172170
@convert_js_args_to_python_args
173-
def _from_openapi_data(cls, modified_date, title, project, *args, **kwargs): # noqa: E501
171+
def _from_openapi_data(cls, modified_date, title, *args, **kwargs): # noqa: E501
174172
"""FullTopic - a model defined in OpenAPI
175173
176174
Args:
177175
modified_date (datetime, none_type):
178176
title (str):
179-
project (int):
180177
181178
Keyword Args:
182179
_check_type (bool): if True, values for parameters in openapi_types
@@ -258,7 +255,6 @@ def _from_openapi_data(cls, modified_date, title, project, *args, **kwargs): #
258255

259256
self.modified_date = modified_date
260257
self.title = title
261-
self.project = project
262258
for var_name, var_value in kwargs.items():
263259
if var_name not in self.attribute_map and \
264260
self._configuration is not None and \
@@ -279,11 +275,10 @@ def _from_openapi_data(cls, modified_date, title, project, *args, **kwargs): #
279275
])
280276

281277
@convert_js_args_to_python_args
282-
def __init__(self, title, project, *args, **kwargs): # noqa: E501
278+
def __init__(self, title, *args, **kwargs): # noqa: E501
283279
"""FullTopic - a model defined in OpenAPI
284280
285281
title (str):
286-
project (int):
287282
288283
Keyword Args:
289284
_check_type (bool): if True, values for parameters in openapi_types
@@ -362,7 +357,6 @@ def __init__(self, title, project, *args, **kwargs): # noqa: E501
362357
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
363358

364359
self.title = title
365-
self.project = project
366360
for var_name, var_value in kwargs.items():
367361
if var_name not in self.attribute_map and \
368362
self._configuration is not None and \

bimdata_api_client/model/full_topic_request.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def openapi_types():
123123
lazy_import()
124124
return {
125125
'title': (str,), # noqa: E501
126-
'project': (int,), # noqa: E501
127126
'guid': (str,), # noqa: E501
128127
'creation_date': (datetime,), # noqa: E501
129128
'creation_author': (str, none_type,), # noqa: E501
@@ -153,7 +152,6 @@ def discriminator():
153152

154153
attribute_map = {
155154
'title': 'title', # noqa: E501
156-
'project': 'project', # noqa: E501
157155
'guid': 'guid', # noqa: E501
158156
'creation_date': 'creation_date', # noqa: E501
159157
'creation_author': 'creation_author', # noqa: E501
@@ -183,12 +181,11 @@ def discriminator():
183181

184182
@classmethod
185183
@convert_js_args_to_python_args
186-
def _from_openapi_data(cls, title, project, *args, **kwargs): # noqa: E501
184+
def _from_openapi_data(cls, title, *args, **kwargs): # noqa: E501
187185
"""FullTopicRequest - a model defined in OpenAPI
188186
189187
Args:
190188
title (str):
191-
project (int):
192189
193190
Keyword Args:
194191
_check_type (bool): if True, values for parameters in openapi_types
@@ -269,7 +266,6 @@ def _from_openapi_data(cls, title, project, *args, **kwargs): # noqa: E501
269266
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
270267

271268
self.title = title
272-
self.project = project
273269
for var_name, var_value in kwargs.items():
274270
if var_name not in self.attribute_map and \
275271
self._configuration is not None and \
@@ -290,12 +286,11 @@ def _from_openapi_data(cls, title, project, *args, **kwargs): # noqa: E501
290286
])
291287

292288
@convert_js_args_to_python_args
293-
def __init__(self, title, project, *args, **kwargs): # noqa: E501
289+
def __init__(self, title, *args, **kwargs): # noqa: E501
294290
"""FullTopicRequest - a model defined in OpenAPI
295291
296292
Args:
297293
title (str):
298-
project (int):
299294
300295
Keyword Args:
301296
_check_type (bool): if True, values for parameters in openapi_types
@@ -374,7 +369,6 @@ def __init__(self, title, project, *args, **kwargs): # noqa: E501
374369
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
375370

376371
self.title = title
377-
self.project = project
378372
for var_name, var_value in kwargs.items():
379373
if var_name not in self.attribute_map and \
380374
self._configuration is not None and \

0 commit comments

Comments
 (0)