step_rest_client 1.0.0__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.
- step_rest_client/__init__.py +136 -0
- step_rest_client/api/__init__.py +26 -0
- step_rest_client/api/assets_api.py +7960 -0
- step_rest_client/api/attributes_api.py +340 -0
- step_rest_client/api/background_process_types_api.py +640 -0
- step_rest_client/api/background_processes_api.py +1577 -0
- step_rest_client/api/classifications_api.py +7991 -0
- step_rest_client/api/data_container_types_api.py +340 -0
- step_rest_client/api/data_type_groups_api.py +340 -0
- step_rest_client/api/entities_api.py +8680 -0
- step_rest_client/api/event_processors_api.py +3337 -0
- step_rest_client/api/export_api.py +383 -0
- step_rest_client/api/gateway_integration_endpoints_api.py +1232 -0
- step_rest_client/api/import_api.py +390 -0
- step_rest_client/api/inbound_integration_endpoints_api.py +2815 -0
- step_rest_client/api/lists_of_values_api.py +642 -0
- step_rest_client/api/object_types_api.py +340 -0
- step_rest_client/api/outbound_integration_endpoints_api.py +3655 -0
- step_rest_client/api/products_api.py +8007 -0
- step_rest_client/api/reference_types_api.py +340 -0
- step_rest_client/api/reporting_api.py +707 -0
- step_rest_client/api/units_api.py +340 -0
- step_rest_client/api/workflow_tasks_api.py +1887 -0
- step_rest_client/api/workflows_api.py +1270 -0
- step_rest_client/api_client.py +797 -0
- step_rest_client/api_response.py +21 -0
- step_rest_client/configuration.py +597 -0
- step_rest_client/exceptions.py +216 -0
- step_rest_client/models/__init__.py +98 -0
- step_rest_client/models/amount.py +89 -0
- step_rest_client/models/and_condition.py +107 -0
- step_rest_client/models/approval_response.py +87 -0
- step_rest_client/models/approval_status.py +99 -0
- step_rest_client/models/asset.py +129 -0
- step_rest_client/models/attribute.py +120 -0
- step_rest_client/models/attribute_link.py +102 -0
- step_rest_client/models/background_process.py +139 -0
- step_rest_client/models/background_process_attachment_metadata.py +105 -0
- step_rest_client/models/background_process_identification.py +89 -0
- step_rest_client/models/background_process_type.py +89 -0
- step_rest_client/models/classification.py +135 -0
- step_rest_client/models/condition.py +265 -0
- step_rest_client/models/data_container.py +139 -0
- step_rest_client/models/data_container_entry.py +117 -0
- step_rest_client/models/data_container_object_condition.py +181 -0
- step_rest_client/models/data_container_type.py +106 -0
- step_rest_client/models/data_type_group.py +108 -0
- step_rest_client/models/endpoint_statistics.py +109 -0
- step_rest_client/models/endpoint_status.py +99 -0
- step_rest_client/models/entity.py +142 -0
- step_rest_client/models/error.py +91 -0
- step_rest_client/models/event_processor.py +93 -0
- step_rest_client/models/event_processor_statistics.py +97 -0
- step_rest_client/models/event_processor_status.py +99 -0
- step_rest_client/models/event_queue_status.py +89 -0
- step_rest_client/models/execution_report_entry.py +103 -0
- step_rest_client/models/export_specification.py +89 -0
- step_rest_client/models/find_similar_business_rule_result.py +91 -0
- step_rest_client/models/find_similar_entities_request.py +95 -0
- step_rest_client/models/find_similar_entities_response.py +103 -0
- step_rest_client/models/find_similar_entities_response_record.py +95 -0
- step_rest_client/models/find_similar_execution_report.py +103 -0
- step_rest_client/models/gateway_integration_endpoint.py +93 -0
- step_rest_client/models/has_data_container_object_condition.py +106 -0
- step_rest_client/models/has_reference_to_condition.py +108 -0
- step_rest_client/models/id_condition.py +105 -0
- step_rest_client/models/inbound_integration_endpoint.py +93 -0
- step_rest_client/models/incoming_reference_entry.py +118 -0
- step_rest_client/models/list_of_values.py +110 -0
- step_rest_client/models/list_of_values_entry.py +91 -0
- step_rest_client/models/lov_value_condition.py +100 -0
- step_rest_client/models/match_and_merge_execution_report.py +119 -0
- step_rest_client/models/match_and_merge_general_execution_report.py +91 -0
- step_rest_client/models/match_and_merge_potential_duplicate.py +93 -0
- step_rest_client/models/match_and_merge_record_in.py +95 -0
- step_rest_client/models/match_and_merge_record_out.py +117 -0
- step_rest_client/models/match_and_merge_response.py +103 -0
- step_rest_client/models/multi_data_container.py +101 -0
- step_rest_client/models/multi_reference.py +97 -0
- step_rest_client/models/multi_value.py +103 -0
- step_rest_client/models/name_condition.py +107 -0
- step_rest_client/models/numeric_value_condition.py +111 -0
- step_rest_client/models/object_type.py +104 -0
- step_rest_client/models/object_type_condition.py +96 -0
- step_rest_client/models/or_condition.py +107 -0
- step_rest_client/models/outbound_integration_endpoint.py +93 -0
- step_rest_client/models/product.py +150 -0
- step_rest_client/models/query.py +91 -0
- step_rest_client/models/query_result.py +99 -0
- step_rest_client/models/reference.py +139 -0
- step_rest_client/models/reference_entry.py +141 -0
- step_rest_client/models/reference_metadata_condition.py +181 -0
- step_rest_client/models/reference_type.py +114 -0
- step_rest_client/models/rejected_by_business_condition.py +93 -0
- step_rest_client/models/simple_below_condition.py +105 -0
- step_rest_client/models/single_data_container.py +97 -0
- step_rest_client/models/single_reference.py +93 -0
- step_rest_client/models/single_value.py +103 -0
- step_rest_client/models/status_flag.py +89 -0
- step_rest_client/models/text_value_condition.py +111 -0
- step_rest_client/models/trigger_workflow_event.py +93 -0
- step_rest_client/models/unit.py +104 -0
- step_rest_client/models/value.py +137 -0
- step_rest_client/models/value_entry.py +91 -0
- step_rest_client/models/workflow.py +91 -0
- step_rest_client/models/workflow_event.py +89 -0
- step_rest_client/models/workflow_instance.py +87 -0
- step_rest_client/models/workflow_instance_creation.py +93 -0
- step_rest_client/models/workflow_node.py +99 -0
- step_rest_client/models/workflow_task.py +113 -0
- step_rest_client/models/workflow_task_query.py +101 -0
- step_rest_client/py.typed +0 -0
- step_rest_client/rest.py +258 -0
- step_rest_client-1.0.0.dist-info/METADATA +23 -0
- step_rest_client-1.0.0.dist-info/RECORD +117 -0
- step_rest_client-1.0.0.dist-info/WHEEL +5 -0
- step_rest_client-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,265 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
STEP REST API V2
|
5
|
+
|
6
|
+
<h1>About</h1><p>The STEP REST API V2 provides read and write access to a set of core STEP objects using the HTTP operations GET, PUT, POST, PATCH and DELETE.</p><h1>Resource Representation</h1><p>With the exception of a few resource operations for retrieving and uploading binary data, all request and response bodies are JSON, compliant with the schema documented here.</p><h1>Context and Workspace</h1><p>All requests are handled in a specific STEP context and workspace and both can be specified via query parameters available for all resource operations. A context must always be specified while requests per default will be handled in the "Main" workspace.</p><h1>Polymorphism</h1><p>In STEP, attributes, reference types and data container types can all be either single- or multivalued. The STEP REST API V2 uses polymorphism to address this complexity with resources that include values, references and data containers specified to produce and consume a common "abstract" supertype that always will be one of either the single- or multivalued subtype.<br/>As an example, the GET /entities/{id}/values/{attributeId} resource operation is specified to return a "Value" but as evident from the model, the "Value" will always be "oneOf" either "SingleValue", that has a "value" property for which the value is an object, or "MultiValue", that has a "values" property for which the value is an array.<br/>Clients are advised to use the presence or absence of the plural array property ("values", "references" and "dataContainers") to determine the concrete type.</p><h1>Authentication</h1><p>The REST API is protected by HTTP Basic Authentication or if OAuth2-based authentication is enabled (SaaS customers only), by Bearer Authentication. With Basic Authentication, user name and password are supplied with each request and it is therefore highly recommended to only use the API in conjunction with HTTPS. For more information about OAuth2-based authentication for SaaS customers, please see the STEP Authentication Guide.</p><h1>Versioning</h1><p>The STEP REST API V2 is versioned using semantic versioning. Stibo Systems reserve the right to make non-breaking, minor / patch changes in any release without warning and clients must be coded / configured to be 'tolerant' and capable of handling such changes.</p><p>Examples of breaking, major changes:</p><ul><li>Renaming of a property</li><li>Removal of a property</li><li>Property type change</li><li>Addition of new property required for write operations</li><li>Marking existing property as required for write operations</li><li>Removal of resource or resource operation</li><li>Materially different behavior for existing resource operation</li></ul><p>Examples of non-breaking, minor / patch changes:</p><ul><li>Addition of new properties in request responses</li><li>Addition of new query parameter not required for write operations</li><li>Addition of new resource or resource operation</li><li>Bug fixes that do not change the schema or resource operations as described here</li><li>Inclusion of a response body for resource operations specified to return a 200 response with no body</li><li>Change of response "Model" / "schema" to type extending the previously specified type</li><li>Renaming a "Model" / "schema" type</li></ul><p>In addition, error message texts may change without warning within the same version. Client program logic should not depend upon the message content.</p><h1>Error Handling</h1><p>The STEP REST API V2 responds with standard HTTP status codes, with 2** responses indicating a success, 4** responses indicating a client error and 5** indicating a server error. Notice that this specification does not specify common error responses like 500 (internal server error) or 401 (unauthorized) for the individual resource operations. Clients should however be capable of handling such responses.</p><p>Error responses have a JSON response body (see Error schema below) containing HTTP status code information in addition to a message providing details about the error. As mentioned above, client program logic should not depend upon the message content.</p><p>The specific status codes used in the API are:</p><ul><li>200 (OK): Success, response may or may not have a body</li><li>201 (Created): Entity successfully created, response may or may not have a body</li><li>400 (Bad request): The server cannot or will not process the request due to an apparent client error</li><li>401 (Unauthorized): Returned only in relation to failed authentication</li><li>404 (Not Found): Returned only in relation to objects specified via path parameters (variable parts of the URL). If STEP objects referenced in request bodies or via query parameters cannot be found, the response will be 400.</li><li>429 (Too Many Requests): Clients are per default limited to 100 requests per second. Returned if the rate limit is exceeded.</li><li>500 (Internal Server Error): Unexpected error (could potentially cover an issue that rightfully should be a 400)</li></ul>
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.3.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
import pprint
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
19
|
+
from typing import Any, List, Optional
|
20
|
+
from step_rest_client.models.id_condition import IdCondition
|
21
|
+
from step_rest_client.models.lov_value_condition import LovValueCondition
|
22
|
+
from step_rest_client.models.name_condition import NameCondition
|
23
|
+
from step_rest_client.models.numeric_value_condition import NumericValueCondition
|
24
|
+
from step_rest_client.models.object_type_condition import ObjectTypeCondition
|
25
|
+
from step_rest_client.models.simple_below_condition import SimpleBelowCondition
|
26
|
+
from step_rest_client.models.text_value_condition import TextValueCondition
|
27
|
+
from pydantic import StrictStr, Field
|
28
|
+
from typing import Union, List, Set, Optional, Dict
|
29
|
+
from typing_extensions import Literal, Self
|
30
|
+
|
31
|
+
CONDITION_ONE_OF_SCHEMAS = ["AndCondition", "HasDataContainerObjectCondition", "HasReferenceToCondition", "IdCondition", "LovValueCondition", "NameCondition", "NumericValueCondition", "ObjectTypeCondition", "OrCondition", "SimpleBelowCondition", "TextValueCondition"]
|
32
|
+
|
33
|
+
class Condition(BaseModel):
|
34
|
+
"""
|
35
|
+
An \"abstract\" representation of a condition. Must always either be an AndCondition, an OrCondition, an IdCondition, a NameCondition, a TextValueCondition, a NumericValueCondition, an ObjectTypeCondition, a SimpleBelowCondition, an LovValueCondition, a HasReferenceToCondition or a HasDataContainerObjectCondition.
|
36
|
+
"""
|
37
|
+
# data type: AndCondition
|
38
|
+
oneof_schema_1_validator: Optional[AndCondition] = None
|
39
|
+
# data type: OrCondition
|
40
|
+
oneof_schema_2_validator: Optional[OrCondition] = None
|
41
|
+
# data type: IdCondition
|
42
|
+
oneof_schema_3_validator: Optional[IdCondition] = None
|
43
|
+
# data type: NameCondition
|
44
|
+
oneof_schema_4_validator: Optional[NameCondition] = None
|
45
|
+
# data type: TextValueCondition
|
46
|
+
oneof_schema_5_validator: Optional[TextValueCondition] = None
|
47
|
+
# data type: NumericValueCondition
|
48
|
+
oneof_schema_6_validator: Optional[NumericValueCondition] = None
|
49
|
+
# data type: ObjectTypeCondition
|
50
|
+
oneof_schema_7_validator: Optional[ObjectTypeCondition] = None
|
51
|
+
# data type: SimpleBelowCondition
|
52
|
+
oneof_schema_8_validator: Optional[SimpleBelowCondition] = None
|
53
|
+
# data type: LovValueCondition
|
54
|
+
oneof_schema_9_validator: Optional[LovValueCondition] = None
|
55
|
+
# data type: HasReferenceToCondition
|
56
|
+
oneof_schema_10_validator: Optional[HasReferenceToCondition] = None
|
57
|
+
# data type: HasDataContainerObjectCondition
|
58
|
+
oneof_schema_11_validator: Optional[HasDataContainerObjectCondition] = None
|
59
|
+
actual_instance: Optional[Union[AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition]] = None
|
60
|
+
one_of_schemas: Set[str] = { "AndCondition", "HasDataContainerObjectCondition", "HasReferenceToCondition", "IdCondition", "LovValueCondition", "NameCondition", "NumericValueCondition", "ObjectTypeCondition", "OrCondition", "SimpleBelowCondition", "TextValueCondition" }
|
61
|
+
|
62
|
+
model_config = ConfigDict(
|
63
|
+
validate_assignment=True,
|
64
|
+
protected_namespaces=(),
|
65
|
+
)
|
66
|
+
|
67
|
+
|
68
|
+
def __init__(self, *args, **kwargs) -> None:
|
69
|
+
if args:
|
70
|
+
if len(args) > 1:
|
71
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
72
|
+
if kwargs:
|
73
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
74
|
+
super().__init__(actual_instance=args[0])
|
75
|
+
else:
|
76
|
+
super().__init__(**kwargs)
|
77
|
+
|
78
|
+
@field_validator('actual_instance')
|
79
|
+
def actual_instance_must_validate_oneof(cls, v):
|
80
|
+
instance = Condition.model_construct()
|
81
|
+
error_messages = []
|
82
|
+
match = 0
|
83
|
+
# validate data type: AndCondition
|
84
|
+
if not isinstance(v, AndCondition):
|
85
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AndCondition`")
|
86
|
+
else:
|
87
|
+
match += 1
|
88
|
+
# validate data type: OrCondition
|
89
|
+
if not isinstance(v, OrCondition):
|
90
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OrCondition`")
|
91
|
+
else:
|
92
|
+
match += 1
|
93
|
+
# validate data type: IdCondition
|
94
|
+
if not isinstance(v, IdCondition):
|
95
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `IdCondition`")
|
96
|
+
else:
|
97
|
+
match += 1
|
98
|
+
# validate data type: NameCondition
|
99
|
+
if not isinstance(v, NameCondition):
|
100
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NameCondition`")
|
101
|
+
else:
|
102
|
+
match += 1
|
103
|
+
# validate data type: TextValueCondition
|
104
|
+
if not isinstance(v, TextValueCondition):
|
105
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextValueCondition`")
|
106
|
+
else:
|
107
|
+
match += 1
|
108
|
+
# validate data type: NumericValueCondition
|
109
|
+
if not isinstance(v, NumericValueCondition):
|
110
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NumericValueCondition`")
|
111
|
+
else:
|
112
|
+
match += 1
|
113
|
+
# validate data type: ObjectTypeCondition
|
114
|
+
if not isinstance(v, ObjectTypeCondition):
|
115
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ObjectTypeCondition`")
|
116
|
+
else:
|
117
|
+
match += 1
|
118
|
+
# validate data type: SimpleBelowCondition
|
119
|
+
if not isinstance(v, SimpleBelowCondition):
|
120
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleBelowCondition`")
|
121
|
+
else:
|
122
|
+
match += 1
|
123
|
+
# validate data type: LovValueCondition
|
124
|
+
if not isinstance(v, LovValueCondition):
|
125
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LovValueCondition`")
|
126
|
+
else:
|
127
|
+
match += 1
|
128
|
+
# validate data type: HasReferenceToCondition
|
129
|
+
if not isinstance(v, HasReferenceToCondition):
|
130
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `HasReferenceToCondition`")
|
131
|
+
else:
|
132
|
+
match += 1
|
133
|
+
# validate data type: HasDataContainerObjectCondition
|
134
|
+
if not isinstance(v, HasDataContainerObjectCondition):
|
135
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `HasDataContainerObjectCondition`")
|
136
|
+
else:
|
137
|
+
match += 1
|
138
|
+
if match > 1:
|
139
|
+
# more than 1 match
|
140
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in Condition with oneOf schemas: AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition. Details: " + ", ".join(error_messages))
|
141
|
+
elif match == 0:
|
142
|
+
# no match
|
143
|
+
raise ValueError("No match found when setting `actual_instance` in Condition with oneOf schemas: AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition. Details: " + ", ".join(error_messages))
|
144
|
+
else:
|
145
|
+
return v
|
146
|
+
|
147
|
+
@classmethod
|
148
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
149
|
+
return cls.from_json(json.dumps(obj))
|
150
|
+
|
151
|
+
@classmethod
|
152
|
+
def from_json(cls, json_str: str) -> Self:
|
153
|
+
"""Returns the object represented by the json string"""
|
154
|
+
instance = cls.model_construct()
|
155
|
+
error_messages = []
|
156
|
+
match = 0
|
157
|
+
|
158
|
+
# deserialize data into AndCondition
|
159
|
+
try:
|
160
|
+
instance.actual_instance = AndCondition.from_json(json_str)
|
161
|
+
match += 1
|
162
|
+
except (ValidationError, ValueError) as e:
|
163
|
+
error_messages.append(str(e))
|
164
|
+
# deserialize data into OrCondition
|
165
|
+
try:
|
166
|
+
instance.actual_instance = OrCondition.from_json(json_str)
|
167
|
+
match += 1
|
168
|
+
except (ValidationError, ValueError) as e:
|
169
|
+
error_messages.append(str(e))
|
170
|
+
# deserialize data into IdCondition
|
171
|
+
try:
|
172
|
+
instance.actual_instance = IdCondition.from_json(json_str)
|
173
|
+
match += 1
|
174
|
+
except (ValidationError, ValueError) as e:
|
175
|
+
error_messages.append(str(e))
|
176
|
+
# deserialize data into NameCondition
|
177
|
+
try:
|
178
|
+
instance.actual_instance = NameCondition.from_json(json_str)
|
179
|
+
match += 1
|
180
|
+
except (ValidationError, ValueError) as e:
|
181
|
+
error_messages.append(str(e))
|
182
|
+
# deserialize data into TextValueCondition
|
183
|
+
try:
|
184
|
+
instance.actual_instance = TextValueCondition.from_json(json_str)
|
185
|
+
match += 1
|
186
|
+
except (ValidationError, ValueError) as e:
|
187
|
+
error_messages.append(str(e))
|
188
|
+
# deserialize data into NumericValueCondition
|
189
|
+
try:
|
190
|
+
instance.actual_instance = NumericValueCondition.from_json(json_str)
|
191
|
+
match += 1
|
192
|
+
except (ValidationError, ValueError) as e:
|
193
|
+
error_messages.append(str(e))
|
194
|
+
# deserialize data into ObjectTypeCondition
|
195
|
+
try:
|
196
|
+
instance.actual_instance = ObjectTypeCondition.from_json(json_str)
|
197
|
+
match += 1
|
198
|
+
except (ValidationError, ValueError) as e:
|
199
|
+
error_messages.append(str(e))
|
200
|
+
# deserialize data into SimpleBelowCondition
|
201
|
+
try:
|
202
|
+
instance.actual_instance = SimpleBelowCondition.from_json(json_str)
|
203
|
+
match += 1
|
204
|
+
except (ValidationError, ValueError) as e:
|
205
|
+
error_messages.append(str(e))
|
206
|
+
# deserialize data into LovValueCondition
|
207
|
+
try:
|
208
|
+
instance.actual_instance = LovValueCondition.from_json(json_str)
|
209
|
+
match += 1
|
210
|
+
except (ValidationError, ValueError) as e:
|
211
|
+
error_messages.append(str(e))
|
212
|
+
# deserialize data into HasReferenceToCondition
|
213
|
+
try:
|
214
|
+
instance.actual_instance = HasReferenceToCondition.from_json(json_str)
|
215
|
+
match += 1
|
216
|
+
except (ValidationError, ValueError) as e:
|
217
|
+
error_messages.append(str(e))
|
218
|
+
# deserialize data into HasDataContainerObjectCondition
|
219
|
+
try:
|
220
|
+
instance.actual_instance = HasDataContainerObjectCondition.from_json(json_str)
|
221
|
+
match += 1
|
222
|
+
except (ValidationError, ValueError) as e:
|
223
|
+
error_messages.append(str(e))
|
224
|
+
|
225
|
+
if match > 1:
|
226
|
+
# more than 1 match
|
227
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into Condition with oneOf schemas: AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition. Details: " + ", ".join(error_messages))
|
228
|
+
elif match == 0:
|
229
|
+
# no match
|
230
|
+
raise ValueError("No match found when deserializing the JSON string into Condition with oneOf schemas: AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition. Details: " + ", ".join(error_messages))
|
231
|
+
else:
|
232
|
+
return instance
|
233
|
+
|
234
|
+
def to_json(self) -> str:
|
235
|
+
"""Returns the JSON representation of the actual instance"""
|
236
|
+
if self.actual_instance is None:
|
237
|
+
return "null"
|
238
|
+
|
239
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
240
|
+
return self.actual_instance.to_json()
|
241
|
+
else:
|
242
|
+
return json.dumps(self.actual_instance)
|
243
|
+
|
244
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AndCondition, HasDataContainerObjectCondition, HasReferenceToCondition, IdCondition, LovValueCondition, NameCondition, NumericValueCondition, ObjectTypeCondition, OrCondition, SimpleBelowCondition, TextValueCondition]]:
|
245
|
+
"""Returns the dict representation of the actual instance"""
|
246
|
+
if self.actual_instance is None:
|
247
|
+
return None
|
248
|
+
|
249
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
250
|
+
return self.actual_instance.to_dict()
|
251
|
+
else:
|
252
|
+
# primitive type
|
253
|
+
return self.actual_instance
|
254
|
+
|
255
|
+
def to_str(self) -> str:
|
256
|
+
"""Returns the string representation of the actual instance"""
|
257
|
+
return pprint.pformat(self.model_dump())
|
258
|
+
|
259
|
+
from step_rest_client.models.and_condition import AndCondition
|
260
|
+
from step_rest_client.models.has_data_container_object_condition import HasDataContainerObjectCondition
|
261
|
+
from step_rest_client.models.has_reference_to_condition import HasReferenceToCondition
|
262
|
+
from step_rest_client.models.or_condition import OrCondition
|
263
|
+
# TODO: Rewrite to not use raise_errors
|
264
|
+
Condition.model_rebuild(raise_errors=False)
|
265
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
STEP REST API V2
|
5
|
+
|
6
|
+
<h1>About</h1><p>The STEP REST API V2 provides read and write access to a set of core STEP objects using the HTTP operations GET, PUT, POST, PATCH and DELETE.</p><h1>Resource Representation</h1><p>With the exception of a few resource operations for retrieving and uploading binary data, all request and response bodies are JSON, compliant with the schema documented here.</p><h1>Context and Workspace</h1><p>All requests are handled in a specific STEP context and workspace and both can be specified via query parameters available for all resource operations. A context must always be specified while requests per default will be handled in the "Main" workspace.</p><h1>Polymorphism</h1><p>In STEP, attributes, reference types and data container types can all be either single- or multivalued. The STEP REST API V2 uses polymorphism to address this complexity with resources that include values, references and data containers specified to produce and consume a common "abstract" supertype that always will be one of either the single- or multivalued subtype.<br/>As an example, the GET /entities/{id}/values/{attributeId} resource operation is specified to return a "Value" but as evident from the model, the "Value" will always be "oneOf" either "SingleValue", that has a "value" property for which the value is an object, or "MultiValue", that has a "values" property for which the value is an array.<br/>Clients are advised to use the presence or absence of the plural array property ("values", "references" and "dataContainers") to determine the concrete type.</p><h1>Authentication</h1><p>The REST API is protected by HTTP Basic Authentication or if OAuth2-based authentication is enabled (SaaS customers only), by Bearer Authentication. With Basic Authentication, user name and password are supplied with each request and it is therefore highly recommended to only use the API in conjunction with HTTPS. For more information about OAuth2-based authentication for SaaS customers, please see the STEP Authentication Guide.</p><h1>Versioning</h1><p>The STEP REST API V2 is versioned using semantic versioning. Stibo Systems reserve the right to make non-breaking, minor / patch changes in any release without warning and clients must be coded / configured to be 'tolerant' and capable of handling such changes.</p><p>Examples of breaking, major changes:</p><ul><li>Renaming of a property</li><li>Removal of a property</li><li>Property type change</li><li>Addition of new property required for write operations</li><li>Marking existing property as required for write operations</li><li>Removal of resource or resource operation</li><li>Materially different behavior for existing resource operation</li></ul><p>Examples of non-breaking, minor / patch changes:</p><ul><li>Addition of new properties in request responses</li><li>Addition of new query parameter not required for write operations</li><li>Addition of new resource or resource operation</li><li>Bug fixes that do not change the schema or resource operations as described here</li><li>Inclusion of a response body for resource operations specified to return a 200 response with no body</li><li>Change of response "Model" / "schema" to type extending the previously specified type</li><li>Renaming a "Model" / "schema" type</li></ul><p>In addition, error message texts may change without warning within the same version. Client program logic should not depend upon the message content.</p><h1>Error Handling</h1><p>The STEP REST API V2 responds with standard HTTP status codes, with 2** responses indicating a success, 4** responses indicating a client error and 5** indicating a server error. Notice that this specification does not specify common error responses like 500 (internal server error) or 401 (unauthorized) for the individual resource operations. Clients should however be capable of handling such responses.</p><p>Error responses have a JSON response body (see Error schema below) containing HTTP status code information in addition to a message providing details about the error. As mentioned above, client program logic should not depend upon the message content.</p><p>The specific status codes used in the API are:</p><ul><li>200 (OK): Success, response may or may not have a body</li><li>201 (Created): Entity successfully created, response may or may not have a body</li><li>400 (Bad request): The server cannot or will not process the request due to an apparent client error</li><li>401 (Unauthorized): Returned only in relation to failed authentication</li><li>404 (Not Found): Returned only in relation to objects specified via path parameters (variable parts of the URL). If STEP objects referenced in request bodies or via query parameters cannot be found, the response will be 400.</li><li>429 (Too Many Requests): Clients are per default limited to 100 requests per second. Returned if the rate limit is exceeded.</li><li>500 (Internal Server Error): Unexpected error (could potentially cover an issue that rightfully should be a 400)</li></ul>
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.3.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
import pprint
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
19
|
+
from typing import Any, List, Optional
|
20
|
+
from pydantic import StrictStr, Field
|
21
|
+
from typing import Union, List, Set, Optional, Dict
|
22
|
+
from typing_extensions import Literal, Self
|
23
|
+
|
24
|
+
DATACONTAINER_ONE_OF_SCHEMAS = ["MultiDataContainer", "SingleDataContainer"]
|
25
|
+
|
26
|
+
class DataContainer(BaseModel):
|
27
|
+
"""
|
28
|
+
An \"abstract\" representation of a data container. Will always either be a SingleDataContainer or a MultiDataContainer depending on whether the data container type is multivalued.
|
29
|
+
"""
|
30
|
+
# data type: SingleDataContainer
|
31
|
+
oneof_schema_1_validator: Optional[SingleDataContainer] = None
|
32
|
+
# data type: MultiDataContainer
|
33
|
+
oneof_schema_2_validator: Optional[MultiDataContainer] = None
|
34
|
+
actual_instance: Optional[Union[MultiDataContainer, SingleDataContainer]] = None
|
35
|
+
one_of_schemas: Set[str] = { "MultiDataContainer", "SingleDataContainer" }
|
36
|
+
|
37
|
+
model_config = ConfigDict(
|
38
|
+
validate_assignment=True,
|
39
|
+
protected_namespaces=(),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def __init__(self, *args, **kwargs) -> None:
|
44
|
+
if args:
|
45
|
+
if len(args) > 1:
|
46
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
47
|
+
if kwargs:
|
48
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
49
|
+
super().__init__(actual_instance=args[0])
|
50
|
+
else:
|
51
|
+
super().__init__(**kwargs)
|
52
|
+
|
53
|
+
@field_validator('actual_instance')
|
54
|
+
def actual_instance_must_validate_oneof(cls, v):
|
55
|
+
instance = DataContainer.model_construct()
|
56
|
+
error_messages = []
|
57
|
+
match = 0
|
58
|
+
# validate data type: SingleDataContainer
|
59
|
+
if not isinstance(v, SingleDataContainer):
|
60
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `SingleDataContainer`")
|
61
|
+
else:
|
62
|
+
match += 1
|
63
|
+
# validate data type: MultiDataContainer
|
64
|
+
if not isinstance(v, MultiDataContainer):
|
65
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiDataContainer`")
|
66
|
+
else:
|
67
|
+
match += 1
|
68
|
+
if match > 1:
|
69
|
+
# more than 1 match
|
70
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in DataContainer with oneOf schemas: MultiDataContainer, SingleDataContainer. Details: " + ", ".join(error_messages))
|
71
|
+
elif match == 0:
|
72
|
+
# no match
|
73
|
+
raise ValueError("No match found when setting `actual_instance` in DataContainer with oneOf schemas: MultiDataContainer, SingleDataContainer. Details: " + ", ".join(error_messages))
|
74
|
+
else:
|
75
|
+
return v
|
76
|
+
|
77
|
+
@classmethod
|
78
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
79
|
+
return cls.from_json(json.dumps(obj))
|
80
|
+
|
81
|
+
@classmethod
|
82
|
+
def from_json(cls, json_str: str) -> Self:
|
83
|
+
"""Returns the object represented by the json string"""
|
84
|
+
instance = cls.model_construct()
|
85
|
+
error_messages = []
|
86
|
+
match = 0
|
87
|
+
|
88
|
+
# deserialize data into SingleDataContainer
|
89
|
+
try:
|
90
|
+
instance.actual_instance = SingleDataContainer.from_json(json_str)
|
91
|
+
match += 1
|
92
|
+
except (ValidationError, ValueError) as e:
|
93
|
+
error_messages.append(str(e))
|
94
|
+
# deserialize data into MultiDataContainer
|
95
|
+
try:
|
96
|
+
instance.actual_instance = MultiDataContainer.from_json(json_str)
|
97
|
+
match += 1
|
98
|
+
except (ValidationError, ValueError) as e:
|
99
|
+
error_messages.append(str(e))
|
100
|
+
|
101
|
+
if match > 1:
|
102
|
+
# more than 1 match
|
103
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into DataContainer with oneOf schemas: MultiDataContainer, SingleDataContainer. Details: " + ", ".join(error_messages))
|
104
|
+
elif match == 0:
|
105
|
+
# no match
|
106
|
+
raise ValueError("No match found when deserializing the JSON string into DataContainer with oneOf schemas: MultiDataContainer, SingleDataContainer. Details: " + ", ".join(error_messages))
|
107
|
+
else:
|
108
|
+
return instance
|
109
|
+
|
110
|
+
def to_json(self) -> str:
|
111
|
+
"""Returns the JSON representation of the actual instance"""
|
112
|
+
if self.actual_instance is None:
|
113
|
+
return "null"
|
114
|
+
|
115
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
116
|
+
return self.actual_instance.to_json()
|
117
|
+
else:
|
118
|
+
return json.dumps(self.actual_instance)
|
119
|
+
|
120
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], MultiDataContainer, SingleDataContainer]]:
|
121
|
+
"""Returns the dict representation of the actual instance"""
|
122
|
+
if self.actual_instance is None:
|
123
|
+
return None
|
124
|
+
|
125
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
126
|
+
return self.actual_instance.to_dict()
|
127
|
+
else:
|
128
|
+
# primitive type
|
129
|
+
return self.actual_instance
|
130
|
+
|
131
|
+
def to_str(self) -> str:
|
132
|
+
"""Returns the string representation of the actual instance"""
|
133
|
+
return pprint.pformat(self.model_dump())
|
134
|
+
|
135
|
+
from step_rest_client.models.multi_data_container import MultiDataContainer
|
136
|
+
from step_rest_client.models.single_data_container import SingleDataContainer
|
137
|
+
# TODO: Rewrite to not use raise_errors
|
138
|
+
DataContainer.model_rebuild(raise_errors=False)
|
139
|
+
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
STEP REST API V2
|
5
|
+
|
6
|
+
<h1>About</h1><p>The STEP REST API V2 provides read and write access to a set of core STEP objects using the HTTP operations GET, PUT, POST, PATCH and DELETE.</p><h1>Resource Representation</h1><p>With the exception of a few resource operations for retrieving and uploading binary data, all request and response bodies are JSON, compliant with the schema documented here.</p><h1>Context and Workspace</h1><p>All requests are handled in a specific STEP context and workspace and both can be specified via query parameters available for all resource operations. A context must always be specified while requests per default will be handled in the "Main" workspace.</p><h1>Polymorphism</h1><p>In STEP, attributes, reference types and data container types can all be either single- or multivalued. The STEP REST API V2 uses polymorphism to address this complexity with resources that include values, references and data containers specified to produce and consume a common "abstract" supertype that always will be one of either the single- or multivalued subtype.<br/>As an example, the GET /entities/{id}/values/{attributeId} resource operation is specified to return a "Value" but as evident from the model, the "Value" will always be "oneOf" either "SingleValue", that has a "value" property for which the value is an object, or "MultiValue", that has a "values" property for which the value is an array.<br/>Clients are advised to use the presence or absence of the plural array property ("values", "references" and "dataContainers") to determine the concrete type.</p><h1>Authentication</h1><p>The REST API is protected by HTTP Basic Authentication or if OAuth2-based authentication is enabled (SaaS customers only), by Bearer Authentication. With Basic Authentication, user name and password are supplied with each request and it is therefore highly recommended to only use the API in conjunction with HTTPS. For more information about OAuth2-based authentication for SaaS customers, please see the STEP Authentication Guide.</p><h1>Versioning</h1><p>The STEP REST API V2 is versioned using semantic versioning. Stibo Systems reserve the right to make non-breaking, minor / patch changes in any release without warning and clients must be coded / configured to be 'tolerant' and capable of handling such changes.</p><p>Examples of breaking, major changes:</p><ul><li>Renaming of a property</li><li>Removal of a property</li><li>Property type change</li><li>Addition of new property required for write operations</li><li>Marking existing property as required for write operations</li><li>Removal of resource or resource operation</li><li>Materially different behavior for existing resource operation</li></ul><p>Examples of non-breaking, minor / patch changes:</p><ul><li>Addition of new properties in request responses</li><li>Addition of new query parameter not required for write operations</li><li>Addition of new resource or resource operation</li><li>Bug fixes that do not change the schema or resource operations as described here</li><li>Inclusion of a response body for resource operations specified to return a 200 response with no body</li><li>Change of response "Model" / "schema" to type extending the previously specified type</li><li>Renaming a "Model" / "schema" type</li></ul><p>In addition, error message texts may change without warning within the same version. Client program logic should not depend upon the message content.</p><h1>Error Handling</h1><p>The STEP REST API V2 responds with standard HTTP status codes, with 2** responses indicating a success, 4** responses indicating a client error and 5** indicating a server error. Notice that this specification does not specify common error responses like 500 (internal server error) or 401 (unauthorized) for the individual resource operations. Clients should however be capable of handling such responses.</p><p>Error responses have a JSON response body (see Error schema below) containing HTTP status code information in addition to a message providing details about the error. As mentioned above, client program logic should not depend upon the message content.</p><p>The specific status codes used in the API are:</p><ul><li>200 (OK): Success, response may or may not have a body</li><li>201 (Created): Entity successfully created, response may or may not have a body</li><li>400 (Bad request): The server cannot or will not process the request due to an apparent client error</li><li>401 (Unauthorized): Returned only in relation to failed authentication</li><li>404 (Not Found): Returned only in relation to objects specified via path parameters (variable parts of the URL). If STEP objects referenced in request bodies or via query parameters cannot be found, the response will be 400.</li><li>429 (Too Many Requests): Clients are per default limited to 100 requests per second. Returned if the rate limit is exceeded.</li><li>500 (Internal Server Error): Unexpected error (could potentially cover an issue that rightfully should be a 400)</li></ul>
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.3.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from step_rest_client.models.value import Value
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class DataContainerEntry(BaseModel):
|
27
|
+
"""
|
28
|
+
An atomic data container a.k.a. a data container object
|
29
|
+
""" # noqa: E501
|
30
|
+
values: Optional[Dict[str, Value]] = Field(default=None, description="Data container values. Keys are attribute IDs and values either a SingleValue or a MultiValue depending on whether the attribute is multivalued.")
|
31
|
+
references: Optional[Dict[str, Reference]] = Field(default=None, description="References from the data container. Keys are reference type IDs and values either a SingleReference or a MultiReference depending on whether the reference type is multivalued.")
|
32
|
+
__properties: ClassVar[List[str]] = ["values", "references"]
|
33
|
+
|
34
|
+
model_config = ConfigDict(
|
35
|
+
populate_by_name=True,
|
36
|
+
validate_assignment=True,
|
37
|
+
protected_namespaces=(),
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return json.dumps(self.to_dict())
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of DataContainerEntry from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
64
|
+
"""
|
65
|
+
excluded_fields: Set[str] = set([
|
66
|
+
])
|
67
|
+
|
68
|
+
_dict = self.model_dump(
|
69
|
+
by_alias=True,
|
70
|
+
exclude=excluded_fields,
|
71
|
+
exclude_none=True,
|
72
|
+
)
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of each value in values (dict)
|
74
|
+
_field_dict = {}
|
75
|
+
if self.values:
|
76
|
+
for _key_values in self.values:
|
77
|
+
if self.values[_key_values]:
|
78
|
+
_field_dict[_key_values] = self.values[_key_values].to_dict()
|
79
|
+
_dict['values'] = _field_dict
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of each value in references (dict)
|
81
|
+
_field_dict = {}
|
82
|
+
if self.references:
|
83
|
+
for _key_references in self.references:
|
84
|
+
if self.references[_key_references]:
|
85
|
+
_field_dict[_key_references] = self.references[_key_references].to_dict()
|
86
|
+
_dict['references'] = _field_dict
|
87
|
+
return _dict
|
88
|
+
|
89
|
+
@classmethod
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
91
|
+
"""Create an instance of DataContainerEntry from a dict"""
|
92
|
+
if obj is None:
|
93
|
+
return None
|
94
|
+
|
95
|
+
if not isinstance(obj, dict):
|
96
|
+
return cls.model_validate(obj)
|
97
|
+
|
98
|
+
_obj = cls.model_validate({
|
99
|
+
"values": dict(
|
100
|
+
(_k, Value.from_dict(_v))
|
101
|
+
for _k, _v in obj["values"].items()
|
102
|
+
)
|
103
|
+
if obj.get("values") is not None
|
104
|
+
else None,
|
105
|
+
"references": dict(
|
106
|
+
(_k, Reference.from_dict(_v))
|
107
|
+
for _k, _v in obj["references"].items()
|
108
|
+
)
|
109
|
+
if obj.get("references") is not None
|
110
|
+
else None
|
111
|
+
})
|
112
|
+
return _obj
|
113
|
+
|
114
|
+
from step_rest_client.models.reference import Reference
|
115
|
+
# TODO: Rewrite to not use raise_errors
|
116
|
+
DataContainerEntry.model_rebuild(raise_errors=False)
|
117
|
+
|