Update revisions
- async AsyncCogniteClient.three_d.revisions.update(
- model_id: int,
- item: ThreeDModelRevision | ThreeDModelRevisionUpdate | Sequence[ThreeDModelRevision | ThreeDModelRevisionUpdate],
- mode: Literal['replace_ignore_null', 'patch', 'replace'] = 'replace_ignore_null',
-
- Parameters:
model_id (int) – Update the revision under the model with this id.
item (ThreeDModelRevision | ThreeDModelRevisionUpdate | Sequence[ThreeDModelRevision | ThreeDModelRevisionUpdate]) – ThreeDModelRevision(s) to update
mode (Literal['replace_ignore_null', 'patch', 'replace']) – How to update data when a non-update object is given (ThreeDModelRevision or -Write). If you use ‘replace_ignore_null’, only the fields you have set will be used to replace existing (default). Using ‘replace’ will additionally clear all the fields that are not specified by you. Last option, ‘patch’, will update only the fields you have set and for container-like fields such as metadata or labels, add the values to the existing. For more details, see Update and Upsert Mode Parameter.
- Returns:
Updated ThreeDModelRevision(s)
- Return type:
Examples
Update a revision that you have fetched. This will perform a full update of the revision:
>>> from cognite.client import CogniteClient, AsyncCogniteClient >>> client = CogniteClient() >>> # async_client = AsyncCogniteClient() # another option >>> revision = client.three_d.revisions.retrieve(model_id=1, id=1) >>> revision.status = "New Status" >>> res = client.three_d.revisions.update(model_id=1, item=revision)
Perform a partial update on a revision, updating the published property and adding a new field to metadata:
>>> from cognite.client.data_classes import ThreeDModelRevisionUpdate >>> my_update = ( ... ThreeDModelRevisionUpdate(id=1) ... .published.set(False) ... .metadata.add({"key": "value"}) ... ) >>> res = client.three_d.revisions.update(model_id=1, item=my_update)