diff --git a/.gitignore b/.gitignore index 1f21cf138..a659bcd64 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ scripts/tmp/ my_file.txt .venv/ *.env +.envrc diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d89dc9a72..f39b5f2c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.2 hooks: - id: ruff args: diff --git a/CHANGELOG.md b/CHANGELOG.md index 6982b5804..eb0d1dc04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,12 +17,48 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.55.1] - 2024-08-29 +### Fixed +- Missing exports for workflow triggers + +## [7.55.0] - 2024-08-23 +### Added +- Support for creating a session using a one-shot token in the `client.iam.session.create` method. +- Parameter `nonce` to the `client.functions.call()` and `client.workflow.executions.run()` methods to allow passing + a custom nonce instead of letting the SDK generate it from your current credentials. + +## [7.54.19] - 2024-08-23 +### Added +- [Feature Preview - beta] Support for `client.workflows.triggers`. + +## [7.54.18] - 2024-08-26 +### Added +- When retrieving datapoints, `instance_id` is now set on the objects (for time series created + through Data Modelling). + +## [7.54.17] - 2024-08-22 +### Added +- [Feature Preview] Added `ExtractorExtension` model of the Core Model. + +## [7.54.16] - 2024-08-22 +### Added +- Added new LocationFiltersAcl capability. + +## [7.54.15] - 2024-08-21 +### Fixed +- [Feature Preview] Updated the Core Model to latest version. + +## [7.54.14] - 2024-08-19 +### Fixed +- [Feature Preview - alpha] fix `files.upload_content`, `files.upload_content_bytes` and + `files.multipart_upload_content_session` + ## [7.54.13] - 2024-08-13 ### Added - [Feature Preview - alpha] Support for `instanceId` in the `client.files.retrieve`, `client.files.retrieve_multiple`, `client.files.update`, `client.files.retrieve_download_urls`, `client.files.download_bytes`, `client.files.download_to_path`, - `client.files.download`. -- [Feature Preview - alpha] Add three new methods for uploading content: `client.files.upload_content`, + `client.files.download`. +- [Feature Preview - alpha] Add three new methods for uploading content: `client.files.upload_content`, `client.files.upload_content_bytes`, `client.files.multipart_upload_content_session`. This is an experimental feature and may change without warning. diff --git a/cognite/client/_api/datapoint_tasks.py b/cognite/client/_api/datapoint_tasks.py index 12c8ad803..984fbfe85 100644 --- a/cognite/client/_api/datapoint_tasks.py +++ b/cognite/client/_api/datapoint_tasks.py @@ -37,6 +37,7 @@ NumericDatapoint, StringDatapoint, ) +from cognite.client.data_classes.data_modeling.ids import NodeId from cognite.client.data_classes.datapoints import ( _INT_AGGREGATES, Aggregate, @@ -462,8 +463,9 @@ def get_datapoints_from_proto(res: DataPointListItem) -> DatapointsAny: return cast(DatapointsAny, []) -def get_ts_info_from_proto(res: DataPointListItem) -> dict[str, int | str | bool | None]: +def get_ts_info_from_proto(res: DataPointListItem) -> dict[str, int | str | bool | NodeId | None]: # Note: When 'unit_external_id' is returned, regular 'unit' is ditched + instance_id = NodeId(res.instanceId.space, res.instanceId.externalId) if res.instanceId else None return { "id": res.id, "external_id": res.externalId, @@ -471,6 +473,7 @@ def get_ts_info_from_proto(res: DataPointListItem) -> dict[str, int | str | bool "is_step": res.isStep, "unit": res.unit, "unit_external_id": res.unitExternalId, + "instance_id": instance_id, } diff --git a/cognite/client/_api/files.py b/cognite/client/_api/files.py index cdede84f8..3541121be 100644 --- a/cognite/client/_api/files.py +++ b/cognite/client/_api/files.py @@ -9,8 +9,6 @@ from typing import Any, BinaryIO, Iterator, Sequence, TextIO, cast, overload from urllib.parse import urljoin, urlparse -from requests import Response - from cognite.client._api_client import APIClient from cognite.client._constants import _RUNNING_IN_BROWSER, DEFAULT_LIMIT_READ from cognite.client.data_classes import ( @@ -464,7 +462,7 @@ def upload_content( path: str, external_id: str | None = None, instance_id: NodeId | None = None, - ) -> FileMetadata | FileMetadataList: + ) -> FileMetadata: """`Upload a file content `_ Args: @@ -472,7 +470,7 @@ def upload_content( external_id (str | None): The external ID provided by the client. Must be unique within the project. instance_id (NodeId | None): Instance ID of the file. Returns: - FileMetadata | FileMetadataList: No description. + FileMetadata: No description. """ fh: bytes | BufferedReader if os.path.isfile(path): @@ -650,19 +648,20 @@ def upload_content_bytes( try: res = self._post( - url_path=f"{self._RESOURCE_PATH}/uploadlink", json=identifiers.as_dicts()[0], headers=headers + url_path=f"{self._RESOURCE_PATH}/uploadlink", + json={"items": identifiers.as_dicts()}, + headers=headers, ) except CogniteAPIError as e: if e.code == 403: raise CogniteAuthorizationError(message=e.message, code=e.code, x_request_id=e.x_request_id) from e raise - file_metadata = self._upload_bytes(content, res) + file_metadata = self._upload_bytes(content, res.json()["items"][0]) return file_metadata - def _upload_bytes(self, content: bytes | TextIO | BinaryIO, res: Response) -> FileMetadata: - returned_file_metadata = res.json() + def _upload_bytes(self, content: bytes | TextIO | BinaryIO, returned_file_metadata: dict) -> FileMetadata: upload_url = returned_file_metadata["uploadUrl"] if urlparse(upload_url).netloc: full_upload_url = upload_url @@ -766,7 +765,7 @@ def upload_bytes( raise CogniteAuthorizationError(message=msg, code=e.code, x_request_id=e.x_request_id) from e raise - return self._upload_bytes(content, res) + return self._upload_bytes(content, res.json()) def multipart_upload_session( self, @@ -911,7 +910,7 @@ def multipart_upload_content_session( try: res = self._post( url_path=f"{self._RESOURCE_PATH}/multiuploadlink", - json=identifiers.as_dicts()[0], + json={"items": identifiers.as_dicts()}, params={"parts": parts}, headers=headers, ) @@ -920,7 +919,7 @@ def multipart_upload_content_session( raise CogniteAuthorizationError(message=e.message, code=e.code, x_request_id=e.x_request_id) from e raise - returned_file_metadata = res.json() + returned_file_metadata = res.json()["items"][0] upload_urls = returned_file_metadata["uploadUrls"] upload_id = returned_file_metadata["uploadId"] diff --git a/cognite/client/_api/functions.py b/cognite/client/_api/functions.py index ca0e7ed61..094cb0249 100644 --- a/cognite/client/_api/functions.py +++ b/cognite/client/_api/functions.py @@ -521,6 +521,7 @@ def call( external_id: str | None = None, data: dict | None = None, wait: bool = True, + nonce: str | None = None, ) -> FunctionCall: """`Call a function by its ID or external ID. `_. @@ -529,6 +530,10 @@ def call( external_id (str | None): External ID data (dict | None): Input data to the function (JSON serializable). This data is passed deserialized into the function through one of the arguments called data. **WARNING:** Secrets or other confidential information should not be passed via this argument. There is a dedicated `secrets` argument in FunctionsAPI.create() for this purpose.' wait (bool): Wait until the function call is finished. Defaults to True. + nonce (str | None): Nonce retrieved from sessions API when creating a session. This will be used to bind the session before executing the function. If not provided, a new session will be created based on the client credentials. + + Tip: + You can create a session via the Sessions API, using the client.iam.session.create() method. Returns: FunctionCall: A function call object. @@ -550,7 +555,7 @@ def call( """ identifier = IdentifierSequence.load(ids=id, external_ids=external_id).as_singleton()[0] id = _get_function_internal_id(self._cognite_client, identifier) - nonce = create_session_and_return_nonce(self._cognite_client, api_name="Functions API") + nonce = nonce or create_session_and_return_nonce(self._cognite_client, api_name="Functions API") if data is None: data = {} diff --git a/cognite/client/_api/iam.py b/cognite/client/_api/iam.py index a609a08e2..9eee4608f 100644 --- a/cognite/client/_api/iam.py +++ b/cognite/client/_api/iam.py @@ -3,7 +3,7 @@ import warnings from itertools import groupby from operator import itemgetter -from typing import TYPE_CHECKING, Any, Dict, Iterable, Sequence, Union, overload +from typing import TYPE_CHECKING, Any, Dict, Iterable, Literal, Sequence, Union, overload from typing_extensions import TypeAlias @@ -34,7 +34,13 @@ SpaceIDScope, UnknownAcl, ) -from cognite.client.data_classes.iam import GroupWrite, SecurityCategoryWrite, SessionStatus, TokenInspection +from cognite.client.data_classes.iam import ( + GroupWrite, + SecurityCategoryWrite, + SessionStatus, + SessionType, + TokenInspection, +) from cognite.client.utils._identifier import IdentifierSequence if TYPE_CHECKING: @@ -528,20 +534,53 @@ def __init__(self, config: ClientConfig, api_version: str | None, cognite_client super().__init__(config, api_version, cognite_client) self._LIST_LIMIT = 100 - def create(self, client_credentials: ClientCredentials | None = None) -> CreatedSession: + def create( + self, + client_credentials: ClientCredentials | None = None, + session_type: SessionType | Literal["DEFAULT"] = "DEFAULT", + ) -> CreatedSession: """`Create a session. `_ Args: - client_credentials (ClientCredentials | None): The client credentials to create the session. If set to None, a session will be created using the credentials used to instantiate -this- CogniteClient object. If that was done using a token, a session will be created using token exchange. Similarly, if the credentials were client credentials, a session will be created using client credentials. This method does not work when using client certificates (not supported server-side). + client_credentials (ClientCredentials | None): The client credentials to create the session. This is required + if session_type is set to 'CLIENT_CREDENTIALS'. + session_type (SessionType | Literal['DEFAULT']): The type of session to create. Can be + either 'CLIENT_CREDENTIALS', 'TOKEN_EXCHANGE', 'ONESHOT_TOKEN_EXCHANGE' or 'DEFAULT'. + Defaults to 'DEFAULT' which will use -this- CogniteClient object to create the session. + If this client was created using a token, 'TOKEN_EXCHANGE' will be used, and if + this client was created using client credentials, 'CLIENT_CREDENTIALS' will be used. + + Session Types: + * **client_credentials**: Credentials for a session using client credentials from an identity provider. + * **token_exchange**: Credentials for a session using token exchange to reuse the user's credentials. + * **one_shot_token_exchange**: Credentials for a session using one-shot token exchange to reuse the user's credentials. One-shot sessions are short-lived sessions that are not refreshed and do not require support for token exchange from the identity provider. Returns: CreatedSession: The object with token inspection details. """ - if client_credentials is None and isinstance((creds := self._config.credentials), OAuthClientCredentials): + if client_credentials is None and isinstance(creds := self._config.credentials, OAuthClientCredentials): client_credentials = ClientCredentials(creds.client_id, creds.client_secret) - items = {"tokenExchange": True} if client_credentials is None else client_credentials.dump(camel_case=True) + session_type_up = session_type.upper() + if session_type_up == "DEFAULT": # For backwards compatibility after session_type was introduced + items = {"tokenExchange": True} if client_credentials is None else client_credentials.dump(camel_case=True) + + elif session_type_up == "CLIENT_CREDENTIALS": + if client_credentials is None: + raise ValueError( + "For session_type='CLIENT_CREDENTIALS', either `client_credentials` must be provided OR " + "this client must be using OAuthClientCredentials" + ) + items = client_credentials.dump(camel_case=True) + + elif session_type_up == "TOKEN_EXCHANGE": + items = {"tokenExchange": True} + + elif session_type_up == "ONESHOT_TOKEN_EXCHANGE": + items = {"oneshotTokenExchange": True} + else: + raise ValueError(f"Session type not understood: {session_type}") return CreatedSession.load(self._post(self._RESOURCE_PATH, {"items": [items]}).json()["items"][0]) @overload diff --git a/cognite/client/_api/workflows.py b/cognite/client/_api/workflows.py index 240f5ec64..4d02d9788 100644 --- a/cognite/client/_api/workflows.py +++ b/cognite/client/_api/workflows.py @@ -1,5 +1,6 @@ from __future__ import annotations +import warnings from collections.abc import Iterator from typing import TYPE_CHECKING, Any, Literal, MutableSequence, Tuple, Union, overload from urllib.parse import quote @@ -17,6 +18,11 @@ WorkflowList, WorkflowStatus, WorkflowTaskExecution, + WorkflowTrigger, + WorkflowTriggerCreate, + WorkflowTriggerList, + WorkflowTriggerRun, + WorkflowTriggerRunList, WorkflowUpsert, WorkflowVersion, WorkflowVersionId, @@ -24,6 +30,7 @@ WorkflowVersionUpsert, ) from cognite.client.exceptions import CogniteAPIError +from cognite.client.utils._experimental import FeaturePreviewWarning from cognite.client.utils._identifier import ( IdentifierSequence, WorkflowVersionIdentifierSequence, @@ -47,6 +54,148 @@ def wrap_workflow_ids( return WorkflowIds.load(workflow_version_ids).dump(camel_case=True, as_external_id=True) +class WorkflowTriggerAPI(APIClient): + _RESOURCE_PATH = "/workflows/triggers" + + def __init__( + self, + config: ClientConfig, + api_version: str | None, + cognite_client: CogniteClient, + ) -> None: + super().__init__(config, api_version, cognite_client) + self._api_subversion = "beta" + self._warning = FeaturePreviewWarning( + api_maturity="beta", sdk_maturity="beta", feature_name="Workflow Orchestration" + ) + + def create( + self, + workflow_trigger: WorkflowTriggerCreate, + client_credentials: ClientCredentials | dict | None = None, + ) -> WorkflowTrigger: + """`Create a new trigger for a workflow. `_ + + Args: + workflow_trigger (WorkflowTriggerCreate): The workflow trigger specitification. + client_credentials (ClientCredentials | dict | None): Specific credentials that should be used to trigger the workflow execution. When passed will take precedence over the current credentials. + + Returns: + WorkflowTrigger: The created workflow trigger specification. + + Examples: + + Create a new scheduled trigger for a workflow: + + >>> from cognite.client import CogniteClient + >>> from cognite.client.data_classes.workflows import WorkflowTriggerCreate, WorkflowScheduledTriggerRule + >>> client = CogniteClient() + >>> client.workflows.triggers.create( + ... WorkflowTriggerCreate( + ... external_id="my_trigger", + ... trigger_rule=WorkflowScheduledTriggerRule(cron_expression="0 0 * * *"), + ... workflow_external_id="my_workflow", + ... workflow_version="1", + ... input={"a": 1, "b": 2}, + ... ) + ... ) + """ + self._warning.warn() + nonce = create_session_and_return_nonce( + self._cognite_client, api_name="Workflow API", client_credentials=client_credentials + ) + dumped = workflow_trigger.dump(camel_case=True) + dumped["authentication"] = {"nonce": nonce} + response = self._post( + url_path=self._RESOURCE_PATH, + json={"items": [dumped]}, + ) + return WorkflowTrigger._load(response.json().get("items")[0]) + + def delete( + self, + external_id: str, + ) -> None: + """`Delete a trigger for a workflow. `_ + + Args: + external_id (str): The external id of the trigger to delete. + + Examples: + + Delete a trigger with external id 'my_trigger': + + >>> from cognite.client import CogniteClient + >>> client = CogniteClient() + >>> client.workflows.triggers.delete("my_trigger") + """ + self._warning.warn() + self._post( + url_path=self._RESOURCE_PATH + "/delete", + json={"items": [{"externalId": external_id}]}, + ) + + def get_triggers( + self, + limit: int = DEFAULT_LIMIT_READ, + ) -> WorkflowTriggerList: + """`Retrieve the trigger list. `_ + + Args: + limit (int): Maximum number of results to return. Defaults to 25. Set to -1, float("inf") or None to return all items. + + Returns: + WorkflowTriggerList: The trigger list. + + Examples: + + Get all triggers: + + >>> from cognite.client import CogniteClient + >>> client = CogniteClient() + >>> res = client.workflows.triggers.get_triggers() + """ + self._warning.warn() + return self._list( + method="GET", + url_path=self._RESOURCE_PATH, + resource_cls=WorkflowTrigger, + list_cls=WorkflowTriggerList, + limit=limit, + ) + + def get_trigger_run_history( + self, + external_id: str, + limit: int = DEFAULT_LIMIT_READ, + ) -> WorkflowTriggerRunList: + """`List the history of runs for a trigger. `_ + + Args: + external_id (str): The external id of the trigger to list runs for. + limit (int): Maximum number of results to return. Defaults to 25. Set to -1, float("inf") or None to return all items. + + Returns: + WorkflowTriggerRunList: The requested trigger runs. + + Examples: + + Get all runs for a trigger with external id 'my_trigger': + + >>> from cognite.client import CogniteClient + >>> client = CogniteClient() + >>> res = client.workflows.triggers.get_trigger_run_history("my_trigger") + """ + self._warning.warn() + return self._list( + method="GET", + url_path=self._RESOURCE_PATH + f"/{external_id}/history", + resource_cls=WorkflowTriggerRun, + list_cls=WorkflowTriggerRunList, + limit=limit, + ) + + class WorkflowTaskAPI(APIClient): _RESOURCE_PATH = "/workflows/tasks" @@ -83,7 +232,7 @@ def update( >>> from cognite.client import CogniteClient >>> client = CogniteClient() - >>> res = client.workflows.executions.trigger("my workflow", "1") + >>> res = client.workflows.executions.run("my workflow", "1") >>> res = client.workflows.executions.retrieve_detailed(res.id) >>> res = client.workflows.tasks.update(res.tasks[1].id, "completed") @@ -142,7 +291,36 @@ def trigger( metadata: dict | None = None, client_credentials: ClientCredentials | None = None, ) -> WorkflowExecution: - """`Trigger a workflow execution. `_ + """`[DEPRECATED]Trigger a workflow execution. `_ + + This method is deprecated, use '.run' instead. It will be completely removed October 2024. + + Args: + workflow_external_id (str): External id of the workflow. + version (str): Version of the workflow. + input (dict | None): The input to the workflow execution. This will be available for tasks that have specified it as an input with the string "${workflow.input}" See tip below for more information. + metadata (dict | None): Application specific metadata. Keys have a maximum length of 32 characters, values a maximum of 255, and there can be a maximum of 10 key-value pairs. + client_credentials (ClientCredentials | None): Specific credentials that should be used to trigger the workflow execution. When passed will take precedence over the current credentials. + Returns: + WorkflowExecution: No description. + """ + warnings.warn( + "This methods has been deprecated, use '.run' instead. It will be completely removed October 2024.", + DeprecationWarning, + stacklevel=2, + ) + return self.run(workflow_external_id, version, input, metadata, client_credentials) + + def run( + self, + workflow_external_id: str, + version: str, + input: dict | None = None, + metadata: dict | None = None, + client_credentials: ClientCredentials | None = None, + nonce: str | None = None, + ) -> WorkflowExecution: + """`Run a workflow execution. `_ Args: workflow_external_id (str): External id of the workflow. @@ -150,6 +328,7 @@ def trigger( input (dict | None): The input to the workflow execution. This will be available for tasks that have specified it as an input with the string "${workflow.input}" See tip below for more information. metadata (dict | None): Application specific metadata. Keys have a maximum length of 32 characters, values a maximum of 255, and there can be a maximum of 10 key-value pairs. client_credentials (ClientCredentials | None): Specific credentials that should be used to trigger the workflow execution. When passed will take precedence over the current credentials. + nonce (str | None): The nonce to use to bind the session. If not provided, a new session will be created using the current credentials. Tip: The workflow input can be available in the workflow tasks. For example, if you have a Task with @@ -162,6 +341,9 @@ def trigger( ... external_id="cdf_deployed_function:my_function", ... data={"workflow_data": "${workflow.input}",})) + Tip: + You can create a session via the Sessions API, using the client.iam.session.create() method. + Returns: WorkflowExecution: The created workflow execution. @@ -171,20 +353,20 @@ def trigger( >>> from cognite.client import CogniteClient >>> client = CogniteClient() - >>> res = client.workflows.executions.trigger("foo", "1") + >>> res = client.workflows.executions.run("foo", "1") Trigger a workflow execution with input data: - >>> res = client.workflows.executions.trigger("foo", "1", input={"a": 1, "b": 2}) + >>> res = client.workflows.executions.run("foo", "1", input={"a": 1, "b": 2}) Trigger a workflow execution using a specific set of client credentials (i.e. not your current credentials): >>> import os >>> from cognite.client.data_classes import ClientCredentials >>> credentials = ClientCredentials("my-client-id", os.environ["MY_CLIENT_SECRET"]) - >>> res = client.workflows.executions.trigger("foo", "1", client_credentials=credentials) + >>> res = client.workflows.executions.run("foo", "1", client_credentials=credentials) """ - nonce = create_session_and_return_nonce( + nonce = nonce or create_session_and_return_nonce( self._cognite_client, api_name="Workflow API", client_credentials=client_credentials ) body = {"authentication": {"nonce": nonce}} @@ -275,7 +457,7 @@ def cancel(self, id: str, reason: str | None) -> WorkflowExecution: >>> from cognite.client import CogniteClient >>> client = CogniteClient() - >>> res = client.workflows.executions.trigger("foo", "1") + >>> res = client.workflows.executions.run("foo", "1") >>> client.workflows.executions.cancel(id="foo", reason="test cancelation") """ response = self._post( @@ -304,7 +486,7 @@ def retry(self, id: str, client_credentials: ClientCredentials | None = None) -> >>> from cognite.client import CogniteClient >>> client = CogniteClient() - >>> res = client.workflows.executions.trigger("foo", "1") + >>> res = client.workflows.executions.run("foo", "1") >>> client.workflows.executions.cancel(id=res.id, reason="test cancellation") >>> client.workflows.executions.retry(res.id) """ @@ -540,6 +722,7 @@ def __init__( self.versions = WorkflowVersionAPI(config, api_version, cognite_client) self.executions = WorkflowExecutionAPI(config, api_version, cognite_client) self.tasks = WorkflowTaskAPI(config, api_version, cognite_client) + self.triggers = WorkflowTriggerAPI(config, api_version, cognite_client) self._DELETE_LIMIT = 100 @overload diff --git a/cognite/client/_proto/data_point_insertion_request_pb2.py b/cognite/client/_proto/data_point_insertion_request_pb2.py new file mode 100644 index 000000000..19fca1f77 --- /dev/null +++ b/cognite/client/_proto/data_point_insertion_request_pb2.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: data_point_insertion_request.proto +# Protobuf Python Version: 4.25.4 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +import cognite.client._proto.data_points_pb2 as data__points__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"data_point_insertion_request.proto\x12\x1f\x63om.cognite.v1.timeseries.proto\x1a\x11\x64\x61ta_points.proto\"\xc7\x02\n\x16\x44\x61taPointInsertionItem\x12\x0c\n\x02id\x18\x01 \x01(\x03H\x00\x12\x14\n\nexternalId\x18\x02 \x01(\tH\x00\x12\x41\n\ninstanceId\x18\x05 \x01(\x0b\x32+.com.cognite.v1.timeseries.proto.InstanceIdH\x00\x12O\n\x11numericDatapoints\x18\x03 \x01(\x0b\x32\x32.com.cognite.v1.timeseries.proto.NumericDatapointsH\x01\x12M\n\x10stringDatapoints\x18\x04 \x01(\x0b\x32\x31.com.cognite.v1.timeseries.proto.StringDatapointsH\x01\x42\x15\n\x13timeSeriesReferenceB\x0f\n\rdatapointType\"c\n\x19\x44\x61taPointInsertionRequest\x12\x46\n\x05items\x18\x01 \x03(\x0b\x32\x37.com.cognite.v1.timeseries.proto.DataPointInsertionItemB\x02P\x01\x62\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'data_point_insertion_request_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + _globals['DESCRIPTOR']._options = None + _globals['DESCRIPTOR']._serialized_options = b'P\001' + _globals['_DATAPOINTINSERTIONITEM']._serialized_start=91 + _globals['_DATAPOINTINSERTIONITEM']._serialized_end=418 + _globals['_DATAPOINTINSERTIONREQUEST']._serialized_start=420 + _globals['_DATAPOINTINSERTIONREQUEST']._serialized_end=519 +# @@protoc_insertion_point(module_scope) diff --git a/cognite/client/_proto/data_point_insertion_request_pb2.pyi b/cognite/client/_proto/data_point_insertion_request_pb2.pyi new file mode 100644 index 000000000..c553056fe --- /dev/null +++ b/cognite/client/_proto/data_point_insertion_request_pb2.pyi @@ -0,0 +1,27 @@ +import cognite.client._proto.data_points_pb2 as _data_points_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class DataPointInsertionItem(_message.Message): + __slots__ = ("id", "externalId", "instanceId", "numericDatapoints", "stringDatapoints") + ID_FIELD_NUMBER: _ClassVar[int] + EXTERNALID_FIELD_NUMBER: _ClassVar[int] + INSTANCEID_FIELD_NUMBER: _ClassVar[int] + NUMERICDATAPOINTS_FIELD_NUMBER: _ClassVar[int] + STRINGDATAPOINTS_FIELD_NUMBER: _ClassVar[int] + id: int + externalId: str + instanceId: _data_points_pb2.InstanceId + numericDatapoints: _data_points_pb2.NumericDatapoints + stringDatapoints: _data_points_pb2.StringDatapoints + def __init__(self, id: _Optional[int] = ..., externalId: _Optional[str] = ..., instanceId: _Optional[_Union[_data_points_pb2.InstanceId, _Mapping]] = ..., numericDatapoints: _Optional[_Union[_data_points_pb2.NumericDatapoints, _Mapping]] = ..., stringDatapoints: _Optional[_Union[_data_points_pb2.StringDatapoints, _Mapping]] = ...) -> None: ... + +class DataPointInsertionRequest(_message.Message): + __slots__ = ("items",) + ITEMS_FIELD_NUMBER: _ClassVar[int] + items: _containers.RepeatedCompositeFieldContainer[DataPointInsertionItem] + def __init__(self, items: _Optional[_Iterable[_Union[DataPointInsertionItem, _Mapping]]] = ...) -> None: ... diff --git a/cognite/client/_proto/data_point_list_response.proto b/cognite/client/_proto/data_point_list_response.proto deleted file mode 100644 index 2328d865b..000000000 --- a/cognite/client/_proto/data_point_list_response.proto +++ /dev/null @@ -1,27 +0,0 @@ -syntax = "proto3"; - -package com.cognite.v1.timeseries.proto; - -import "data_points.proto"; - -option java_multiple_files = true; - -message DataPointListItem { - int64 id = 1; - string externalId = 2; - bool isString = 6; - bool isStep = 7; - string unit = 8; - string nextCursor = 9; - string unitExternalId = 10; - - oneof datapointType { - NumericDatapoints numericDatapoints = 3; - StringDatapoints stringDatapoints = 4; - AggregateDatapoints aggregateDatapoints = 5; - } -} - -message DataPointListResponse { - repeated DataPointListItem items = 1; -} diff --git a/cognite/client/_proto/data_point_list_response_pb2.py b/cognite/client/_proto/data_point_list_response_pb2.py index 0fdb04c20..d6d91cf3f 100644 --- a/cognite/client/_proto/data_point_list_response_pb2.py +++ b/cognite/client/_proto/data_point_list_response_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: data_point_list_response.proto -# Protobuf Python Version: 4.25.3 +# Protobuf Python Version: 4.25.4 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -15,7 +15,7 @@ import cognite.client._proto.data_points_pb2 as data__points__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x64\x61ta_point_list_response.proto\x12\x1f\x63om.cognite.v1.timeseries.proto\x1a\x11\x64\x61ta_points.proto\"\x95\x03\n\x11\x44\x61taPointListItem\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x12\n\nexternalId\x18\x02 \x01(\t\x12\x10\n\x08isString\x18\x06 \x01(\x08\x12\x0e\n\x06isStep\x18\x07 \x01(\x08\x12\x0c\n\x04unit\x18\x08 \x01(\t\x12\x12\n\nnextCursor\x18\t \x01(\t\x12\x16\n\x0eunitExternalId\x18\n \x01(\t\x12O\n\x11numericDatapoints\x18\x03 \x01(\x0b\x32\x32.com.cognite.v1.timeseries.proto.NumericDatapointsH\x00\x12M\n\x10stringDatapoints\x18\x04 \x01(\x0b\x32\x31.com.cognite.v1.timeseries.proto.StringDatapointsH\x00\x12S\n\x13\x61ggregateDatapoints\x18\x05 \x01(\x0b\x32\x34.com.cognite.v1.timeseries.proto.AggregateDatapointsH\x00\x42\x0f\n\rdatapointType\"Z\n\x15\x44\x61taPointListResponse\x12\x41\n\x05items\x18\x01 \x03(\x0b\x32\x32.com.cognite.v1.timeseries.proto.DataPointListItemB\x02P\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x64\x61ta_point_list_response.proto\x12\x1f\x63om.cognite.v1.timeseries.proto\x1a\x11\x64\x61ta_points.proto\"\xd6\x03\n\x11\x44\x61taPointListItem\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x12\n\nexternalId\x18\x02 \x01(\t\x12?\n\ninstanceId\x18\x0b \x01(\x0b\x32+.com.cognite.v1.timeseries.proto.InstanceId\x12\x10\n\x08isString\x18\x06 \x01(\x08\x12\x0e\n\x06isStep\x18\x07 \x01(\x08\x12\x0c\n\x04unit\x18\x08 \x01(\t\x12\x12\n\nnextCursor\x18\t \x01(\t\x12\x16\n\x0eunitExternalId\x18\n \x01(\t\x12O\n\x11numericDatapoints\x18\x03 \x01(\x0b\x32\x32.com.cognite.v1.timeseries.proto.NumericDatapointsH\x00\x12M\n\x10stringDatapoints\x18\x04 \x01(\x0b\x32\x31.com.cognite.v1.timeseries.proto.StringDatapointsH\x00\x12S\n\x13\x61ggregateDatapoints\x18\x05 \x01(\x0b\x32\x34.com.cognite.v1.timeseries.proto.AggregateDatapointsH\x00\x42\x0f\n\rdatapointType\"Z\n\x15\x44\x61taPointListResponse\x12\x41\n\x05items\x18\x01 \x03(\x0b\x32\x32.com.cognite.v1.timeseries.proto.DataPointListItemB\x02P\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -24,7 +24,7 @@ _globals['DESCRIPTOR']._options = None _globals['DESCRIPTOR']._serialized_options = b'P\001' _globals['_DATAPOINTLISTITEM']._serialized_start=87 - _globals['_DATAPOINTLISTITEM']._serialized_end=492 - _globals['_DATAPOINTLISTRESPONSE']._serialized_start=494 - _globals['_DATAPOINTLISTRESPONSE']._serialized_end=584 + _globals['_DATAPOINTLISTITEM']._serialized_end=557 + _globals['_DATAPOINTLISTRESPONSE']._serialized_start=559 + _globals['_DATAPOINTLISTRESPONSE']._serialized_end=649 # @@protoc_insertion_point(module_scope) diff --git a/cognite/client/_proto/data_point_list_response_pb2.pyi b/cognite/client/_proto/data_point_list_response_pb2.pyi index 0f2cf785c..4a1ded105 100644 --- a/cognite/client/_proto/data_point_list_response_pb2.pyi +++ b/cognite/client/_proto/data_point_list_response_pb2.pyi @@ -1,4 +1,4 @@ -import data_points_pb2 as _data_points_pb2 +import cognite.client._proto.data_points_pb2 as _data_points_pb2 from google.protobuf.internal import containers as _containers from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message @@ -7,9 +7,10 @@ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Map DESCRIPTOR: _descriptor.FileDescriptor class DataPointListItem(_message.Message): - __slots__ = ("id", "externalId", "isString", "isStep", "unit", "nextCursor", "unitExternalId", "numericDatapoints", "stringDatapoints", "aggregateDatapoints") + __slots__ = ("id", "externalId", "instanceId", "isString", "isStep", "unit", "nextCursor", "unitExternalId", "numericDatapoints", "stringDatapoints", "aggregateDatapoints") ID_FIELD_NUMBER: _ClassVar[int] EXTERNALID_FIELD_NUMBER: _ClassVar[int] + INSTANCEID_FIELD_NUMBER: _ClassVar[int] ISSTRING_FIELD_NUMBER: _ClassVar[int] ISSTEP_FIELD_NUMBER: _ClassVar[int] UNIT_FIELD_NUMBER: _ClassVar[int] @@ -20,6 +21,7 @@ class DataPointListItem(_message.Message): AGGREGATEDATAPOINTS_FIELD_NUMBER: _ClassVar[int] id: int externalId: str + instanceId: _data_points_pb2.InstanceId isString: bool isStep: bool unit: str @@ -28,7 +30,7 @@ class DataPointListItem(_message.Message): numericDatapoints: _data_points_pb2.NumericDatapoints stringDatapoints: _data_points_pb2.StringDatapoints aggregateDatapoints: _data_points_pb2.AggregateDatapoints - def __init__(self, id: _Optional[int] = ..., externalId: _Optional[str] = ..., isString: bool = ..., isStep: bool = ..., unit: _Optional[str] = ..., nextCursor: _Optional[str] = ..., unitExternalId: _Optional[str] = ..., numericDatapoints: _Optional[_Union[_data_points_pb2.NumericDatapoints, _Mapping]] = ..., stringDatapoints: _Optional[_Union[_data_points_pb2.StringDatapoints, _Mapping]] = ..., aggregateDatapoints: _Optional[_Union[_data_points_pb2.AggregateDatapoints, _Mapping]] = ...) -> None: ... + def __init__(self, id: _Optional[int] = ..., externalId: _Optional[str] = ..., instanceId: _Optional[_Union[_data_points_pb2.InstanceId, _Mapping]] = ..., isString: bool = ..., isStep: bool = ..., unit: _Optional[str] = ..., nextCursor: _Optional[str] = ..., unitExternalId: _Optional[str] = ..., numericDatapoints: _Optional[_Union[_data_points_pb2.NumericDatapoints, _Mapping]] = ..., stringDatapoints: _Optional[_Union[_data_points_pb2.StringDatapoints, _Mapping]] = ..., aggregateDatapoints: _Optional[_Union[_data_points_pb2.AggregateDatapoints, _Mapping]] = ...) -> None: ... class DataPointListResponse(_message.Message): __slots__ = ("items",) diff --git a/cognite/client/_proto/data_points.proto b/cognite/client/_proto/data_points.proto deleted file mode 100644 index d8e010a74..000000000 --- a/cognite/client/_proto/data_points.proto +++ /dev/null @@ -1,56 +0,0 @@ -syntax = "proto3"; - -package com.cognite.v1.timeseries.proto; - -option java_multiple_files = true; - -message Status { - int64 code = 1; - string symbol = 2; -} - -message NumericDatapoint { - int64 timestamp = 1; - double value = 2; - Status status = 3; - bool nullValue = 4; -} - -message NumericDatapoints { - repeated NumericDatapoint datapoints = 1; -} - -message StringDatapoint { - int64 timestamp = 1; - string value = 2; - Status status = 3; - bool nullValue = 4; -} - -message StringDatapoints { - repeated StringDatapoint datapoints = 1; -} - -message AggregateDatapoint { - int64 timestamp = 1; - double average = 2; - double max = 3; - double min = 4; - double count = 5; - double sum = 6; - double interpolation = 7; - double stepInterpolation = 8; - double continuousVariance = 9; - double discreteVariance = 10; - double totalVariation = 11; - double countGood = 12; - double countUncertain = 13; - double countBad = 14; - double durationGood = 15; - double durationUncertain = 16; - double durationBad = 17; -} - -message AggregateDatapoints { - repeated AggregateDatapoint datapoints = 1; -} diff --git a/cognite/client/_proto/data_points_pb2.py b/cognite/client/_proto/data_points_pb2.py index 806b2d39b..2f5337ee8 100644 --- a/cognite/client/_proto/data_points_pb2.py +++ b/cognite/client/_proto/data_points_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: data_points.proto -# Protobuf Python Version: 4.25.3 +# Protobuf Python Version: 4.25.4 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool @@ -14,7 +14,7 @@ -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11\x64\x61ta_points.proto\x12\x1f\x63om.cognite.v1.timeseries.proto\"&\n\x06Status\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x03\x12\x0e\n\x06symbol\x18\x02 \x01(\t\"\x80\x01\n\x10NumericDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\x01\x12\x37\n\x06status\x18\x03 \x01(\x0b\x32\'.com.cognite.v1.timeseries.proto.Status\x12\x11\n\tnullValue\x18\x04 \x01(\x08\"Z\n\x11NumericDatapoints\x12\x45\n\ndatapoints\x18\x01 \x03(\x0b\x32\x31.com.cognite.v1.timeseries.proto.NumericDatapoint\"\x7f\n\x0fStringDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t\x12\x37\n\x06status\x18\x03 \x01(\x0b\x32\'.com.cognite.v1.timeseries.proto.Status\x12\x11\n\tnullValue\x18\x04 \x01(\x08\"X\n\x10StringDatapoints\x12\x44\n\ndatapoints\x18\x01 \x03(\x0b\x32\x30.com.cognite.v1.timeseries.proto.StringDatapoint\"\xf1\x02\n\x12\x41ggregateDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\x0f\n\x07\x61verage\x18\x02 \x01(\x01\x12\x0b\n\x03max\x18\x03 \x01(\x01\x12\x0b\n\x03min\x18\x04 \x01(\x01\x12\r\n\x05\x63ount\x18\x05 \x01(\x01\x12\x0b\n\x03sum\x18\x06 \x01(\x01\x12\x15\n\rinterpolation\x18\x07 \x01(\x01\x12\x19\n\x11stepInterpolation\x18\x08 \x01(\x01\x12\x1a\n\x12\x63ontinuousVariance\x18\t \x01(\x01\x12\x18\n\x10\x64iscreteVariance\x18\n \x01(\x01\x12\x16\n\x0etotalVariation\x18\x0b \x01(\x01\x12\x11\n\tcountGood\x18\x0c \x01(\x01\x12\x16\n\x0e\x63ountUncertain\x18\r \x01(\x01\x12\x10\n\x08\x63ountBad\x18\x0e \x01(\x01\x12\x14\n\x0c\x64urationGood\x18\x0f \x01(\x01\x12\x19\n\x11\x64urationUncertain\x18\x10 \x01(\x01\x12\x13\n\x0b\x64urationBad\x18\x11 \x01(\x01\"^\n\x13\x41ggregateDatapoints\x12G\n\ndatapoints\x18\x01 \x03(\x0b\x32\x33.com.cognite.v1.timeseries.proto.AggregateDatapointB\x02P\x01\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11\x64\x61ta_points.proto\x12\x1f\x63om.cognite.v1.timeseries.proto\"&\n\x06Status\x12\x0c\n\x04\x63ode\x18\x01 \x01(\x03\x12\x0e\n\x06symbol\x18\x02 \x01(\t\"\x80\x01\n\x10NumericDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\x01\x12\x37\n\x06status\x18\x03 \x01(\x0b\x32\'.com.cognite.v1.timeseries.proto.Status\x12\x11\n\tnullValue\x18\x04 \x01(\x08\"Z\n\x11NumericDatapoints\x12\x45\n\ndatapoints\x18\x01 \x03(\x0b\x32\x31.com.cognite.v1.timeseries.proto.NumericDatapoint\"\x7f\n\x0fStringDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\r\n\x05value\x18\x02 \x01(\t\x12\x37\n\x06status\x18\x03 \x01(\x0b\x32\'.com.cognite.v1.timeseries.proto.Status\x12\x11\n\tnullValue\x18\x04 \x01(\x08\"X\n\x10StringDatapoints\x12\x44\n\ndatapoints\x18\x01 \x03(\x0b\x32\x30.com.cognite.v1.timeseries.proto.StringDatapoint\"\xf1\x02\n\x12\x41ggregateDatapoint\x12\x11\n\ttimestamp\x18\x01 \x01(\x03\x12\x0f\n\x07\x61verage\x18\x02 \x01(\x01\x12\x0b\n\x03max\x18\x03 \x01(\x01\x12\x0b\n\x03min\x18\x04 \x01(\x01\x12\r\n\x05\x63ount\x18\x05 \x01(\x01\x12\x0b\n\x03sum\x18\x06 \x01(\x01\x12\x15\n\rinterpolation\x18\x07 \x01(\x01\x12\x19\n\x11stepInterpolation\x18\x08 \x01(\x01\x12\x1a\n\x12\x63ontinuousVariance\x18\t \x01(\x01\x12\x18\n\x10\x64iscreteVariance\x18\n \x01(\x01\x12\x16\n\x0etotalVariation\x18\x0b \x01(\x01\x12\x11\n\tcountGood\x18\x0c \x01(\x01\x12\x16\n\x0e\x63ountUncertain\x18\r \x01(\x01\x12\x10\n\x08\x63ountBad\x18\x0e \x01(\x01\x12\x14\n\x0c\x64urationGood\x18\x0f \x01(\x01\x12\x19\n\x11\x64urationUncertain\x18\x10 \x01(\x01\x12\x13\n\x0b\x64urationBad\x18\x11 \x01(\x01\"^\n\x13\x41ggregateDatapoints\x12G\n\ndatapoints\x18\x01 \x03(\x0b\x32\x33.com.cognite.v1.timeseries.proto.AggregateDatapoint\"/\n\nInstanceId\x12\r\n\x05space\x18\x01 \x01(\t\x12\x12\n\nexternalId\x18\x02 \x01(\tB\x02P\x01\x62\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -36,4 +36,6 @@ _globals['_AGGREGATEDATAPOINT']._serialized_end=906 _globals['_AGGREGATEDATAPOINTS']._serialized_start=908 _globals['_AGGREGATEDATAPOINTS']._serialized_end=1002 + _globals['_INSTANCEID']._serialized_start=1004 + _globals['_INSTANCEID']._serialized_end=1051 # @@protoc_insertion_point(module_scope) diff --git a/cognite/client/_proto/data_points_pb2.pyi b/cognite/client/_proto/data_points_pb2.pyi index 733b718b0..8a1ebf8fb 100644 --- a/cognite/client/_proto/data_points_pb2.pyi +++ b/cognite/client/_proto/data_points_pb2.pyi @@ -92,3 +92,11 @@ class AggregateDatapoints(_message.Message): DATAPOINTS_FIELD_NUMBER: _ClassVar[int] datapoints: _containers.RepeatedCompositeFieldContainer[AggregateDatapoint] def __init__(self, datapoints: _Optional[_Iterable[_Union[AggregateDatapoint, _Mapping]]] = ...) -> None: ... + +class InstanceId(_message.Message): + __slots__ = ("space", "externalId") + SPACE_FIELD_NUMBER: _ClassVar[int] + EXTERNALID_FIELD_NUMBER: _ClassVar[int] + space: str + externalId: str + def __init__(self, space: _Optional[str] = ..., externalId: _Optional[str] = ...) -> None: ... diff --git a/cognite/client/_version.py b/cognite/client/_version.py index c8a3c7acf..edd6657ff 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.54.13" +__version__ = "7.55.1" __api_subversion__ = "20230101" diff --git a/cognite/client/data_classes/__init__.py b/cognite/client/data_classes/__init__.py index 1eb05c917..5fee33dc0 100644 --- a/cognite/client/data_classes/__init__.py +++ b/cognite/client/data_classes/__init__.py @@ -303,6 +303,11 @@ WorkflowList, WorkflowTask, WorkflowTaskExecution, + WorkflowTrigger, + WorkflowTriggerCreate, + WorkflowTriggerList, + WorkflowTriggerRun, + WorkflowTriggerRunList, WorkflowUpsert, WorkflowUpsertList, WorkflowVersion, @@ -569,6 +574,12 @@ "WorkflowTask", "WorkflowUpsertList", "WorkflowVersionUpsertList", + "WorkflowVersionUpsertList", + "WorkflowTrigger", + "WorkflowTriggerCreate", + "WorkflowTriggerList", + "WorkflowTriggerRun", + "WorkflowTriggerRunList", "HasName", "HasExternalId", "HasInternalId", diff --git a/cognite/client/data_classes/capabilities.py b/cognite/client/data_classes/capabilities.py index d6cf6e018..64681a3a5 100644 --- a/cognite/client/data_classes/capabilities.py +++ b/cognite/client/data_classes/capabilities.py @@ -797,6 +797,22 @@ class Scope: DataSet = DataSetScope +@dataclass +class LocationFiltersAcl(Capability): + _capability_name = "locationFiltersAcl" + actions: Sequence[Action] + scope: AllScope | IDScope + allow_unknown: bool = field(default=False, compare=False, repr=False) + + class Action(Capability.Action): # type: ignore [misc] + Read = "READ" + Write = "WRITE" + + class Scope: + All = AllScope + SpaceID = IDScope + + @dataclass class ProjectsAcl(Capability): _capability_name = "projectsAcl" diff --git a/cognite/client/data_classes/cdm/__init__.py b/cognite/client/data_classes/data_modeling/cdm/__init__.py similarity index 100% rename from cognite/client/data_classes/cdm/__init__.py rename to cognite/client/data_classes/data_modeling/cdm/__init__.py diff --git a/cognite/client/data_classes/cdm/v1.py b/cognite/client/data_classes/data_modeling/cdm/v1.py similarity index 89% rename from cognite/client/data_classes/cdm/v1.py rename to cognite/client/data_classes/data_modeling/cdm/v1.py index 0b2ad5dfc..016ef81dc 100644 --- a/cognite/client/data_classes/cdm/v1.py +++ b/cognite/client/data_classes/data_modeling/cdm/v1.py @@ -14,27 +14,41 @@ ) -class CogniteDescribableProperties: +class _Cognite3DTransformationProperties: + translation_x = PropertyOptions("translationX") + translation_y = PropertyOptions("translationY") + translation_z = PropertyOptions("translationZ") + euler_rotation_x = PropertyOptions("eulerRotationX") + euler_rotation_y = PropertyOptions("eulerRotationY") + euler_rotation_z = PropertyOptions("eulerRotationZ") + scale_x = PropertyOptions("scaleX") + scale_y = PropertyOptions("scaleY") + scale_z = PropertyOptions("scaleZ") + @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteDescribable", "v1") + return ViewId("cdf_cdm", "Cognite3DTransformation", "v1") -class CogniteDescribableNodeApply(CogniteDescribableProperties, TypedNodeApply): - """This represents the writing format of Cognite describable node. +class Cognite3DTransformationNodeApply(_Cognite3DTransformationProperties, TypedNodeApply): + """This represents the writing format of Cognite 3D transformation node. It is used to when data is written to CDF. - The describable core concept is used as a standard way of holding the bare minimum of information about the instance - + The Cognite3DTransformation object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in the 3D coordinate system. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions. The object's transformation is defined in "CDF space", a coordinate system where the positive Z axis is the up direction Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite describable node. - name (str | None): Name of the instance - description (str | None): Description of the instance - tags (list[str] | None): Text based labels for generic use, limited to 1000 - aliases (list[str] | None): Alternative names for the node + external_id (str): The external id of the Cognite 3D transformation node. + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -44,38 +58,52 @@ def __init__( space: str, external_id: str, *, - name: str | None = None, - description: str | None = None, - tags: list[str] | None = None, - aliases: list[str] | None = None, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.name = name - self.description = description - self.tags = tags - self.aliases = aliases + self.translation_x = translation_x + self.translation_y = translation_y + self.translation_z = translation_z + self.euler_rotation_x = euler_rotation_x + self.euler_rotation_y = euler_rotation_y + self.euler_rotation_z = euler_rotation_z + self.scale_x = scale_x + self.scale_y = scale_y + self.scale_z = scale_z -class CogniteDescribableNode(CogniteDescribableProperties, TypedNode): - """This represents the reading format of Cognite describable node. +class Cognite3DTransformationNode(_Cognite3DTransformationProperties, TypedNode): + """This represents the reading format of Cognite 3D transformation node. It is used to when data is read from CDF. - The describable core concept is used as a standard way of holding the bare minimum of information about the instance - + The Cognite3DTransformation object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in the 3D coordinate system. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions. The object's transformation is defined in "CDF space", a coordinate system where the positive Z axis is the up direction Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite describable node. + external_id (str): The external id of the Cognite 3D transformation node. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - name (str | None): Name of the instance - description (str | None): Description of the instance - tags (list[str] | None): Text based labels for generic use, limited to 1000 - aliases (list[str] | None): Alternative names for the node + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -88,57 +116,69 @@ def __init__( last_updated_time: int, created_time: int, *, - name: str | None = None, - description: str | None = None, - tags: list[str] | None = None, - aliases: list[str] | None = None, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.name = name - self.description = description - self.tags = tags - self.aliases = aliases + self.translation_x = translation_x + self.translation_y = translation_y + self.translation_z = translation_z + self.euler_rotation_x = euler_rotation_x + self.euler_rotation_y = euler_rotation_y + self.euler_rotation_z = euler_rotation_z + self.scale_x = scale_x + self.scale_y = scale_y + self.scale_z = scale_z - def as_write(self) -> CogniteDescribableNodeApply: - return CogniteDescribableNodeApply( + def as_write(self) -> Cognite3DTransformationNodeApply: + return Cognite3DTransformationNodeApply( self.space, self.external_id, - name=self.name, - description=self.description, - tags=self.tags, - aliases=self.aliases, + translation_x=self.translation_x, + translation_y=self.translation_y, + translation_z=self.translation_z, + euler_rotation_x=self.euler_rotation_x, + euler_rotation_y=self.euler_rotation_y, + euler_rotation_z=self.euler_rotation_z, + scale_x=self.scale_x, + scale_y=self.scale_y, + scale_z=self.scale_z, existing_version=self.version, type=self.type, ) -class CogniteSchedulableProperties: - start_time = PropertyOptions("startTime") - end_time = PropertyOptions("endTime") - scheduled_start_time = PropertyOptions("scheduledStartTime") - scheduled_end_time = PropertyOptions("scheduledEndTime") - +class _CogniteCubeMapProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteSchedulable", "v1") + return ViewId("cdf_cdm", "CogniteCubeMap", "v1") -class CogniteSchedulableApply(CogniteSchedulableProperties, TypedNodeApply): - """This represents the writing format of Cognite schedulable. +class CogniteCubeMapApply(_CogniteCubeMapProperties, TypedNodeApply): + """This represents the writing format of Cognite cube map. It is used to when data is written to CDF. - CogniteSchedulable represents the metadata about when an activity (or similar) starts and ends. + The cube map holds references to 6 images in used to visually represent the surrounding environment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite schedulable. - start_time (datetime | None): The actual start time of an activity (or similar that extends this) - end_time (datetime | None): The actual end time of an activity (or similar that extends this) - scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) - scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) + external_id (str): The external id of the Cognite cube map. + front (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the front projection of the cube map + back (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the back projection of the cube map + left (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the left projection of the cube map + right (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the right projection of the cube map + top (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the top projection of the cube map + bottom (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the bottom projection of the cube map existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -148,37 +188,43 @@ def __init__( space: str, external_id: str, *, - start_time: datetime | None = None, - end_time: datetime | None = None, - scheduled_start_time: datetime | None = None, - scheduled_end_time: datetime | None = None, + front: DirectRelationReference | tuple[str, str] | None = None, + back: DirectRelationReference | tuple[str, str] | None = None, + left: DirectRelationReference | tuple[str, str] | None = None, + right: DirectRelationReference | tuple[str, str] | None = None, + top: DirectRelationReference | tuple[str, str] | None = None, + bottom: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.start_time = start_time - self.end_time = end_time - self.scheduled_start_time = scheduled_start_time - self.scheduled_end_time = scheduled_end_time + self.front = DirectRelationReference.load(front) if front else None + self.back = DirectRelationReference.load(back) if back else None + self.left = DirectRelationReference.load(left) if left else None + self.right = DirectRelationReference.load(right) if right else None + self.top = DirectRelationReference.load(top) if top else None + self.bottom = DirectRelationReference.load(bottom) if bottom else None -class CogniteSchedulable(CogniteSchedulableProperties, TypedNode): - """This represents the reading format of Cognite schedulable. +class CogniteCubeMap(_CogniteCubeMapProperties, TypedNode): + """This represents the reading format of Cognite cube map. It is used to when data is read from CDF. - CogniteSchedulable represents the metadata about when an activity (or similar) starts and ends. + The cube map holds references to 6 images in used to visually represent the surrounding environment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite schedulable. + external_id (str): The external id of the Cognite cube map. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - start_time (datetime | None): The actual start time of an activity (or similar that extends this) - end_time (datetime | None): The actual end time of an activity (or similar that extends this) - scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) - scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) + front (DirectRelationReference | None): Direct relation to a file holding the front projection of the cube map + back (DirectRelationReference | None): Direct relation to a file holding the back projection of the cube map + left (DirectRelationReference | None): Direct relation to a file holding the left projection of the cube map + right (DirectRelationReference | None): Direct relation to a file holding the right projection of the cube map + top (DirectRelationReference | None): Direct relation to a file holding the top projection of the cube map + bottom (DirectRelationReference | None): Direct relation to a file holding the bottom projection of the cube map type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -191,59 +237,61 @@ def __init__( last_updated_time: int, created_time: int, *, - start_time: datetime | None = None, - end_time: datetime | None = None, - scheduled_start_time: datetime | None = None, - scheduled_end_time: datetime | None = None, + front: DirectRelationReference | None = None, + back: DirectRelationReference | None = None, + left: DirectRelationReference | None = None, + right: DirectRelationReference | None = None, + top: DirectRelationReference | None = None, + bottom: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.start_time = start_time - self.end_time = end_time - self.scheduled_start_time = scheduled_start_time - self.scheduled_end_time = scheduled_end_time + self.front = DirectRelationReference.load(front) if front else None + self.back = DirectRelationReference.load(back) if back else None + self.left = DirectRelationReference.load(left) if left else None + self.right = DirectRelationReference.load(right) if right else None + self.top = DirectRelationReference.load(top) if top else None + self.bottom = DirectRelationReference.load(bottom) if bottom else None - def as_write(self) -> CogniteSchedulableApply: - return CogniteSchedulableApply( + def as_write(self) -> CogniteCubeMapApply: + return CogniteCubeMapApply( self.space, self.external_id, - start_time=self.start_time, - end_time=self.end_time, - scheduled_start_time=self.scheduled_start_time, - scheduled_end_time=self.scheduled_end_time, + front=self.front, + back=self.back, + left=self.left, + right=self.right, + top=self.top, + bottom=self.bottom, existing_version=self.version, type=self.type, ) -class CogniteSourceableProperties: - source_id = PropertyOptions("sourceId") - source_context = PropertyOptions("sourceContext") - source_created_time = PropertyOptions("sourceCreatedTime") - source_updated_time = PropertyOptions("sourceUpdatedTime") - source_created_user = PropertyOptions("sourceCreatedUser") - source_updated_user = PropertyOptions("sourceUpdatedUser") +class _Cognite3DRevisionProperties: + type_ = PropertyOptions("type") + model_3d = PropertyOptions("model3D") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteSourceable", "v1") + return ViewId("cdf_cdm", "Cognite3DRevision", "v1") -class CogniteSourceableNodeApply(CogniteSourceableProperties, TypedNodeApply): - """This represents the writing format of Cognite sourceable node. +class Cognite3DRevisionApply(_Cognite3DRevisionProperties, TypedNodeApply): + """This represents the writing format of Cognite 3D revision. It is used to when data is written to CDF. + + Shared revision information for various 3D data types. Normally not used directly, but through CognitePointCloudRevision, Image360Collection or CogniteCADRevision + Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite sourceable node. - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + external_id (str): The external id of the Cognite 3D revision. + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | tuple[str, str] | None): The model 3d field. existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -253,44 +301,37 @@ def __init__( space: str, external_id: str, *, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | tuple[str, str] | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.source_id = source_id - self.source_context = source_context - self.source = DirectRelationReference.load(source) if source else None - self.source_created_time = source_created_time - self.source_updated_time = source_updated_time - self.source_created_user = source_created_user - self.source_updated_user = source_updated_user + self.status = status + self.published = published + self.type_ = type_ + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None -class CogniteSourceableNode(CogniteSourceableProperties, TypedNode): - """This represents the reading format of Cognite sourceable node. +class Cognite3DRevision(_Cognite3DRevisionProperties, TypedNode): + """This represents the reading format of Cognite 3D revision. It is used to when data is read from CDF. + Shared revision information for various 3D data types. Normally not used directly, but through CognitePointCloudRevision, Image360Collection or CogniteCADRevision + Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite sourceable node. + external_id (str): The external id of the Cognite 3D revision. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | None): The model 3d field. type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -303,60 +344,52 @@ def __init__( last_updated_time: int, created_time: int, *, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.source_id = source_id - self.source_context = source_context - self.source = DirectRelationReference.load(source) if source else None - self.source_created_time = source_created_time - self.source_updated_time = source_updated_time - self.source_created_user = source_created_user - self.source_updated_user = source_updated_user + self.status = status + self.published = published + self.type_ = type_ + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None - def as_write(self) -> CogniteSourceableNodeApply: - return CogniteSourceableNodeApply( + def as_write(self) -> Cognite3DRevisionApply: + return Cognite3DRevisionApply( self.space, self.external_id, - source_id=self.source_id, - source_context=self.source_context, - source=self.source, - source_created_time=self.source_created_time, - source_updated_time=self.source_updated_time, - source_created_user=self.source_created_user, - source_updated_user=self.source_updated_user, + status=self.status, + published=self.published, + type_=self.type_, + model_3d=self.model_3d, existing_version=self.version, type=self.type, ) -class CogniteVisualizableProperties: - object_3d = PropertyOptions("object3D") - +class _CogniteDescribableProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteVisualizable", "v1") + return ViewId("cdf_cdm", "CogniteDescribable", "v1") -class CogniteVisualizableApply(CogniteVisualizableProperties, TypedNodeApply): - """This represents the writing format of Cognite visualizable. +class CogniteDescribableNodeApply(_CogniteDescribableProperties, TypedNodeApply): + """This represents the writing format of Cognite describable node. It is used to when data is written to CDF. - CogniteVisualizable defines the standard way to reference a related 3D resource + The describable core concept is used as a standard way of holding the bare minimum of information about the instance Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite visualizable. - object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to an Object3D instance representing the 3D resource + external_id (str): The external id of the Cognite describable node. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -366,28 +399,37 @@ def __init__( space: str, external_id: str, *, - object_3d: DirectRelationReference | tuple[str, str] | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.name = name + self.description = description + self.tags = tags + self.aliases = aliases -class CogniteVisualizable(CogniteVisualizableProperties, TypedNode): - """This represents the reading format of Cognite visualizable. +class CogniteDescribableNode(_CogniteDescribableProperties, TypedNode): + """This represents the reading format of Cognite describable node. It is used to when data is read from CDF. - CogniteVisualizable defines the standard way to reference a related 3D resource + The describable core concept is used as a standard way of holding the bare minimum of information about the instance Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite visualizable. + external_id (str): The external id of the Cognite describable node. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - object_3d (DirectRelationReference | None): Direct relation to an Object3D instance representing the 3D resource + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -400,47 +442,56 @@ def __init__( last_updated_time: int, created_time: int, *, - object_3d: DirectRelationReference | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.name = name + self.description = description + self.tags = tags + self.aliases = aliases - def as_write(self) -> CogniteVisualizableApply: - return CogniteVisualizableApply( + def as_write(self) -> CogniteDescribableNodeApply: + return CogniteDescribableNodeApply( self.space, self.external_id, - object_3d=self.object_3d, + name=self.name, + description=self.description, + tags=self.tags, + aliases=self.aliases, existing_version=self.version, type=self.type, ) -class CogniteRevision3DProperties: - type_ = PropertyOptions("type") - model_3d = PropertyOptions("model3D") +class _CogniteSchedulableProperties: + start_time = PropertyOptions("startTime") + end_time = PropertyOptions("endTime") + scheduled_start_time = PropertyOptions("scheduledStartTime") + scheduled_end_time = PropertyOptions("scheduledEndTime") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteRevision3D", "v1") + return ViewId("cdf_cdm", "CogniteSchedulable", "v1") -class CogniteRevision3DApply(CogniteRevision3DProperties, TypedNodeApply): - """This represents the writing format of Cognite revision 3D. +class CogniteSchedulableApply(_CogniteSchedulableProperties, TypedNodeApply): + """This represents the writing format of Cognite schedulable. It is used to when data is written to CDF. - Shared revision information for various 3D data types. Normally not used directly, but through CognitePointCloudRevision, Image360Collection or CogniteCADRevision - - + CogniteSchedulable represents the metadata about when an activity (or similar) starts and ends. Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite revision 3D. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | tuple[str, str] | None): The model 3D field. + external_id (str): The external id of the Cognite schedulable. + start_time (datetime | None): The actual start time of an activity (or similar that extends this) + end_time (datetime | None): The actual end time of an activity (or similar that extends this) + scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) + scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -450,38 +501,36 @@ def __init__( space: str, external_id: str, *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, + start_time: datetime | None = None, + end_time: datetime | None = None, + scheduled_start_time: datetime | None = None, + scheduled_end_time: datetime | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.status = status - self.published = published - self.type_ = type_ - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.start_time = start_time + self.end_time = end_time + self.scheduled_start_time = scheduled_start_time + self.scheduled_end_time = scheduled_end_time -class CogniteRevision3D(CogniteRevision3DProperties, TypedNode): - """This represents the reading format of Cognite revision 3D. +class CogniteSchedulable(_CogniteSchedulableProperties, TypedNode): + """This represents the reading format of Cognite schedulable. It is used to when data is read from CDF. - Shared revision information for various 3D data types. Normally not used directly, but through CognitePointCloudRevision, Image360Collection or CogniteCADRevision - - + CogniteSchedulable represents the metadata about when an activity (or similar) starts and ends. Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite revision 3D. + external_id (str): The external id of the Cognite schedulable. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | None): The model 3D field. + start_time (datetime | None): The actual start time of an activity (or similar that extends this) + end_time (datetime | None): The actual end time of an activity (or similar that extends this) + scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) + scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -494,55 +543,60 @@ def __init__( last_updated_time: int, created_time: int, *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | None = None, + start_time: datetime | None = None, + end_time: datetime | None = None, + scheduled_start_time: datetime | None = None, + scheduled_end_time: datetime | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.status = status - self.published = published - self.type_ = type_ - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.start_time = start_time + self.end_time = end_time + self.scheduled_start_time = scheduled_start_time + self.scheduled_end_time = scheduled_end_time - def as_write(self) -> CogniteRevision3DApply: - return CogniteRevision3DApply( + def as_write(self) -> CogniteSchedulableApply: + return CogniteSchedulableApply( self.space, self.external_id, - status=self.status, - published=self.published, - type_=self.type_, - model_3d=self.model_3d, + start_time=self.start_time, + end_time=self.end_time, + scheduled_start_time=self.scheduled_start_time, + scheduled_end_time=self.scheduled_end_time, existing_version=self.version, type=self.type, ) -class CogniteCubeMapProperties: +class _CogniteSourceableProperties: + source_id = PropertyOptions("sourceId") + source_context = PropertyOptions("sourceContext") + source_created_time = PropertyOptions("sourceCreatedTime") + source_updated_time = PropertyOptions("sourceUpdatedTime") + source_created_user = PropertyOptions("sourceCreatedUser") + source_updated_user = PropertyOptions("sourceUpdatedUser") + @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteCubeMap", "v1") + return ViewId("cdf_cdm", "CogniteSourceable", "v1") -class CogniteCubeMapApply(CogniteCubeMapProperties, TypedNodeApply): - """This represents the writing format of Cognite cube map. +class CogniteSourceableNodeApply(_CogniteSourceableProperties, TypedNodeApply): + """This represents the writing format of Cognite sourceable node. It is used to when data is written to CDF. - The cube map holds references to projections for a cube surrounding an 3D entity extending this, such as CogniteImage360 - - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite cube map. - front (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the front projection of the cube map - back (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the back projection of the cube map - left (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the left projection of the cube map - right (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the right projection of the cube map - top (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the top projection of the cube map - bottom (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the bottom projection of the cube map + external_id (str): The external id of the Cognite sourceable node. + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -552,44 +606,44 @@ def __init__( space: str, external_id: str, *, - front: DirectRelationReference | tuple[str, str] | None = None, - back: DirectRelationReference | tuple[str, str] | None = None, - left: DirectRelationReference | tuple[str, str] | None = None, - right: DirectRelationReference | tuple[str, str] | None = None, - top: DirectRelationReference | tuple[str, str] | None = None, - bottom: DirectRelationReference | tuple[str, str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | tuple[str, str] | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.front = DirectRelationReference.load(front) if front else None - self.back = DirectRelationReference.load(back) if back else None - self.left = DirectRelationReference.load(left) if left else None - self.right = DirectRelationReference.load(right) if right else None - self.top = DirectRelationReference.load(top) if top else None - self.bottom = DirectRelationReference.load(bottom) if bottom else None + self.source_id = source_id + self.source_context = source_context + self.source = DirectRelationReference.load(source) if source else None + self.source_created_time = source_created_time + self.source_updated_time = source_updated_time + self.source_created_user = source_created_user + self.source_updated_user = source_updated_user -class CogniteCubeMap(CogniteCubeMapProperties, TypedNode): - """This represents the reading format of Cognite cube map. +class CogniteSourceableNode(_CogniteSourceableProperties, TypedNode): + """This represents the reading format of Cognite sourceable node. It is used to when data is read from CDF. - The cube map holds references to projections for a cube surrounding an 3D entity extending this, such as CogniteImage360 - - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite cube map. + external_id (str): The external id of the Cognite sourceable node. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - front (DirectRelationReference | None): Direct relation to a file holding the front projection of the cube map - back (DirectRelationReference | None): Direct relation to a file holding the back projection of the cube map - left (DirectRelationReference | None): Direct relation to a file holding the left projection of the cube map - right (DirectRelationReference | None): Direct relation to a file holding the right projection of the cube map - top (DirectRelationReference | None): Direct relation to a file holding the top projection of the cube map - bottom (DirectRelationReference | None): Direct relation to a file holding the bottom projection of the cube map + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -602,74 +656,484 @@ def __init__( last_updated_time: int, created_time: int, *, - front: DirectRelationReference | None = None, - back: DirectRelationReference | None = None, - left: DirectRelationReference | None = None, - right: DirectRelationReference | None = None, - top: DirectRelationReference | None = None, - bottom: DirectRelationReference | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.front = DirectRelationReference.load(front) if front else None - self.back = DirectRelationReference.load(back) if back else None - self.left = DirectRelationReference.load(left) if left else None - self.right = DirectRelationReference.load(right) if right else None - self.top = DirectRelationReference.load(top) if top else None - self.bottom = DirectRelationReference.load(bottom) if bottom else None + self.source_id = source_id + self.source_context = source_context + self.source = DirectRelationReference.load(source) if source else None + self.source_created_time = source_created_time + self.source_updated_time = source_updated_time + self.source_created_user = source_created_user + self.source_updated_user = source_updated_user - def as_write(self) -> CogniteCubeMapApply: - return CogniteCubeMapApply( + def as_write(self) -> CogniteSourceableNodeApply: + return CogniteSourceableNodeApply( self.space, self.external_id, - front=self.front, - back=self.back, - left=self.left, - right=self.right, - top=self.top, - bottom=self.bottom, - existing_version=self.version, - type=self.type, - ) - + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, + existing_version=self.version, + type=self.type, + ) + + +class _CogniteVisualizableProperties: + object_3d = PropertyOptions("object3D") + + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_cdm", "CogniteVisualizable", "v1") + + +class CogniteVisualizableApply(_CogniteVisualizableProperties, TypedNodeApply): + """This represents the writing format of Cognite visualizable. + + It is used to when data is written to CDF. + + CogniteVisualizable defines the standard way to reference a related 3D resource + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite visualizable. + object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to an Object3D instance representing the 3D resource + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + object_3d: DirectRelationReference | tuple[str, str] | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + + +class CogniteVisualizable(_CogniteVisualizableProperties, TypedNode): + """This represents the reading format of Cognite visualizable. + + It is used to when data is read from CDF. + + CogniteVisualizable defines the standard way to reference a related 3D resource + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite visualizable. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + object_3d (DirectRelationReference | None): Direct relation to an Object3D instance representing the 3D resource + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + object_3d: DirectRelationReference | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + + def as_write(self) -> CogniteVisualizableApply: + return CogniteVisualizableApply( + self.space, + self.external_id, + object_3d=self.object_3d, + existing_version=self.version, + type=self.type, + ) + + +class _Cognite360ImageProperties: + collection_360 = PropertyOptions("collection360") + station_360 = PropertyOptions("station360") + taken_at = PropertyOptions("takenAt") + + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_cdm", "Cognite360Image", "v1") + + +class Cognite360ImageApply(_Cognite360ImageProperties, Cognite3DTransformationNodeApply, CogniteCubeMapApply): + """This represents the writing format of Cognite 360 image. + + It is used to when data is written to CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite 360 image. + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis + front (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the front projection of the cube map + back (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the back projection of the cube map + left (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the left projection of the cube map + right (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the right projection of the cube map + top (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the top projection of the cube map + bottom (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the bottom projection of the cube map + collection_360 (DirectRelationReference | tuple[str, str] | None): Direct relation to Cognite360ImageCollection + station_360 (DirectRelationReference | tuple[str, str] | None): Direct relation to Cognite3DGroup instance that groups different Cognite360Image instances to the same station + taken_at (datetime | None): The timestamp when the 6 photos were taken + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, + front: DirectRelationReference | tuple[str, str] | None = None, + back: DirectRelationReference | tuple[str, str] | None = None, + left: DirectRelationReference | tuple[str, str] | None = None, + right: DirectRelationReference | tuple[str, str] | None = None, + top: DirectRelationReference | tuple[str, str] | None = None, + bottom: DirectRelationReference | tuple[str, str] | None = None, + collection_360: DirectRelationReference | tuple[str, str] | None = None, + station_360: DirectRelationReference | tuple[str, str] | None = None, + taken_at: datetime | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + Cognite3DTransformationNodeApply.__init__( + self, + space, + external_id, + translation_x=translation_x, + translation_y=translation_y, + translation_z=translation_z, + euler_rotation_x=euler_rotation_x, + euler_rotation_y=euler_rotation_y, + euler_rotation_z=euler_rotation_z, + scale_x=scale_x, + scale_y=scale_y, + scale_z=scale_z, + existing_version=existing_version, + type=type, + ) + CogniteCubeMapApply.__init__( + self, + space, + external_id, + front=front, + back=back, + left=left, + right=right, + top=top, + bottom=bottom, + existing_version=existing_version, + type=type, + ) + self.collection_360 = DirectRelationReference.load(collection_360) if collection_360 else None + self.station_360 = DirectRelationReference.load(station_360) if station_360 else None + self.taken_at = taken_at + + +class Cognite360Image(_Cognite360ImageProperties, Cognite3DTransformationNode, CogniteCubeMap): + """This represents the reading format of Cognite 360 image. + + It is used to when data is read from CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite 360 image. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis + front (DirectRelationReference | None): Direct relation to a file holding the front projection of the cube map + back (DirectRelationReference | None): Direct relation to a file holding the back projection of the cube map + left (DirectRelationReference | None): Direct relation to a file holding the left projection of the cube map + right (DirectRelationReference | None): Direct relation to a file holding the right projection of the cube map + top (DirectRelationReference | None): Direct relation to a file holding the top projection of the cube map + bottom (DirectRelationReference | None): Direct relation to a file holding the bottom projection of the cube map + collection_360 (DirectRelationReference | None): Direct relation to Cognite360ImageCollection + station_360 (DirectRelationReference | None): Direct relation to Cognite3DGroup instance that groups different Cognite360Image instances to the same station + taken_at (datetime | None): The timestamp when the 6 photos were taken + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, + front: DirectRelationReference | None = None, + back: DirectRelationReference | None = None, + left: DirectRelationReference | None = None, + right: DirectRelationReference | None = None, + top: DirectRelationReference | None = None, + bottom: DirectRelationReference | None = None, + collection_360: DirectRelationReference | None = None, + station_360: DirectRelationReference | None = None, + taken_at: datetime | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + Cognite3DTransformationNode.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + translation_x=translation_x, + translation_y=translation_y, + translation_z=translation_z, + euler_rotation_x=euler_rotation_x, + euler_rotation_y=euler_rotation_y, + euler_rotation_z=euler_rotation_z, + scale_x=scale_x, + scale_y=scale_y, + scale_z=scale_z, + type=type, + deleted_time=deleted_time, + ) + CogniteCubeMap.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + front=front, + back=back, + left=left, + right=right, + top=top, + bottom=bottom, + type=type, + deleted_time=deleted_time, + ) + self.collection_360 = DirectRelationReference.load(collection_360) if collection_360 else None + self.station_360 = DirectRelationReference.load(station_360) if station_360 else None + self.taken_at = taken_at + + def as_write(self) -> Cognite360ImageApply: + return Cognite360ImageApply( + self.space, + self.external_id, + translation_x=self.translation_x, + translation_y=self.translation_y, + translation_z=self.translation_z, + euler_rotation_x=self.euler_rotation_x, + euler_rotation_y=self.euler_rotation_y, + euler_rotation_z=self.euler_rotation_z, + scale_x=self.scale_x, + scale_y=self.scale_y, + scale_z=self.scale_z, + front=self.front, + back=self.back, + left=self.left, + right=self.right, + top=self.top, + bottom=self.bottom, + collection_360=self.collection_360, + station_360=self.station_360, + taken_at=self.taken_at, + existing_version=self.version, + type=self.type, + ) + + +class _CogniteCADRevisionProperties: + revision_id = PropertyOptions("revisionId") + + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_cdm", "CogniteCADRevision", "v1") + + +class CogniteCADRevisionApply(_CogniteCADRevisionProperties, Cognite3DRevisionApply): + """This represents the writing format of Cognite cad revision. + + It is used to when data is written to CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite cad revision. + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | tuple[str, str] | None): . + revision_id (int | None): The 3D API revision identifier for this CAD model + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, + revision_id: int | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + super().__init__( + space, + external_id, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + existing_version=existing_version, + type=type, + ) + self.revision_id = revision_id + + +class CogniteCADRevision(_CogniteCADRevisionProperties, Cognite3DRevision): + """This represents the reading format of Cognite cad revision. + + It is used to when data is read from CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite cad revision. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | None): . + revision_id (int | None): The 3D API revision identifier for this CAD model + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | None = None, + revision_id: int | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + super().__init__( + space, + external_id, + version, + last_updated_time, + created_time, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + type=type, + deleted_time=deleted_time, + ) + self.revision_id = revision_id + + def as_write(self) -> CogniteCADRevisionApply: + return CogniteCADRevisionApply( + self.space, + self.external_id, + status=self.status, + published=self.published, + type_=self.type_, + model_3d=self.model_3d, + revision_id=self.revision_id, + existing_version=self.version, + type=self.type, + ) -class CogniteTransformation3DProperties: - translation_x = PropertyOptions("translationX") - translation_y = PropertyOptions("translationY") - translation_z = PropertyOptions("translationZ") - euler_rotation_x = PropertyOptions("eulerRotationX") - euler_rotation_y = PropertyOptions("eulerRotationY") - euler_rotation_z = PropertyOptions("eulerRotationZ") - scale_x = PropertyOptions("scaleX") - scale_y = PropertyOptions("scaleY") - scale_z = PropertyOptions("scaleZ") + +class _CognitePointCloudRevisionProperties: + revision_id = PropertyOptions("revisionId") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteTransformation3D", "v1") + return ViewId("cdf_cdm", "CognitePointCloudRevision", "v1") -class CogniteTransformation3DNodeApply(CogniteTransformation3DProperties, TypedNodeApply): - """This represents the writing format of Cognite transformation 3D node. +class CognitePointCloudRevisionApply(_CognitePointCloudRevisionProperties, Cognite3DRevisionApply): + """This represents the writing format of Cognite point cloud revision. It is used to when data is written to CDF. - The CogniteTransformation3D object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in 3D space. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions - - + Navigational aid for traversing CognitePointCloudRevision instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite transformation 3D node. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis + external_id (str): The external id of the Cognite point cloud revision. + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | tuple[str, str] | None): . + revision_id (int | None): The 3D API revision identifier for this PointCloud model existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -679,53 +1143,44 @@ def __init__( space: str, external_id: str, *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, + revision_id: int | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) - self.translation_x = translation_x - self.translation_y = translation_y - self.translation_z = translation_z - self.euler_rotation_x = euler_rotation_x - self.euler_rotation_y = euler_rotation_y - self.euler_rotation_z = euler_rotation_z - self.scale_x = scale_x - self.scale_y = scale_y - self.scale_z = scale_z + super().__init__( + space, + external_id, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + existing_version=existing_version, + type=type, + ) + self.revision_id = revision_id -class CogniteTransformation3DNode(CogniteTransformation3DProperties, TypedNode): - """This represents the reading format of Cognite transformation 3D node. +class CognitePointCloudRevision(_CognitePointCloudRevisionProperties, Cognite3DRevision): + """This represents the reading format of Cognite point cloud revision. It is used to when data is read from CDF. - The CogniteTransformation3D object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in 3D space. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions - - + Navigational aid for traversing CognitePointCloudRevision instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite transformation 3D node. + external_id (str): The external id of the Cognite point cloud revision. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | None): . + revision_id (int | None): The 3D API revision identifier for this PointCloud model type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -738,69 +1193,68 @@ def __init__( last_updated_time: int, created_time: int, *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | None = None, + revision_id: int | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) - self.translation_x = translation_x - self.translation_y = translation_y - self.translation_z = translation_z - self.euler_rotation_x = euler_rotation_x - self.euler_rotation_y = euler_rotation_y - self.euler_rotation_z = euler_rotation_z - self.scale_x = scale_x - self.scale_y = scale_y - self.scale_z = scale_z + super().__init__( + space, + external_id, + version, + last_updated_time, + created_time, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + type=type, + deleted_time=deleted_time, + ) + self.revision_id = revision_id - def as_write(self) -> CogniteTransformation3DNodeApply: - return CogniteTransformation3DNodeApply( + def as_write(self) -> CognitePointCloudRevisionApply: + return CognitePointCloudRevisionApply( self.space, self.external_id, - translation_x=self.translation_x, - translation_y=self.translation_y, - translation_z=self.translation_z, - euler_rotation_x=self.euler_rotation_x, - euler_rotation_y=self.euler_rotation_y, - euler_rotation_z=self.euler_rotation_z, - scale_x=self.scale_x, - scale_y=self.scale_y, - scale_z=self.scale_z, + status=self.status, + published=self.published, + type_=self.type_, + model_3d=self.model_3d, + revision_id=self.revision_id, existing_version=self.version, type=self.type, ) -class CogniteAssetClassProperties: +class _Cognite360ImageCollectionProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteAssetClass", "v1") + return ViewId("cdf_cdm", "Cognite360ImageCollection", "v1") -class CogniteAssetClassApply(CogniteAssetClassProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite asset class. +class Cognite360ImageCollectionApply( + _Cognite360ImageCollectionProperties, CogniteDescribableNodeApply, Cognite3DRevisionApply +): + """This represents the writing format of Cognite 360 image collection. It is used to when data is written to CDF. - This identifies the class of an asset - + Represents a logical collection of Cognite360Image instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset class. + external_id (str): The external id of the Cognite 360 image collection. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the class of asset - standard (str | None): Textual string for which standard the code is from + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | tuple[str, str] | None): The model 3d field. existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -814,12 +1268,15 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - standard: str | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - super().__init__( + CogniteDescribableNodeApply.__init__( + self, space, external_id, name=name, @@ -829,20 +1286,28 @@ def __init__( existing_version=existing_version, type=type, ) - self.code = code - self.standard = standard + Cognite3DRevisionApply.__init__( + self, + space, + external_id, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + existing_version=existing_version, + type=type, + ) -class CogniteAssetClass(CogniteAssetClassProperties, CogniteDescribableNode): - """This represents the reading format of Cognite asset class. +class Cognite360ImageCollection(_Cognite360ImageCollectionProperties, CogniteDescribableNode, Cognite3DRevision): + """This represents the reading format of Cognite 360 image collection. It is used to when data is read from CDF. - This identifies the class of an asset - + Represents a logical collection of Cognite360Image instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset class. + external_id (str): The external id of the Cognite 360 image collection. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -850,8 +1315,10 @@ class CogniteAssetClass(CogniteAssetClassProperties, CogniteDescribableNode): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the class of asset - standard (str | None): Textual string for which standard the code is from + status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. + published (bool | None): The published field. + type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. + model_3d (DirectRelationReference | None): The model 3d field. type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -868,12 +1335,15 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - standard: str | None = None, + status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, + published: bool | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + model_3d: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - super().__init__( + CogniteDescribableNode.__init__( + self, space, external_id, version, @@ -886,48 +1356,60 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.code = code - self.standard = standard + Cognite3DRevision.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + status=status, + published=published, + type_=type_, + model_3d=model_3d, + type=type, + deleted_time=deleted_time, + ) - def as_write(self) -> CogniteAssetClassApply: - return CogniteAssetClassApply( + def as_write(self) -> Cognite360ImageCollectionApply: + return Cognite360ImageCollectionApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - code=self.code, - standard=self.standard, + status=self.status, + published=self.published, + type_=self.type_, + model_3d=self.model_3d, existing_version=self.version, type=self.type, ) -class CogniteAssetTypeProperties: - asset_class = PropertyOptions("assetClass") +class _Cognite360ImageStationProperties: + group_type = PropertyOptions("groupType") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteAssetType", "v1") + return ViewId("cdf_cdm", "Cognite360ImageStation", "v1") -class CogniteAssetTypeApply(CogniteAssetTypeProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite asset type. +class Cognite360ImageStationApply(_Cognite360ImageStationProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite 360 image station. It is used to when data is written to CDF. - This identifies the type of an asset - + A way to group images across collections. Used for creating visual scan history Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset type. + external_id (str): The external id of the Cognite 360 image station. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the type of asset - asset_class (DirectRelationReference | tuple[str, str] | None): Class of this type, direct relation to CogniteAssetClass + group_type (Literal['Station360'] | None): Type of group existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -941,8 +1423,7 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - asset_class: DirectRelationReference | tuple[str, str] | None = None, + group_type: Literal["Station360"] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -956,20 +1437,18 @@ def __init__( existing_version=existing_version, type=type, ) - self.code = code - self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None - + self.group_type = group_type -class CogniteAssetType(CogniteAssetTypeProperties, CogniteDescribableNode): - """This represents the reading format of Cognite asset type. - It is used to when data is read from CDF. +class Cognite360ImageStation(_Cognite360ImageStationProperties, CogniteDescribableNode): + """This represents the reading format of Cognite 360 image station. - This identifies the type of an asset + It is used to when data is read from CDF. + A way to group images across collections. Used for creating visual scan history Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset type. + external_id (str): The external id of the Cognite 360 image station. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -977,8 +1456,7 @@ class CogniteAssetType(CogniteAssetTypeProperties, CogniteDescribableNode): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the type of asset - asset_class (DirectRelationReference | None): Class of this type, direct relation to CogniteAssetClass + group_type (Literal['Station360'] | None): Type of group type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -995,8 +1473,7 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - asset_class: DirectRelationReference | None = None, + group_type: Literal["Station360"] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1013,56 +1490,45 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.code = code - self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None + self.group_type = group_type - def as_write(self) -> CogniteAssetTypeApply: - return CogniteAssetTypeApply( + def as_write(self) -> Cognite360ImageStationApply: + return Cognite360ImageStationApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - code=self.code, - asset_class=self.asset_class, + group_type=self.group_type, existing_version=self.version, type=self.type, ) -class CogniteCADNodeProperties: - object_3d = PropertyOptions("object3D") - model_3d = PropertyOptions("model3D") - cad_node_reference = PropertyOptions("cadNodeReference") - tree_indexes = PropertyOptions("treeIndexes") - sub_tree_sizes = PropertyOptions("subTreeSizes") +class _Cognite3DModelProperties: + type_ = PropertyOptions("type") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteCADNode", "v1") + return ViewId("cdf_cdm", "Cognite3DModel", "v1") -class CogniteCADNodeApply(CogniteCADNodeProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite cad node. +class Cognite3DModelApply(_Cognite3DModelProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite 3D model. It is used to when data is written to CDF. - Represents nodes from the 3D model that have been contextualized - + Groups revisions of 3D data of various kinds together (CAD, PointCloud, Cognite360Image) Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite cad node. + external_id (str): The external id of the Cognite 3D model. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to object3D grouping for this node - model_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to CogniteModel3D - cad_node_reference (str | None): Reference to a node within a CAD model from the 3D API - revisions (list[DirectRelationReference | tuple[str, str]] | None): List of direct relations to instances of CogniteRevision3D which this CogniteCADNode exists in. - tree_indexes (list[int] | None): List of tree indexes in the same order as revisions. Used by Reveal and similar applications to map from CogniteCADNode to tree index - sub_tree_sizes (list[int] | None): List of subtree sizes in the same order as revisions. Used by Reveal and similar applications to know how many nodes exists below this node in the hierarchy + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | tuple[str, str] | None): Thumbnail of the 3D model existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1076,12 +1542,8 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - object_3d: DirectRelationReference | tuple[str, str] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, - cad_node_reference: str | None = None, - revisions: list[DirectRelationReference | tuple[str, str]] | None = None, - tree_indexes: list[int] | None = None, - sub_tree_sizes: list[int] | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1095,24 +1557,19 @@ def __init__( existing_version=existing_version, type=type, ) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None - self.cad_node_reference = cad_node_reference - self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None - self.tree_indexes = tree_indexes - self.sub_tree_sizes = sub_tree_sizes + self.type_ = type_ + self.thumbnail = DirectRelationReference.load(thumbnail) if thumbnail else None -class CogniteCADNode(CogniteCADNodeProperties, CogniteDescribableNode): - """This represents the reading format of Cognite cad node. +class Cognite3DModel(_Cognite3DModelProperties, CogniteDescribableNode): + """This represents the reading format of Cognite 3D model. It is used to when data is read from CDF. - Represents nodes from the 3D model that have been contextualized - + Groups revisions of 3D data of various kinds together (CAD, PointCloud, Cognite360Image) Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite cad node. + external_id (str): The external id of the Cognite 3D model. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -1120,12 +1577,8 @@ class CogniteCADNode(CogniteCADNodeProperties, CogniteDescribableNode): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - object_3d (DirectRelationReference | None): Direct relation to object3D grouping for this node - model_3d (DirectRelationReference | None): Direct relation to CogniteModel3D - cad_node_reference (str | None): Reference to a node within a CAD model from the 3D API - revisions (list[DirectRelationReference] | None): List of direct relations to instances of CogniteRevision3D which this CogniteCADNode exists in. - tree_indexes (list[int] | None): List of tree indexes in the same order as revisions. Used by Reveal and similar applications to map from CogniteCADNode to tree index - sub_tree_sizes (list[int] | None): List of subtree sizes in the same order as revisions. Used by Reveal and similar applications to know how many nodes exists below this node in the hierarchy + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | None): Thumbnail of the 3D model type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1142,12 +1595,8 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - object_3d: DirectRelationReference | None = None, - model_3d: DirectRelationReference | None = None, - cad_node_reference: str | None = None, - revisions: list[DirectRelationReference] | None = None, - tree_indexes: list[int] | None = None, - sub_tree_sizes: list[int] | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1164,59 +1613,56 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None - self.cad_node_reference = cad_node_reference - self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None - self.tree_indexes = tree_indexes - self.sub_tree_sizes = sub_tree_sizes + self.type_ = type_ + self.thumbnail = DirectRelationReference.load(thumbnail) if thumbnail else None - def as_write(self) -> CogniteCADNodeApply: - return CogniteCADNodeApply( + def as_write(self) -> Cognite3DModelApply: + return Cognite3DModelApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - object_3d=self.object_3d, - model_3d=self.model_3d, - cad_node_reference=self.cad_node_reference, - revisions=self.revisions, # type: ignore[arg-type] - tree_indexes=self.tree_indexes, - sub_tree_sizes=self.sub_tree_sizes, + type_=self.type_, + thumbnail=self.thumbnail, existing_version=self.version, type=self.type, ) -class CogniteEquipmentTypeProperties: - equipment_class = PropertyOptions("equipmentClass") - standard_reference = PropertyOptions("standardReference") +class _Cognite3DObjectProperties: + x_min = PropertyOptions("xMin") + x_max = PropertyOptions("xMax") + y_min = PropertyOptions("yMin") + y_max = PropertyOptions("yMax") + z_min = PropertyOptions("zMin") + z_max = PropertyOptions("zMax") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteEquipmentType", "v1") + return ViewId("cdf_cdm", "Cognite3DObject", "v1") -class CogniteEquipmentTypeApply(CogniteEquipmentTypeProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite equipment type. +class Cognite3DObjectApply(_Cognite3DObjectProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite 3D object. It is used to when data is written to CDF. - This identifies the type of an equipment - + This is the virtual position representation of an object in the physical world, connecting an asset to one or more 3D resources Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite equipment type. + external_id (str): The external id of the Cognite 3D object. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the type of equipment - equipment_class (str | None): Class of equipment - standard (str | None): Identifier for which standard this equipment type is sourced from, such as ISO14224 or similar - standard_reference (str | None): Reference to the source of the equipment specification + x_min (float | None): Lowest X value in bounding box + x_max (float | None): Highest X value in bounding box + y_min (float | None): Lowest Y value in bounding box + y_max (float | None): Highest Y value in bounding box + z_min (float | None): Lowest Z value in bounding box + z_max (float | None): Highest Z value in bounding box existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1230,10 +1676,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - equipment_class: str | None = None, - standard: str | None = None, - standard_reference: str | None = None, + x_min: float | None = None, + x_max: float | None = None, + y_min: float | None = None, + y_max: float | None = None, + z_min: float | None = None, + z_max: float | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1247,22 +1695,23 @@ def __init__( existing_version=existing_version, type=type, ) - self.code = code - self.equipment_class = equipment_class - self.standard = standard - self.standard_reference = standard_reference + self.x_min = x_min + self.x_max = x_max + self.y_min = y_min + self.y_max = y_max + self.z_min = z_min + self.z_max = z_max -class CogniteEquipmentType(CogniteEquipmentTypeProperties, CogniteDescribableNode): - """This represents the reading format of Cognite equipment type. +class Cognite3DObject(_Cognite3DObjectProperties, CogniteDescribableNode): + """This represents the reading format of Cognite 3D object. It is used to when data is read from CDF. - This identifies the type of an equipment - + This is the virtual position representation of an object in the physical world, connecting an asset to one or more 3D resources Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite equipment type. + external_id (str): The external id of the Cognite 3D object. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -1270,10 +1719,12 @@ class CogniteEquipmentType(CogniteEquipmentTypeProperties, CogniteDescribableNod description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - code (str | None): A unique identifier for the type of equipment - equipment_class (str | None): Class of equipment - standard (str | None): Identifier for which standard this equipment type is sourced from, such as ISO14224 or similar - standard_reference (str | None): Reference to the source of the equipment specification + x_min (float | None): Lowest X value in bounding box + x_max (float | None): Highest X value in bounding box + y_min (float | None): Lowest Y value in bounding box + y_max (float | None): Highest Y value in bounding box + z_min (float | None): Lowest Z value in bounding box + z_max (float | None): Highest Z value in bounding box type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1290,10 +1741,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - code: str | None = None, - equipment_class: str | None = None, - standard: str | None = None, - standard_reference: str | None = None, + x_min: float | None = None, + x_max: float | None = None, + y_min: float | None = None, + y_max: float | None = None, + z_min: float | None = None, + z_max: float | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1310,53 +1763,53 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.code = code - self.equipment_class = equipment_class - self.standard = standard - self.standard_reference = standard_reference + self.x_min = x_min + self.x_max = x_max + self.y_min = y_min + self.y_max = y_max + self.z_min = z_min + self.z_max = z_max - def as_write(self) -> CogniteEquipmentTypeApply: - return CogniteEquipmentTypeApply( + def as_write(self) -> Cognite3DObjectApply: + return Cognite3DObjectApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - code=self.code, - equipment_class=self.equipment_class, - standard=self.standard, - standard_reference=self.standard_reference, + x_min=self.x_min, + x_max=self.x_max, + y_min=self.y_min, + y_max=self.y_max, + z_min=self.z_min, + z_max=self.z_max, existing_version=self.version, type=self.type, ) -class CogniteFileCategoryProperties: - standard_reference = PropertyOptions("standardReference") - +class _CogniteAssetClassProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteFileCategory", "v1") + return ViewId("cdf_cdm", "CogniteAssetClass", "v1") -class CogniteFileCategoryApply(CogniteFileCategoryProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite file category. +class CogniteAssetClassApply(_CogniteAssetClassProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite asset clas. It is used to when data is written to CDF. - This identifies the category of file as found through contextualization/categorization - + This identifies the class of an asset Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite file category. - code (str): Identified category code, such as 'AA' for Accounting (from Norsok) + external_id (str): The external id of the Cognite asset clas. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - standard (str | None): Name of the standard the category originates from, such as 'Norsok' - standard_reference (str | None): Reference to the source of the category standard + code (str | None): A unique identifier for the class of asset + standard (str | None): Textual string for which standard the code is from existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1366,13 +1819,12 @@ def __init__( space: str, external_id: str, *, - code: str, name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, + code: str | None = None, standard: str | None = None, - standard_reference: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1388,29 +1840,26 @@ def __init__( ) self.code = code self.standard = standard - self.standard_reference = standard_reference -class CogniteFileCategory(CogniteFileCategoryProperties, CogniteDescribableNode): - """This represents the reading format of Cognite file category. +class CogniteAssetClass(_CogniteAssetClassProperties, CogniteDescribableNode): + """This represents the reading format of Cognite asset clas. It is used to when data is read from CDF. - This identifies the category of file as found through contextualization/categorization - + This identifies the class of an asset Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite file category. + external_id (str): The external id of the Cognite asset clas. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - code (str): Identified category code, such as 'AA' for Accounting (from Norsok) name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - standard (str | None): Name of the standard the category originates from, such as 'Norsok' - standard_reference (str | None): Reference to the source of the category standard + code (str | None): A unique identifier for the class of asset + standard (str | None): Textual string for which standard the code is from type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1423,13 +1872,12 @@ def __init__( last_updated_time: int, created_time: int, *, - code: str, name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, + code: str | None = None, standard: str | None = None, - standard_reference: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1448,47 +1896,46 @@ def __init__( ) self.code = code self.standard = standard - self.standard_reference = standard_reference - def as_write(self) -> CogniteFileCategoryApply: - return CogniteFileCategoryApply( + def as_write(self) -> CogniteAssetClassApply: + return CogniteAssetClassApply( self.space, self.external_id, - code=self.code, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, + code=self.code, standard=self.standard, - standard_reference=self.standard_reference, existing_version=self.version, type=self.type, ) -class CogniteImage360StationProperties: - group_type = PropertyOptions("groupType") +class _CogniteAssetTypeProperties: + asset_class = PropertyOptions("assetClass") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteImage360Station", "v1") + return ViewId("cdf_cdm", "CogniteAssetType", "v1") -class CogniteImage360StationApply(CogniteImage360StationProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite image 360 station. +class CogniteAssetTypeApply(_CogniteAssetTypeProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite asset type. It is used to when data is written to CDF. - Navigational aid for traversing multiple CogniteImage360 instances for a single station - + This identifies the type of an asset Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 station. + external_id (str): The external id of the Cognite asset type. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - group_type (Literal['Station360'] | None): Type of group + code (str | None): A unique identifier for the type of asset + standard (str | None): Textual string for which standard the code is from + asset_class (DirectRelationReference | tuple[str, str] | None): Class of this type, direct relation to CogniteAssetClass existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1502,7 +1949,9 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - group_type: Literal["Station360"] | None = None, + code: str | None = None, + standard: str | None = None, + asset_class: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1516,19 +1965,20 @@ def __init__( existing_version=existing_version, type=type, ) - self.group_type = group_type + self.code = code + self.standard = standard + self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None -class CogniteImage360Station(CogniteImage360StationProperties, CogniteDescribableNode): - """This represents the reading format of Cognite image 360 station. +class CogniteAssetType(_CogniteAssetTypeProperties, CogniteDescribableNode): + """This represents the reading format of Cognite asset type. It is used to when data is read from CDF. - Navigational aid for traversing multiple CogniteImage360 instances for a single station - + This identifies the type of an asset Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 station. + external_id (str): The external id of the Cognite asset type. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -1536,7 +1986,9 @@ class CogniteImage360Station(CogniteImage360StationProperties, CogniteDescribabl description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - group_type (Literal['Station360'] | None): Type of group + code (str | None): A unique identifier for the type of asset + standard (str | None): Textual string for which standard the code is from + asset_class (DirectRelationReference | None): Class of this type, direct relation to CogniteAssetClass type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1553,7 +2005,9 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - group_type: Literal["Station360"] | None = None, + code: str | None = None, + standard: str | None = None, + asset_class: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1570,45 +2024,57 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.group_type = group_type + self.code = code + self.standard = standard + self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None - def as_write(self) -> CogniteImage360StationApply: - return CogniteImage360StationApply( + def as_write(self) -> CogniteAssetTypeApply: + return CogniteAssetTypeApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - group_type=self.group_type, + code=self.code, + standard=self.standard, + asset_class=self.asset_class, existing_version=self.version, type=self.type, ) -class CogniteModel3DProperties: - type_ = PropertyOptions("type") +class _CogniteCADNodeProperties: + object_3d = PropertyOptions("object3D") + model_3d = PropertyOptions("model3D") + cad_node_reference = PropertyOptions("cadNodeReference") + tree_indexes = PropertyOptions("treeIndexes") + sub_tree_sizes = PropertyOptions("subTreeSizes") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteModel3D", "v1") + return ViewId("cdf_cdm", "CogniteCADNode", "v1") -class CogniteModel3DApply(CogniteModel3DProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite model 3D. +class CogniteCADNodeApply(_CogniteCADNodeProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite cad node. It is used to when data is written to CDF. - Groups revisions of 3D data of various kinds together (CAD, PointCloud, CogniteImage360) - + Represents nodes from the 3D model that have been contextualized Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite model 3D. + external_id (str): The external id of the Cognite cad node. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to object3D grouping for this node + model_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to Cognite3DModel + cad_node_reference (str | None): Reference to a node within a CAD model from the 3D API + revisions (list[DirectRelationReference | tuple[str, str]] | None): List of direct relations to instances of Cognite3DRevision which this CogniteCADNode exists in. + tree_indexes (list[int] | None): List of tree indexes in the same order as revisions. Used by Reveal and similar applications to map from CogniteCADNode to tree index + sub_tree_sizes (list[int] | None): List of subtree sizes in the same order as revisions. Used by Reveal and similar applications to know how many nodes exists below this node in the hierarchy existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1622,7 +2088,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + object_3d: DirectRelationReference | tuple[str, str] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, + cad_node_reference: str | None = None, + revisions: list[DirectRelationReference | tuple[str, str]] | None = None, + tree_indexes: list[int] | None = None, + sub_tree_sizes: list[int] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1636,19 +2107,23 @@ def __init__( existing_version=existing_version, type=type, ) - self.type_ = type_ + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.cad_node_reference = cad_node_reference + self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None + self.tree_indexes = tree_indexes + self.sub_tree_sizes = sub_tree_sizes -class CogniteModel3D(CogniteModel3DProperties, CogniteDescribableNode): - """This represents the reading format of Cognite model 3D. +class CogniteCADNode(_CogniteCADNodeProperties, CogniteDescribableNode): + """This represents the reading format of Cognite cad node. It is used to when data is read from CDF. - Groups revisions of 3D data of various kinds together (CAD, PointCloud, CogniteImage360) - + Represents nodes from the 3D model that have been contextualized Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite model 3D. + external_id (str): The external id of the Cognite cad node. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -1656,7 +2131,12 @@ class CogniteModel3D(CogniteModel3DProperties, CogniteDescribableNode): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + object_3d (DirectRelationReference | None): Direct relation to object3D grouping for this node + model_3d (DirectRelationReference | None): Direct relation to Cognite3DModel + cad_node_reference (str | None): Reference to a node within a CAD model from the 3D API + revisions (list[DirectRelationReference] | None): List of direct relations to instances of Cognite3DRevision which this CogniteCADNode exists in. + tree_indexes (list[int] | None): List of tree indexes in the same order as revisions. Used by Reveal and similar applications to map from CogniteCADNode to tree index + sub_tree_sizes (list[int] | None): List of subtree sizes in the same order as revisions. Used by Reveal and similar applications to know how many nodes exists below this node in the hierarchy type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1673,7 +2153,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + object_3d: DirectRelationReference | None = None, + model_3d: DirectRelationReference | None = None, + cad_node_reference: str | None = None, + revisions: list[DirectRelationReference] | None = None, + tree_indexes: list[int] | None = None, + sub_tree_sizes: list[int] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1690,55 +2175,58 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.type_ = type_ + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.cad_node_reference = cad_node_reference + self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None + self.tree_indexes = tree_indexes + self.sub_tree_sizes = sub_tree_sizes - def as_write(self) -> CogniteModel3DApply: - return CogniteModel3DApply( + def as_write(self) -> CogniteCADNodeApply: + return CogniteCADNodeApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - type_=self.type_, + object_3d=self.object_3d, + model_3d=self.model_3d, + cad_node_reference=self.cad_node_reference, + revisions=self.revisions, # type: ignore[arg-type] + tree_indexes=self.tree_indexes, + sub_tree_sizes=self.sub_tree_sizes, existing_version=self.version, type=self.type, ) -class CogniteObject3DProperties: - x_min = PropertyOptions("xMin") - x_max = PropertyOptions("xMax") - y_min = PropertyOptions("yMin") - y_max = PropertyOptions("yMax") - z_min = PropertyOptions("zMin") - z_max = PropertyOptions("zMax") +class _CogniteEquipmentTypeProperties: + equipment_class = PropertyOptions("equipmentClass") + standard_reference = PropertyOptions("standardReference") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteObject3D", "v1") + return ViewId("cdf_cdm", "CogniteEquipmentType", "v1") -class CogniteObject3DApply(CogniteObject3DProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite object 3D. +class CogniteEquipmentTypeApply(_CogniteEquipmentTypeProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite equipment type. It is used to when data is written to CDF. - This is a virtual representation of an object in world space, tied to an asset and 3D resources. - + This identifies the type of an equipment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite object 3D. + external_id (str): The external id of the Cognite equipment type. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - x_min (float | None): Lowest X value - x_max (float | None): Highest X value - y_min (float | None): Lowest Y value - y_max (float | None): Highest Y value - z_min (float | None): Lowest Z value - z_max (float | None): Highest Z value + code (str | None): A unique identifier for the type of equipment + equipment_class (str | None): Class of equipment + standard (str | None): Identifier for which standard this equipment type is sourced from, such as ISO14224 or similar + standard_reference (str | None): Reference to the source of the equipment specification existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1752,12 +2240,10 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - x_min: float | None = None, - x_max: float | None = None, - y_min: float | None = None, - y_max: float | None = None, - z_min: float | None = None, - z_max: float | None = None, + code: str | None = None, + equipment_class: str | None = None, + standard: str | None = None, + standard_reference: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1771,24 +2257,21 @@ def __init__( existing_version=existing_version, type=type, ) - self.x_min = x_min - self.x_max = x_max - self.y_min = y_min - self.y_max = y_max - self.z_min = z_min - self.z_max = z_max + self.code = code + self.equipment_class = equipment_class + self.standard = standard + self.standard_reference = standard_reference -class CogniteObject3D(CogniteObject3DProperties, CogniteDescribableNode): - """This represents the reading format of Cognite object 3D. +class CogniteEquipmentType(_CogniteEquipmentTypeProperties, CogniteDescribableNode): + """This represents the reading format of Cognite equipment type. It is used to when data is read from CDF. - This is a virtual representation of an object in world space, tied to an asset and 3D resources. - + This identifies the type of an equipment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite object 3D. + external_id (str): The external id of the Cognite equipment type. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -1796,12 +2279,10 @@ class CogniteObject3D(CogniteObject3DProperties, CogniteDescribableNode): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - x_min (float | None): Lowest X value - x_max (float | None): Highest X value - y_min (float | None): Lowest Y value - y_max (float | None): Highest Y value - z_min (float | None): Lowest Z value - z_max (float | None): Highest Z value + code (str | None): A unique identifier for the type of equipment + equipment_class (str | None): Class of equipment + standard (str | None): Identifier for which standard this equipment type is sourced from, such as ISO14224 or similar + standard_reference (str | None): Reference to the source of the equipment specification type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1818,12 +2299,10 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - x_min: float | None = None, - x_max: float | None = None, - y_min: float | None = None, - y_max: float | None = None, - z_min: float | None = None, - z_max: float | None = None, + code: str | None = None, + equipment_class: str | None = None, + standard: str | None = None, + standard_reference: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -1840,65 +2319,52 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.x_min = x_min - self.x_max = x_max - self.y_min = y_min - self.y_max = y_max - self.z_min = z_min - self.z_max = z_max + self.code = code + self.equipment_class = equipment_class + self.standard = standard + self.standard_reference = standard_reference - def as_write(self) -> CogniteObject3DApply: - return CogniteObject3DApply( + def as_write(self) -> CogniteEquipmentTypeApply: + return CogniteEquipmentTypeApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - x_min=self.x_min, - x_max=self.x_max, - y_min=self.y_min, - y_max=self.y_max, - z_min=self.z_min, - z_max=self.z_max, + code=self.code, + equipment_class=self.equipment_class, + standard=self.standard, + standard_reference=self.standard_reference, existing_version=self.version, type=self.type, ) -class CognitePointCloudVolumeProperties: - object_3d = PropertyOptions("object3D") - model_3d = PropertyOptions("model3D") - volume_references = PropertyOptions("volumeReferences") - volume_type = PropertyOptions("volumeType") - format_version = PropertyOptions("formatVersion") +class _CogniteFileCategoryProperties: + standard_reference = PropertyOptions("standardReference") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CognitePointCloudVolume", "v1") + return ViewId("cdf_cdm", "CogniteFileCategory", "v1") -class CognitePointCloudVolumeApply(CognitePointCloudVolumeProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite point cloud volume. +class CogniteFileCategoryApply(_CogniteFileCategoryProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite file category. It is used to when data is written to CDF. - PointCloud volume definition - + This identifies the category of file as found through contextualization/categorization Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud volume. + external_id (str): The external id of the Cognite file category. + code (str): Identified category code, such as 'AA' for Accounting (from Norsok) name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to object3D grouping for this node - model_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to CogniteModel3D instance - volume_references (list[str] | None): Unique volume metric hashes used to access the 3D specialized data storage - revisions (list[DirectRelationReference | tuple[str, str]] | None): List of direct relations to revision information - volume_type (Literal["Box", "Cylinder"] | None): Type of volume (Cylinder or Box) - volume (list[float] | None): Relevant coordinates for the volume type, 9 floats in total, that defines the volume - format_version (str | None): Specifies the version the 'volume' field is following. Volume definition is today 9 floats (property volume) + standard (str | None): Name of the standard the category originates from, such as 'Norsok' + standard_reference (str | None): Reference to the source of the category standard existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -1908,17 +2374,13 @@ def __init__( space: str, external_id: str, *, + code: str, name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - object_3d: DirectRelationReference | tuple[str, str] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, - volume_references: list[str] | None = None, - revisions: list[DirectRelationReference | tuple[str, str]] | None = None, - volume_type: Literal["Box", "Cylinder"] | None = None, - volume: list[float] | None = None, - format_version: str | None = None, + standard: str | None = None, + standard_reference: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -1932,39 +2394,30 @@ def __init__( existing_version=existing_version, type=type, ) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None - self.volume_references = volume_references - self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None - self.volume_type = volume_type - self.volume = volume - self.format_version = format_version + self.code = code + self.standard = standard + self.standard_reference = standard_reference -class CognitePointCloudVolume(CognitePointCloudVolumeProperties, CogniteDescribableNode): - """This represents the reading format of Cognite point cloud volume. +class CogniteFileCategory(_CogniteFileCategoryProperties, CogniteDescribableNode): + """This represents the reading format of Cognite file category. It is used to when data is read from CDF. - PointCloud volume definition - + This identifies the category of file as found through contextualization/categorization Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud volume. + external_id (str): The external id of the Cognite file category. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + code (str): Identified category code, such as 'AA' for Accounting (from Norsok) name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - object_3d (DirectRelationReference | None): Direct relation to object3D grouping for this node - model_3d (DirectRelationReference | None): Direct relation to CogniteModel3D instance - volume_references (list[str] | None): Unique volume metric hashes used to access the 3D specialized data storage - revisions (list[DirectRelationReference] | None): List of direct relations to revision information - volume_type (Literal["Box", "Cylinder"] | None): Type of volume (Cylinder or Box) - volume (list[float] | None): Relevant coordinates for the volume type, 9 floats in total, that defines the volume - format_version (str | None): Specifies the version the 'volume' field is following. Volume definition is today 9 floats (property volume) + standard (str | None): Name of the standard the category originates from, such as 'Norsok' + standard_reference (str | None): Reference to the source of the category standard type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -1977,17 +2430,13 @@ def __init__( last_updated_time: int, created_time: int, *, + code: str, name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - object_3d: DirectRelationReference | None = None, - model_3d: DirectRelationReference | None = None, - volume_references: list[str] | None = None, - revisions: list[DirectRelationReference] | None = None, - volume_type: Literal["Box", "Cylinder"] | None = None, - volume: list[float] | None = None, - format_version: str | None = None, + standard: str | None = None, + standard_reference: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -2004,58 +2453,58 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None - self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None - self.volume_references = volume_references - self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None - self.volume_type = volume_type - self.volume = volume - self.format_version = format_version + self.code = code + self.standard = standard + self.standard_reference = standard_reference - def as_write(self) -> CognitePointCloudVolumeApply: - return CognitePointCloudVolumeApply( + def as_write(self) -> CogniteFileCategoryApply: + return CogniteFileCategoryApply( self.space, self.external_id, + code=self.code, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - object_3d=self.object_3d, - model_3d=self.model_3d, - volume_references=self.volume_references, - revisions=self.revisions, # type: ignore[arg-type] - volume_type=self.volume_type, - volume=self.volume, - format_version=self.format_version, + standard=self.standard, + standard_reference=self.standard_reference, existing_version=self.version, type=self.type, ) -class CogniteSourceSystemProperties: - version_ = PropertyOptions("version") +class _CognitePointCloudVolumeProperties: + object_3d = PropertyOptions("object3D") + model_3d = PropertyOptions("model3D") + volume_references = PropertyOptions("volumeReferences") + volume_type = PropertyOptions("volumeType") + format_version = PropertyOptions("formatVersion") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteSourceSystem", "v1") + return ViewId("cdf_cdm", "CognitePointCloudVolume", "v1") -class CogniteSourceSystemApply(CogniteSourceSystemProperties, CogniteDescribableNodeApply): - """This represents the writing format of Cognite source system. +class CognitePointCloudVolumeApply(_CognitePointCloudVolumeProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite point cloud volume. It is used to when data is written to CDF. - The CogniteSourceSystem core concept is used to standardize the way source system is stored. - + PointCloud volume definition Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite source system. + external_id (str): The external id of the Cognite point cloud volume. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - version_ (str | None): Version identifier for the source system - manufacturer (str | None): Manufacturer of the source system + object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to object3D grouping for this node + model_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to Cognite3DModel instance + volume_references (list[str] | None): Unique volume metric hashes used to access the 3D specialized data storage + revisions (list[DirectRelationReference | tuple[str, str]] | None): List of direct relations to revision information + volume_type (Literal["Box", "Cylinder"] | None): Type of volume (Cylinder or Box) + volume (list[float] | None): Relevant coordinates for the volume type, 9 floats in total, that defines the volume + format_version (str | None): Specifies the version the 'volume' field is following. Volume definition is today 9 floats (property volume) existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -2069,8 +2518,13 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - version_: str | None = None, - manufacturer: str | None = None, + object_3d: DirectRelationReference | tuple[str, str] | None = None, + model_3d: DirectRelationReference | tuple[str, str] | None = None, + volume_references: list[str] | None = None, + revisions: list[DirectRelationReference | tuple[str, str]] | None = None, + volume_type: Literal["Box", "Cylinder"] | None = None, + volume: list[float] | None = None, + format_version: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -2084,20 +2538,24 @@ def __init__( existing_version=existing_version, type=type, ) - self.version_ = version_ - self.manufacturer = manufacturer + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.volume_references = volume_references + self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None + self.volume_type = volume_type + self.volume = volume + self.format_version = format_version -class CogniteSourceSystem(CogniteSourceSystemProperties, CogniteDescribableNode): - """This represents the reading format of Cognite source system. +class CognitePointCloudVolume(_CognitePointCloudVolumeProperties, CogniteDescribableNode): + """This represents the reading format of Cognite point cloud volume. It is used to when data is read from CDF. - The CogniteSourceSystem core concept is used to standardize the way source system is stored. - + PointCloud volume definition Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite source system. + external_id (str): The external id of the Cognite point cloud volume. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -2105,8 +2563,13 @@ class CogniteSourceSystem(CogniteSourceSystemProperties, CogniteDescribableNode) description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - version_ (str | None): Version identifier for the source system - manufacturer (str | None): Manufacturer of the source system + object_3d (DirectRelationReference | None): Direct relation to object3D grouping for this node + model_3d (DirectRelationReference | None): Direct relation to Cognite3DModel instance + volume_references (list[str] | None): Unique volume metric hashes used to access the 3D specialized data storage + revisions (list[DirectRelationReference] | None): List of direct relations to revision information + volume_type (Literal["Box", "Cylinder"] | None): Type of volume (Cylinder or Box) + volume (list[float] | None): Relevant coordinates for the volume type, 9 floats in total, that defines the volume + format_version (str | None): Specifies the version the 'volume' field is following. Volume definition is today 9 floats (property volume) type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -2123,8 +2586,13 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - version_: str | None = None, - manufacturer: str | None = None, + object_3d: DirectRelationReference | None = None, + model_3d: DirectRelationReference | None = None, + volume_references: list[str] | None = None, + revisions: list[DirectRelationReference] | None = None, + volume_type: Literal["Box", "Cylinder"] | None = None, + volume: list[float] | None = None, + format_version: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -2141,62 +2609,57 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.version_ = version_ - self.manufacturer = manufacturer + self.object_3d = DirectRelationReference.load(object_3d) if object_3d else None + self.model_3d = DirectRelationReference.load(model_3d) if model_3d else None + self.volume_references = volume_references + self.revisions = [DirectRelationReference.load(revision) for revision in revisions] if revisions else None + self.volume_type = volume_type + self.volume = volume + self.format_version = format_version - def as_write(self) -> CogniteSourceSystemApply: - return CogniteSourceSystemApply( + def as_write(self) -> CognitePointCloudVolumeApply: + return CognitePointCloudVolumeApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - version_=self.version_, - manufacturer=self.manufacturer, + object_3d=self.object_3d, + model_3d=self.model_3d, + volume_references=self.volume_references, + revisions=self.revisions, # type: ignore[arg-type] + volume_type=self.volume_type, + volume=self.volume, + format_version=self.format_version, existing_version=self.version, type=self.type, ) -class CogniteActivityProperties: - time_series = PropertyOptions("timeSeries") +class _CogniteSourceSystemProperties: + version_ = PropertyOptions("version") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteActivity", "v1") + return ViewId("cdf_cdm", "CogniteSourceSystem", "v1") -class CogniteActivityApply( - CogniteActivityProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply, CogniteSchedulableApply -): - """This represents the writing format of Cognite activity. +class CogniteSourceSystemApply(_CogniteSourceSystemProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite source system. It is used to when data is written to CDF. - Represent an activity - + The CogniteSourceSystem core concept is used to standardize the way source system is stored. Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite activity. + external_id (str): The external id of the Cognite source system. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - start_time (datetime | None): The actual start time of an activity (or similar that extends this) - end_time (datetime | None): The actual end time of an activity (or similar that extends this) - scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) - scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) - assets (list[DirectRelationReference | tuple[str, str]] | None): List of assets this activity relates to - equipment (list[DirectRelationReference | tuple[str, str]] | None): The list of equipment this activity relates to - time_series (list[DirectRelationReference | tuple[str, str]] | None): The list of time series this activity relates to + version_ (str | None): Version identifier for the source system + manufacturer (str | None): Manufacturer of the source system existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -2210,25 +2673,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | tuple[str, str] | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, - start_time: datetime | None = None, - end_time: datetime | None = None, - scheduled_start_time: datetime | None = None, - scheduled_end_time: datetime | None = None, - assets: list[DirectRelationReference | tuple[str, str]] | None = None, - equipment: list[DirectRelationReference | tuple[str, str]] | None = None, - time_series: list[DirectRelationReference | tuple[str, str]] | None = None, + version_: str | None = None, + manufacturer: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - CogniteDescribableNodeApply.__init__( - self, + super().__init__( space, external_id, name=name, @@ -2238,48 +2688,19 @@ def __init__( existing_version=existing_version, type=type, ) - CogniteSourceableNodeApply.__init__( - self, - space, - external_id, - source_id=source_id, - source_context=source_context, - source=source, - source_created_time=source_created_time, - source_updated_time=source_updated_time, - source_created_user=source_created_user, - source_updated_user=source_updated_user, - existing_version=existing_version, - type=type, - ) - CogniteSchedulableApply.__init__( - self, - space, - external_id, - start_time=start_time, - end_time=end_time, - scheduled_start_time=scheduled_start_time, - scheduled_end_time=scheduled_end_time, - existing_version=existing_version, - type=type, - ) - self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None - self.time_series = ( - [DirectRelationReference.load(time_series) for time_series in time_series] if time_series else None - ) + self.version_ = version_ + self.manufacturer = manufacturer -class CogniteActivity(CogniteActivityProperties, CogniteDescribableNode, CogniteSourceableNode, CogniteSchedulable): - """This represents the reading format of Cognite activity. +class CogniteSourceSystem(_CogniteSourceSystemProperties, CogniteDescribableNode): + """This represents the reading format of Cognite source system. It is used to when data is read from CDF. - Represent an activity - + The CogniteSourceSystem core concept is used to standardize the way source system is stored. Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite activity. + external_id (str): The external id of the Cognite source system. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -2287,20 +2708,8 @@ class CogniteActivity(CogniteActivityProperties, CogniteDescribableNode, Cognite description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - start_time (datetime | None): The actual start time of an activity (or similar that extends this) - end_time (datetime | None): The actual end time of an activity (or similar that extends this) - scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) - scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) - assets (list[DirectRelationReference] | None): List of assets this activity relates to - equipment (list[DirectRelationReference] | None): The list of equipment this activity relates to - time_series (list[DirectRelationReference] | None): The list of time series this activity relates to + version_ (str | None): Version identifier for the source system + manufacturer (str | None): Manufacturer of the source system type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -2317,25 +2726,12 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, - start_time: datetime | None = None, - end_time: datetime | None = None, - scheduled_start_time: datetime | None = None, - scheduled_end_time: datetime | None = None, - assets: list[DirectRelationReference] | None = None, - equipment: list[DirectRelationReference] | None = None, - time_series: list[DirectRelationReference] | None = None, + version_: str | None = None, + manufacturer: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - CogniteDescribableNode.__init__( - self, + super().__init__( space, external_id, version, @@ -2348,104 +2744,49 @@ def __init__( type=type, deleted_time=deleted_time, ) - CogniteSourceableNode.__init__( - self, - space, - external_id, - version, - last_updated_time, - created_time, - source_id=source_id, - source_context=source_context, - source=source, - source_created_time=source_created_time, - source_updated_time=source_updated_time, - source_created_user=source_created_user, - source_updated_user=source_updated_user, - type=type, - deleted_time=deleted_time, - ) - CogniteSchedulable.__init__( - self, - space, - external_id, - version, - last_updated_time, - created_time, - start_time=start_time, - end_time=end_time, - scheduled_start_time=scheduled_start_time, - scheduled_end_time=scheduled_end_time, - type=type, - deleted_time=deleted_time, - ) - self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None - self.time_series = ( - [DirectRelationReference.load(time_series) for time_series in time_series] if time_series else None - ) + self.version_ = version_ + self.manufacturer = manufacturer - def as_write(self) -> CogniteActivityApply: - return CogniteActivityApply( + def as_write(self) -> CogniteSourceSystemApply: + return CogniteSourceSystemApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - source_id=self.source_id, - source_context=self.source_context, - source=self.source, - source_created_time=self.source_created_time, - source_updated_time=self.source_updated_time, - source_created_user=self.source_created_user, - source_updated_user=self.source_updated_user, - start_time=self.start_time, - end_time=self.end_time, - scheduled_start_time=self.scheduled_start_time, - scheduled_end_time=self.scheduled_end_time, - assets=self.assets, # type: ignore[arg-type] - equipment=self.equipment, # type: ignore[arg-type] - time_series=self.time_series, + version_=self.version_, + manufacturer=self.manufacturer, existing_version=self.version, type=self.type, ) -class CogniteEquipmentProperties: - serial_number = PropertyOptions("serialNumber") - equipment_type = PropertyOptions("equipmentType") +class _CogniteUnitProperties: + source_reference = PropertyOptions("sourceReference") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteEquipment", "v1") + return ViewId("cdf_cdm", "CogniteUnit", "v1") -class CogniteEquipmentApply(CogniteEquipmentProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): - """This represents the writing format of Cognite equipment. +class CogniteUnitApply(_CogniteUnitProperties, CogniteDescribableNodeApply): + """This represents the writing format of Cognite unit. It is used to when data is written to CDF. - Represent a physical piece of equipment - + Represents a single unit of measurement Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite equipment. + external_id (str): The external id of the Cognite unit. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - serial_number (str | None): Serial number of the equipment - manufacturer (str | None): Manufacturer of the equipment - equipment_type (DirectRelationReference | tuple[str, str] | None): Type of this equipment, direct relation to CogniteEquipmentType - files (list[DirectRelationReference | tuple[str, str]] | None): List of files this equipment relates to + symbol (str | None): The symbol for the unit of measurement + quantity (str | None): Specifies the physical quantity the unit measures + source (str | None): Source of the unit definition + source_reference (str | None): Reference to the source of the unit definition existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -2459,22 +2800,14 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | tuple[str, str] | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, - serial_number: str | None = None, - manufacturer: str | None = None, - equipment_type: DirectRelationReference | tuple[str, str] | None = None, - files: list[DirectRelationReference | tuple[str, str]] | None = None, + symbol: str | None = None, + quantity: str | None = None, + source: str | None = None, + source_reference: str | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - CogniteDescribableNodeApply.__init__( - self, + super().__init__( space, external_id, name=name, @@ -2483,37 +2816,22 @@ def __init__( aliases=aliases, existing_version=existing_version, type=type, - ) - CogniteSourceableNodeApply.__init__( - self, - space, - external_id, - source_id=source_id, - source_context=source_context, - source=source, - source_created_time=source_created_time, - source_updated_time=source_updated_time, - source_created_user=source_created_user, - source_updated_user=source_updated_user, - existing_version=existing_version, - type=type, - ) - self.serial_number = serial_number - self.manufacturer = manufacturer - self.equipment_type = DirectRelationReference.load(equipment_type) if equipment_type else None - self.files = [DirectRelationReference.load(file) for file in files] if files else None + ) + self.symbol = symbol + self.quantity = quantity + self.source = source + self.source_reference = source_reference -class CogniteEquipment(CogniteEquipmentProperties, CogniteDescribableNode, CogniteSourceableNode): - """This represents the reading format of Cognite equipment. +class CogniteUnit(_CogniteUnitProperties, CogniteDescribableNode): + """This represents the reading format of Cognite unit. It is used to when data is read from CDF. - Represent a physical piece of equipment - + Represents a single unit of measurement Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite equipment. + external_id (str): The external id of the Cognite unit. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -2521,17 +2839,10 @@ class CogniteEquipment(CogniteEquipmentProperties, CogniteDescribableNode, Cogni description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - source_id (str | None): Identifier from the source system - source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. - source (DirectRelationReference | None): Direct relation to a source system - source_created_time (datetime | None): When the instance was created in source system (if available) - source_updated_time (datetime | None): When the instance was last updated in the source system (if available) - source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF - source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - serial_number (str | None): Serial number of the equipment - manufacturer (str | None): Manufacturer of the equipment - equipment_type (DirectRelationReference | None): Type of this equipment, direct relation to CogniteEquipmentType - files (list[DirectRelationReference] | None): List of files this equipment relates to + symbol (str | None): The symbol for the unit of measurement + quantity (str | None): Specifies the physical quantity the unit measures + source (str | None): Source of the unit definition + source_reference (str | None): Reference to the source of the unit definition type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -2548,22 +2859,14 @@ def __init__( description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - source_id: str | None = None, - source_context: str | None = None, - source: DirectRelationReference | None = None, - source_created_time: datetime | None = None, - source_updated_time: datetime | None = None, - source_created_user: str | None = None, - source_updated_user: str | None = None, - serial_number: str | None = None, - manufacturer: str | None = None, - equipment_type: DirectRelationReference | None = None, - files: list[DirectRelationReference] | None = None, + symbol: str | None = None, + quantity: str | None = None, + source: str | None = None, + source_reference: str | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - CogniteDescribableNode.__init__( - self, + super().__init__( space, external_id, version, @@ -2576,72 +2879,47 @@ def __init__( type=type, deleted_time=deleted_time, ) - CogniteSourceableNode.__init__( - self, - space, - external_id, - version, - last_updated_time, - created_time, - source_id=source_id, - source_context=source_context, - source=source, - source_created_time=source_created_time, - source_updated_time=source_updated_time, - source_created_user=source_created_user, - source_updated_user=source_updated_user, - type=type, - deleted_time=deleted_time, - ) - self.serial_number = serial_number - self.manufacturer = manufacturer - self.equipment_type = DirectRelationReference.load(equipment_type) if equipment_type else None - self.files = [DirectRelationReference.load(file) for file in files] if files else None + self.symbol = symbol + self.quantity = quantity + self.source = source + self.source_reference = source_reference - def as_write(self) -> CogniteEquipmentApply: - return CogniteEquipmentApply( + def as_write(self) -> CogniteUnitApply: + return CogniteUnitApply( self.space, self.external_id, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - source_id=self.source_id, - source_context=self.source_context, + symbol=self.symbol, + quantity=self.quantity, source=self.source, - source_created_time=self.source_created_time, - source_updated_time=self.source_updated_time, - source_created_user=self.source_created_user, - source_updated_user=self.source_updated_user, - serial_number=self.serial_number, - manufacturer=self.manufacturer, - equipment_type=self.equipment_type, - files=self.files, # type: ignore[arg-type] + source_reference=self.source_reference, existing_version=self.version, type=self.type, ) -class CogniteFileProperties: - mime_type = PropertyOptions("mimeType") - is_uploaded = PropertyOptions("isUploaded") - uploaded_time = PropertyOptions("uploadedTime") +class _CogniteActivityProperties: + time_series = PropertyOptions("timeSeries") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteFile", "v1") + return ViewId("cdf_cdm", "CogniteActivity", "v1") -class CogniteFileApply(CogniteFileProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): - """This represents the writing format of Cognite file. +class CogniteActivityApply( + _CogniteActivityProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply, CogniteSchedulableApply +): + """This represents the writing format of Cognite activity. It is used to when data is written to CDF. - This concept models the underlying file - + Represent an activity Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite file. + external_id (str): The external id of the Cognite activity. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 @@ -2653,12 +2931,13 @@ class CogniteFileApply(CogniteFileProperties, CogniteDescribableNodeApply, Cogni source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - assets (list[DirectRelationReference | tuple[str, str]] | None): List of assets this file relates to - mime_type (str | None): MIME type of the file - directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) - is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion - uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available - category (DirectRelationReference | tuple[str, str] | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file + start_time (datetime | None): The actual start time of an activity (or similar that extends this) + end_time (datetime | None): The actual end time of an activity (or similar that extends this) + scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) + scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) + assets (list[DirectRelationReference | tuple[str, str]] | None): List of assets this activity relates to + equipment (list[DirectRelationReference | tuple[str, str]] | None): The list of equipment this activity relates to + time_series (list[DirectRelationReference | tuple[str, str]] | None): The list of time series this activity relates to existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -2679,12 +2958,13 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, + start_time: datetime | None = None, + end_time: datetime | None = None, + scheduled_start_time: datetime | None = None, + scheduled_end_time: datetime | None = None, assets: list[DirectRelationReference | tuple[str, str]] | None = None, - mime_type: str | None = None, - directory: str | None = None, - is_uploaded: bool | None = None, - uploaded_time: datetime | None = None, - category: DirectRelationReference | tuple[str, str] | None = None, + equipment: list[DirectRelationReference | tuple[str, str]] | None = None, + time_series: list[DirectRelationReference | tuple[str, str]] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -2713,24 +2993,33 @@ def __init__( existing_version=existing_version, type=type, ) + CogniteSchedulableApply.__init__( + self, + space, + external_id, + start_time=start_time, + end_time=end_time, + scheduled_start_time=scheduled_start_time, + scheduled_end_time=scheduled_end_time, + existing_version=existing_version, + type=type, + ) self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.mime_type = mime_type - self.directory = directory - self.is_uploaded = is_uploaded - self.uploaded_time = uploaded_time - self.category = DirectRelationReference.load(category) if category else None + self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None + self.time_series = ( + [DirectRelationReference.load(time_series) for time_series in time_series] if time_series else None + ) -class CogniteFile(CogniteFileProperties, CogniteDescribableNode, CogniteSourceableNode): - """This represents the reading format of Cognite file. +class CogniteActivity(_CogniteActivityProperties, CogniteDescribableNode, CogniteSourceableNode, CogniteSchedulable): + """This represents the reading format of Cognite activity. It is used to when data is read from CDF. - This concept models the underlying file - + Represent an activity Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite file. + external_id (str): The external id of the Cognite activity. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -2745,12 +3034,13 @@ class CogniteFile(CogniteFileProperties, CogniteDescribableNode, CogniteSourceab source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - assets (list[DirectRelationReference] | None): List of assets this file relates to - mime_type (str | None): MIME type of the file - directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) - is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion - uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available - category (DirectRelationReference | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file + start_time (datetime | None): The actual start time of an activity (or similar that extends this) + end_time (datetime | None): The actual end time of an activity (or similar that extends this) + scheduled_start_time (datetime | None): The planned start time of an activity (or similar that extends this) + scheduled_end_time (datetime | None): The planned end time of an activity (or similar that extends this) + assets (list[DirectRelationReference] | None): List of assets this activity relates to + equipment (list[DirectRelationReference] | None): The list of equipment this activity relates to + time_series (list[DirectRelationReference] | None): The list of time series this activity relates to type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -2774,12 +3064,13 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, + start_time: datetime | None = None, + end_time: datetime | None = None, + scheduled_start_time: datetime | None = None, + scheduled_end_time: datetime | None = None, assets: list[DirectRelationReference] | None = None, - mime_type: str | None = None, - directory: str | None = None, - is_uploaded: bool | None = None, - uploaded_time: datetime | None = None, - category: DirectRelationReference | None = None, + equipment: list[DirectRelationReference] | None = None, + time_series: list[DirectRelationReference] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -2814,15 +3105,28 @@ def __init__( type=type, deleted_time=deleted_time, ) + CogniteSchedulable.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + start_time=start_time, + end_time=end_time, + scheduled_start_time=scheduled_start_time, + scheduled_end_time=scheduled_end_time, + type=type, + deleted_time=deleted_time, + ) self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.mime_type = mime_type - self.directory = directory - self.is_uploaded = is_uploaded - self.uploaded_time = uploaded_time - self.category = DirectRelationReference.load(category) if category else None + self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None + self.time_series = ( + [DirectRelationReference.load(time_series) for time_series in time_series] if time_series else None + ) - def as_write(self) -> CogniteFileApply: - return CogniteFileApply( + def as_write(self) -> CogniteActivityApply: + return CogniteActivityApply( self.space, self.external_id, name=self.name, @@ -2836,35 +3140,36 @@ def as_write(self) -> CogniteFileApply: source_updated_time=self.source_updated_time, source_created_user=self.source_created_user, source_updated_user=self.source_updated_user, + start_time=self.start_time, + end_time=self.end_time, + scheduled_start_time=self.scheduled_start_time, + scheduled_end_time=self.scheduled_end_time, assets=self.assets, # type: ignore[arg-type] - mime_type=self.mime_type, - directory=self.directory, - is_uploaded=self.is_uploaded, - uploaded_time=self.uploaded_time, - category=self.category, + equipment=self.equipment, # type: ignore[arg-type] + time_series=self.time_series, existing_version=self.version, type=self.type, ) -class CogniteTimeSeriesProperties: - type_ = PropertyOptions("type") - is_step = PropertyOptions("isStep") - source_unit = PropertyOptions("sourceUnit") +class _CogniteEquipmentProperties: + serial_number = PropertyOptions("serialNumber") + equipment_type = PropertyOptions("equipmentType") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteTimeSeries", "v1") + return ViewId("cdf_cdm", "CogniteEquipment", "v1") -class CogniteTimeSeriesApply(CogniteTimeSeriesProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): - """This represents the writing format of Cognite time series. +class CogniteEquipmentApply(_CogniteEquipmentProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): + """This represents the writing format of Cognite equipment. It is used to when data is written to CDF. + + Represent a physical piece of equipment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite time series. - type_ (Literal["numeric", "string"]): Defines data type of the data points. + external_id (str): The external id of the Cognite equipment. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 @@ -2876,11 +3181,11 @@ class CogniteTimeSeriesApply(CogniteTimeSeriesProperties, CogniteDescribableNode source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - is_step (bool | None): Defines whether the time series is a step series or not. - source_unit (str | None): Unit as specified in the source system - unit (DirectRelationReference | tuple[str, str] | None): direct relation to unit in the `cdf_units` space - assets (list[DirectRelationReference | tuple[str, str]] | None): The asset field. - equipment (list[DirectRelationReference | tuple[str, str]] | None): The equipment field. + asset (DirectRelationReference | tuple[str, str] | None): Asset associated with this equipment + serial_number (str | None): Serial number of the equipment + manufacturer (str | None): Manufacturer of the equipment + equipment_type (DirectRelationReference | tuple[str, str] | None): Type of this equipment, direct relation to CogniteEquipmentType + files (list[DirectRelationReference | tuple[str, str]] | None): List of files this equipment relates to existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -2890,7 +3195,6 @@ def __init__( space: str, external_id: str, *, - type_: Literal["numeric", "string"], name: str | None = None, description: str | None = None, tags: list[str] | None = None, @@ -2902,11 +3206,11 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, - is_step: bool | None = None, - source_unit: str | None = None, - unit: DirectRelationReference | tuple[str, str] | None = None, - assets: list[DirectRelationReference | tuple[str, str]] | None = None, - equipment: list[DirectRelationReference | tuple[str, str]] | None = None, + asset: DirectRelationReference | tuple[str, str] | None = None, + serial_number: str | None = None, + manufacturer: str | None = None, + equipment_type: DirectRelationReference | tuple[str, str] | None = None, + files: list[DirectRelationReference | tuple[str, str]] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -2935,26 +3239,25 @@ def __init__( existing_version=existing_version, type=type, ) - self.type_ = type_ - self.is_step = is_step - self.source_unit = source_unit - self.unit = DirectRelationReference.load(unit) if unit else None - self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None + self.asset = DirectRelationReference.load(asset) if asset else None + self.serial_number = serial_number + self.manufacturer = manufacturer + self.equipment_type = DirectRelationReference.load(equipment_type) if equipment_type else None + self.files = [DirectRelationReference.load(file) for file in files] if files else None -class CogniteTimeSeries(CogniteTimeSeriesProperties, CogniteDescribableNode, CogniteSourceableNode): - """This represents the reading format of Cognite time series. +class CogniteEquipment(_CogniteEquipmentProperties, CogniteDescribableNode, CogniteSourceableNode): + """This represents the reading format of Cognite equipment. It is used to when data is read from CDF. + Represent a physical piece of equipment Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite time series. + external_id (str): The external id of the Cognite equipment. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - type_ (Literal["numeric", "string"]): Defines data type of the data points. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 @@ -2966,11 +3269,11 @@ class CogniteTimeSeries(CogniteTimeSeriesProperties, CogniteDescribableNode, Cog source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - is_step (bool | None): Defines whether the time series is a step series or not. - source_unit (str | None): Unit as specified in the source system - unit (DirectRelationReference | None): direct relation to unit in the `cdf_units` space - assets (list[DirectRelationReference] | None): The asset field. - equipment (list[DirectRelationReference] | None): The equipment field. + asset (DirectRelationReference | None): Asset associated with this equipment + serial_number (str | None): Serial number of the equipment + manufacturer (str | None): Manufacturer of the equipment + equipment_type (DirectRelationReference | None): Type of this equipment, direct relation to CogniteEquipmentType + files (list[DirectRelationReference] | None): List of files this equipment relates to type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -2983,7 +3286,6 @@ def __init__( last_updated_time: int, created_time: int, *, - type_: Literal["numeric", "string"], name: str | None = None, description: str | None = None, tags: list[str] | None = None, @@ -2995,11 +3297,11 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, - is_step: bool | None = None, - source_unit: str | None = None, - unit: DirectRelationReference | None = None, - assets: list[DirectRelationReference] | None = None, - equipment: list[DirectRelationReference] | None = None, + asset: DirectRelationReference | None = None, + serial_number: str | None = None, + manufacturer: str | None = None, + equipment_type: DirectRelationReference | None = None, + files: list[DirectRelationReference] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -3033,19 +3335,17 @@ def __init__( source_updated_user=source_updated_user, type=type, deleted_time=deleted_time, - ) - self.type_ = type_ - self.is_step = is_step - self.source_unit = source_unit - self.unit = DirectRelationReference.load(unit) if unit else None - self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None - self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None + ) + self.asset = DirectRelationReference.load(asset) if asset else None + self.serial_number = serial_number + self.manufacturer = manufacturer + self.equipment_type = DirectRelationReference.load(equipment_type) if equipment_type else None + self.files = [DirectRelationReference.load(file) for file in files] if files else None - def as_write(self) -> CogniteTimeSeriesApply: - return CogniteTimeSeriesApply( + def as_write(self) -> CogniteEquipmentApply: + return CogniteEquipmentApply( self.space, self.external_id, - type_=self.type_, name=self.name, description=self.description, tags=self.tags, @@ -3057,39 +3357,35 @@ def as_write(self) -> CogniteTimeSeriesApply: source_updated_time=self.source_updated_time, source_created_user=self.source_created_user, source_updated_user=self.source_updated_user, - is_step=self.is_step, - source_unit=self.source_unit, - unit=self.unit, - assets=self.assets, # type: ignore[arg-type] - equipment=self.equipment, # type: ignore[arg-type] + asset=self.asset, + serial_number=self.serial_number, + manufacturer=self.manufacturer, + equipment_type=self.equipment_type, + files=self.files, # type: ignore[arg-type] existing_version=self.version, type=self.type, ) -class CogniteAssetProperties: - last_path_materialization_time = PropertyOptions("lastPathMaterializationTime") - asset_class = PropertyOptions("assetClass") - type_ = PropertyOptions("type") +class _CogniteFileProperties: + mime_type = PropertyOptions("mimeType") + is_uploaded = PropertyOptions("isUploaded") + uploaded_time = PropertyOptions("uploadedTime") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteAsset", "v1") + return ViewId("cdf_cdm", "CogniteFile", "v1") -class CogniteAssetApply( - CogniteAssetProperties, CogniteVisualizableApply, CogniteDescribableNodeApply, CogniteSourceableNodeApply -): - """This represents the writing format of Cognite asset. +class CogniteFileApply(_CogniteFileProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): + """This represents the writing format of Cognite file. It is used to when data is written to CDF. - The asset is the bare bone representation of assets in our asset centric world - + This concept models the underlying file Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset. - object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to an Object3D instance representing the 3D resource + external_id (str): The external id of the Cognite file. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 @@ -3101,13 +3397,12 @@ class CogniteAssetApply( source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - parent (DirectRelationReference | tuple[str, str] | None): Parent of this asset - root (DirectRelationReference | tuple[str, str] | None): Asset at the top of the hierarchy. - path (list[DirectRelationReference | tuple[str, str]] | None): Materialized path of this asset - last_path_materialization_time (datetime | None): Last time the path materializer updated the path of this asset - equipment (DirectRelationReference | tuple[str, str] | None): Equipment associated with this asset - asset_class (DirectRelationReference | tuple[str, str] | None): Class of this asset - type_ (DirectRelationReference | tuple[str, str] | None): Type of this asset + assets (list[DirectRelationReference | tuple[str, str]] | None): List of assets this file relates to + mime_type (str | None): MIME type of the file + directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) + is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion + uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available + category (DirectRelationReference | tuple[str, str] | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -3117,7 +3412,6 @@ def __init__( space: str, external_id: str, *, - object_3d: DirectRelationReference | tuple[str, str] | None = None, name: str | None = None, description: str | None = None, tags: list[str] | None = None, @@ -3129,19 +3423,15 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, - parent: DirectRelationReference | tuple[str, str] | None = None, - root: DirectRelationReference | tuple[str, str] | None = None, - path: list[DirectRelationReference | tuple[str, str]] | None = None, - last_path_materialization_time: datetime | None = None, - equipment: DirectRelationReference | tuple[str, str] | None = None, - asset_class: DirectRelationReference | tuple[str, str] | None = None, - type_: DirectRelationReference | tuple[str, str] | None = None, + assets: list[DirectRelationReference | tuple[str, str]] | None = None, + mime_type: str | None = None, + directory: str | None = None, + is_uploaded: bool | None = None, + uploaded_time: datetime | None = None, + category: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - CogniteVisualizableApply.__init__( - self, space, external_id, object_3d=object_3d, existing_version=existing_version, type=type - ) CogniteDescribableNodeApply.__init__( self, space, @@ -3167,29 +3457,26 @@ def __init__( existing_version=existing_version, type=type, ) - self.parent = DirectRelationReference.load(parent) if parent else None - self.root = DirectRelationReference.load(root) if root else None - self.path = [DirectRelationReference.load(path) for path in path] if path else None - self.last_path_materialization_time = last_path_materialization_time - self.equipment = DirectRelationReference.load(equipment) if equipment else None - self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None - self.type_ = DirectRelationReference.load(type_) if type_ else None + self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None + self.mime_type = mime_type + self.directory = directory + self.is_uploaded = is_uploaded + self.uploaded_time = uploaded_time + self.category = DirectRelationReference.load(category) if category else None -class CogniteAsset(CogniteAssetProperties, CogniteVisualizable, CogniteDescribableNode, CogniteSourceableNode): - """This represents the reading format of Cognite asset. +class CogniteFile(_CogniteFileProperties, CogniteDescribableNode, CogniteSourceableNode): + """This represents the reading format of Cognite file. It is used to when data is read from CDF. - The asset is the bare bone representation of assets in our asset centric world - + This concept models the underlying file Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite asset. + external_id (str): The external id of the Cognite file. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - object_3d (DirectRelationReference | None): Direct relation to an Object3D instance representing the 3D resource name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 @@ -3201,13 +3488,12 @@ class CogniteAsset(CogniteAssetProperties, CogniteVisualizable, CogniteDescribab source_updated_time (datetime | None): When the instance was last updated in the source system (if available) source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF - parent (DirectRelationReference | None): Parent of this asset - root (DirectRelationReference | None): Asset at the top of the hierarchy. - path (list[DirectRelationReference] | None): Materialized path of this asset - last_path_materialization_time (datetime | None): Last time the path materializer updated the path of this asset - equipment (DirectRelationReference | None): Equipment associated with this asset - asset_class (DirectRelationReference | None): Class of this asset - type_ (DirectRelationReference | None): Type of this asset + assets (list[DirectRelationReference] | None): List of assets this file relates to + mime_type (str | None): MIME type of the file + directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) + is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion + uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available + category (DirectRelationReference | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -3220,7 +3506,6 @@ def __init__( last_updated_time: int, created_time: int, *, - object_3d: DirectRelationReference | None = None, name: str | None = None, description: str | None = None, tags: list[str] | None = None, @@ -3232,27 +3517,15 @@ def __init__( source_updated_time: datetime | None = None, source_created_user: str | None = None, source_updated_user: str | None = None, - parent: DirectRelationReference | None = None, - root: DirectRelationReference | None = None, - path: list[DirectRelationReference] | None = None, - last_path_materialization_time: datetime | None = None, - equipment: DirectRelationReference | None = None, - asset_class: DirectRelationReference | None = None, - type_: DirectRelationReference | None = None, + assets: list[DirectRelationReference] | None = None, + mime_type: str | None = None, + directory: str | None = None, + is_uploaded: bool | None = None, + uploaded_time: datetime | None = None, + category: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - CogniteVisualizable.__init__( - self, - space, - external_id, - version, - last_updated_time, - created_time, - object_3d=object_3d, - type=type, - deleted_time=deleted_time, - ) CogniteDescribableNode.__init__( self, space, @@ -3284,19 +3557,17 @@ def __init__( type=type, deleted_time=deleted_time, ) - self.parent = DirectRelationReference.load(parent) if parent else None - self.root = DirectRelationReference.load(root) if root else None - self.path = [DirectRelationReference.load(path) for path in path] if path else None - self.last_path_materialization_time = last_path_materialization_time - self.equipment = DirectRelationReference.load(equipment) if equipment else None - self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None - self.type_ = DirectRelationReference.load(type_) if type_ else None + self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None + self.mime_type = mime_type + self.directory = directory + self.is_uploaded = is_uploaded + self.uploaded_time = uploaded_time + self.category = DirectRelationReference.load(category) if category else None - def as_write(self) -> CogniteAssetApply: - return CogniteAssetApply( + def as_write(self) -> CogniteFileApply: + return CogniteFileApply( self.space, self.external_id, - object_3d=self.object_3d, name=self.name, description=self.description, tags=self.tags, @@ -3308,159 +3579,52 @@ def as_write(self) -> CogniteAssetApply: source_updated_time=self.source_updated_time, source_created_user=self.source_created_user, source_updated_user=self.source_updated_user, - parent=self.parent, - root=self.root, - path=self.path, # type: ignore[arg-type] - last_path_materialization_time=self.last_path_materialization_time, - equipment=self.equipment, - asset_class=self.asset_class, - type_=self.type_, + assets=self.assets, # type: ignore[arg-type] + mime_type=self.mime_type, + directory=self.directory, + is_uploaded=self.is_uploaded, + uploaded_time=self.uploaded_time, + category=self.category, existing_version=self.version, type=self.type, ) -class CogniteCADRevisionProperties: - revision_id = PropertyOptions("revisionId") - - @classmethod - def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteCADRevision", "v1") - - -class CogniteCADRevisionApply(CogniteCADRevisionProperties, CogniteRevision3DApply): - """This represents the writing format of Cognite cad revision. - - It is used to when data is written to CDF. - Args: - space (str): The space where the node is located. - external_id (str): The external id of the Cognite cad revision. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | tuple[str, str] | None): . - revision_id (int | None): The 3D API revision identifier for this CAD model - existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. - type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. - """ - - def __init__( - self, - space: str, - external_id: str, - *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, - revision_id: int | None = None, - existing_version: int | None = None, - type: DirectRelationReference | tuple[str, str] | None = None, - ) -> None: - super().__init__( - space, - external_id, - status=status, - published=published, - type_=type_, - model_3d=model_3d, - existing_version=existing_version, - type=type, - ) - self.revision_id = revision_id - - -class CogniteCADRevision(CogniteCADRevisionProperties, CogniteRevision3D): - """This represents the reading format of Cognite cad revision. - - It is used to when data is read from CDF. - - Args: - space (str): The space where the node is located. - external_id (str): The external id of the Cognite cad revision. - version (int): DMS version. - last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | None): . - revision_id (int | None): The 3D API revision identifier for this CAD model - type (DirectRelationReference | None): Direct relation pointing to the type node. - deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results - """ - - def __init__( - self, - space: str, - external_id: str, - version: int, - last_updated_time: int, - created_time: int, - *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | None = None, - revision_id: int | None = None, - type: DirectRelationReference | None = None, - deleted_time: int | None = None, - ) -> None: - super().__init__( - space, - external_id, - version, - last_updated_time, - created_time, - status=status, - published=published, - type_=type_, - model_3d=model_3d, - type=type, - deleted_time=deleted_time, - ) - self.revision_id = revision_id - - def as_write(self) -> CogniteCADRevisionApply: - return CogniteCADRevisionApply( - self.space, - self.external_id, - status=self.status, - published=self.published, - type_=self.type_, - model_3d=self.model_3d, - revision_id=self.revision_id, - existing_version=self.version, - type=self.type, - ) - +class _CogniteTimeSeriesProperties: + is_step = PropertyOptions("isStep") + type_ = PropertyOptions("type") + source_unit = PropertyOptions("sourceUnit") -class CogniteImage360CollectionProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteImage360Collection", "v1") + return ViewId("cdf_cdm", "CogniteTimeSeries", "v1") -class CogniteImage360CollectionApply( - CogniteImage360CollectionProperties, CogniteDescribableNodeApply, CogniteRevision3DApply -): - """This represents the writing format of Cognite image 360 collection. +class CogniteTimeSeriesApply(_CogniteTimeSeriesProperties, CogniteDescribableNodeApply, CogniteSourceableNodeApply): + """This represents the writing format of Cognite time series. It is used to when data is written to CDF. - Represents a logical collection of CogniteImage360 instances - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 collection. + external_id (str): The external id of the Cognite time series. + is_step (bool): Defines whether the time series is a step series or not. + type_ (Literal["numeric", "string"]): Defines data type of the data points. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | tuple[str, str] | None): The model 3D field. + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_unit (str | None): Unit as specified in the source system + unit (DirectRelationReference | tuple[str, str] | None): direct relation to the unit of the time series + assets (list[DirectRelationReference | tuple[str, str]] | None): The asset field. + equipment (list[DirectRelationReference | tuple[str, str]] | None): The equipment field. existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -3470,14 +3634,23 @@ def __init__( space: str, external_id: str, *, + is_step: bool, + type_: Literal["numeric", "string"], name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | tuple[str, str] | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + source_unit: str | None = None, + unit: DirectRelationReference | tuple[str, str] | None = None, + assets: list[DirectRelationReference | tuple[str, str]] | None = None, + equipment: list[DirectRelationReference | tuple[str, str]] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -3492,40 +3665,56 @@ def __init__( existing_version=existing_version, type=type, ) - CogniteRevision3DApply.__init__( + CogniteSourceableNodeApply.__init__( self, space, external_id, - status=status, - published=published, - type_=type_, - model_3d=model_3d, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, existing_version=existing_version, type=type, ) + self.is_step = is_step + self.type_ = type_ + self.source_unit = source_unit + self.unit = DirectRelationReference.load(unit) if unit else None + self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None + self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None -class CogniteImage360Collection(CogniteImage360CollectionProperties, CogniteDescribableNode, CogniteRevision3D): - """This represents the reading format of Cognite image 360 collection. +class CogniteTimeSeries(_CogniteTimeSeriesProperties, CogniteDescribableNode, CogniteSourceableNode): + """This represents the reading format of Cognite time series. It is used to when data is read from CDF. - Represents a logical collection of CogniteImage360 instances - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 collection. + external_id (str): The external id of the Cognite time series. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + is_step (bool): Defines whether the time series is a step series or not. + type_ (Literal["numeric", "string"]): Defines data type of the data points. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | None): The model 3D field. + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_unit (str | None): Unit as specified in the source system + unit (DirectRelationReference | None): direct relation to the unit of the time series + assets (list[DirectRelationReference] | None): The asset field. + equipment (list[DirectRelationReference] | None): The equipment field. type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -3538,14 +3727,23 @@ def __init__( last_updated_time: int, created_time: int, *, + is_step: bool, + type_: Literal["numeric", "string"], name: str | None = None, description: str | None = None, tags: list[str] | None = None, aliases: list[str] | None = None, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + source_unit: str | None = None, + unit: DirectRelationReference | None = None, + assets: list[DirectRelationReference] | None = None, + equipment: list[DirectRelationReference] | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -3563,61 +3761,95 @@ def __init__( type=type, deleted_time=deleted_time, ) - CogniteRevision3D.__init__( + CogniteSourceableNode.__init__( self, space, external_id, version, last_updated_time, created_time, - status=status, - published=published, - type_=type_, - model_3d=model_3d, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, type=type, deleted_time=deleted_time, ) + self.is_step = is_step + self.type_ = type_ + self.source_unit = source_unit + self.unit = DirectRelationReference.load(unit) if unit else None + self.assets = [DirectRelationReference.load(asset) for asset in assets] if assets else None + self.equipment = [DirectRelationReference.load(equipment) for equipment in equipment] if equipment else None - def as_write(self) -> CogniteImage360CollectionApply: - return CogniteImage360CollectionApply( + def as_write(self) -> CogniteTimeSeriesApply: + return CogniteTimeSeriesApply( self.space, self.external_id, + is_step=self.is_step, + type_=self.type_, name=self.name, description=self.description, tags=self.tags, aliases=self.aliases, - status=self.status, - published=self.published, - type_=self.type_, - model_3d=self.model_3d, + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, + source_unit=self.source_unit, + unit=self.unit, + assets=self.assets, # type: ignore[arg-type] + equipment=self.equipment, # type: ignore[arg-type] existing_version=self.version, type=self.type, ) -class CognitePointCloudRevisionProperties: - revision_id = PropertyOptions("revisionId") +class _CogniteAssetProperties: + path_last_updated_time = PropertyOptions("pathLastUpdatedTime") + asset_class = PropertyOptions("assetClass") + type_ = PropertyOptions("type") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CognitePointCloudRevision", "v1") + return ViewId("cdf_cdm", "CogniteAsset", "v1") -class CognitePointCloudRevisionApply(CognitePointCloudRevisionProperties, CogniteRevision3DApply): - """This represents the writing format of Cognite point cloud revision. +class CogniteAssetApply( + _CogniteAssetProperties, CogniteVisualizableApply, CogniteDescribableNodeApply, CogniteSourceableNodeApply +): + """This represents the writing format of Cognite asset. It is used to when data is written to CDF. - Navigational aid for traversing CognitePointCloudRevision instances - + The asset is the bare bone representation of assets in our asset centric world Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud revision. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | tuple[str, str] | None): . - revision_id (int | None): The 3D API revision identifier for this PointCloud model + external_id (str): The external id of the Cognite asset. + object_3d (DirectRelationReference | tuple[str, str] | None): Direct relation to an Object3D instance representing the 3D resource + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + parent (DirectRelationReference | tuple[str, str] | None): Parent of this asset + root (DirectRelationReference | tuple[str, str] | None): Asset at the top of the hierarchy. + path (list[DirectRelationReference | tuple[str, str]] | None): Materialized path of this asset + path_last_updated_time (datetime | None): Last time the path was updated for this asset + asset_class (DirectRelationReference | tuple[str, str] | None): Class of this asset + type_ (DirectRelationReference | tuple[str, str] | None): Type of this asset existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -3627,45 +3859,93 @@ def __init__( space: str, external_id: str, *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | tuple[str, str] | None = None, - revision_id: int | None = None, + object_3d: DirectRelationReference | tuple[str, str] | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | tuple[str, str] | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + parent: DirectRelationReference | tuple[str, str] | None = None, + root: DirectRelationReference | tuple[str, str] | None = None, + path: list[DirectRelationReference | tuple[str, str]] | None = None, + path_last_updated_time: datetime | None = None, + asset_class: DirectRelationReference | tuple[str, str] | None = None, + type_: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - super().__init__( + CogniteVisualizableApply.__init__( + self, space, external_id, object_3d=object_3d, existing_version=existing_version, type=type + ) + CogniteDescribableNodeApply.__init__( + self, space, external_id, - status=status, - published=published, - type_=type_, - model_3d=model_3d, + name=name, + description=description, + tags=tags, + aliases=aliases, existing_version=existing_version, type=type, ) - self.revision_id = revision_id + CogniteSourceableNodeApply.__init__( + self, + space, + external_id, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + existing_version=existing_version, + type=type, + ) + self.parent = DirectRelationReference.load(parent) if parent else None + self.root = DirectRelationReference.load(root) if root else None + self.path = [DirectRelationReference.load(path) for path in path] if path else None + self.path_last_updated_time = path_last_updated_time + self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None + self.type_ = DirectRelationReference.load(type_) if type_ else None -class CognitePointCloudRevision(CognitePointCloudRevisionProperties, CogniteRevision3D): - """This represents the reading format of Cognite point cloud revision. +class CogniteAsset(_CogniteAssetProperties, CogniteVisualizable, CogniteDescribableNode, CogniteSourceableNode): + """This represents the reading format of Cognite asset. It is used to when data is read from CDF. - Navigational aid for traversing CognitePointCloudRevision instances - + The asset is the bare bone representation of assets in our asset centric world Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud revision. + external_id (str): The external id of the Cognite asset. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - status (Literal["Done", "Failed", "Processing", "Queued"] | None): The status field. - published (Literal["Done", "Failed", "Processing", "Queued"] | None): The published field. - type_ (Literal["CAD", "Image360", "PointCloud"] | None): The type field. - model_3d (DirectRelationReference | None): . - revision_id (int | None): The 3D API revision identifier for this PointCloud model + object_3d (DirectRelationReference | None): Direct relation to an Object3D instance representing the 3D resource + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + parent (DirectRelationReference | None): Parent of this asset + root (DirectRelationReference | None): Asset at the top of the hierarchy. + path (list[DirectRelationReference] | None): Materialized path of this asset + path_last_updated_time (datetime | None): Last time the path was updated for this asset + asset_class (DirectRelationReference | None): Class of this asset + type_ (DirectRelationReference | None): Type of this asset type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -3678,78 +3958,124 @@ def __init__( last_updated_time: int, created_time: int, *, - status: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - published: Literal["Done", "Failed", "Processing", "Queued"] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - model_3d: DirectRelationReference | None = None, - revision_id: int | None = None, + object_3d: DirectRelationReference | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + parent: DirectRelationReference | None = None, + root: DirectRelationReference | None = None, + path: list[DirectRelationReference] | None = None, + path_last_updated_time: datetime | None = None, + asset_class: DirectRelationReference | None = None, + type_: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - super().__init__( + CogniteVisualizable.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + object_3d=object_3d, + type=type, + deleted_time=deleted_time, + ) + CogniteDescribableNode.__init__( + self, space, external_id, version, last_updated_time, created_time, - status=status, - published=published, - type_=type_, - model_3d=model_3d, + name=name, + description=description, + tags=tags, + aliases=aliases, type=type, deleted_time=deleted_time, ) - self.revision_id = revision_id + CogniteSourceableNode.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + type=type, + deleted_time=deleted_time, + ) + self.parent = DirectRelationReference.load(parent) if parent else None + self.root = DirectRelationReference.load(root) if root else None + self.path = [DirectRelationReference.load(path) for path in path] if path else None + self.path_last_updated_time = path_last_updated_time + self.asset_class = DirectRelationReference.load(asset_class) if asset_class else None + self.type_ = DirectRelationReference.load(type_) if type_ else None - def as_write(self) -> CognitePointCloudRevisionApply: - return CognitePointCloudRevisionApply( + def as_write(self) -> CogniteAssetApply: + return CogniteAssetApply( self.space, self.external_id, - status=self.status, - published=self.published, + object_3d=self.object_3d, + name=self.name, + description=self.description, + tags=self.tags, + aliases=self.aliases, + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, + parent=self.parent, + root=self.root, + path=self.path, # type: ignore[arg-type] + path_last_updated_time=self.path_last_updated_time, + asset_class=self.asset_class, type_=self.type_, - model_3d=self.model_3d, - revision_id=self.revision_id, existing_version=self.version, type=self.type, ) -class CogniteImage360Properties: - collection_360 = PropertyOptions("collection360") - station_360 = PropertyOptions("station360") - taken_at = PropertyOptions("takenAt") - +class _Cognite360ImageModelProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteImage360", "v1") + return ViewId("cdf_cdm", "Cognite360ImageModel", "v1") -class CogniteImage360Apply(CogniteImage360Properties, CogniteTransformation3DNodeApply, CogniteCubeMapApply): - """This represents the writing format of Cognite image 360. +class Cognite360ImageModelApply(_Cognite360ImageModelProperties, Cognite3DModelApply): + """This represents the writing format of Cognite 360 image model. It is used to when data is written to CDF. + + Navigational aid for traversing Cognite360ImageModel instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis - front (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the front projection of the cube map - back (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the back projection of the cube map - left (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the left projection of the cube map - right (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the right projection of the cube map - top (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the top projection of the cube map - bottom (DirectRelationReference | tuple[str, str] | None): Direct relation to a file holding the bottom projection of the cube map - collection_360 (DirectRelationReference | tuple[str, str] | None): Direct relation to CogniteImage360Collection - station_360 (DirectRelationReference | tuple[str, str] | None): Direct relation to CogniteGroup3D instance that groups different CogniteImage360 instances to the same station - taken_at (datetime | None): The timestamp when the 6 photos were taken. + external_id (str): The external id of the Cognite 360 image model. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | tuple[str, str] | None): Thumbnail of the 3D model existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -3759,90 +4085,47 @@ def __init__( space: str, external_id: str, *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, - front: DirectRelationReference | tuple[str, str] | None = None, - back: DirectRelationReference | tuple[str, str] | None = None, - left: DirectRelationReference | tuple[str, str] | None = None, - right: DirectRelationReference | tuple[str, str] | None = None, - top: DirectRelationReference | tuple[str, str] | None = None, - bottom: DirectRelationReference | tuple[str, str] | None = None, - collection_360: DirectRelationReference | tuple[str, str] | None = None, - station_360: DirectRelationReference | tuple[str, str] | None = None, - taken_at: datetime | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - CogniteTransformation3DNodeApply.__init__( - self, - space, - external_id, - translation_x=translation_x, - translation_y=translation_y, - translation_z=translation_z, - euler_rotation_x=euler_rotation_x, - euler_rotation_y=euler_rotation_y, - euler_rotation_z=euler_rotation_z, - scale_x=scale_x, - scale_y=scale_y, - scale_z=scale_z, - existing_version=existing_version, - type=type, - ) - CogniteCubeMapApply.__init__( - self, + super().__init__( space, external_id, - front=front, - back=back, - left=left, - right=right, - top=top, - bottom=bottom, + name=name, + description=description, + tags=tags, + aliases=aliases, + type_=type_, + thumbnail=thumbnail, existing_version=existing_version, type=type, ) - self.collection_360 = DirectRelationReference.load(collection_360) if collection_360 else None - self.station_360 = DirectRelationReference.load(station_360) if station_360 else None - self.taken_at = taken_at -class CogniteImage360(CogniteImage360Properties, CogniteTransformation3DNode, CogniteCubeMap): - """This represents the reading format of Cognite image 360. +class Cognite360ImageModel(_Cognite360ImageModelProperties, Cognite3DModel): + """This represents the reading format of Cognite 360 image model. It is used to when data is read from CDF. + Navigational aid for traversing Cognite360ImageModel instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360. + external_id (str): The external id of the Cognite 360 image model. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis - front (DirectRelationReference | None): Direct relation to a file holding the front projection of the cube map - back (DirectRelationReference | None): Direct relation to a file holding the back projection of the cube map - left (DirectRelationReference | None): Direct relation to a file holding the left projection of the cube map - right (DirectRelationReference | None): Direct relation to a file holding the right projection of the cube map - top (DirectRelationReference | None): Direct relation to a file holding the top projection of the cube map - bottom (DirectRelationReference | None): Direct relation to a file holding the bottom projection of the cube map - collection_360 (DirectRelationReference | None): Direct relation to CogniteImage360Collection - station_360 (DirectRelationReference | None): Direct relation to CogniteGroup3D instance that groups different CogniteImage360 instances to the same station - taken_at (datetime | None): The timestamp when the 6 photos were taken. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | None): Thumbnail of the 3D model type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -3855,106 +4138,58 @@ def __init__( last_updated_time: int, created_time: int, *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, - front: DirectRelationReference | None = None, - back: DirectRelationReference | None = None, - left: DirectRelationReference | None = None, - right: DirectRelationReference | None = None, - top: DirectRelationReference | None = None, - bottom: DirectRelationReference | None = None, - collection_360: DirectRelationReference | None = None, - station_360: DirectRelationReference | None = None, - taken_at: datetime | None = None, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: - CogniteTransformation3DNode.__init__( - self, - space, - external_id, - version, - last_updated_time, - created_time, - translation_x=translation_x, - translation_y=translation_y, - translation_z=translation_z, - euler_rotation_x=euler_rotation_x, - euler_rotation_y=euler_rotation_y, - euler_rotation_z=euler_rotation_z, - scale_x=scale_x, - scale_y=scale_y, - scale_z=scale_z, - type=type, - deleted_time=deleted_time, - ) - CogniteCubeMap.__init__( - self, + super().__init__( space, external_id, version, last_updated_time, created_time, - front=front, - back=back, - left=left, - right=right, - top=top, - bottom=bottom, + name=name, + description=description, + tags=tags, + aliases=aliases, + type_=type_, + thumbnail=thumbnail, type=type, deleted_time=deleted_time, ) - self.collection_360 = DirectRelationReference.load(collection_360) if collection_360 else None - self.station_360 = DirectRelationReference.load(station_360) if station_360 else None - self.taken_at = taken_at - def as_write(self) -> CogniteImage360Apply: - return CogniteImage360Apply( + def as_write(self) -> Cognite360ImageModelApply: + return Cognite360ImageModelApply( self.space, self.external_id, - translation_x=self.translation_x, - translation_y=self.translation_y, - translation_z=self.translation_z, - euler_rotation_x=self.euler_rotation_x, - euler_rotation_y=self.euler_rotation_y, - euler_rotation_z=self.euler_rotation_z, - scale_x=self.scale_x, - scale_y=self.scale_y, - scale_z=self.scale_z, - front=self.front, - back=self.back, - left=self.left, - right=self.right, - top=self.top, - bottom=self.bottom, - collection_360=self.collection_360, - station_360=self.station_360, - taken_at=self.taken_at, + name=self.name, + description=self.description, + tags=self.tags, + aliases=self.aliases, + type_=self.type_, + thumbnail=self.thumbnail, existing_version=self.version, type=self.type, ) -class CogniteCADModelProperties: +class _CogniteCADModelProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteCADModel", "v1") + return ViewId("cdf_cdm", "CogniteCADModel", "v1") -class CogniteCADModelApply(CogniteCADModelProperties, CogniteModel3DApply): +class CogniteCADModelApply(_CogniteCADModelProperties, Cognite3DModelApply): """This represents the writing format of Cognite cad model. It is used to when data is written to CDF. Navigational aid for traversing CogniteCADModel instances - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite cad model. @@ -3962,7 +4197,8 @@ class CogniteCADModelApply(CogniteCADModelProperties, CogniteModel3DApply): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | tuple[str, str] | None): Thumbnail of the 3D model existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -3977,6 +4213,7 @@ def __init__( tags: list[str] | None = None, aliases: list[str] | None = None, type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -3988,18 +4225,18 @@ def __init__( tags=tags, aliases=aliases, type_=type_, + thumbnail=thumbnail, existing_version=existing_version, type=type, ) -class CogniteCADModel(CogniteCADModelProperties, CogniteModel3D): +class CogniteCADModel(_CogniteCADModelProperties, Cognite3DModel): """This represents the reading format of Cognite cad model. It is used to when data is read from CDF. Navigational aid for traversing CogniteCADModel instances - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite cad model. @@ -4010,7 +4247,8 @@ class CogniteCADModel(CogniteCADModelProperties, CogniteModel3D): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | None): Thumbnail of the 3D model type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -4028,6 +4266,7 @@ def __init__( tags: list[str] | None = None, aliases: list[str] | None = None, type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -4042,6 +4281,7 @@ def __init__( tags=tags, aliases=aliases, type_=type_, + thumbnail=thumbnail, type=type, deleted_time=deleted_time, ) @@ -4055,32 +4295,33 @@ def as_write(self) -> CogniteCADModelApply: tags=self.tags, aliases=self.aliases, type_=self.type_, + thumbnail=self.thumbnail, existing_version=self.version, type=self.type, ) -class CogniteImage360ModelProperties: +class _CognitePointCloudModelProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteImage360Model", "v1") + return ViewId("cdf_cdm", "CognitePointCloudModel", "v1") -class CogniteImage360ModelApply(CogniteImage360ModelProperties, CogniteModel3DApply): - """This represents the writing format of Cognite image 360 model. +class CognitePointCloudModelApply(_CognitePointCloudModelProperties, Cognite3DModelApply): + """This represents the writing format of Cognite point cloud model. It is used to when data is written to CDF. - Navigational aid for traversing CogniteImage360Model instances - + Navigational aid for traversing CognitePointCloudModel instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 model. + external_id (str): The external id of the Cognite point cloud model. name (str | None): Name of the instance description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | tuple[str, str] | None): Thumbnail of the 3D model existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. """ @@ -4095,6 +4336,7 @@ def __init__( tags: list[str] | None = None, aliases: list[str] | None = None, type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | tuple[str, str] | None = None, existing_version: int | None = None, type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: @@ -4106,21 +4348,21 @@ def __init__( tags=tags, aliases=aliases, type_=type_, + thumbnail=thumbnail, existing_version=existing_version, type=type, ) -class CogniteImage360Model(CogniteImage360ModelProperties, CogniteModel3D): - """This represents the reading format of Cognite image 360 model. +class CognitePointCloudModel(_CognitePointCloudModelProperties, Cognite3DModel): + """This represents the reading format of Cognite point cloud model. It is used to when data is read from CDF. - Navigational aid for traversing CogniteImage360Model instances - + Navigational aid for traversing CognitePointCloudModel instances Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 model. + external_id (str): The external id of the Cognite point cloud model. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. @@ -4128,7 +4370,8 @@ class CogniteImage360Model(CogniteImage360ModelProperties, CogniteModel3D): description (str | None): Description of the instance tags (list[str] | None): Text based labels for generic use, limited to 1000 aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 + type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or Cognite360Image + thumbnail (DirectRelationReference | None): Thumbnail of the 3D model type (DirectRelationReference | None): Direct relation pointing to the type node. deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -4146,6 +4389,7 @@ def __init__( tags: list[str] | None = None, aliases: list[str] | None = None, type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + thumbnail: DirectRelationReference | None = None, type: DirectRelationReference | None = None, deleted_time: int | None = None, ) -> None: @@ -4160,12 +4404,13 @@ def __init__( tags=tags, aliases=aliases, type_=type_, + thumbnail=thumbnail, type=type, deleted_time=deleted_time, ) - def as_write(self) -> CogniteImage360ModelApply: - return CogniteImage360ModelApply( + def as_write(self) -> CognitePointCloudModelApply: + return CognitePointCloudModelApply( self.space, self.external_id, name=self.name, @@ -4173,81 +4418,93 @@ def as_write(self) -> CogniteImage360ModelApply: tags=self.tags, aliases=self.aliases, type_=self.type_, + thumbnail=self.thumbnail, existing_version=self.version, type=self.type, ) -class CognitePointCloudModelProperties: - @classmethod - def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CognitePointCloudModel", "v1") - - -class CognitePointCloudModelApply(CognitePointCloudModelProperties, CogniteModel3DApply): - """This represents the writing format of Cognite point cloud model. +class Cognite3DTransformationEdgeApply(_Cognite3DTransformationProperties, TypedEdgeApply): + """This represents the writing format of Cognite 3D transformation edge. It is used to when data is written to CDF. - Navigational aid for traversing CognitePointCloudModel instances - - Args: - space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud model. - name (str | None): Name of the instance - description (str | None): Description of the instance - tags (list[str] | None): Text based labels for generic use, limited to 1000 - aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 - existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. - type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + The Cognite3DTransformation object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in the 3D coordinate system. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions. The object's transformation is defined in "CDF space", a coordinate system where the positive Z axis is the up direction + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite 3D transformation edge. + type (DirectRelationReference | tuple[str, str]): The type of edge. + start_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. + end_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis + existing_version (int | None): Fail the ingestion request if the edge's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the edge (for the specified container or edge). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. """ def __init__( self, space: str, external_id: str, + type: DirectRelationReference | tuple[str, str], + start_node: DirectRelationReference | tuple[str, str], + end_node: DirectRelationReference | tuple[str, str], *, - name: str | None = None, - description: str | None = None, - tags: list[str] | None = None, - aliases: list[str] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, existing_version: int | None = None, - type: DirectRelationReference | tuple[str, str] | None = None, ) -> None: - super().__init__( - space, - external_id, - name=name, - description=description, - tags=tags, - aliases=aliases, - type_=type_, - existing_version=existing_version, - type=type, - ) + TypedEdgeApply.__init__(self, space, external_id, type, start_node, end_node, existing_version) + self.translation_x = translation_x + self.translation_y = translation_y + self.translation_z = translation_z + self.euler_rotation_x = euler_rotation_x + self.euler_rotation_y = euler_rotation_y + self.euler_rotation_z = euler_rotation_z + self.scale_x = scale_x + self.scale_y = scale_y + self.scale_z = scale_z -class CognitePointCloudModel(CognitePointCloudModelProperties, CogniteModel3D): - """This represents the reading format of Cognite point cloud model. +class Cognite3DTransformationEdge(_Cognite3DTransformationProperties, TypedEdge): + """This represents the reading format of Cognite 3D transformation edge. It is used to when data is read from CDF. - Navigational aid for traversing CognitePointCloudModel instances + The Cognite3DTransformation object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in the 3D coordinate system. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions. The object's transformation is defined in "CDF space", a coordinate system where the positive Z axis is the up direction Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite point cloud model. + external_id (str): The external id of the Cognite 3D transformation edge. + type (DirectRelationReference): The type of edge. + start_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. + end_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. version (int): DMS version. last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - name (str | None): Name of the instance - description (str | None): Description of the instance - tags (list[str] | None): Text based labels for generic use, limited to 1000 - aliases (list[str] | None): Alternative names for the node - type_ (Literal["CAD", "Image360", "PointCloud"] | None): CAD, PointCloud or CogniteImage360 - type (DirectRelationReference | None): Direct relation pointing to the type node. + translation_x (float | None): The displacement of the object along the X-axis in the 3D coordinate system + translation_y (float | None): The displacement of the object along the Y-axis in the 3D coordinate system + translation_z (float | None): The displacement of the object along the Z-axis in the 3D coordinate system + euler_rotation_x (float | None): The rotation of the object around the X-axis in radians + euler_rotation_y (float | None): The rotation of the object around the Y-axis in radians + euler_rotation_z (float | None): The rotation of the object around the Z-axis in radians + scale_x (float | None): The scaling factor applied to the object along the X-axis + scale_y (float | None): The scaling factor applied to the object along the Y-axis + scale_z (float | None): The scaling factor applied to the object along the Z-axis deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -4255,55 +4512,74 @@ def __init__( self, space: str, external_id: str, + type: DirectRelationReference, + start_node: DirectRelationReference, + end_node: DirectRelationReference, version: int, last_updated_time: int, created_time: int, *, - name: str | None = None, - description: str | None = None, - tags: list[str] | None = None, - aliases: list[str] | None = None, - type_: Literal["CAD", "Image360", "PointCloud"] | None = None, - type: DirectRelationReference | None = None, + translation_x: float | None = None, + translation_y: float | None = None, + translation_z: float | None = None, + euler_rotation_x: float | None = None, + euler_rotation_y: float | None = None, + euler_rotation_z: float | None = None, + scale_x: float | None = None, + scale_y: float | None = None, + scale_z: float | None = None, deleted_time: int | None = None, ) -> None: - super().__init__( + TypedEdge.__init__( + self, space, external_id, version, + type, last_updated_time, created_time, - name=name, - description=description, - tags=tags, - aliases=aliases, - type_=type_, - type=type, - deleted_time=deleted_time, + start_node, + end_node, + deleted_time, + None, ) + self.translation_x = translation_x + self.translation_y = translation_y + self.translation_z = translation_z + self.euler_rotation_x = euler_rotation_x + self.euler_rotation_y = euler_rotation_y + self.euler_rotation_z = euler_rotation_z + self.scale_x = scale_x + self.scale_y = scale_y + self.scale_z = scale_z - def as_write(self) -> CognitePointCloudModelApply: - return CognitePointCloudModelApply( + def as_write(self) -> Cognite3DTransformationEdgeApply: + return Cognite3DTransformationEdgeApply( self.space, self.external_id, - name=self.name, - description=self.description, - tags=self.tags, - aliases=self.aliases, - type_=self.type_, + self.type, + self.start_node, + self.end_node, + translation_x=self.translation_x, + translation_y=self.translation_y, + translation_z=self.translation_z, + euler_rotation_x=self.euler_rotation_x, + euler_rotation_y=self.euler_rotation_y, + euler_rotation_z=self.euler_rotation_z, + scale_x=self.scale_x, + scale_y=self.scale_y, + scale_z=self.scale_z, existing_version=self.version, - type=self.type, ) -class CogniteDescribableEdgeApply(CogniteDescribableProperties, TypedEdgeApply): +class CogniteDescribableEdgeApply(_CogniteDescribableProperties, TypedEdgeApply): """This represents the writing format of Cognite describable edge. It is used to when data is written to CDF. The describable core concept is used as a standard way of holding the bare minimum of information about the instance - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite describable edge. @@ -4338,14 +4614,13 @@ def __init__( self.aliases = aliases -class CogniteDescribableEdge(CogniteDescribableProperties, TypedEdge): +class CogniteDescribableEdge(_CogniteDescribableProperties, TypedEdge): """This represents the reading format of Cognite describable edge. It is used to when data is read from CDF. The describable core concept is used as a standard way of holding the bare minimum of information about the instance - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite describable edge. @@ -4412,7 +4687,7 @@ def as_write(self) -> CogniteDescribableEdgeApply: ) -class CogniteSourceableEdgeApply(CogniteSourceableProperties, TypedEdgeApply): +class CogniteSourceableEdgeApply(_CogniteSourceableProperties, TypedEdgeApply): """This represents the writing format of Cognite sourceable edge. It is used to when data is written to CDF. @@ -4460,7 +4735,7 @@ def __init__( self.source_updated_user = source_updated_user -class CogniteSourceableEdge(CogniteSourceableProperties, TypedEdge): +class CogniteSourceableEdge(_CogniteSourceableProperties, TypedEdge): """This represents the reading format of Cognite sourceable edge. It is used to when data is read from CDF. @@ -4525,188 +4800,36 @@ def __init__( self.source_created_user = source_created_user self.source_updated_user = source_updated_user - def as_write(self) -> CogniteSourceableEdgeApply: - return CogniteSourceableEdgeApply( - self.space, - self.external_id, - self.type, - self.start_node, - self.end_node, - source_id=self.source_id, - source_context=self.source_context, - source=self.source, - source_created_time=self.source_created_time, - source_updated_time=self.source_updated_time, - source_created_user=self.source_created_user, - source_updated_user=self.source_updated_user, - existing_version=self.version, - ) - - -class CogniteTransformation3DEdgeApply(CogniteTransformation3DProperties, TypedEdgeApply): - """This represents the writing format of Cognite transformation 3D edge. - - It is used to when data is written to CDF. - - The CogniteTransformation3D object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in 3D space. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions - - - Args: - space (str): The space where the node is located. - external_id (str): The external id of the Cognite transformation 3D edge. - type (DirectRelationReference | tuple[str, str]): The type of edge. - start_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. - end_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis - existing_version (int | None): Fail the ingestion request if the edge's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the edge (for the specified container or edge). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. - """ - - def __init__( - self, - space: str, - external_id: str, - type: DirectRelationReference | tuple[str, str], - start_node: DirectRelationReference | tuple[str, str], - end_node: DirectRelationReference | tuple[str, str], - *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, - existing_version: int | None = None, - ) -> None: - TypedEdgeApply.__init__(self, space, external_id, type, start_node, end_node, existing_version) - self.translation_x = translation_x - self.translation_y = translation_y - self.translation_z = translation_z - self.euler_rotation_x = euler_rotation_x - self.euler_rotation_y = euler_rotation_y - self.euler_rotation_z = euler_rotation_z - self.scale_x = scale_x - self.scale_y = scale_y - self.scale_z = scale_z - - -class CogniteTransformation3DEdge(CogniteTransformation3DProperties, TypedEdge): - """This represents the reading format of Cognite transformation 3D edge. - - It is used to when data is read from CDF. - - The CogniteTransformation3D object defines a comprehensive 3D transformation, enabling precise adjustments to an object's position, orientation, and size in 3D space. It allows for the translation of objects along the three spatial axes, rotation around these axes using Euler angles, and scaling along each axis to modify the object's dimensions - - - Args: - space (str): The space where the node is located. - external_id (str): The external id of the Cognite transformation 3D edge. - type (DirectRelationReference): The type of edge. - start_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. - end_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. - version (int): DMS version. - last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. - translation_x (float | None): The displacement of the object along the X-axis in 3D space - translation_y (float | None): The displacement of the object along the Y-axis in 3D space - translation_z (float | None): The displacement of the object along the Z-axis in 3D space - euler_rotation_x (float | None): The rotation of the object around the X-axis, measured in degrees - euler_rotation_y (float | None): The rotation of the object around the Y-axis, measured in degrees - euler_rotation_z (float | None): The rotation of the object around the Z-axis, measured in degrees - scale_x (float | None): The scaling factor applied to the object along the X-axis - scale_y (float | None): The scaling factor applied to the object along the Y-axis - scale_z (float | None): The scaling factor applied to the object along the Z-axis - deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results - """ - - def __init__( - self, - space: str, - external_id: str, - type: DirectRelationReference, - start_node: DirectRelationReference, - end_node: DirectRelationReference, - version: int, - last_updated_time: int, - created_time: int, - *, - translation_x: float | None = None, - translation_y: float | None = None, - translation_z: float | None = None, - euler_rotation_x: float | None = None, - euler_rotation_y: float | None = None, - euler_rotation_z: float | None = None, - scale_x: float | None = None, - scale_y: float | None = None, - scale_z: float | None = None, - deleted_time: int | None = None, - ) -> None: - TypedEdge.__init__( - self, - space, - external_id, - version, - type, - last_updated_time, - created_time, - start_node, - end_node, - deleted_time, - None, - ) - self.translation_x = translation_x - self.translation_y = translation_y - self.translation_z = translation_z - self.euler_rotation_x = euler_rotation_x - self.euler_rotation_y = euler_rotation_y - self.euler_rotation_z = euler_rotation_z - self.scale_x = scale_x - self.scale_y = scale_y - self.scale_z = scale_z - - def as_write(self) -> CogniteTransformation3DEdgeApply: - return CogniteTransformation3DEdgeApply( + def as_write(self) -> CogniteSourceableEdgeApply: + return CogniteSourceableEdgeApply( self.space, self.external_id, self.type, self.start_node, self.end_node, - translation_x=self.translation_x, - translation_y=self.translation_y, - translation_z=self.translation_z, - euler_rotation_x=self.euler_rotation_x, - euler_rotation_y=self.euler_rotation_y, - euler_rotation_z=self.euler_rotation_z, - scale_x=self.scale_x, - scale_y=self.scale_y, - scale_z=self.scale_z, + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, existing_version=self.version, ) -class CogniteAnnotationProperties: +class _CogniteAnnotationProperties: @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteAnnotation", "v1") + return ViewId("cdf_cdm", "CogniteAnnotation", "v1") -class CogniteAnnotationApply(CogniteAnnotationProperties, CogniteDescribableEdgeApply, CogniteSourceableEdgeApply): +class CogniteAnnotationApply(_CogniteAnnotationProperties, CogniteDescribableEdgeApply, CogniteSourceableEdgeApply): """This represents the writing format of Cognite annotation. It is used to when data is written to CDF. Annotation represents contextualization results or links - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite annotation. @@ -4725,7 +4848,7 @@ class CogniteAnnotationApply(CogniteAnnotationProperties, CogniteDescribableEdge source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation existing_version (int | None): Fail the ingestion request if the edge's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the edge (for the specified container or edge). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. """ @@ -4785,13 +4908,12 @@ def __init__( self.status = status -class CogniteAnnotation(CogniteAnnotationProperties, CogniteDescribableEdge, CogniteSourceableEdge): +class CogniteAnnotation(_CogniteAnnotationProperties, CogniteDescribableEdge, CogniteSourceableEdge): """This represents the reading format of Cognite annotation. It is used to when data is read from CDF. Annotation represents contextualization results or links - Args: space (str): The space where the node is located. external_id (str): The external id of the Cognite annotation. @@ -4813,7 +4935,7 @@ class CogniteAnnotation(CogniteAnnotationProperties, CogniteDescribableEdge, Cog source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -4905,35 +5027,22 @@ def as_write(self) -> CogniteAnnotationApply: ) -class CogniteDiagramAnnotationProperties: - start_node_page_number = PropertyOptions("startNodePageNumber") - end_node_page_number = PropertyOptions("endNodePageNumber") - start_node_x_min = PropertyOptions("startNodeXMin") - start_node_x_max = PropertyOptions("startNodeXMax") - start_node_y_min = PropertyOptions("startNodeYMin") - start_node_y_max = PropertyOptions("startNodeYMax") - start_node_text = PropertyOptions("startNodeText") - end_node_x_min = PropertyOptions("endNodeXMin") - end_node_x_max = PropertyOptions("endNodeXMax") - end_node_y_min = PropertyOptions("endNodeYMin") - end_node_y_max = PropertyOptions("endNodeYMax") - end_node_text = PropertyOptions("endNodeText") +class _Cognite360ImageAnnotationProperties: + format_version = PropertyOptions("formatVersion") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteDiagramAnnotation", "v1") + return ViewId("cdf_cdm", "Cognite360ImageAnnotation", "v1") -class CogniteDiagramAnnotationApply(CogniteDiagramAnnotationProperties, CogniteAnnotationApply): - """This represents the writing format of Cognite diagram annotation. +class Cognite360ImageAnnotationApply(_Cognite360ImageAnnotationProperties, CogniteAnnotationApply): + """This represents the writing format of Cognite 360 image annotation. It is used to when data is written to CDF. - Annotation for diagrams - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite diagram annotation. + external_id (str): The external id of the Cognite 360 image annotation. type (DirectRelationReference | tuple[str, str]): The type of edge. start_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. end_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. @@ -4949,19 +5058,9 @@ class CogniteDiagramAnnotationApply(CogniteDiagramAnnotationProperties, CogniteA source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match - start_node_page_number (int | None): The number of the page on which this annotation is located in `startNode` File. The first page has number 1 - end_node_page_number (int | None): The number of the page on which this annotation is located in the endNode File if an endNode is present. The first page has number 1 - start_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than startNodeXMax - start_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than startNodeXMin - start_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than startNodeYMax - start_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than startNodeYMin - start_node_text (str | None): The text extracted from within the bounding box on the startNode - end_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than endNodeXMax. Only applicable if an endNode is defined - end_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than endNodeXMin. Only applicable if an endNode is defined - end_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than endNodeYMax. Only applicable if an endNode is defined - end_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than endNodeYMin. Only applicable if an endNode is defined - end_node_text (str | None): The text extracted from within the bounding box on the endNode. Only applicable if an endNode is defined + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation + polygon (list[float] | None): List of floats representing the polygon. Format depends on formatVersion + format_version (str | None): Specifies the storage representation for the polygon existing_version (int | None): Fail the ingestion request if the edge's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the edge (for the specified container or edge). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. """ @@ -4986,18 +5085,8 @@ def __init__( source_updated_user: str | None = None, confidence: float | None = None, status: Literal["Approved", "Rejected", "Suggested"] | None = None, - start_node_page_number: int | None = None, - end_node_page_number: int | None = None, - start_node_x_min: float | None = None, - start_node_x_max: float | None = None, - start_node_y_min: float | None = None, - start_node_y_max: float | None = None, - start_node_text: str | None = None, - end_node_x_min: float | None = None, - end_node_x_max: float | None = None, - end_node_y_min: float | None = None, - end_node_y_max: float | None = None, - end_node_text: str | None = None, + polygon: list[float] | None = None, + format_version: str | None = None, existing_version: int | None = None, ) -> None: super().__init__( @@ -5021,30 +5110,18 @@ def __init__( status=status, existing_version=existing_version, ) - self.start_node_page_number = start_node_page_number - self.end_node_page_number = end_node_page_number - self.start_node_x_min = start_node_x_min - self.start_node_x_max = start_node_x_max - self.start_node_y_min = start_node_y_min - self.start_node_y_max = start_node_y_max - self.start_node_text = start_node_text - self.end_node_x_min = end_node_x_min - self.end_node_x_max = end_node_x_max - self.end_node_y_min = end_node_y_min - self.end_node_y_max = end_node_y_max - self.end_node_text = end_node_text + self.polygon = polygon + self.format_version = format_version -class CogniteDiagramAnnotation(CogniteDiagramAnnotationProperties, CogniteAnnotation): - """This represents the reading format of Cognite diagram annotation. +class Cognite360ImageAnnotation(_Cognite360ImageAnnotationProperties, CogniteAnnotation): + """This represents the reading format of Cognite 360 image annotation. It is used to when data is read from CDF. - Annotation for diagrams - Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite diagram annotation. + external_id (str): The external id of the Cognite 360 image annotation. type (DirectRelationReference): The type of edge. start_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. end_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. @@ -5063,19 +5140,9 @@ class CogniteDiagramAnnotation(CogniteDiagramAnnotationProperties, CogniteAnnota source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match - start_node_page_number (int | None): The number of the page on which this annotation is located in `startNode` File. The first page has number 1 - end_node_page_number (int | None): The number of the page on which this annotation is located in the endNode File if an endNode is present. The first page has number 1 - start_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than startNodeXMax - start_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than startNodeXMin - start_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than startNodeYMax - start_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than startNodeYMin - start_node_text (str | None): The text extracted from within the bounding box on the startNode - end_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than endNodeXMax. Only applicable if an endNode is defined - end_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than endNodeXMin. Only applicable if an endNode is defined - end_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than endNodeYMax. Only applicable if an endNode is defined - end_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than endNodeYMin. Only applicable if an endNode is defined - end_node_text (str | None): The text extracted from within the bounding box on the endNode. Only applicable if an endNode is defined + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation + polygon (list[float] | None): List of floats representing the polygon. Format depends on formatVersion + format_version (str | None): Specifies the storage representation for the polygon deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -5103,18 +5170,8 @@ def __init__( source_updated_user: str | None = None, confidence: float | None = None, status: Literal["Approved", "Rejected", "Suggested"] | None = None, - start_node_page_number: int | None = None, - end_node_page_number: int | None = None, - start_node_x_min: float | None = None, - start_node_x_max: float | None = None, - start_node_y_min: float | None = None, - start_node_y_max: float | None = None, - start_node_text: str | None = None, - end_node_x_min: float | None = None, - end_node_x_max: float | None = None, - end_node_y_min: float | None = None, - end_node_y_max: float | None = None, - end_node_text: str | None = None, + polygon: list[float] | None = None, + format_version: str | None = None, deleted_time: int | None = None, ) -> None: super().__init__( @@ -5141,21 +5198,11 @@ def __init__( status=status, deleted_time=deleted_time, ) - self.start_node_page_number = start_node_page_number - self.end_node_page_number = end_node_page_number - self.start_node_x_min = start_node_x_min - self.start_node_x_max = start_node_x_max - self.start_node_y_min = start_node_y_min - self.start_node_y_max = start_node_y_max - self.start_node_text = start_node_text - self.end_node_x_min = end_node_x_min - self.end_node_x_max = end_node_x_max - self.end_node_y_min = end_node_y_min - self.end_node_y_max = end_node_y_max - self.end_node_text = end_node_text + self.polygon = polygon + self.format_version = format_version - def as_write(self) -> CogniteDiagramAnnotationApply: - return CogniteDiagramAnnotationApply( + def as_write(self) -> Cognite360ImageAnnotationApply: + return Cognite360ImageAnnotationApply( self.space, self.external_id, self.type, @@ -5174,38 +5221,40 @@ def as_write(self) -> CogniteDiagramAnnotationApply: source_updated_user=self.source_updated_user, confidence=self.confidence, status=self.status, - start_node_page_number=self.start_node_page_number, - end_node_page_number=self.end_node_page_number, - start_node_x_min=self.start_node_x_min, - start_node_x_max=self.start_node_x_max, - start_node_y_min=self.start_node_y_min, - start_node_y_max=self.start_node_y_max, - start_node_text=self.start_node_text, - end_node_x_min=self.end_node_x_min, - end_node_x_max=self.end_node_x_max, - end_node_y_min=self.end_node_y_min, - end_node_y_max=self.end_node_y_max, - end_node_text=self.end_node_text, + polygon=self.polygon, + format_version=self.format_version, existing_version=self.version, ) -class CogniteImage360AnnotationProperties: - format_version = PropertyOptions("formatVersion") +class _CogniteDiagramAnnotationProperties: + start_node_page_number = PropertyOptions("startNodePageNumber") + end_node_page_number = PropertyOptions("endNodePageNumber") + start_node_x_min = PropertyOptions("startNodeXMin") + start_node_x_max = PropertyOptions("startNodeXMax") + start_node_y_min = PropertyOptions("startNodeYMin") + start_node_y_max = PropertyOptions("startNodeYMax") + start_node_text = PropertyOptions("startNodeText") + end_node_x_min = PropertyOptions("endNodeXMin") + end_node_x_max = PropertyOptions("endNodeXMax") + end_node_y_min = PropertyOptions("endNodeYMin") + end_node_y_max = PropertyOptions("endNodeYMax") + end_node_text = PropertyOptions("endNodeText") @classmethod def get_source(cls) -> ViewId: - return ViewId("cdf_cdm_experimental", "CogniteImage360Annotation", "v1") + return ViewId("cdf_cdm", "CogniteDiagramAnnotation", "v1") -class CogniteImage360AnnotationApply(CogniteImage360AnnotationProperties, CogniteAnnotationApply): - """This represents the writing format of Cognite image 360 annotation. +class CogniteDiagramAnnotationApply(_CogniteDiagramAnnotationProperties, CogniteAnnotationApply): + """This represents the writing format of Cognite diagram annotation. It is used to when data is written to CDF. + Annotation for diagrams Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 annotation. + external_id (str): The external id of the Cognite diagram annotation. type (DirectRelationReference | tuple[str, str]): The type of edge. start_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. end_node (DirectRelationReference | tuple[str, str]): Reference to the direct relation. The reference consists of a space and an external-id. @@ -5221,9 +5270,19 @@ class CogniteImage360AnnotationApply(CogniteImage360AnnotationProperties, Cognit source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match - polygon (list[float] | None): List of floats representing the polygon. Format depends on formatVersion - format_version (str | None): Specifies the storage representation for the polygon property + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation + start_node_page_number (int | None): The number of the page on which this annotation is located in `startNode` File. The first page has number 1 + end_node_page_number (int | None): The number of the page on which this annotation is located in the endNode File if an endNode is present. The first page has number 1 + start_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than startNodeXMax + start_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than startNodeXMin + start_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than startNodeYMax + start_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than startNodeYMin + start_node_text (str | None): The text extracted from within the bounding box on the startNode + end_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than endNodeXMax. Only applicable if an endNode is defined + end_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than endNodeXMin. Only applicable if an endNode is defined + end_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than endNodeYMax. Only applicable if an endNode is defined + end_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than endNodeYMin. Only applicable if an endNode is defined + end_node_text (str | None): The text extracted from within the bounding box on the endNode. Only applicable if an endNode is defined existing_version (int | None): Fail the ingestion request if the edge's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the edge (for the specified container or edge). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. """ @@ -5248,8 +5307,18 @@ def __init__( source_updated_user: str | None = None, confidence: float | None = None, status: Literal["Approved", "Rejected", "Suggested"] | None = None, - polygon: list[float] | None = None, - format_version: str | None = None, + start_node_page_number: int | None = None, + end_node_page_number: int | None = None, + start_node_x_min: float | None = None, + start_node_x_max: float | None = None, + start_node_y_min: float | None = None, + start_node_y_max: float | None = None, + start_node_text: str | None = None, + end_node_x_min: float | None = None, + end_node_x_max: float | None = None, + end_node_y_min: float | None = None, + end_node_y_max: float | None = None, + end_node_text: str | None = None, existing_version: int | None = None, ) -> None: super().__init__( @@ -5273,18 +5342,29 @@ def __init__( status=status, existing_version=existing_version, ) - self.polygon = polygon - self.format_version = format_version + self.start_node_page_number = start_node_page_number + self.end_node_page_number = end_node_page_number + self.start_node_x_min = start_node_x_min + self.start_node_x_max = start_node_x_max + self.start_node_y_min = start_node_y_min + self.start_node_y_max = start_node_y_max + self.start_node_text = start_node_text + self.end_node_x_min = end_node_x_min + self.end_node_x_max = end_node_x_max + self.end_node_y_min = end_node_y_min + self.end_node_y_max = end_node_y_max + self.end_node_text = end_node_text -class CogniteImage360Annotation(CogniteImage360AnnotationProperties, CogniteAnnotation): - """This represents the reading format of Cognite image 360 annotation. +class CogniteDiagramAnnotation(_CogniteDiagramAnnotationProperties, CogniteAnnotation): + """This represents the reading format of Cognite diagram annotation. It is used to when data is read from CDF. + Annotation for diagrams Args: space (str): The space where the node is located. - external_id (str): The external id of the Cognite image 360 annotation. + external_id (str): The external id of the Cognite diagram annotation. type (DirectRelationReference): The type of edge. start_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. end_node (DirectRelationReference): Reference to the direct relation. The reference consists of a space and an external-id. @@ -5303,9 +5383,19 @@ class CogniteImage360Annotation(CogniteImage360AnnotationProperties, CogniteAnno source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF confidence (float | None): The confidence that the annotation is a good match - status (Literal["Approved", "Rejected", "Suggested"] | None): The confidence that the annotation is a good match - polygon (list[float] | None): List of floats representing the polygon. Format depends on formatVersion - format_version (str | None): Specifies the storage representation for the polygon property + status (Literal["Approved", "Rejected", "Suggested"] | None): The status of the annotation + start_node_page_number (int | None): The number of the page on which this annotation is located in `startNode` File. The first page has number 1 + end_node_page_number (int | None): The number of the page on which this annotation is located in the endNode File if an endNode is present. The first page has number 1 + start_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than startNodeXMax + start_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than startNodeXMin + start_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than startNodeYMax + start_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than startNodeYMin + start_node_text (str | None): The text extracted from within the bounding box on the startNode + end_node_x_min (float | None): Value between [0,1]. Minimum abscissa of the bounding box (left edge). Must be strictly less than endNodeXMax. Only applicable if an endNode is defined + end_node_x_max (float | None): Value between [0,1]. Maximum abscissa of the bounding box (right edge). Must be strictly more than endNodeXMin. Only applicable if an endNode is defined + end_node_y_min (float | None): Value between [0,1]. Minimum ordinate of the bounding box (bottom edge). Must be strictly less than endNodeYMax. Only applicable if an endNode is defined + end_node_y_max (float | None): Value between [0,1]. Maximum ordinate of the bounding box (top edge). Must be strictly more than endNodeYMin. Only applicable if an endNode is defined + end_node_text (str | None): The text extracted from within the bounding box on the endNode. Only applicable if an endNode is defined deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results """ @@ -5333,8 +5423,18 @@ def __init__( source_updated_user: str | None = None, confidence: float | None = None, status: Literal["Approved", "Rejected", "Suggested"] | None = None, - polygon: list[float] | None = None, - format_version: str | None = None, + start_node_page_number: int | None = None, + end_node_page_number: int | None = None, + start_node_x_min: float | None = None, + start_node_x_max: float | None = None, + start_node_y_min: float | None = None, + start_node_y_max: float | None = None, + start_node_text: str | None = None, + end_node_x_min: float | None = None, + end_node_x_max: float | None = None, + end_node_y_min: float | None = None, + end_node_y_max: float | None = None, + end_node_text: str | None = None, deleted_time: int | None = None, ) -> None: super().__init__( @@ -5361,11 +5461,21 @@ def __init__( status=status, deleted_time=deleted_time, ) - self.polygon = polygon - self.format_version = format_version + self.start_node_page_number = start_node_page_number + self.end_node_page_number = end_node_page_number + self.start_node_x_min = start_node_x_min + self.start_node_x_max = start_node_x_max + self.start_node_y_min = start_node_y_min + self.start_node_y_max = start_node_y_max + self.start_node_text = start_node_text + self.end_node_x_min = end_node_x_min + self.end_node_x_max = end_node_x_max + self.end_node_y_min = end_node_y_min + self.end_node_y_max = end_node_y_max + self.end_node_text = end_node_text - def as_write(self) -> CogniteImage360AnnotationApply: - return CogniteImage360AnnotationApply( + def as_write(self) -> CogniteDiagramAnnotationApply: + return CogniteDiagramAnnotationApply( self.space, self.external_id, self.type, @@ -5384,7 +5494,17 @@ def as_write(self) -> CogniteImage360AnnotationApply: source_updated_user=self.source_updated_user, confidence=self.confidence, status=self.status, - polygon=self.polygon, - format_version=self.format_version, + start_node_page_number=self.start_node_page_number, + end_node_page_number=self.end_node_page_number, + start_node_x_min=self.start_node_x_min, + start_node_x_max=self.start_node_x_max, + start_node_y_min=self.start_node_y_min, + start_node_y_max=self.start_node_y_max, + start_node_text=self.start_node_text, + end_node_x_min=self.end_node_x_min, + end_node_x_max=self.end_node_x_max, + end_node_y_min=self.end_node_y_min, + end_node_y_max=self.end_node_y_max, + end_node_text=self.end_node_text, existing_version=self.version, ) diff --git a/cognite/client/data_classes/data_modeling/data_models.py b/cognite/client/data_classes/data_modeling/data_models.py index a37e673e2..bd5ba3f83 100644 --- a/cognite/client/data_classes/data_modeling/data_models.py +++ b/cognite/client/data_classes/data_modeling/data_models.py @@ -2,7 +2,7 @@ from abc import ABC from operator import attrgetter -from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, Generic, Literal, Sequence, TypeVar, Union, cast from typing_extensions import Self @@ -55,7 +55,7 @@ class DataModelApply(DataModelCore): version (str): DMS version. description (str | None): Textual description of the data model name (str | None): Human readable name for the data model. - views (list[ViewId | ViewApply] | None): List of views included in this data model. + views (Sequence[ViewId | ViewApply] | None): List of views included in this data model. """ def __init__( @@ -65,7 +65,7 @@ def __init__( version: str, description: str | None = None, name: str | None = None, - views: list[ViewId | ViewApply] | None = None, + views: Sequence[ViewId | ViewApply] | None = None, ) -> None: validate_data_modeling_identifier(space, external_id) super().__init__(space, external_id, version, description, name) diff --git a/cognite/client/data_classes/data_modeling/extractor_extensions/__init__.py b/cognite/client/data_classes/data_modeling/extractor_extensions/__init__.py new file mode 100644 index 000000000..d30eef205 --- /dev/null +++ b/cognite/client/data_classes/data_modeling/extractor_extensions/__init__.py @@ -0,0 +1,5 @@ +from __future__ import annotations + +from cognite.client.utils._experimental import FeaturePreviewWarning + +FeaturePreviewWarning("alpha", "alpha", "Extractor Extension Model").warn() diff --git a/cognite/client/data_classes/data_modeling/extractor_extensions/v1.py b/cognite/client/data_classes/data_modeling/extractor_extensions/v1.py new file mode 100644 index 000000000..e8f5b4beb --- /dev/null +++ b/cognite/client/data_classes/data_modeling/extractor_extensions/v1.py @@ -0,0 +1,533 @@ +from __future__ import annotations + +from datetime import datetime +from typing import Literal + +from cognite.client.data_classes.data_modeling import DirectRelationReference +from cognite.client.data_classes.data_modeling.cdm.v1 import ( + CogniteFile, + CogniteFileApply, + CogniteTimeSeries, + CogniteTimeSeriesApply, +) +from cognite.client.data_classes.data_modeling.ids import ViewId +from cognite.client.data_classes.data_modeling.typed_instances import ( + PropertyOptions, + TypedNode, + TypedNodeApply, +) + + +class _CogniteExtractorDataProperties: + extracted_data = PropertyOptions("extractedData") + + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_extraction_extensions", "CogniteExtractorData", "v1") + + +class CogniteExtractorDataApply(_CogniteExtractorDataProperties, TypedNodeApply): + """This represents the writing format of Cognite extractor datum. + + It is used to when data is written to CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor datum. + extracted_data (dict | None): Unstructured information extracted from source system + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + extracted_data: dict | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + TypedNodeApply.__init__(self, space, external_id, existing_version, None, type) + self.extracted_data = extracted_data + + +class CogniteExtractorData(_CogniteExtractorDataProperties, TypedNode): + """This represents the reading format of Cognite extractor datum. + + It is used to when data is read from CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor datum. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + extracted_data (dict | None): Unstructured information extracted from source system + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + extracted_data: dict | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + TypedNode.__init__(self, space, external_id, version, last_updated_time, created_time, deleted_time, None, type) + self.extracted_data = extracted_data + + def as_write(self) -> CogniteExtractorDataApply: + return CogniteExtractorDataApply( + self.space, + self.external_id, + extracted_data=self.extracted_data, + existing_version=self.version, + type=self.type, + ) + + +class _CogniteExtractorFileProperties: + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_extraction_extensions", "CogniteExtractorFile", "v1") + + +class CogniteExtractorFileApply(_CogniteExtractorFileProperties, CogniteFileApply, CogniteExtractorDataApply): + """This represents the writing format of Cognite extractor file. + + It is used to when data is written to CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor file. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + assets (list[DirectRelationReference | tuple[str, str]] | None): List of assets this file relates to + mime_type (str | None): MIME type of the file + directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) + is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion + uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available + category (DirectRelationReference | tuple[str, str] | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file + extracted_data (dict | None): Unstructured information extracted from source system + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | tuple[str, str] | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + assets: list[DirectRelationReference | tuple[str, str]] | None = None, + mime_type: str | None = None, + directory: str | None = None, + is_uploaded: bool | None = None, + uploaded_time: datetime | None = None, + category: DirectRelationReference | tuple[str, str] | None = None, + extracted_data: dict | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + CogniteFileApply.__init__( + self, + space, + external_id, + name=name, + description=description, + tags=tags, + aliases=aliases, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + assets=assets, + mime_type=mime_type, + directory=directory, + is_uploaded=is_uploaded, + uploaded_time=uploaded_time, + category=category, + existing_version=existing_version, + type=type, + ) + CogniteExtractorDataApply.__init__( + self, space, external_id, extracted_data=extracted_data, existing_version=existing_version, type=type + ) + + +class CogniteExtractorFile(_CogniteExtractorFileProperties, CogniteFile, CogniteExtractorData): + """This represents the reading format of Cognite extractor file. + + It is used to when data is read from CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor file. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + assets (list[DirectRelationReference] | None): List of assets this file relates to + mime_type (str | None): MIME type of the file + directory (str | None): Contains the path elements from the source (for when the source system has a file system hierarchy or similar) + is_uploaded (bool | None): Whether the file content has been uploaded to Cognite Data Fusion + uploaded_time (datetime | None): Point in time when the file upload was completed and the file was made available + category (DirectRelationReference | None): Direct relation to an instance of CogniteFileCategory representing the detected categorization/class for the file + extracted_data (dict | None): Unstructured information extracted from source system + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + assets: list[DirectRelationReference] | None = None, + mime_type: str | None = None, + directory: str | None = None, + is_uploaded: bool | None = None, + uploaded_time: datetime | None = None, + category: DirectRelationReference | None = None, + extracted_data: dict | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + CogniteFile.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + name=name, + description=description, + tags=tags, + aliases=aliases, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + assets=assets, + mime_type=mime_type, + directory=directory, + is_uploaded=is_uploaded, + uploaded_time=uploaded_time, + category=category, + type=type, + deleted_time=deleted_time, + ) + CogniteExtractorData.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + extracted_data=extracted_data, + type=type, + deleted_time=deleted_time, + ) + + def as_write(self) -> CogniteExtractorFileApply: + return CogniteExtractorFileApply( + self.space, + self.external_id, + name=self.name, + description=self.description, + tags=self.tags, + aliases=self.aliases, + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, + assets=self.assets, # type: ignore[arg-type] + mime_type=self.mime_type, + directory=self.directory, + is_uploaded=self.is_uploaded, + uploaded_time=self.uploaded_time, + category=self.category, + extracted_data=self.extracted_data, + existing_version=self.version, + type=self.type, + ) + + +class _CogniteExtractorTimeSeriesProperties: + @classmethod + def get_source(cls) -> ViewId: + return ViewId("cdf_extraction_extensions", "CogniteExtractorTimeSeries", "v1") + + +class CogniteExtractorTimeSeriesApply( + _CogniteExtractorTimeSeriesProperties, CogniteTimeSeriesApply, CogniteExtractorDataApply +): + """This represents the writing format of Cognite extractor time series. + + It is used to when data is written to CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor time series. + is_step (bool): Defines whether the time series is a step series or not. + type_ (Literal["numeric", "string"]): Defines data type of the data points. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | tuple[str, str] | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_unit (str | None): Unit as specified in the source system + unit (DirectRelationReference | tuple[str, str] | None): direct relation to the unit of the time series + assets (list[DirectRelationReference | tuple[str, str]] | None): The asset field. + equipment (list[DirectRelationReference | tuple[str, str]] | None): The equipment field. + extracted_data (dict | None): Unstructured information extracted from source system + existing_version (int | None): Fail the ingestion request if the node's version is greater than or equal to this value. If no existingVersion is specified, the ingestion will always overwrite any existing data for the node (for the specified container or node). If existingVersion is set to 0, the upsert will behave as an insert, so it will fail the bulk if the item already exists. If skipOnVersionConflict is set on the ingestion request, then the item will be skipped instead of failing the ingestion request. + type (DirectRelationReference | tuple[str, str] | None): Direct relation pointing to the type node. + """ + + def __init__( + self, + space: str, + external_id: str, + *, + is_step: bool, + type_: Literal["numeric", "string"], + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | tuple[str, str] | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + source_unit: str | None = None, + unit: DirectRelationReference | tuple[str, str] | None = None, + assets: list[DirectRelationReference | tuple[str, str]] | None = None, + equipment: list[DirectRelationReference | tuple[str, str]] | None = None, + extracted_data: dict | None = None, + existing_version: int | None = None, + type: DirectRelationReference | tuple[str, str] | None = None, + ) -> None: + CogniteTimeSeriesApply.__init__( + self, + space, + external_id, + name=name, + description=description, + tags=tags, + aliases=aliases, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + is_step=is_step, + type_=type_, + source_unit=source_unit, + unit=unit, + assets=assets, + equipment=equipment, + existing_version=existing_version, + type=type, + ) + CogniteExtractorDataApply.__init__( + self, space, external_id, extracted_data=extracted_data, existing_version=existing_version, type=type + ) + + +class CogniteExtractorTimeSeries(_CogniteExtractorTimeSeriesProperties, CogniteTimeSeries, CogniteExtractorData): + """This represents the reading format of Cognite extractor time series. + + It is used to when data is read from CDF. + + Args: + space (str): The space where the node is located. + external_id (str): The external id of the Cognite extractor time series. + version (int): DMS version. + last_updated_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + created_time (int): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. + is_step (bool): Defines whether the time series is a step series or not. + type_ (Literal["numeric", "string"]): Defines data type of the data points. + name (str | None): Name of the instance + description (str | None): Description of the instance + tags (list[str] | None): Text based labels for generic use, limited to 1000 + aliases (list[str] | None): Alternative names for the node + source_id (str | None): Identifier from the source system + source_context (str | None): Context of the source id. For systems where the sourceId is globally unique, the sourceContext is expected to not be set. + source (DirectRelationReference | None): Direct relation to a source system + source_created_time (datetime | None): When the instance was created in source system (if available) + source_updated_time (datetime | None): When the instance was last updated in the source system (if available) + source_created_user (str | None): User identifier from the source system on who created the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_updated_user (str | None): User identifier from the source system on who last updated the source data. This identifier is not guaranteed to match the user identifiers in CDF + source_unit (str | None): Unit as specified in the source system + unit (DirectRelationReference | None): direct relation to the unit of the time series + assets (list[DirectRelationReference] | None): The asset field. + equipment (list[DirectRelationReference] | None): The equipment field. + extracted_data (dict | None): Unstructured information extracted from source system + type (DirectRelationReference | None): Direct relation pointing to the type node. + deleted_time (int | None): The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds. Timestamp when the instance was soft deleted. Note that deleted instances are filtered out of query results, but present in sync results + """ + + def __init__( + self, + space: str, + external_id: str, + version: int, + last_updated_time: int, + created_time: int, + *, + is_step: bool, + type_: Literal["numeric", "string"], + name: str | None = None, + description: str | None = None, + tags: list[str] | None = None, + aliases: list[str] | None = None, + source_id: str | None = None, + source_context: str | None = None, + source: DirectRelationReference | None = None, + source_created_time: datetime | None = None, + source_updated_time: datetime | None = None, + source_created_user: str | None = None, + source_updated_user: str | None = None, + source_unit: str | None = None, + unit: DirectRelationReference | None = None, + assets: list[DirectRelationReference] | None = None, + equipment: list[DirectRelationReference] | None = None, + extracted_data: dict | None = None, + type: DirectRelationReference | None = None, + deleted_time: int | None = None, + ) -> None: + CogniteTimeSeries.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + name=name, + description=description, + tags=tags, + aliases=aliases, + source_id=source_id, + source_context=source_context, + source=source, + source_created_time=source_created_time, + source_updated_time=source_updated_time, + source_created_user=source_created_user, + source_updated_user=source_updated_user, + is_step=is_step, + type_=type_, + source_unit=source_unit, + unit=unit, + assets=assets, + equipment=equipment, + type=type, + deleted_time=deleted_time, + ) + CogniteExtractorData.__init__( + self, + space, + external_id, + version, + last_updated_time, + created_time, + extracted_data=extracted_data, + type=type, + deleted_time=deleted_time, + ) + + def as_write(self) -> CogniteExtractorTimeSeriesApply: + return CogniteExtractorTimeSeriesApply( + self.space, + self.external_id, + is_step=self.is_step, + type_=self.type_, + name=self.name, + description=self.description, + tags=self.tags, + aliases=self.aliases, + source_id=self.source_id, + source_context=self.source_context, + source=self.source, + source_created_time=self.source_created_time, + source_updated_time=self.source_updated_time, + source_created_user=self.source_created_user, + source_updated_user=self.source_updated_user, + source_unit=self.source_unit, + unit=self.unit, + assets=self.assets, # type: ignore[arg-type] + equipment=self.equipment, # type: ignore[arg-type] + extracted_data=self.extracted_data, + existing_version=self.version, + type=self.type, + ) diff --git a/cognite/client/data_classes/datapoints.py b/cognite/client/data_classes/datapoints.py index 29dfbf661..54bdaf9b2 100644 --- a/cognite/client/data_classes/datapoints.py +++ b/cognite/client/data_classes/datapoints.py @@ -555,9 +555,7 @@ def _ts_info(self) -> dict[str, Any]: return { "id": self.id, "external_id": self.external_id, - "instance_id": self.instance_id.dump(camel_case=False, include_instance_type=False) - if self.instance_id - else None, + "instance_id": self.instance_id, "is_string": self.is_string, "is_step": self.is_step, "unit": self.unit, @@ -777,6 +775,8 @@ def dump(self, camel_case: bool = True, convert_timestamps: bool = False) -> dic dumped = self._ts_info if self.timezone is not None: dumped["timezone"] = str(self.timezone) + if self.instance_id: + dumped["instance_id"] = self.instance_id.dump(camel_case=camel_case, include_instance_type=False) datapoints = [dict(zip(attrs, map(numpy_dtype_fix, row))) for row in zip(*arrays)] if self.status_code is not None or self.status_symbol is not None: @@ -1237,6 +1237,7 @@ def _slice(self, slice: slice) -> Datapoints: truncated_datapoints = Datapoints( id=self.id, external_id=self.external_id, + instance_id=self.instance_id, is_string=self.is_string, is_step=self.is_step, unit=self.unit, diff --git a/cognite/client/data_classes/workflows.py b/cognite/client/data_classes/workflows.py index 2e18f9a7f..90410888f 100644 --- a/cognite/client/data_classes/workflows.py +++ b/cognite/client/data_classes/workflows.py @@ -13,10 +13,11 @@ CogniteResource, CogniteResourceList, ExternalIDTransformerMixin, + UnknownCogniteObject, WriteableCogniteResource, WriteableCogniteResourceList, ) -from cognite.client.utils._text import to_snake_case +from cognite.client.utils._text import convert_all_keys_to_camel_case, to_snake_case if TYPE_CHECKING: from cognite.client import CogniteClient @@ -1175,3 +1176,245 @@ def load(cls, resource: Any, cognite_client: CogniteClient | None = None) -> Wor def dump(self, camel_case: bool = True, as_external_id: bool = False) -> list[dict[str, Any]]: return [workflow_id.dump(camel_case, as_external_id_key=as_external_id) for workflow_id in self.data] + + +class WorkflowTriggerRule(CogniteObject, ABC): + """This is the base class for all workflow trigger rules.""" + + _trigger_type: ClassVar[str] + + def __init__(self) -> None: + self.trigger_type = self._trigger_type + + @classmethod + def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> Self: + trigger_type = resource["triggerType"] + if trigger_type in _TRIGGER_RULE_BY_TYPE: + return cast(Self, _TRIGGER_RULE_BY_TYPE[trigger_type]._load_trigger(resource)) + # If more triggers are added in the future, this ensures that the SDK does not break. + return cast(Self, UnknownCogniteObject(resource)) + + @classmethod + @abstractmethod + def _load_trigger(cls, data: dict) -> Self: + raise NotImplementedError() + + +class WorkflowScheduledTriggerRule(WorkflowTriggerRule): + """ + This class represents a scheduled trigger rule. + + Args: + cron_expression(str | None): The cron specification for the scheduled trigger. + """ + + _trigger_type = "schedule" + + def __init__(self, cron_expression: str | None = None) -> None: + super().__init__() + self.cron_expression = cron_expression + + @classmethod + def _load_trigger(cls, data: dict) -> WorkflowScheduledTriggerRule: + return cls(cron_expression=data.get("cronExpression")) + + +_TRIGGER_RULE_BY_TYPE: dict[str, type[WorkflowTriggerRule]] = { + subclass._trigger_type: subclass # type: ignore + for subclass in WorkflowTriggerRule.__subclasses__() +} + + +class WorkflowTriggerCore(WriteableCogniteResource["WorkflowTriggerCreate"], ABC): + """ + This class represents a base class for a workflow trigger. + + Args: + external_id (str): The external ID provided by the client. Must be unique for the resource type. + trigger_rule (WorkflowTriggerRule): The trigger rule of the workflow version trigger. + workflow_external_id (str): The external ID of the workflow. + workflow_version (str): The version of the workflow. + input (dict | None): The input data of the workflow version trigger. Defaults to None. + """ + + def __init__( + self, + external_id: str, + trigger_rule: WorkflowTriggerRule, + workflow_external_id: str, + workflow_version: str, + input: dict | None = None, + ) -> None: + self.external_id = external_id + self.trigger_rule = trigger_rule + self.workflow_external_id = workflow_external_id + self.workflow_version = workflow_version + self.input = input + + +class WorkflowTriggerCreate(WorkflowTriggerCore): + """ + This class represents a workflow trigger for creation. + + Args: + external_id (str): The external ID provided by the client. Must be unique for the resource type. + trigger_rule (WorkflowTriggerRule): The trigger rule of the workflow version trigger. + workflow_external_id (str): The external ID of the workflow. + workflow_version (str): The version of the workflow. + input (dict | None): The input data of the workflow version trigger. Defaults to None. + """ + + def dump(self, camel_case: bool = True) -> dict[str, Any]: + item: dict[str, Any] = { + "external_id": self.external_id, + "trigger_rule": self.trigger_rule.dump(camel_case=camel_case), + "workflow_external_id": self.workflow_external_id, + "workflow_version": self.workflow_version, + } + if self.input: + item["input"] = self.input + if camel_case: + return convert_all_keys_to_camel_case(item) + return item + + @classmethod + def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> WorkflowTriggerCreate: + return cls( + external_id=resource["externalId"], + workflow_external_id=resource["workflowExternalId"], + workflow_version=resource["workflowVersion"], + trigger_rule=WorkflowTriggerRule._load(resource["triggerRule"]), + input=resource.get("input"), + ) + + def as_write(self) -> WorkflowTriggerCreate: + """Returns this workflow trigger create instance.""" + return self + + +class WorkflowTrigger(WorkflowTriggerCore): + """ + This class represents a workflow trigger. + + Args: + external_id (str): The external ID provided by the client. Must be unique for the resource type. + trigger_rule (WorkflowTriggerRule): The trigger rule of the workflow version trigger. + workflow_external_id (str): The external ID of the workflow. + workflow_version (str): The version of the workflow. + input (dict | None): The input data passed to the workflow when an execution is started. Defaults to None. + created_time (int | None): The time when the workflow version trigger was created. Unix timestamp in milliseconds. Defaults to None. + last_updated_time (int | None): The time when the workflow version trigger was last updated. Unix timestamp in milliseconds. Defaults to None. + """ + + def __init__( + self, + external_id: str, + trigger_rule: WorkflowTriggerRule, + workflow_external_id: str, + workflow_version: str, + input: dict | None = None, + created_time: int | None = None, + last_updated_time: int | None = None, + ) -> None: + super().__init__( + external_id=external_id, + trigger_rule=trigger_rule, + workflow_external_id=workflow_external_id, + workflow_version=workflow_version, + input=input, + ) + self.created_time = created_time + self.last_updated_time = last_updated_time + + def dump(self, camel_case: bool = True) -> dict[str, Any]: + item: dict[str, Any] = { + "external_id": self.external_id, + "trigger_rule": self.trigger_rule.dump(camel_case=camel_case), + "workflow_external_id": self.workflow_external_id, + "workflow_version": self.workflow_version, + } + if self.input: + item["input"] = self.input + if self.created_time: + item["created_time"] = self.created_time + if self.last_updated_time: + item["last_updated_time"] = self.last_updated_time + if camel_case: + return convert_all_keys_to_camel_case(item) + return item + + @classmethod + def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> WorkflowTrigger: + return cls( + external_id=resource["externalId"], + workflow_external_id=resource["workflowExternalId"], + workflow_version=resource["workflowVersion"], + trigger_rule=WorkflowTriggerRule._load(resource["triggerRule"]), + input=resource.get("input"), + created_time=resource.get("createdTime"), + last_updated_time=resource.get("lastUpdatedTime"), + ) + + def as_write(self) -> WorkflowTriggerCreate: + """Returns this workflow trigger instance.""" + return WorkflowTriggerCreate( + external_id=self.external_id, + trigger_rule=self.trigger_rule, + workflow_external_id=self.workflow_external_id, + workflow_version=self.workflow_version, + input=self.input, + ) + + +class WorkflowTriggerList(CogniteResourceList[WorkflowTrigger]): + """ + This class represents a list of workflow triggers. + """ + + _RESOURCE = WorkflowTrigger + + +class WorkflowTriggerRun(CogniteResource): + """ + This class represents a workflow trigger run. + """ + + def __init__( + self, + trigger_external_id: str, + trigger_fire_time: int, + workflow_external_id: str, + workflow_version: str, + ) -> None: + self.trigger_external_id = trigger_external_id + self.trigger_fire_time = trigger_fire_time + self.workflow_external_id = workflow_external_id + self.workflow_version = workflow_version + + def dump(self, camel_case: bool = True) -> dict[str, Any]: + item = { + "trigger_external_id": self.trigger_external_id, + "trigger_fire_time": self.trigger_fire_time, + "workflow_external_id": self.workflow_external_id, + "workflow_version": self.workflow_version, + } + if camel_case: + return convert_all_keys_to_camel_case(item) + return item + + @classmethod + def _load(cls, resource: dict, cognite_client: CogniteClient | None = None) -> WorkflowTriggerRun: + return cls( + trigger_external_id=resource["triggerExternalId"], + trigger_fire_time=resource["triggerFireTime"], + workflow_external_id=resource["workflowExternalId"], + workflow_version=resource["workflowVersion"], + ) + + +class WorkflowTriggerRunList(CogniteResourceList[WorkflowTriggerRun]): + """ + This class represents a list of workflow trigger runs. + """ + + _RESOURCE = WorkflowTriggerRun diff --git a/cognite/client/testing.py b/cognite/client/testing.py index f8a2204e5..bfc3f8593 100644 --- a/cognite/client/testing.py +++ b/cognite/client/testing.py @@ -60,7 +60,13 @@ from cognite.client._api.units import UnitAPI, UnitSystemAPI from cognite.client._api.user_profiles import UserProfilesAPI from cognite.client._api.vision import VisionAPI -from cognite.client._api.workflows import WorkflowAPI, WorkflowExecutionAPI, WorkflowTaskAPI, WorkflowVersionAPI +from cognite.client._api.workflows import ( + WorkflowAPI, + WorkflowExecutionAPI, + WorkflowTaskAPI, + WorkflowTriggerAPI, + WorkflowVersionAPI, +) class CogniteClientMock(MagicMock): @@ -159,6 +165,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.workflows.versions = MagicMock(spec_set=WorkflowVersionAPI) self.workflows.executions = MagicMock(spec_set=WorkflowExecutionAPI) self.workflows.tasks = MagicMock(spec_set=WorkflowTaskAPI) + self.workflows.triggers = MagicMock(spec_set=WorkflowTriggerAPI) self.units = MagicMock(spec=UnitAPI) self.units.systems = MagicMock(spec_set=UnitSystemAPI) diff --git a/docs/source/workflow_orchestration.rst b/docs/source/workflow_orchestration.rst index aaba2cb20..002395270 100644 --- a/docs/source/workflow_orchestration.rst +++ b/docs/source/workflow_orchestration.rst @@ -49,6 +49,10 @@ Retrieve Detailed Workflow Execution ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automethod:: cognite.client._api.workflows.WorkflowExecutionAPI.retrieve_detailed +Run Workflow Execution +^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. automethod:: cognite.client._api.workflows.WorkflowExecutionAPI.run + Trigger Workflow Execution ^^^^^^^^^^^^^^^^^^^^^^^^^^ .. automethod:: cognite.client._api.workflows.WorkflowExecutionAPI.trigger diff --git a/poetry.lock b/poetry.lock index 3807c5de4..43f6bc5e2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "alabaster" @@ -760,13 +760,13 @@ license = ["ukkonen"] [[package]] name = "idna" -version = "3.7" +version = "3.8" description = "Internationalized Domain Names in Applications (IDNA)" optional = false -python-versions = ">=3.5" +python-versions = ">=3.6" files = [ - {file = "idna-3.7-py3-none-any.whl", hash = "sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0"}, - {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, + {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, + {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, ] [[package]] @@ -782,13 +782,13 @@ files = [ [[package]] name = "importlib-metadata" -version = "8.2.0" +version = "8.4.0" description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_metadata-8.2.0-py3-none-any.whl", hash = "sha256:11901fa0c2f97919b288679932bb64febaeacf289d18ac84dd68cb2e74213369"}, - {file = "importlib_metadata-8.2.0.tar.gz", hash = "sha256:72e8d4399996132204f9a16dcc751af254a48f8d1b20b9ff0f98d4a8f901e73d"}, + {file = "importlib_metadata-8.4.0-py3-none-any.whl", hash = "sha256:66f342cc6ac9818fc6ff340576acd24d65ba0b3efabb2b4ac08b598965a4a2f1"}, + {file = "importlib_metadata-8.4.0.tar.gz", hash = "sha256:9a547d3bc3608b025f93d403fdd1aae741c24fbb8314df4b155675742ce303c5"}, ] [package.dependencies] @@ -801,21 +801,25 @@ test = ["flufl.flake8", "importlib-resources (>=1.3)", "jaraco.test (>=5.4)", "p [[package]] name = "importlib-resources" -version = "6.4.0" +version = "6.4.4" description = "Read resources from Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "importlib_resources-6.4.0-py3-none-any.whl", hash = "sha256:50d10f043df931902d4194ea07ec57960f66a80449ff867bfe782b4c486ba78c"}, - {file = "importlib_resources-6.4.0.tar.gz", hash = "sha256:cdb2b453b8046ca4e3798eb1d84f3cce1446a0e8e7b5ef4efb600f19fc398145"}, + {file = "importlib_resources-6.4.4-py3-none-any.whl", hash = "sha256:dda242603d1c9cd836c3368b1174ed74cb4049ecd209e7a1a0104620c18c5c11"}, + {file = "importlib_resources-6.4.4.tar.gz", hash = "sha256:20600c8b7361938dc0bb2d5ec0297802e575df486f5a544fa414da65e13721f7"}, ] [package.dependencies] zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["jaraco.test (>=5.4)", "pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)", "zipp (>=3.17)"] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +cover = ["pytest-cov"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["jaraco.test (>=5.4)", "pytest (>=6,!=8.1.*)", "zipp (>=3.17)"] +type = ["pytest-mypy"] [[package]] name = "iniconfig" @@ -887,21 +891,21 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-ena [[package]] name = "jaraco-context" -version = "5.3.0" +version = "6.0.1" description = "Useful decorators and context managers" optional = false python-versions = ">=3.8" files = [ - {file = "jaraco.context-5.3.0-py3-none-any.whl", hash = "sha256:3e16388f7da43d384a1a7cd3452e72e14732ac9fe459678773a3608a812bf266"}, - {file = "jaraco.context-5.3.0.tar.gz", hash = "sha256:c2f67165ce1f9be20f32f650f25d8edfc1646a8aeee48ae06fb35f90763576d2"}, + {file = "jaraco.context-6.0.1-py3-none-any.whl", hash = "sha256:f797fc481b490edb305122c9181830a3a5b76d84ef6d1aef2fb9b47ab956f9e4"}, + {file = "jaraco_context-6.0.1.tar.gz", hash = "sha256:9bae4ea555cf0b14938dc0aee7c9f32ed303aa20a3b73e7dc80111628792d1b3"}, ] [package.dependencies] "backports.tarfile" = {version = "*", markers = "python_version < \"3.12\""} [package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["portend", "pytest (>=6,!=8.1.1)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +test = ["portend", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)"] [[package]] name = "jaraco-functools" @@ -1176,38 +1180,38 @@ broker = ["pymsalruntime (>=0.13.2,<0.17)"] [[package]] name = "mypy" -version = "1.11.1" +version = "1.11.2" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c"}, - {file = "mypy-1.11.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411"}, - {file = "mypy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03"}, - {file = "mypy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4"}, - {file = "mypy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5"}, - {file = "mypy-1.11.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca"}, - {file = "mypy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de"}, - {file = "mypy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809"}, - {file = "mypy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8"}, - {file = "mypy-1.11.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a"}, - {file = "mypy-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417"}, - {file = "mypy-1.11.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e"}, - {file = "mypy-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2"}, - {file = "mypy-1.11.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b"}, - {file = "mypy-1.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0"}, - {file = "mypy-1.11.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd"}, - {file = "mypy-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe"}, - {file = "mypy-1.11.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c"}, - {file = "mypy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69"}, - {file = "mypy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74"}, - {file = "mypy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b"}, - {file = "mypy-1.11.1-py3-none-any.whl", hash = "sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54"}, - {file = "mypy-1.11.1.tar.gz", hash = "sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d42a6dd818ffce7be66cce644f1dff482f1d97c53ca70908dff0b9ddc120b77a"}, + {file = "mypy-1.11.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:801780c56d1cdb896eacd5619a83e427ce436d86a3bdf9112527f24a66618fef"}, + {file = "mypy-1.11.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:41ea707d036a5307ac674ea172875f40c9d55c5394f888b168033177fce47383"}, + {file = "mypy-1.11.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6e658bd2d20565ea86da7d91331b0eed6d2eee22dc031579e6297f3e12c758c8"}, + {file = "mypy-1.11.2-cp310-cp310-win_amd64.whl", hash = "sha256:478db5f5036817fe45adb7332d927daa62417159d49783041338921dcf646fc7"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:75746e06d5fa1e91bfd5432448d00d34593b52e7e91a187d981d08d1f33d4385"}, + {file = "mypy-1.11.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a976775ab2256aadc6add633d44f100a2517d2388906ec4f13231fafbb0eccca"}, + {file = "mypy-1.11.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cd953f221ac1379050a8a646585a29574488974f79d8082cedef62744f0a0104"}, + {file = "mypy-1.11.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:57555a7715c0a34421013144a33d280e73c08df70f3a18a552938587ce9274f4"}, + {file = "mypy-1.11.2-cp311-cp311-win_amd64.whl", hash = "sha256:36383a4fcbad95f2657642a07ba22ff797de26277158f1cc7bd234821468b1b6"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:e8960dbbbf36906c5c0b7f4fbf2f0c7ffb20f4898e6a879fcf56a41a08b0d318"}, + {file = "mypy-1.11.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:06d26c277962f3fb50e13044674aa10553981ae514288cb7d0a738f495550b36"}, + {file = "mypy-1.11.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6e7184632d89d677973a14d00ae4d03214c8bc301ceefcdaf5c474866814c987"}, + {file = "mypy-1.11.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:3a66169b92452f72117e2da3a576087025449018afc2d8e9bfe5ffab865709ca"}, + {file = "mypy-1.11.2-cp312-cp312-win_amd64.whl", hash = "sha256:969ea3ef09617aff826885a22ece0ddef69d95852cdad2f60c8bb06bf1f71f70"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:37c7fa6121c1cdfcaac97ce3d3b5588e847aa79b580c1e922bb5d5d2902df19b"}, + {file = "mypy-1.11.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4a8a53bc3ffbd161b5b2a4fff2f0f1e23a33b0168f1c0778ec70e1a3d66deb86"}, + {file = "mypy-1.11.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2ff93107f01968ed834f4256bc1fc4475e2fecf6c661260066a985b52741ddce"}, + {file = "mypy-1.11.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:edb91dded4df17eae4537668b23f0ff6baf3707683734b6a818d5b9d0c0c31a1"}, + {file = "mypy-1.11.2-cp38-cp38-win_amd64.whl", hash = "sha256:ee23de8530d99b6db0573c4ef4bd8f39a2a6f9b60655bf7a1357e585a3486f2b"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:801ca29f43d5acce85f8e999b1e431fb479cb02d0e11deb7d2abb56bdaf24fd6"}, + {file = "mypy-1.11.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:af8d155170fcf87a2afb55b35dc1a0ac21df4431e7d96717621962e4b9192e70"}, + {file = "mypy-1.11.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f7821776e5c4286b6a13138cc935e2e9b6fde05e081bdebf5cdb2bb97c9df81d"}, + {file = "mypy-1.11.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:539c570477a96a4e6fb718b8d5c3e0c0eba1f485df13f86d2970c91f0673148d"}, + {file = "mypy-1.11.2-cp39-cp39-win_amd64.whl", hash = "sha256:3f14cd3d386ac4d05c5a39a51b84387403dadbd936e17cb35882134d4f8f0d24"}, + {file = "mypy-1.11.2-py3-none-any.whl", hash = "sha256:b499bc07dbdcd3de92b0a8b29fdf592c111276f6a12fe29c30f6c417dd546d12"}, + {file = "mypy-1.11.2.tar.gz", hash = "sha256:7f9993ad3e0ffdc95c2a14b66dee63729f021968bff8ad911867579c65d13a79"}, ] [package.dependencies] @@ -1668,22 +1672,22 @@ wcwidth = "*" [[package]] name = "protobuf" -version = "5.27.3" +version = "5.27.4" description = "" optional = false python-versions = ">=3.8" files = [ - {file = "protobuf-5.27.3-cp310-abi3-win32.whl", hash = "sha256:dcb307cd4ef8fec0cf52cb9105a03d06fbb5275ce6d84a6ae33bc6cf84e0a07b"}, - {file = "protobuf-5.27.3-cp310-abi3-win_amd64.whl", hash = "sha256:16ddf3f8c6c41e1e803da7abea17b1793a97ef079a912e42351eabb19b2cffe7"}, - {file = "protobuf-5.27.3-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:68248c60d53f6168f565a8c76dc58ba4fa2ade31c2d1ebdae6d80f969cdc2d4f"}, - {file = "protobuf-5.27.3-cp38-abi3-manylinux2014_aarch64.whl", hash = "sha256:b8a994fb3d1c11156e7d1e427186662b64694a62b55936b2b9348f0a7c6625ce"}, - {file = "protobuf-5.27.3-cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:a55c48f2a2092d8e213bd143474df33a6ae751b781dd1d1f4d953c128a415b25"}, - {file = "protobuf-5.27.3-cp38-cp38-win32.whl", hash = "sha256:043853dcb55cc262bf2e116215ad43fa0859caab79bb0b2d31b708f128ece035"}, - {file = "protobuf-5.27.3-cp38-cp38-win_amd64.whl", hash = "sha256:c2a105c24f08b1e53d6c7ffe69cb09d0031512f0b72f812dd4005b8112dbe91e"}, - {file = "protobuf-5.27.3-cp39-cp39-win32.whl", hash = "sha256:c84eee2c71ed83704f1afbf1a85c3171eab0fd1ade3b399b3fad0884cbcca8bf"}, - {file = "protobuf-5.27.3-cp39-cp39-win_amd64.whl", hash = "sha256:af7c0b7cfbbb649ad26132e53faa348580f844d9ca46fd3ec7ca48a1ea5db8a1"}, - {file = "protobuf-5.27.3-py3-none-any.whl", hash = "sha256:8572c6533e544ebf6899c360e91d6bcbbee2549251643d32c52cf8a5de295ba5"}, - {file = "protobuf-5.27.3.tar.gz", hash = "sha256:82460903e640f2b7e34ee81a947fdaad89de796d324bcbc38ff5430bcdead82c"}, + {file = "protobuf-5.27.4-cp310-abi3-win32.whl", hash = "sha256:10319748764b917a9a7cddef1582a0a9cd0f8f6d04e545c6236f7ccaf9b624d9"}, + {file = "protobuf-5.27.4-cp310-abi3-win_amd64.whl", hash = "sha256:f0c24374aaaf103f33662e4de7666a4a4280abebdb8a9f3f0f9b1d71b61174ec"}, + {file = "protobuf-5.27.4-cp38-abi3-macosx_10_9_universal2.whl", hash = "sha256:e85fed07013e5a0121efbaf1b14355fdc66f6e545f12fc5985b2882370410006"}, + {file = "protobuf-5.27.4-cp38-abi3-manylinux2014_aarch64.whl", hash = "sha256:d5a0e229061600842e57af4ff6a8522ede5280bcfa4fe7f3a1c20589377859a6"}, + {file = "protobuf-5.27.4-cp38-abi3-manylinux2014_x86_64.whl", hash = "sha256:25ba1f0633f73c3939f3b84e1636f3eb3bab7196952ebb83906d56945edd6aa8"}, + {file = "protobuf-5.27.4-cp38-cp38-win32.whl", hash = "sha256:565b051249a2f8270af04206dd4f3b73a02343e7d9e072aed57441b369b3467d"}, + {file = "protobuf-5.27.4-cp38-cp38-win_amd64.whl", hash = "sha256:e673f173cbac4e59c7817ed358e471e4c77aa9166986edf3e731156379a556c7"}, + {file = "protobuf-5.27.4-cp39-cp39-win32.whl", hash = "sha256:25169c7624d5a9e669fa6faff5a6e818f854346d51ee347b2284676beb9e85dd"}, + {file = "protobuf-5.27.4-cp39-cp39-win_amd64.whl", hash = "sha256:1fe7735902e84ce35c4152cf07981c176713935a8efad78cea547aae5f4f75cb"}, + {file = "protobuf-5.27.4-py3-none-any.whl", hash = "sha256:b97259641e8d38738eef34a173e51d2d53a453baab01a32477a64752d9ce59a3"}, + {file = "protobuf-5.27.4.tar.gz", hash = "sha256:eaa1016e353d8fc5bf08c8087e96eed15f5297aa52bb7ee1f533278bb3f3aad7"}, ] [[package]] @@ -1945,17 +1949,17 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments [[package]] name = "pytest-asyncio" -version = "0.23.8" +version = "0.24.0" description = "Pytest support for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"}, - {file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"}, + {file = "pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b"}, + {file = "pytest_asyncio-0.24.0.tar.gz", hash = "sha256:d081d828e576d85f875399194281e92bf8a68d60d72d1a2faf2feddb6c46b276"}, ] [package.dependencies] -pytest = ">=7.0.0,<9" +pytest = ">=8.2,<9" [package.extras] docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] @@ -2249,13 +2253,13 @@ idna2008 = ["idna"] [[package]] name = "rich" -version = "13.7.1" +version = "13.8.0" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.7.1-py3-none-any.whl", hash = "sha256:4edbae314f59eb482f54e9e30bf00d33350aaa94f4bfcd4e9e3110e64d0d7222"}, - {file = "rich-13.7.1.tar.gz", hash = "sha256:9be308cb1fe2f1f57d67ce99e95af38a1e2bc71ad9813b0e247cf7ffbcc3a432"}, + {file = "rich-13.8.0-py3-none-any.whl", hash = "sha256:2e85306a063b9492dffc86278197a60cbece75bcb766022f3436f567cae11bdc"}, + {file = "rich-13.8.0.tar.gz", hash = "sha256:a5ac1f1cd448ade0d59cc3356f7db7a7ccda2c8cbae9c7a90c28ff463d3e91f4"}, ] [package.dependencies] @@ -2283,47 +2287,53 @@ jeepney = ">=0.6" [[package]] name = "shapely" -version = "2.0.5" +version = "2.0.6" description = "Manipulation and analysis of geometric objects" optional = true python-versions = ">=3.7" files = [ - {file = "shapely-2.0.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:89d34787c44f77a7d37d55ae821f3a784fa33592b9d217a45053a93ade899375"}, - {file = "shapely-2.0.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:798090b426142df2c5258779c1d8d5734ec6942f778dab6c6c30cfe7f3bf64ff"}, - {file = "shapely-2.0.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45211276900c4790d6bfc6105cbf1030742da67594ea4161a9ce6812a6721e68"}, - {file = "shapely-2.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e119444bc27ca33e786772b81760f2028d930ac55dafe9bc50ef538b794a8e1"}, - {file = "shapely-2.0.5-cp310-cp310-win32.whl", hash = "sha256:9a4492a2b2ccbeaebf181e7310d2dfff4fdd505aef59d6cb0f217607cb042fb3"}, - {file = "shapely-2.0.5-cp310-cp310-win_amd64.whl", hash = "sha256:1e5cb5ee72f1bc7ace737c9ecd30dc174a5295fae412972d3879bac2e82c8fae"}, - {file = "shapely-2.0.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5bbfb048a74cf273db9091ff3155d373020852805a37dfc846ab71dde4be93ec"}, - {file = "shapely-2.0.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:93be600cbe2fbaa86c8eb70656369f2f7104cd231f0d6585c7d0aa555d6878b8"}, - {file = "shapely-2.0.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f8e71bb9a46814019f6644c4e2560a09d44b80100e46e371578f35eaaa9da1c"}, - {file = "shapely-2.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5251c28a29012e92de01d2e84f11637eb1d48184ee8f22e2df6c8c578d26760"}, - {file = "shapely-2.0.5-cp311-cp311-win32.whl", hash = "sha256:35110e80070d664781ec7955c7de557456b25727a0257b354830abb759bf8311"}, - {file = "shapely-2.0.5-cp311-cp311-win_amd64.whl", hash = "sha256:6c6b78c0007a34ce7144f98b7418800e0a6a5d9a762f2244b00ea560525290c9"}, - {file = "shapely-2.0.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:03bd7b5fa5deb44795cc0a503999d10ae9d8a22df54ae8d4a4cd2e8a93466195"}, - {file = "shapely-2.0.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2ff9521991ed9e201c2e923da014e766c1aa04771bc93e6fe97c27dcf0d40ace"}, - {file = "shapely-2.0.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b65365cfbf657604e50d15161ffcc68de5cdb22a601bbf7823540ab4918a98d"}, - {file = "shapely-2.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:21f64e647a025b61b19585d2247137b3a38a35314ea68c66aaf507a1c03ef6fe"}, - {file = "shapely-2.0.5-cp312-cp312-win32.whl", hash = "sha256:3ac7dc1350700c139c956b03d9c3df49a5b34aaf91d024d1510a09717ea39199"}, - {file = "shapely-2.0.5-cp312-cp312-win_amd64.whl", hash = "sha256:30e8737983c9d954cd17feb49eb169f02f1da49e24e5171122cf2c2b62d65c95"}, - {file = "shapely-2.0.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:ff7731fea5face9ec08a861ed351734a79475631b7540ceb0b66fb9732a5f529"}, - {file = "shapely-2.0.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff9e520af0c5a578e174bca3c18713cd47a6c6a15b6cf1f50ac17dc8bb8db6a2"}, - {file = "shapely-2.0.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:49b299b91557b04acb75e9732645428470825061f871a2edc36b9417d66c1fc5"}, - {file = "shapely-2.0.5-cp37-cp37m-win32.whl", hash = "sha256:b5870633f8e684bf6d1ae4df527ddcb6f3895f7b12bced5c13266ac04f47d231"}, - {file = "shapely-2.0.5-cp37-cp37m-win_amd64.whl", hash = "sha256:401cb794c5067598f50518e5a997e270cd7642c4992645479b915c503866abed"}, - {file = "shapely-2.0.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:e91ee179af539100eb520281ba5394919067c6b51824e6ab132ad4b3b3e76dd0"}, - {file = "shapely-2.0.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8af6f7260f809c0862741ad08b1b89cb60c130ae30efab62320bbf4ee9cc71fa"}, - {file = "shapely-2.0.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f5456dd522800306ba3faef77c5ba847ec30a0bd73ab087a25e0acdd4db2514f"}, - {file = "shapely-2.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b714a840402cde66fd7b663bb08cacb7211fa4412ea2a209688f671e0d0631fd"}, - {file = "shapely-2.0.5-cp38-cp38-win32.whl", hash = "sha256:7e8cf5c252fac1ea51b3162be2ec3faddedc82c256a1160fc0e8ddbec81b06d2"}, - {file = "shapely-2.0.5-cp38-cp38-win_amd64.whl", hash = "sha256:4461509afdb15051e73ab178fae79974387f39c47ab635a7330d7fee02c68a3f"}, - {file = "shapely-2.0.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7545a39c55cad1562be302d74c74586f79e07b592df8ada56b79a209731c0219"}, - {file = "shapely-2.0.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4c83a36f12ec8dee2066946d98d4d841ab6512a6ed7eb742e026a64854019b5f"}, - {file = "shapely-2.0.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:89e640c2cd37378480caf2eeda9a51be64201f01f786d127e78eaeff091ec897"}, - {file = "shapely-2.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:06efe39beafde3a18a21dde169d32f315c57da962826a6d7d22630025200c5e6"}, - {file = "shapely-2.0.5-cp39-cp39-win32.whl", hash = "sha256:8203a8b2d44dcb366becbc8c3d553670320e4acf0616c39e218c9561dd738d92"}, - {file = "shapely-2.0.5-cp39-cp39-win_amd64.whl", hash = "sha256:7fed9dbfbcfec2682d9a047b9699db8dcc890dfca857ecba872c42185fc9e64e"}, - {file = "shapely-2.0.5.tar.gz", hash = "sha256:bff2366bc786bfa6cb353d6b47d0443c570c32776612e527ee47b6df63fcfe32"}, + {file = "shapely-2.0.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:29a34e068da2d321e926b5073539fd2a1d4429a2c656bd63f0bd4c8f5b236d0b"}, + {file = "shapely-2.0.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c84c3f53144febf6af909d6b581bc05e8785d57e27f35ebaa5c1ab9baba13b"}, + {file = "shapely-2.0.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2ad2fae12dca8d2b727fa12b007e46fbc522148a584f5d6546c539f3464dccde"}, + {file = "shapely-2.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3304883bd82d44be1b27a9d17f1167fda8c7f5a02a897958d86c59ec69b705e"}, + {file = "shapely-2.0.6-cp310-cp310-win32.whl", hash = "sha256:3ec3a0eab496b5e04633a39fa3d5eb5454628228201fb24903d38174ee34565e"}, + {file = "shapely-2.0.6-cp310-cp310-win_amd64.whl", hash = "sha256:28f87cdf5308a514763a5c38de295544cb27429cfa655d50ed8431a4796090c4"}, + {file = "shapely-2.0.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5aeb0f51a9db176da9a30cb2f4329b6fbd1e26d359012bb0ac3d3c7781667a9e"}, + {file = "shapely-2.0.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9a7a78b0d51257a367ee115f4d41ca4d46edbd0dd280f697a8092dd3989867b2"}, + {file = "shapely-2.0.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f32c23d2f43d54029f986479f7c1f6e09c6b3a19353a3833c2ffb226fb63a855"}, + {file = "shapely-2.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b3dc9fb0eb56498912025f5eb352b5126f04801ed0e8bdbd867d21bdbfd7cbd0"}, + {file = "shapely-2.0.6-cp311-cp311-win32.whl", hash = "sha256:d93b7e0e71c9f095e09454bf18dad5ea716fb6ced5df3cb044564a00723f339d"}, + {file = "shapely-2.0.6-cp311-cp311-win_amd64.whl", hash = "sha256:c02eb6bf4cfb9fe6568502e85bb2647921ee49171bcd2d4116c7b3109724ef9b"}, + {file = "shapely-2.0.6-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:cec9193519940e9d1b86a3b4f5af9eb6910197d24af02f247afbfb47bcb3fab0"}, + {file = "shapely-2.0.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:83b94a44ab04a90e88be69e7ddcc6f332da7c0a0ebb1156e1c4f568bbec983c3"}, + {file = "shapely-2.0.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:537c4b2716d22c92036d00b34aac9d3775e3691f80c7aa517c2c290351f42cd8"}, + {file = "shapely-2.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:98fea108334be345c283ce74bf064fa00cfdd718048a8af7343c59eb40f59726"}, + {file = "shapely-2.0.6-cp312-cp312-win32.whl", hash = "sha256:42fd4cd4834747e4990227e4cbafb02242c0cffe9ce7ef9971f53ac52d80d55f"}, + {file = "shapely-2.0.6-cp312-cp312-win_amd64.whl", hash = "sha256:665990c84aece05efb68a21b3523a6b2057e84a1afbef426ad287f0796ef8a48"}, + {file = "shapely-2.0.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:42805ef90783ce689a4dde2b6b2f261e2c52609226a0438d882e3ced40bb3013"}, + {file = "shapely-2.0.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6d2cb146191a47bd0cee8ff5f90b47547b82b6345c0d02dd8b25b88b68af62d7"}, + {file = "shapely-2.0.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e3fdef0a1794a8fe70dc1f514440aa34426cc0ae98d9a1027fb299d45741c381"}, + {file = "shapely-2.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c665a0301c645615a107ff7f52adafa2153beab51daf34587170d85e8ba6805"}, + {file = "shapely-2.0.6-cp313-cp313-win32.whl", hash = "sha256:0334bd51828f68cd54b87d80b3e7cee93f249d82ae55a0faf3ea21c9be7b323a"}, + {file = "shapely-2.0.6-cp313-cp313-win_amd64.whl", hash = "sha256:d37d070da9e0e0f0a530a621e17c0b8c3c9d04105655132a87cfff8bd77cc4c2"}, + {file = "shapely-2.0.6-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:fa7468e4f5b92049c0f36d63c3e309f85f2775752e076378e36c6387245c5462"}, + {file = "shapely-2.0.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed5867e598a9e8ac3291da6cc9baa62ca25706eea186117034e8ec0ea4355653"}, + {file = "shapely-2.0.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:81d9dfe155f371f78c8d895a7b7f323bb241fb148d848a2bf2244f79213123fe"}, + {file = "shapely-2.0.6-cp37-cp37m-win32.whl", hash = "sha256:fbb7bf02a7542dba55129062570211cfb0defa05386409b3e306c39612e7fbcc"}, + {file = "shapely-2.0.6-cp37-cp37m-win_amd64.whl", hash = "sha256:837d395fac58aa01aa544495b97940995211e3e25f9aaf87bc3ba5b3a8cd1ac7"}, + {file = "shapely-2.0.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c6d88ade96bf02f6bfd667ddd3626913098e243e419a0325ebef2bbd481d1eb6"}, + {file = "shapely-2.0.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:8b3b818c4407eaa0b4cb376fd2305e20ff6df757bf1356651589eadc14aab41b"}, + {file = "shapely-2.0.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bbc783529a21f2bd50c79cef90761f72d41c45622b3e57acf78d984c50a5d13"}, + {file = "shapely-2.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2423f6c0903ebe5df6d32e0066b3d94029aab18425ad4b07bf98c3972a6e25a1"}, + {file = "shapely-2.0.6-cp38-cp38-win32.whl", hash = "sha256:2de00c3bfa80d6750832bde1d9487e302a6dd21d90cb2f210515cefdb616e5f5"}, + {file = "shapely-2.0.6-cp38-cp38-win_amd64.whl", hash = "sha256:3a82d58a1134d5e975f19268710e53bddd9c473743356c90d97ce04b73e101ee"}, + {file = "shapely-2.0.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:392f66f458a0a2c706254f473290418236e52aa4c9b476a072539d63a2460595"}, + {file = "shapely-2.0.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:eba5bae271d523c938274c61658ebc34de6c4b33fdf43ef7e938b5776388c1be"}, + {file = "shapely-2.0.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7060566bc4888b0c8ed14b5d57df8a0ead5c28f9b69fb6bed4476df31c51b0af"}, + {file = "shapely-2.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b02154b3e9d076a29a8513dffcb80f047a5ea63c897c0cd3d3679f29363cf7e5"}, + {file = "shapely-2.0.6-cp39-cp39-win32.whl", hash = "sha256:44246d30124a4f1a638a7d5419149959532b99dfa25b54393512e6acc9c211ac"}, + {file = "shapely-2.0.6-cp39-cp39-win_amd64.whl", hash = "sha256:2b542d7f1dbb89192d3512c52b679c822ba916f93479fa5d4fc2fe4fa0b3c9e8"}, + {file = "shapely-2.0.6.tar.gz", hash = "sha256:997f6159b1484059ec239cacaa53467fd8b5564dabe186cd84ac2944663b0bf6"}, ] [package.dependencies] @@ -2737,18 +2747,22 @@ files = [ [[package]] name = "zipp" -version = "3.20.0" +version = "3.20.1" description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.8" files = [ - {file = "zipp-3.20.0-py3-none-any.whl", hash = "sha256:58da6168be89f0be59beb194da1250516fdaa062ccebd30127ac65d30045e10d"}, - {file = "zipp-3.20.0.tar.gz", hash = "sha256:0145e43d89664cfe1a2e533adc75adafed82fe2da404b4bbb6b026c0157bdb31"}, + {file = "zipp-3.20.1-py3-none-any.whl", hash = "sha256:9960cd8967c8f85a56f920d5d507274e74f9ff813a0ab8889a5b5be2daf44064"}, + {file = "zipp-3.20.1.tar.gz", hash = "sha256:c22b14cc4763c5a5b04134207736c107db42e9d3ef2d9779d465f5f1bcba572b"}, ] [package.extras] +check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)"] +cover = ["pytest-cov"] doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy", "pytest-ruff (>=0.2.1)"] +enabler = ["pytest-enabler (>=2.2)"] +test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] +type = ["pytest-mypy"] [extras] all = ["PyYAML", "geopandas", "geopandas", "numpy", "numpy", "numpy", "pandas", "pandas", "pip", "shapely", "sympy"] diff --git a/pyproject.toml b/pyproject.toml index 0c454c38c..a3566ee1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.54.13" +version = "7.55.1" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" @@ -89,5 +89,5 @@ PyYAML = "^6.0" pytest-icdiff = "*" # Used for better diffs in pytest [build-system] -requires = ["poetry>=1.0"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/scripts/generate_core_model.py b/scripts/generate_core_model.py index afa377f55..8bdb3bd59 100644 --- a/scripts/generate_core_model.py +++ b/scripts/generate_core_model.py @@ -1,6 +1,6 @@ """This script requires pygen to be installed. It generates typed classes for the core data model v1. -`pip install cognite-pygen==0.99.28` +`pip install cognite-pygen==0.99.34` Note that `pygen` requires `Python 3.9` or later`, so if you develop in an older version of Python, you need to run this script in a Python 3.9 environment. @@ -13,13 +13,21 @@ THIS_REPO = Path(__file__).resolve().parent.parent -OUTPUT_FILE = THIS_REPO / "cognite" / "client" / "data_classes" / "cdm" / "v1.py" +OUTPUT_FILE = THIS_REPO / "cognite" / "client" / "data_classes" / "data_modeling" / "cdm" / "v1.py" def main() -> None: client = make_cognite_client(beta=False) - generate_typed(("cdf_cdm_experimental", "core_data_model", "v1"), OUTPUT_FILE, client, format_code=False) + typed_classes = generate_typed(("cdf_cdm", "CogniteCore", "v1"), None, client, format_code=True) + + # For some reason, mypy doesn't need the ignore in one location. + typed_classes = typed_classes.replace( + "time_series=self.time_series, # type: ignore[arg-type]", "time_series=self.time_series," + ) + + with OUTPUT_FILE.open("w", encoding="utf-8", newline="\n") as f: + f.write(typed_classes) if __name__ == "__main__": diff --git a/scripts/generate_extractor_extension_model.py b/scripts/generate_extractor_extension_model.py new file mode 100644 index 000000000..8e5766f7b --- /dev/null +++ b/scripts/generate_extractor_extension_model.py @@ -0,0 +1,35 @@ +"""This script requires pygen to be installed. It generates typed classes for the core data model v1. + +`pip install cognite-pygen==0.99.34` + +Note that `pygen` requires `Python 3.9` or later`, so if you develop in an older version of Python, +you need to run this script in a Python 3.9 environment. +""" + +from pathlib import Path + +from cognite.pygen._generator import generate_typed +from tests.tests_integration.conftest import make_cognite_client + +THIS_REPO = Path(__file__).resolve().parent.parent + +OUTPUT_FILE = THIS_REPO / "cognite" / "client" / "data_classes" / "data_modeling" / "extractor_extension" / "v1.py" + + +def main() -> None: + client = make_cognite_client(beta=False) + + typed_classes = generate_typed( + ("cdf_extraction_extensions", "CogniteExtractorExtensions", "v1"), + None, + client, + format_code=True, + module_by_space={"cdf_cdm": "cognite.client.data_classes.cdm.v1"}, + ) + + with OUTPUT_FILE.open("w", encoding="utf-8", newline="\n") as f: + f.write(typed_classes) + + +if __name__ == "__main__": + main() diff --git a/scripts/update_proto_files.py b/scripts/update_proto_files.py new file mode 100644 index 000000000..2ce4e724a --- /dev/null +++ b/scripts/update_proto_files.py @@ -0,0 +1,57 @@ +""" +Creates/updates the proto files in cognite/client/_proto/ using definitions from: +https://github.com/cognitedata/protobuf-files + +Requires `protoc` to be installed. On MacOS, you can install it with Homebrew: +$ brew install protobuf + +Note: +As long as we support `protobuf >= 4`, we need to use the last `protoc` version with v4 support. +That seems to be release 25.4, which can be downloaded here: +https://github.com/protocolbuffers/protobuf/releases +""" + +import os +import shlex +import subprocess +import tempfile +from pathlib import Path + +import requests + +URL_BASE = "https://raw.githubusercontent.com/cognitedata/protobuf-files/master/v1/timeseries/" +FILES = "data_point_list_response.proto", "data_points.proto", "data_point_insertion_request.proto" +PROTO_DIR = str(Path("cognite/client/_proto").resolve()) + + +def download_proto_files_and_compile(): + with tempfile.TemporaryDirectory() as tmpdir: + os.chdir(tmpdir) + for file in map(Path, FILES): + file.touch() + file.write_bytes(requests.get(f"{URL_BASE}{file}").content) + protoc_command = " ".join(("protoc", *FILES, f"--python_out={PROTO_DIR}", f"--pyi_out={PROTO_DIR}")) + subprocess.run(shlex.split(protoc_command), check=True) + + +def patch_bad_imports(): + for file in Path().glob("*.py"): + file.write_text( + file.read_text().replace( + "import data_points_pb2 as data__points__pb2", + "import cognite.client._proto.data_points_pb2 as data__points__pb2", + ) + ) + for file in Path().glob("*.pyi"): + file.write_text( + file.read_text().replace( + "import data_points_pb2 as _data_points_pb2", + "import cognite.client._proto.data_points_pb2 as _data_points_pb2", + ) + ) + + +if __name__ == "__main__": + download_proto_files_and_compile() + os.chdir(PROTO_DIR) + patch_bad_imports() diff --git a/tests/tests_integration/test_api/test_data_modeling/test_core_model.py b/tests/tests_integration/test_api/test_data_modeling/test_core_model.py index 732d2b9a9..8777023b1 100644 --- a/tests/tests_integration/test_api/test_data_modeling/test_core_model.py +++ b/tests/tests_integration/test_api/test_data_modeling/test_core_model.py @@ -7,7 +7,6 @@ from _pytest.mark import ParameterSet from cognite.client import CogniteClient -from cognite.client.data_classes.cdm import v1 as cdm from cognite.client.data_classes.data_modeling import ( Space, SpaceApply, @@ -16,6 +15,7 @@ TypedNode, TypedNodeApply, ) +from cognite.client.data_classes.data_modeling.cdm import v1 as cdm DATA_SPACE = "python_sdk_core_v1_test_space" @@ -102,25 +102,25 @@ def core_model_v1_node_test_cases() -> Iterable[ParameterSet]: id="CogniteEquipment", ) yield pytest.param( - cdm.CogniteModel3DApply( + cdm.Cognite3DModelApply( space=DATA_SPACE, external_id="test_model_3d", name="Test model 3D", description="Test model 3D for core model v1 tests with Python SDK", aliases=["test_model_3d_alias"], ), - cdm.CogniteModel3D, + cdm.Cognite3DModel, id="CogniteModel3D", ) yield pytest.param( - cdm.CogniteObject3DApply( + cdm.Cognite3DObjectApply( space=DATA_SPACE, external_id="test_object_3d", name="Test object 3D", description="Test object 3D for core model v1 tests with Python SDK", aliases=["test_object_3d_alias"], ), - cdm.CogniteObject3D, + cdm.Cognite3DObject, id="CogniteObject3D", ) diff --git a/tests/tests_integration/test_api/test_data_modeling/test_instances.py b/tests/tests_integration/test_api/test_data_modeling/test_instances.py index 32a6e2a7c..8ee76650a 100644 --- a/tests/tests_integration/test_api/test_data_modeling/test_instances.py +++ b/tests/tests_integration/test_api/test_data_modeling/test_instances.py @@ -1116,8 +1116,7 @@ def test_sync_movies_released_in_1994(self, cognite_client: CogniteClient, movie my_query.cursors = result.cursors new_result = cognite_client.data_modeling.instances.sync(my_query) - assert len(new_result["movies"]) == 1, "Only the new movie should be returned" - assert new_result["movies"][0].external_id == new_1994_movie.external_id + assert new_1994_movie.external_id in [node.external_id for node in new_result["movies"]] finally: cognite_client.data_modeling.instances.delete(new_1994_movie.as_id()) diff --git a/tests/tests_integration/test_api/test_data_workflows.py b/tests/tests_integration/test_api/test_data_workflows.py index 3d91542bc..9a3c0f30b 100644 --- a/tests/tests_integration/test_api/test_data_workflows.py +++ b/tests/tests_integration/test_api/test_data_workflows.py @@ -15,7 +15,10 @@ WorkflowDefinitionUpsert, WorkflowExecutionList, WorkflowList, + WorkflowScheduledTriggerRule, WorkflowTask, + WorkflowTrigger, + WorkflowTriggerCreate, WorkflowUpsert, WorkflowVersion, WorkflowVersionList, @@ -200,7 +203,7 @@ def workflow_execution_list( if executions: return executions # Creating at least one execution - result = cognite_client.workflows.executions.trigger( + result = cognite_client.workflows.executions.run( add_multiply_workflow.workflow_external_id, add_multiply_workflow.version, {"a": 5, "b": 6}, @@ -228,7 +231,36 @@ def clean_created_sessions(cognite_client: CogniteClient) -> None: current_sessions = cognite_client.iam.sessions.list(status="active", limit=-1) existing_ids = {session.id for session in existing_active_sessions} to_revoked = [session.id for session in current_sessions if session.id not in existing_ids] - cognite_client.iam.sessions.revoke(to_revoked) + if len(to_revoked) > 0: + cognite_client.iam.sessions.revoke(to_revoked) + + +@pytest.fixture() +def clean_created_workflow_triggers(cognite_client: CogniteClient) -> None: + existing_workflow_triggers = cognite_client.workflows.triggers.get_triggers(limit=-1) + yield None + current_workflow_triggers = cognite_client.workflows.triggers.get_triggers(limit=-1) + existing_external_ids = {trigger.external_id for trigger in existing_workflow_triggers} + to_clean = [ + trigger.external_id for trigger in current_workflow_triggers if trigger.external_id not in existing_external_ids + ] + for external_id in to_clean: + cognite_client.workflows.triggers.delete(external_id) + + +@pytest.fixture() +def workflow_scheduled_trigger(cognite_client: CogniteClient, add_multiply_workflow: WorkflowVersion) -> None: + trigger = cognite_client.workflows.triggers.create( + WorkflowTriggerCreate( + external_id="integration_test-workflow-scheduled-trigger", + trigger_rule=WorkflowScheduledTriggerRule(cron_expression="0 0 * * *"), + workflow_external_id="integration_test-workflow-add_multiply", + workflow_version="1", + input={"a": 1, "b": 2}, + ) + ) + yield trigger + cognite_client.workflows.triggers.delete(trigger.external_id) class TestWorkflows: @@ -415,7 +447,7 @@ def test_trigger_retrieve_detailed_update_update_task( cognite_client: CogniteClient, add_multiply_workflow: WorkflowVersion, ) -> None: - workflow_execution = cognite_client.workflows.executions.trigger( + workflow_execution = cognite_client.workflows.executions.run( add_multiply_workflow.workflow_external_id, add_multiply_workflow.version, ) @@ -434,7 +466,7 @@ def test_trigger_retrieve_detailed_update_update_task( def test_trigger_cancel_retry_workflow( self, cognite_client: CogniteClient, add_multiply_workflow: WorkflowVersion ) -> None: - workflow_execution = cognite_client.workflows.executions.trigger( + workflow_execution = cognite_client.workflows.executions.run( add_multiply_workflow.workflow_external_id, add_multiply_workflow.version, ) @@ -447,3 +479,43 @@ def test_trigger_cancel_retry_workflow( retried_workflow_execution = cognite_client.workflows.executions.retry(workflow_execution.id) assert retried_workflow_execution.status == "running" + + +class TestWorkflowTriggers: + @pytest.mark.usefixtures("clean_created_sessions", "clean_created_workflow_triggers") + def test_create_delete( + self, + cognite_client: CogniteClient, + workflow_scheduled_trigger: WorkflowTrigger, + ) -> None: + assert workflow_scheduled_trigger is not None + assert workflow_scheduled_trigger.external_id == "integration_test-workflow-scheduled-trigger" + assert workflow_scheduled_trigger.trigger_rule == WorkflowScheduledTriggerRule(cron_expression="0 0 * * *") + assert workflow_scheduled_trigger.workflow_external_id == "integration_test-workflow-add_multiply" + assert workflow_scheduled_trigger.workflow_version == "1" + assert workflow_scheduled_trigger.input == {"a": 1, "b": 2} + assert workflow_scheduled_trigger.created_time is not None + assert workflow_scheduled_trigger.last_updated_time is not None + + @pytest.mark.usefixtures("clean_created_sessions", "clean_created_workflow_triggers") + def test_trigger_list( + self, + cognite_client: CogniteClient, + workflow_scheduled_trigger: WorkflowTrigger, + ) -> None: + triggers = cognite_client.workflows.triggers.get_triggers() + external_ids = {trigger.external_id for trigger in triggers} + + assert workflow_scheduled_trigger.external_id in external_ids + + @pytest.mark.usefixtures("clean_created_sessions", "clean_created_workflow_triggers") + def test_trigger_run_history( + self, + cognite_client: CogniteClient, + workflow_scheduled_trigger: WorkflowTrigger, + ) -> None: + history = cognite_client.workflows.triggers.get_trigger_run_history( + external_id=workflow_scheduled_trigger.external_id + ) + # it would take too long to wait for the trigger to run, so we just check that the history is not None + assert history is not None diff --git a/tests/tests_integration/test_api/test_datapoints.py b/tests/tests_integration/test_api/test_datapoints.py index 37997da77..1c9c8b0b9 100644 --- a/tests/tests_integration/test_api/test_datapoints.py +++ b/tests/tests_integration/test_api/test_datapoints.py @@ -9,12 +9,14 @@ import itertools import math +import platform import random import re import unittest from contextlib import nullcontext as does_not_raise from datetime import datetime, timezone -from typing import Callable, Literal +from sys import version_info +from typing import Callable, Iterator, Literal from unittest.mock import patch import numpy as np @@ -36,6 +38,8 @@ TimeSeriesList, ) from cognite.client.data_classes.data_modeling import NodeApply, NodeOrEdgeData, Space, ViewId +from cognite.client.data_classes.data_modeling.instances import NodeApplyResult +from cognite.client.data_classes.data_modeling.spaces import SpaceApply from cognite.client.data_classes.datapoints import ALL_SORTED_DP_AGGS from cognite.client.exceptions import CogniteAPIError, CogniteNotFoundError from cognite.client.utils._identifier import InstanceId @@ -407,6 +411,50 @@ def dps_queries_dst_transitions(all_test_time_series): ] +@pytest.fixture(scope="session") +def space_for_time_series(cognite_client) -> Iterator[Space]: + name = "PySDK-DMS-time-series-integration-test" + space = SpaceApply(name, name=name.replace("-", " ")) + yield cognite_client.data_modeling.spaces.apply(space) + + +@pytest.fixture(scope="session") +def ts_create_in_dms(cognite_client, space_for_time_series) -> NodeApplyResult: + from cognite.client.data_classes.data_modeling.cdm.v1 import CogniteTimeSeriesApply + + dms_ts = CogniteTimeSeriesApply( + space=space_for_time_series.space, + # One per test runner, per OS, to avoid conflicts: + external_id=f"dms-time-series-{platform.system()}-{'-'.join(map(str, version_info[:2]))}", + is_step=True, + type_="numeric", + ) + (dms_ts_node,) = cognite_client.data_modeling.instances.apply(dms_ts).nodes + return dms_ts_node + + +class TestTimeSeriesCreatedInDMS: + def test_insert_read_delete_dps(self, cognite_client, ts_create_in_dms): + # Ensure the DMS time series is retrievable from normal TS API: + inst_id = ts_create_in_dms.as_id() + ts = cognite_client.time_series.retrieve(instance_id=inst_id) + assert ts.instance_id == inst_id + + numbers = random_cognite_ids(3) + datapoints = [ + (datetime(2018, 1, 1, tzinfo=timezone.utc), numbers[0]), + (datetime(2018, 1, 2, tzinfo=timezone.utc), numbers[1], StatusCode.Good), + (datetime(2018, 1, 3, tzinfo=timezone.utc), numbers[2], StatusCode.Uncertain), + ] + cognite_client.time_series.data.insert(datapoints, instance_id=inst_id) + + dps1 = cognite_client.time_series.data.retrieve(instance_id=inst_id, ignore_bad_datapoints=False) + assert dps1.instance_id == inst_id + dps2 = cognite_client.time_series.data.retrieve(id=ts.id, ignore_bad_datapoints=False) + + assert dps1.value == dps2.value == numbers + + class TestRetrieveRawDatapointsAPI: """Note: Since `retrieve` and `retrieve_arrays` endpoints should give identical results, except for the data container types, all tests run both endpoints except those targeting a specific bug diff --git a/tests/tests_integration/test_api/test_files.py b/tests/tests_integration/test_api/test_files.py index bb308be18..fea6c9019 100644 --- a/tests/tests_integration/test_api/test_files.py +++ b/tests/tests_integration/test_api/test_files.py @@ -15,8 +15,8 @@ Label, LabelDefinition, ) -from cognite.client.data_classes.cdm.v1 import CogniteFileApply from cognite.client.data_classes.data_modeling import Space +from cognite.client.data_classes.data_modeling.cdm.v1 import CogniteFileApply from cognite.client.utils._text import random_string diff --git a/tests/tests_integration/test_api/test_functions.py b/tests/tests_integration/test_api/test_functions.py index 15a511583..d3c456f6d 100644 --- a/tests/tests_integration/test_api/test_functions.py +++ b/tests/tests_integration/test_api/test_functions.py @@ -76,6 +76,13 @@ def test_iterate_chunked_functions(self, cognite_client: CogniteClient) -> None: else: assert False, "Expected at least one function" + def test_call_function_with_oneshot(self, cognite_client: CogniteClient, a_function: Function) -> None: + session = cognite_client.iam.sessions.create(session_type="ONESHOT_TOKEN_EXCHANGE") + + response = cognite_client.functions.call(id=a_function.id, wait=True, nonce=session.nonce) + + assert response.status == "Completed" + class TestFunctionSchedulesAPI: def test_create_retrieve_delete(self, cognite_client: CogniteClient, a_function: Function) -> None: diff --git a/tests/tests_integration/test_api/test_relationships.py b/tests/tests_integration/test_api/test_relationships.py index f65450d40..9cf6628ef 100644 --- a/tests/tests_integration/test_api/test_relationships.py +++ b/tests/tests_integration/test_api/test_relationships.py @@ -14,6 +14,7 @@ TimeSeries, ) from cognite.client.exceptions import CogniteNotFoundError +from cognite.client.utils._text import random_string @pytest.fixture @@ -245,14 +246,14 @@ def test_upsert_2_relationships_one_preexisting(self, cognite_client: CogniteCli asset3 = Asset(external_id="test_upsert_2_asset_one_preexisting:asset3", name="asset3") new_relationship = Relationship( - external_id="test_upsert_2_relationships_one_preexisting:new", + external_id=f"test_upsert_2_relationships_one_preexisting:new:{random_string(5)}", source_external_id=asset1.external_id, target_external_id=asset2.external_id, source_type="asset", target_type="asset", ) preexisting = Relationship( - external_id="test_upsert_2_relationships_one_preexisting:preexisting", + external_id=f"test_upsert_2_relationships_one_preexisting:preexisting:{random_string(5)}", source_external_id=asset2.external_id, target_external_id=asset3.external_id, source_type="asset", diff --git a/tests/tests_integration/test_api/test_time_series.py b/tests/tests_integration/test_api/test_time_series.py index 223dcff14..73dfe8628 100644 --- a/tests/tests_integration/test_api/test_time_series.py +++ b/tests/tests_integration/test_api/test_time_series.py @@ -5,8 +5,8 @@ from cognite.client import CogniteClient from cognite.client.data_classes import DataSet, TimeSeries, TimeSeriesFilter, TimeSeriesList, TimeSeriesUpdate, filters -from cognite.client.data_classes.cdm.v1 import CogniteTimeSeriesApply from cognite.client.data_classes.data_modeling import Space +from cognite.client.data_classes.data_modeling.cdm.v1 import CogniteTimeSeriesApply from cognite.client.data_classes.time_series import TimeSeriesProperty from cognite.client.utils._time import MAX_TIMESTAMP_MS, MIN_TIMESTAMP_MS from tests.utils import set_request_limit diff --git a/tests/tests_unit/test_data_classes/test_capabilities.py b/tests/tests_unit/test_data_classes/test_capabilities.py index 3aed8fdec..e261df3c4 100644 --- a/tests/tests_unit/test_data_classes/test_capabilities.py +++ b/tests/tests_unit/test_data_classes/test_capabilities.py @@ -70,6 +70,7 @@ def all_acls(): {"groupsAcl": {"actions": ["READ", "CREATE", "UPDATE", "DELETE"], "scope": {"currentuserscope": {}}}}, {"hostedExtractorsAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, {"labelsAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, + {"locationFiltersAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, {"modelHostingAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, {"monitoringTasksAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, {"notificationsAcl": {"actions": ["READ", "WRITE"], "scope": {"all": {}}}}, diff --git a/tests/tests_unit/test_data_classes/test_cdm/test_v1.py b/tests/tests_unit/test_data_classes/test_cdm/test_v1.py index 20a2241d0..aaba297ec 100644 --- a/tests/tests_unit/test_data_classes/test_cdm/test_v1.py +++ b/tests/tests_unit/test_data_classes/test_cdm/test_v1.py @@ -1,6 +1,6 @@ from datetime import datetime -from cognite.client.data_classes.cdm.v1 import CogniteModel3DApply, CogniteSourceableNodeApply +from cognite.client.data_classes.data_modeling.cdm.v1 import Cognite3DModelApply, CogniteSourceableNodeApply class TestSourceable: @@ -25,7 +25,7 @@ def test_dump_load(self) -> None: "sources": [ { "source": { - "space": "cdf_cdm_experimental", + "space": "cdf_cdm", "externalId": "CogniteSourceable", "version": "v1", "type": "view", @@ -46,7 +46,7 @@ def test_dump_load(self) -> None: class TestModel3D: def test_dump(self) -> None: - my_model = CogniteModel3DApply( + my_model = Cognite3DModelApply( "sp_data_space", "my_model", name="The model", @@ -63,8 +63,8 @@ def test_dump(self) -> None: "sources": [ { "source": { - "space": "cdf_cdm_experimental", - "externalId": "CogniteModel3D", + "space": "cdf_cdm", + "externalId": "Cognite3DModel", "version": "v1", "type": "view", },