cognite-toolkit 0.7.39__py3-none-any.whl → 0.7.51__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cognite_toolkit/_cdf_tk/apps/_download_app.py +1 -1
- cognite_toolkit/_cdf_tk/apps/_dump_app.py +1 -1
- cognite_toolkit/_cdf_tk/apps/_migrate_app.py +6 -6
- cognite_toolkit/_cdf_tk/builders/_function.py +81 -9
- cognite_toolkit/_cdf_tk/builders/_raw.py +1 -1
- cognite_toolkit/_cdf_tk/client/_resource_base.py +187 -0
- cognite_toolkit/_cdf_tk/client/_toolkit_client.py +37 -5
- cognite_toolkit/_cdf_tk/client/api/agents.py +107 -0
- cognite_toolkit/_cdf_tk/client/api/annotations.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/assets.py +130 -0
- cognite_toolkit/_cdf_tk/client/api/containers.py +132 -0
- cognite_toolkit/_cdf_tk/client/api/data_models.py +137 -0
- cognite_toolkit/_cdf_tk/client/api/datasets.py +141 -0
- cognite_toolkit/_cdf_tk/client/api/events.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/extraction_pipelines.py +148 -0
- cognite_toolkit/_cdf_tk/client/api/filemetadata.py +176 -0
- cognite_toolkit/_cdf_tk/client/api/function_schedules.py +115 -0
- cognite_toolkit/_cdf_tk/client/api/functions.py +113 -0
- cognite_toolkit/_cdf_tk/client/api/graphql_data_models.py +167 -0
- cognite_toolkit/_cdf_tk/client/api/groups.py +121 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_destinations.py +131 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_jobs.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_mappings.py +129 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractor_sources.py +136 -0
- cognite_toolkit/_cdf_tk/client/api/hosted_extractors.py +23 -0
- cognite_toolkit/_cdf_tk/client/api/infield.py +8 -8
- cognite_toolkit/_cdf_tk/client/api/instances.py +139 -0
- cognite_toolkit/_cdf_tk/client/api/labels.py +125 -0
- cognite_toolkit/_cdf_tk/client/api/legacy/canvas.py +3 -3
- cognite_toolkit/_cdf_tk/client/api/legacy/charts.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/extended_data_modeling.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/extended_files.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/legacy/extended_functions.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/extended_raw.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/extended_timeseries.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/legacy/location_filters.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/capabilities.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/data_postprocessing.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/frames.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/locations.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/maps.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/robotics/robots.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/legacy/search_config.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/location_filters.py +177 -0
- cognite_toolkit/_cdf_tk/client/api/migration.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/project.py +2 -2
- cognite_toolkit/_cdf_tk/client/api/raw.py +204 -0
- cognite_toolkit/_cdf_tk/client/api/relationships.py +133 -0
- cognite_toolkit/_cdf_tk/client/api/robotics.py +19 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_capabilities.py +127 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_data_postprocessing.py +138 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_frames.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_locations.py +127 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_maps.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/robotics_robots.py +122 -0
- cognite_toolkit/_cdf_tk/client/api/search_config.py +101 -0
- cognite_toolkit/_cdf_tk/client/api/security_categories.py +94 -0
- cognite_toolkit/_cdf_tk/client/api/sequences.py +133 -0
- cognite_toolkit/_cdf_tk/client/api/simulator_models.py +154 -0
- cognite_toolkit/_cdf_tk/client/api/simulators.py +8 -0
- cognite_toolkit/_cdf_tk/client/api/spaces.py +117 -0
- cognite_toolkit/_cdf_tk/client/api/streams.py +65 -57
- cognite_toolkit/_cdf_tk/client/api/three_d.py +300 -283
- cognite_toolkit/_cdf_tk/client/api/timeseries.py +137 -0
- cognite_toolkit/_cdf_tk/client/api/token.py +1 -1
- cognite_toolkit/_cdf_tk/client/api/transformations.py +146 -0
- cognite_toolkit/_cdf_tk/client/api/views.py +139 -0
- cognite_toolkit/_cdf_tk/client/api/workflow_triggers.py +128 -0
- cognite_toolkit/_cdf_tk/client/api/workflow_versions.py +138 -0
- cognite_toolkit/_cdf_tk/client/api/workflows.py +119 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py +10 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/api.py +358 -0
- cognite_toolkit/_cdf_tk/client/cdf_client/responses.py +38 -0
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/__init__.py +9 -7
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/_client.py +23 -14
- cognite_toolkit/_cdf_tk/{utils → client}/http_client/_data_classes.py +12 -2
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py +151 -0
- cognite_toolkit/_cdf_tk/client/http_client/_exception.py +13 -0
- cognite_toolkit/_cdf_tk/client/http_client/_item_classes.py +118 -0
- cognite_toolkit/_cdf_tk/client/request_classes/base.py +19 -0
- cognite_toolkit/_cdf_tk/client/request_classes/filters.py +113 -0
- cognite_toolkit/_cdf_tk/client/request_classes/graphql.py +28 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/agent.py +130 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/annotation.py +79 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/apm_config.py +128 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/asset.py +47 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/charts_data.py +1 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/cognite_file.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/__init__.py +168 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_constraints.py +37 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_container.py +50 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_model.py +73 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_data_types.py +116 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_indexes.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_instance.py +154 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_references.py +86 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_space.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view.py +143 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view_property.py +152 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/dataset.py +35 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/event.py +40 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/extraction_pipeline.py +59 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py +52 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/function.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/function_schedule.py +65 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/graphql_data_model.py +40 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/__init__.py +187 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/_constants.py +2 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/acls.py +653 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/capability.py +56 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/group.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/group/scopes.py +166 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_destination.py +34 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_job.py +134 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_mapping.py +72 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/__init__.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_auth.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_base.py +26 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_certificate.py +20 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_eventhub.py +31 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_kafka.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_mqtt.py +36 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/hosted_extractor_source/_rest.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/identifiers.py +59 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/infield.py +1 -1
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/instance_api.py +35 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/label.py +27 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/legacy/__init__.py +0 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/canvas.py +48 -15
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/charts.py +1 -1
- cognite_toolkit/_cdf_tk/client/resource_classes/location_filter.py +84 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/raw.py +44 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/relationship.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/resource_view_mapping.py +38 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/__init__.py +37 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_capability.py +53 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_common.py +34 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_data_post_processing.py +49 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_frame.py +46 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_location.py +36 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_map.py +65 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/robotics/_robot.py +58 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/search_config.py +54 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/securitycategory.py +24 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/sequence.py +45 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/sequence_rows.py +56 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/simulator_model.py +50 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/streamlit_.py +71 -0
- cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/streams.py +9 -26
- cognite_toolkit/_cdf_tk/client/resource_classes/three_d.py +135 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/timeseries.py +52 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/transformation.py +140 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow.py +27 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow_trigger.py +63 -0
- cognite_toolkit/_cdf_tk/client/resource_classes/workflow_version.py +155 -0
- cognite_toolkit/_cdf_tk/client/testing.py +31 -2
- cognite_toolkit/_cdf_tk/commands/_migrate/command.py +103 -108
- cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py +22 -15
- cognite_toolkit/_cdf_tk/commands/_migrate/creators.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py +11 -10
- cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py +148 -57
- cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_migrate/issues.py +22 -39
- cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py +29 -27
- cognite_toolkit/_cdf_tk/commands/_profile.py +1 -1
- cognite_toolkit/_cdf_tk/commands/_purge.py +8 -8
- cognite_toolkit/_cdf_tk/commands/_upload.py +1 -1
- cognite_toolkit/_cdf_tk/commands/build_cmd.py +12 -2
- cognite_toolkit/_cdf_tk/commands/build_v2/_module_parser.py +138 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/_modules_parser.py +163 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/build_cmd.py +83 -96
- cognite_toolkit/_cdf_tk/commands/build_v2/{build_input.py → build_parameters.py} +8 -22
- cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_modules.py +27 -0
- cognite_toolkit/_cdf_tk/commands/build_v2/data_classes/_resource.py +22 -0
- cognite_toolkit/_cdf_tk/commands/dump_resource.py +4 -4
- cognite_toolkit/_cdf_tk/commands/pull.py +97 -2
- cognite_toolkit/_cdf_tk/commands/run.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/__init__.py +16 -6
- cognite_toolkit/_cdf_tk/cruds/_data_cruds.py +9 -5
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/auth.py +6 -2
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/classic.py +70 -89
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/configuration.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/datamodel.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/extraction_pipeline.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/fieldops.py +14 -7
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/file.py +50 -59
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/function.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/industrial_tool.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/location.py +4 -3
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/migration.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/raw.py +6 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/relationship.py +5 -4
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/robotics.py +1 -1
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/simulators.py +122 -0
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/streams.py +15 -31
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/timeseries.py +42 -47
- cognite_toolkit/_cdf_tk/cruds/_resource_cruds/transformation.py +1 -1
- cognite_toolkit/_cdf_tk/data_classes/__init__.py +3 -0
- cognite_toolkit/_cdf_tk/data_classes/_issues.py +36 -0
- cognite_toolkit/_cdf_tk/data_classes/_module_directories.py +2 -1
- cognite_toolkit/_cdf_tk/data_classes/_tracking_info.py +4 -0
- cognite_toolkit/_cdf_tk/feature_flags.py +8 -0
- cognite_toolkit/_cdf_tk/resource_classes/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/resource_classes/capabilities.py +6 -0
- cognite_toolkit/_cdf_tk/resource_classes/search_config.py +1 -1
- cognite_toolkit/_cdf_tk/resource_classes/simulator_model.py +17 -0
- cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py +13 -4
- cognite_toolkit/_cdf_tk/storageio/_applications.py +53 -15
- cognite_toolkit/_cdf_tk/storageio/_asset_centric.py +117 -107
- cognite_toolkit/_cdf_tk/storageio/_base.py +3 -1
- cognite_toolkit/_cdf_tk/storageio/_datapoints.py +7 -7
- cognite_toolkit/_cdf_tk/storageio/_file_content.py +64 -54
- cognite_toolkit/_cdf_tk/storageio/_instances.py +1 -1
- cognite_toolkit/_cdf_tk/storageio/_raw.py +1 -1
- cognite_toolkit/_cdf_tk/storageio/logger.py +162 -0
- cognite_toolkit/_cdf_tk/tk_warnings/__init__.py +2 -0
- cognite_toolkit/_cdf_tk/tk_warnings/fileread.py +20 -0
- cognite_toolkit/_cdf_tk/utils/__init__.py +11 -1
- cognite_toolkit/_cdf_tk/utils/cdf.py +1 -1
- cognite_toolkit/_cdf_tk/utils/interactive_select.py +8 -6
- cognite_toolkit/_cdf_tk/utils/modules.py +7 -0
- cognite_toolkit/_cdf_tk/utils/pip_validator.py +96 -0
- cognite_toolkit/_cdf_tk/utils/useful_types.py +4 -7
- cognite_toolkit/_cdf_tk/utils/useful_types2.py +14 -0
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml +1 -1
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml +1 -1
- cognite_toolkit/_resources/cdf.toml +1 -1
- cognite_toolkit/_version.py +1 -1
- {cognite_toolkit-0.7.39.dist-info → cognite_toolkit-0.7.51.dist-info}/METADATA +13 -3
- cognite_toolkit-0.7.51.dist-info/RECORD +445 -0
- {cognite_toolkit-0.7.39.dist-info → cognite_toolkit-0.7.51.dist-info}/WHEEL +2 -2
- cognite_toolkit/_cdf_tk/client/data_classes/api_classes.py +0 -30
- cognite_toolkit/_cdf_tk/client/data_classes/base.py +0 -67
- cognite_toolkit/_cdf_tk/client/data_classes/three_d.py +0 -112
- cognite_toolkit/_cdf_tk/commands/build_v2/build_issues.py +0 -27
- cognite_toolkit/_cdf_tk/utils/http_client/_data_classes2.py +0 -247
- cognite_toolkit/_cdf_tk/utils/http_client/_exception.py +0 -4
- cognite_toolkit-0.7.39.dist-info/RECORD +0 -322
- /cognite_toolkit/_cdf_tk/{utils → client}/http_client/_tracker.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → request_classes}/__init__.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes/legacy → resource_classes}/__init__.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/capabilities.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/apm_config_v1.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/extendable_cognite_file.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/extended_filemetadata.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/extended_filemetdata.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/extended_timeseries.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/functions.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/graphql_data_models.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/instances.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/location_filters.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/migration.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/pending_instances_ids.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/project.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/raw.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/robotics.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/search_config.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/sequences.py +0 -0
- /cognite_toolkit/_cdf_tk/client/{data_classes → resource_classes}/legacy/streamlit_.py +0 -0
- {cognite_toolkit-0.7.39.dist-info → cognite_toolkit-0.7.51.dist-info}/entry_points.txt +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
from typing import Generic, TypeVar
|
|
2
|
-
|
|
3
|
-
from pydantic import BaseModel, Field, JsonValue
|
|
4
|
-
|
|
5
|
-
from cognite_toolkit._cdf_tk.utils.http_client._data_classes2 import RequestResource
|
|
6
|
-
|
|
7
|
-
T = TypeVar("T", bound=BaseModel)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class PagedResponse(BaseModel, Generic[T]):
|
|
11
|
-
items: list[T]
|
|
12
|
-
next_cursor: str | None = Field(None, alias="nextCursor")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class QueryResponse(BaseModel, Generic[T]):
|
|
16
|
-
items: dict[str, list[T]]
|
|
17
|
-
typing: dict[str, JsonValue] | None = None
|
|
18
|
-
next_cursor: dict[str, str] = Field(alias="nextCursor")
|
|
19
|
-
debug: dict[str, JsonValue] | None = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class InternalIdRequest(RequestResource):
|
|
23
|
-
id: int
|
|
24
|
-
|
|
25
|
-
def as_id(self) -> int:
|
|
26
|
-
return self.id
|
|
27
|
-
|
|
28
|
-
@classmethod
|
|
29
|
-
def from_ids(cls, ids: list[int]) -> list["InternalIdRequest"]:
|
|
30
|
-
return [cls(id=id_) for id_ in ids]
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from abc import ABC, abstractmethod
|
|
3
|
-
from collections import UserList
|
|
4
|
-
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
|
5
|
-
|
|
6
|
-
from pydantic import ConfigDict
|
|
7
|
-
from pydantic.alias_generators import to_camel
|
|
8
|
-
|
|
9
|
-
from cognite_toolkit._cdf_tk.utils.http_client._data_classes2 import BaseModelObject, RequestResource
|
|
10
|
-
|
|
11
|
-
if TYPE_CHECKING:
|
|
12
|
-
from cognite.client import CogniteClient
|
|
13
|
-
|
|
14
|
-
if sys.version_info >= (3, 11):
|
|
15
|
-
from typing import Self
|
|
16
|
-
else:
|
|
17
|
-
from typing_extensions import Self
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
T_RequestResource = TypeVar("T_RequestResource", bound=RequestResource)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class ResponseResource(BaseModelObject, Generic[T_RequestResource], ABC):
|
|
24
|
-
@abstractmethod
|
|
25
|
-
def as_request_resource(self) -> T_RequestResource:
|
|
26
|
-
"""Convert the response resource to a request resource."""
|
|
27
|
-
...
|
|
28
|
-
|
|
29
|
-
def as_write(self) -> T_RequestResource:
|
|
30
|
-
"""Alias for as_request_resource to match protocol signature."""
|
|
31
|
-
return self.as_request_resource()
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class Identifier(RequestResource, ABC):
|
|
35
|
-
"""Base class for all identifier classes."""
|
|
36
|
-
|
|
37
|
-
model_config = ConfigDict(alias_generator=to_camel, extra="ignore", populate_by_name=True, frozen=True)
|
|
38
|
-
|
|
39
|
-
def dump(self, camel_case: bool = True, include_type: bool = True) -> dict[str, Any]:
|
|
40
|
-
"""Dump the resource to a dictionary.
|
|
41
|
-
|
|
42
|
-
This is the default serialization method for request resources.
|
|
43
|
-
"""
|
|
44
|
-
return self.model_dump(mode="json", by_alias=camel_case, exclude_unset=not include_type)
|
|
45
|
-
|
|
46
|
-
def as_id(self) -> Self:
|
|
47
|
-
return self
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
T_Resource = TypeVar("T_Resource", bound=RequestResource | ResponseResource)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class BaseResourceList(UserList[T_Resource]):
|
|
54
|
-
"""Base class for resource lists."""
|
|
55
|
-
|
|
56
|
-
_RESOURCE: type[T_Resource]
|
|
57
|
-
|
|
58
|
-
def __init__(self, initlist: list[T_Resource] | None = None, **_: Any) -> None:
|
|
59
|
-
super().__init__(initlist or [])
|
|
60
|
-
|
|
61
|
-
def dump(self, camel_case: bool = True) -> list[dict[str, Any]]:
|
|
62
|
-
return [item.dump(camel_case) for item in self.data]
|
|
63
|
-
|
|
64
|
-
@classmethod
|
|
65
|
-
def load(cls, data: list[dict[str, Any]], cognite_client: "CogniteClient | None" = None) -> Self:
|
|
66
|
-
items = [cls._RESOURCE.model_validate(item) for item in data]
|
|
67
|
-
return cls(items) # type: ignore[arg-type]
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
from collections.abc import Hashable
|
|
2
|
-
from typing import Literal
|
|
3
|
-
|
|
4
|
-
from pydantic import Field
|
|
5
|
-
|
|
6
|
-
from .base import BaseModelObject, RequestResource, ResponseResource
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class NodeReference(BaseModelObject):
|
|
10
|
-
space: str
|
|
11
|
-
external_id: str
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class RevisionStatus(BaseModelObject):
|
|
15
|
-
status: Literal["Queued", "Processing", "Done", "Failed"] | None = None
|
|
16
|
-
revision_id: int | None = None
|
|
17
|
-
created_time: int | None = None
|
|
18
|
-
revision_count: int | None = None
|
|
19
|
-
types: list[str] | None = None
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class ThreeDModelRequest(RequestResource):
|
|
23
|
-
name: str
|
|
24
|
-
|
|
25
|
-
def as_id(self) -> str:
|
|
26
|
-
return self.name
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class ThreeDModelClassicRequest(ThreeDModelRequest):
|
|
30
|
-
data_set_id: int | None = None
|
|
31
|
-
metadata: dict[str, str] | None = None
|
|
32
|
-
|
|
33
|
-
def as_id(self) -> str:
|
|
34
|
-
return self.name
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class ThreeDModelDMSRequest(ThreeDModelRequest):
|
|
38
|
-
space: str
|
|
39
|
-
type: Literal["CAD", "PointCloud", "Image360"]
|
|
40
|
-
thumbnail_reference: NodeReference | None = None
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class ThreeDModelResponse(ResponseResource[ThreeDModelRequest]):
|
|
44
|
-
name: str
|
|
45
|
-
id: int
|
|
46
|
-
created_time: int
|
|
47
|
-
data_set_id: int | None = None
|
|
48
|
-
metadata: dict[str, str] | None = None
|
|
49
|
-
space: str | None = None
|
|
50
|
-
last_revision_info: RevisionStatus | None = None
|
|
51
|
-
|
|
52
|
-
def as_request_resource(self) -> ThreeDModelRequest:
|
|
53
|
-
if self.space is None:
|
|
54
|
-
return ThreeDModelClassicRequest._load(self.dump())
|
|
55
|
-
else:
|
|
56
|
-
return ThreeDModelDMSRequest._load(self.dump())
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class AssetMappingDMRequest(RequestResource):
|
|
60
|
-
node_id: int
|
|
61
|
-
asset_instance_id: NodeReference
|
|
62
|
-
# These fields are part of the path request and not the body schema.
|
|
63
|
-
model_id: int = Field(exclude=True)
|
|
64
|
-
revision_id: int = Field(exclude=True)
|
|
65
|
-
|
|
66
|
-
def as_id(self) -> Hashable:
|
|
67
|
-
return (
|
|
68
|
-
self.model_id,
|
|
69
|
-
self.revision_id,
|
|
70
|
-
self.node_id,
|
|
71
|
-
self.asset_instance_id.space,
|
|
72
|
-
self.asset_instance_id.external_id,
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class AssetMappingClassicRequest(RequestResource):
|
|
77
|
-
node_id: int
|
|
78
|
-
asset_id: int | None = None
|
|
79
|
-
asset_instance_id: NodeReference | None = None
|
|
80
|
-
# These fields are part of the path request and not the body schema.
|
|
81
|
-
model_id: int = Field(exclude=True)
|
|
82
|
-
revision_id: int = Field(exclude=True)
|
|
83
|
-
|
|
84
|
-
def as_id(self) -> Hashable:
|
|
85
|
-
if self.asset_id:
|
|
86
|
-
return self.model_id, self.revision_id, self.node_id, self.asset_id
|
|
87
|
-
elif self.asset_instance_id:
|
|
88
|
-
return (
|
|
89
|
-
self.model_id,
|
|
90
|
-
self.revision_id,
|
|
91
|
-
self.node_id,
|
|
92
|
-
self.asset_instance_id.space,
|
|
93
|
-
self.asset_instance_id.external_id,
|
|
94
|
-
)
|
|
95
|
-
else:
|
|
96
|
-
raise AttributeError("asset_id or asset_instance_id is required")
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class AssetMappingResponse(ResponseResource[AssetMappingClassicRequest]):
|
|
100
|
-
node_id: int
|
|
101
|
-
asset_id: int | None = None
|
|
102
|
-
asset_instance_id: NodeReference | None = None
|
|
103
|
-
tree_index: int | None = None
|
|
104
|
-
subtree_size: int | None = None
|
|
105
|
-
# These fields are part of the path request and response, but they are included here for convenience.
|
|
106
|
-
model_id: int = Field(exclude=True)
|
|
107
|
-
revision_id: int = Field(exclude=True)
|
|
108
|
-
|
|
109
|
-
def as_request_resource(self) -> AssetMappingClassicRequest:
|
|
110
|
-
return AssetMappingClassicRequest.model_validate(
|
|
111
|
-
{**self.dump(), "modelId": self.model_id, "revisionId": self.revision_id}
|
|
112
|
-
)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
if sys.version_info >= (3, 11):
|
|
4
|
-
from typing import Self
|
|
5
|
-
else:
|
|
6
|
-
from typing_extensions import Self
|
|
7
|
-
|
|
8
|
-
from collections import UserList
|
|
9
|
-
|
|
10
|
-
from pydantic import BaseModel
|
|
11
|
-
|
|
12
|
-
from cognite_toolkit._cdf_tk.tk_warnings import ToolkitWarning, WarningList
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class BuildIssue(BaseModel):
|
|
16
|
-
"""Issue with the build. Can have a recommendation for the user to improve the build."""
|
|
17
|
-
|
|
18
|
-
description: str
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class BuildIssueList(UserList[BuildIssue]):
|
|
22
|
-
"""List of build issues."""
|
|
23
|
-
|
|
24
|
-
@classmethod
|
|
25
|
-
def from_warning_list(cls, warning_list: WarningList[ToolkitWarning]) -> Self:
|
|
26
|
-
"""Create a BuildIssueList from a WarningList."""
|
|
27
|
-
return cls([BuildIssue(description=warning.get_message()) for warning in warning_list])
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import gzip
|
|
2
|
-
import sys
|
|
3
|
-
from abc import ABC, abstractmethod
|
|
4
|
-
from collections import UserList
|
|
5
|
-
from collections.abc import Hashable, Sequence
|
|
6
|
-
from typing import Any, Literal
|
|
7
|
-
|
|
8
|
-
import httpx
|
|
9
|
-
from cognite.client import global_config
|
|
10
|
-
from pydantic import BaseModel, ConfigDict, Field, JsonValue, TypeAdapter, model_validator
|
|
11
|
-
from pydantic.alias_generators import to_camel
|
|
12
|
-
|
|
13
|
-
from cognite_toolkit._cdf_tk.utils.http_client._exception import ToolkitAPIError
|
|
14
|
-
from cognite_toolkit._cdf_tk.utils.http_client._tracker import ItemsRequestTracker
|
|
15
|
-
from cognite_toolkit._cdf_tk.utils.useful_types import PrimitiveType
|
|
16
|
-
|
|
17
|
-
if sys.version_info >= (3, 11):
|
|
18
|
-
from typing import Self
|
|
19
|
-
else:
|
|
20
|
-
from typing_extensions import Self
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class HTTPResult2(BaseModel):
|
|
24
|
-
def get_success_or_raise(self) -> "SuccessResponse2":
|
|
25
|
-
"""Raises an exception if any response in the list indicates a failure."""
|
|
26
|
-
if isinstance(self, SuccessResponse2):
|
|
27
|
-
return self
|
|
28
|
-
elif isinstance(self, FailedResponse2):
|
|
29
|
-
raise ToolkitAPIError(f"Request failed with status code {self.status_code}: {self.error.message}")
|
|
30
|
-
elif isinstance(self, FailedRequest2):
|
|
31
|
-
raise ToolkitAPIError(f"Request failed with error: {self.error}")
|
|
32
|
-
else:
|
|
33
|
-
raise ToolkitAPIError("Unknown HTTPResult2 type")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class FailedRequest2(HTTPResult2):
|
|
37
|
-
error: str
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class SuccessResponse2(HTTPResult2):
|
|
41
|
-
status_code: int
|
|
42
|
-
body: str
|
|
43
|
-
content: bytes
|
|
44
|
-
|
|
45
|
-
@property
|
|
46
|
-
def body_json(self) -> dict[str, Any]:
|
|
47
|
-
"""Parse the response body as JSON."""
|
|
48
|
-
return TypeAdapter(dict[str, JsonValue]).validate_json(self.body)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class ErrorDetails2(BaseModel):
|
|
52
|
-
"""This is the expected structure of error details in the CDF API"""
|
|
53
|
-
|
|
54
|
-
code: int
|
|
55
|
-
message: str
|
|
56
|
-
missing: list[JsonValue] | None = None
|
|
57
|
-
duplicated: list[JsonValue] | None = None
|
|
58
|
-
is_auto_retryable: bool | None = None
|
|
59
|
-
|
|
60
|
-
@classmethod
|
|
61
|
-
def from_response(cls, response: httpx.Response) -> "ErrorDetails2":
|
|
62
|
-
"""Populate the error details from a httpx response."""
|
|
63
|
-
try:
|
|
64
|
-
res = TypeAdapter(dict[Literal["error"], ErrorDetails2]).validate_json(response.text)
|
|
65
|
-
except ValueError:
|
|
66
|
-
return cls(code=response.status_code, message=response.text)
|
|
67
|
-
return res["error"]
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class FailedResponse2(HTTPResult2):
|
|
71
|
-
status_code: int
|
|
72
|
-
body: str
|
|
73
|
-
error: ErrorDetails2
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class BaseRequestMessage(BaseModel, ABC):
|
|
77
|
-
endpoint_url: str
|
|
78
|
-
method: Literal["GET", "POST", "PATCH", "DELETE", "PUT"]
|
|
79
|
-
connect_attempt: int = 0
|
|
80
|
-
read_attempt: int = 0
|
|
81
|
-
status_attempt: int = 0
|
|
82
|
-
api_version: str | None = None
|
|
83
|
-
content_type: str = "application/json"
|
|
84
|
-
accept: str = "application/json"
|
|
85
|
-
|
|
86
|
-
parameters: dict[str, PrimitiveType] | None = None
|
|
87
|
-
|
|
88
|
-
@property
|
|
89
|
-
def total_attempts(self) -> int:
|
|
90
|
-
return self.connect_attempt + self.read_attempt + self.status_attempt
|
|
91
|
-
|
|
92
|
-
@property
|
|
93
|
-
@abstractmethod
|
|
94
|
-
def content(self) -> str | bytes | None: ...
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class RequestMessage2(BaseRequestMessage):
|
|
98
|
-
data_content: bytes | None = None
|
|
99
|
-
body_content: dict[str, JsonValue] | None = None
|
|
100
|
-
|
|
101
|
-
@model_validator(mode="before")
|
|
102
|
-
def check_data_or_body(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
103
|
-
if values.get("data_content") is not None and values.get("body_content") is not None:
|
|
104
|
-
raise ValueError("Only one of data_content or body_content can be set.")
|
|
105
|
-
return values
|
|
106
|
-
|
|
107
|
-
@property
|
|
108
|
-
def content(self) -> str | bytes | None:
|
|
109
|
-
data: str | bytes | None = None
|
|
110
|
-
if self.data_content is not None:
|
|
111
|
-
data = self.data_content
|
|
112
|
-
if not global_config.disable_gzip:
|
|
113
|
-
data = gzip.compress(data)
|
|
114
|
-
elif self.body_content is not None:
|
|
115
|
-
# We serialize using pydantic instead of json.dumps. This is because pydantic is faster
|
|
116
|
-
# and handles more complex types such as datetime, float('nan'), etc.
|
|
117
|
-
data = _BODY_SERIALIZER.dump_json(self.body_content)
|
|
118
|
-
if not global_config.disable_gzip and isinstance(data, bytes):
|
|
119
|
-
data = gzip.compress(data)
|
|
120
|
-
return data
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
_BODY_SERIALIZER = TypeAdapter(dict[str, JsonValue])
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class ItemsResultMessage2(BaseModel):
|
|
127
|
-
ids: list[Hashable]
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
class ItemsFailedRequest2(ItemsResultMessage2):
|
|
131
|
-
error_message: str
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class ItemsSuccessResponse2(ItemsResultMessage2):
|
|
135
|
-
status_code: int
|
|
136
|
-
body: str
|
|
137
|
-
content: bytes
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
class ItemsFailedResponse2(ItemsResultMessage2):
|
|
141
|
-
status_code: int
|
|
142
|
-
error: ErrorDetails2
|
|
143
|
-
body: str
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
class BaseModelObject(BaseModel):
|
|
147
|
-
"""Base class for all object. This includes resources and nested objects."""
|
|
148
|
-
|
|
149
|
-
# We allow extra fields to support forward compatibility.
|
|
150
|
-
model_config = ConfigDict(alias_generator=to_camel, extra="allow")
|
|
151
|
-
|
|
152
|
-
def dump(self, camel_case: bool = True) -> dict[str, Any]:
|
|
153
|
-
"""Dump the resource to a dictionary.
|
|
154
|
-
|
|
155
|
-
This is the default serialization method for request resources.
|
|
156
|
-
"""
|
|
157
|
-
return self.model_dump(mode="json", by_alias=camel_case, exclude_unset=True)
|
|
158
|
-
|
|
159
|
-
@classmethod
|
|
160
|
-
def _load(cls, resource: dict[str, Any]) -> "Self":
|
|
161
|
-
"""Load method to match CogniteResource signature."""
|
|
162
|
-
return cls.model_validate(resource)
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
class RequestResource(BaseModelObject, ABC):
|
|
166
|
-
@abstractmethod
|
|
167
|
-
def as_id(self) -> Hashable: ...
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
def _set_default_tracker(data: dict[str, Any]) -> ItemsRequestTracker:
|
|
171
|
-
if "tracker" not in data or data["tracker"] is None:
|
|
172
|
-
return ItemsRequestTracker(data.get("max_failures_before_abort", 50))
|
|
173
|
-
return data["tracker"]
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
class ItemsRequest2(BaseRequestMessage):
|
|
177
|
-
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
178
|
-
items: Sequence[RequestResource]
|
|
179
|
-
extra_body_fields: dict[str, JsonValue] | None = None
|
|
180
|
-
max_failures_before_abort: int = 50
|
|
181
|
-
tracker: ItemsRequestTracker = Field(init=False, default_factory=_set_default_tracker, exclude=True)
|
|
182
|
-
|
|
183
|
-
@property
|
|
184
|
-
def content(self) -> str | bytes | None:
|
|
185
|
-
body: dict[str, JsonValue] = {"items": [item.dump() for item in self.items]}
|
|
186
|
-
if self.extra_body_fields:
|
|
187
|
-
body.update(self.extra_body_fields)
|
|
188
|
-
res = _BODY_SERIALIZER.dump_json(body)
|
|
189
|
-
if not global_config.disable_gzip and isinstance(res, bytes):
|
|
190
|
-
return gzip.compress(res)
|
|
191
|
-
return res
|
|
192
|
-
|
|
193
|
-
def split(self, status_attempts: int) -> list["ItemsRequest2"]:
|
|
194
|
-
"""Split the request into multiple requests with a single item each."""
|
|
195
|
-
mid = len(self.items) // 2
|
|
196
|
-
if mid == 0:
|
|
197
|
-
return [self]
|
|
198
|
-
self.tracker.register_failure()
|
|
199
|
-
messages: list[ItemsRequest2] = []
|
|
200
|
-
for part in (self.items[:mid], self.items[mid:]):
|
|
201
|
-
new_request = self.model_copy(update={"items": part, "status_attempt": status_attempts})
|
|
202
|
-
new_request.tracker = self.tracker
|
|
203
|
-
messages.append(new_request)
|
|
204
|
-
return messages
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
class ItemResponse(BaseModel):
|
|
208
|
-
items: list[dict[str, JsonValue]]
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
class ItemsResultList(UserList[ItemsResultMessage2]):
|
|
212
|
-
def __init__(self, collection: Sequence[ItemsResultMessage2] | None = None) -> None:
|
|
213
|
-
super().__init__(collection or [])
|
|
214
|
-
|
|
215
|
-
def raise_for_status(self) -> None:
|
|
216
|
-
"""Raises an exception if any response in the list indicates a failure."""
|
|
217
|
-
failed_responses = [resp for resp in self.data if isinstance(resp, ItemsFailedResponse2)]
|
|
218
|
-
failed_requests = [resp for resp in self.data if isinstance(resp, ItemsFailedRequest2)]
|
|
219
|
-
if not failed_responses and not failed_requests:
|
|
220
|
-
return
|
|
221
|
-
error_messages = "; ".join(f"Status {err.status_code}: {err.error.message}" for err in failed_responses)
|
|
222
|
-
if failed_requests:
|
|
223
|
-
if error_messages:
|
|
224
|
-
error_messages += "; "
|
|
225
|
-
error_messages += "; ".join(f"Request error: {err.error_message}" for err in failed_requests)
|
|
226
|
-
raise ToolkitAPIError(f"One or more requests failed: {error_messages}")
|
|
227
|
-
|
|
228
|
-
@property
|
|
229
|
-
def has_failed(self) -> bool:
|
|
230
|
-
"""Indicates whether any response in the list indicates a failure.
|
|
231
|
-
|
|
232
|
-
Returns:
|
|
233
|
-
bool: True if there are any failed responses or requests, False otherwise.
|
|
234
|
-
"""
|
|
235
|
-
for resp in self.data:
|
|
236
|
-
if isinstance(resp, ItemsFailedResponse2 | ItemsFailedRequest2):
|
|
237
|
-
return True
|
|
238
|
-
return False
|
|
239
|
-
|
|
240
|
-
def get_items(self) -> list[dict[str, JsonValue]]:
|
|
241
|
-
"""Get the items from all successful responses."""
|
|
242
|
-
items: list[dict[str, JsonValue]] = []
|
|
243
|
-
for resp in self.data:
|
|
244
|
-
if isinstance(resp, ItemsSuccessResponse2):
|
|
245
|
-
body_json = ItemResponse.model_validate_json(resp.body)
|
|
246
|
-
items.extend(body_json.items)
|
|
247
|
-
return items
|