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,99 @@
|
|
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, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ApprovalStatus(BaseModel):
|
26
|
+
"""
|
27
|
+
The approval status of a workspace revisable object
|
28
|
+
""" # noqa: E501
|
29
|
+
approval_status: Optional[StrictStr] = Field(default=None, description="The status", alias="approvalStatus")
|
30
|
+
__properties: ClassVar[List[str]] = ["approvalStatus"]
|
31
|
+
|
32
|
+
@field_validator('approval_status')
|
33
|
+
def approval_status_validate_enum(cls, value):
|
34
|
+
"""Validates the enum"""
|
35
|
+
if value is None:
|
36
|
+
return value
|
37
|
+
|
38
|
+
if value not in set(['NotInApproved', 'PartlyApproved', 'ContextApproved', 'CompletelyApproved']):
|
39
|
+
raise ValueError("must be one of enum values ('NotInApproved', 'PartlyApproved', 'ContextApproved', 'CompletelyApproved')")
|
40
|
+
return value
|
41
|
+
|
42
|
+
model_config = ConfigDict(
|
43
|
+
populate_by_name=True,
|
44
|
+
validate_assignment=True,
|
45
|
+
protected_namespaces=(),
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def to_str(self) -> str:
|
50
|
+
"""Returns the string representation of the model using alias"""
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
52
|
+
|
53
|
+
def to_json(self) -> str:
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
56
|
+
return json.dumps(self.to_dict())
|
57
|
+
|
58
|
+
@classmethod
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
60
|
+
"""Create an instance of ApprovalStatus from a JSON string"""
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
62
|
+
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
65
|
+
|
66
|
+
This has the following differences from calling pydantic's
|
67
|
+
`self.model_dump(by_alias=True)`:
|
68
|
+
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
70
|
+
were set at model initialization. Other fields with value `None`
|
71
|
+
are ignored.
|
72
|
+
* OpenAPI `readOnly` fields are excluded.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
"approval_status",
|
76
|
+
])
|
77
|
+
|
78
|
+
_dict = self.model_dump(
|
79
|
+
by_alias=True,
|
80
|
+
exclude=excluded_fields,
|
81
|
+
exclude_none=True,
|
82
|
+
)
|
83
|
+
return _dict
|
84
|
+
|
85
|
+
@classmethod
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
87
|
+
"""Create an instance of ApprovalStatus from a dict"""
|
88
|
+
if obj is None:
|
89
|
+
return None
|
90
|
+
|
91
|
+
if not isinstance(obj, dict):
|
92
|
+
return cls.model_validate(obj)
|
93
|
+
|
94
|
+
_obj = cls.model_validate({
|
95
|
+
"approvalStatus": obj.get("approvalStatus")
|
96
|
+
})
|
97
|
+
return _obj
|
98
|
+
|
99
|
+
|
@@ -0,0 +1,129 @@
|
|
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, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from step_rest_client.models.reference import Reference
|
23
|
+
from step_rest_client.models.value import Value
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class Asset(BaseModel):
|
28
|
+
"""
|
29
|
+
An asset object
|
30
|
+
""" # noqa: E501
|
31
|
+
id: Optional[StrictStr] = Field(default=None, description="ID of the asset object")
|
32
|
+
name: Optional[StrictStr] = Field(default=None, description="Asset name")
|
33
|
+
object_type: Optional[StrictStr] = Field(default=None, description="Object type ID", alias="objectType")
|
34
|
+
classifications: Optional[List[StrictStr]] = Field(default=None, description="IDs of the classifications that the asset is linked into")
|
35
|
+
values: Optional[Dict[str, Value]] = Field(default=None, description="Asset values. Keys are attribute IDs and values either a SingleValue or a MultiValue depending on whether the attribute is multivalued.")
|
36
|
+
references: Optional[Dict[str, Reference]] = Field(default=None, description="References / links from the asset. Keys are reference / link type IDs and values either a SingleReference or a MultiReference depending on whether the reference type is multivalued.")
|
37
|
+
content_metadata: Optional[Dict[str, StrictStr]] = Field(default=None, description="Read-only asset content metadata values. Keys are attribute IDs and values simple string values.", alias="contentMetadata")
|
38
|
+
__properties: ClassVar[List[str]] = ["id", "name", "objectType", "classifications", "values", "references", "contentMetadata"]
|
39
|
+
|
40
|
+
model_config = ConfigDict(
|
41
|
+
populate_by_name=True,
|
42
|
+
validate_assignment=True,
|
43
|
+
protected_namespaces=(),
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
def to_str(self) -> str:
|
48
|
+
"""Returns the string representation of the model using alias"""
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
50
|
+
|
51
|
+
def to_json(self) -> str:
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
54
|
+
return json.dumps(self.to_dict())
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
58
|
+
"""Create an instance of Asset from a JSON string"""
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
60
|
+
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
63
|
+
|
64
|
+
This has the following differences from calling pydantic's
|
65
|
+
`self.model_dump(by_alias=True)`:
|
66
|
+
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
68
|
+
were set at model initialization. Other fields with value `None`
|
69
|
+
are ignored.
|
70
|
+
* OpenAPI `readOnly` fields are excluded.
|
71
|
+
* OpenAPI `readOnly` fields are excluded.
|
72
|
+
"""
|
73
|
+
excluded_fields: Set[str] = set([
|
74
|
+
"id",
|
75
|
+
"content_metadata",
|
76
|
+
])
|
77
|
+
|
78
|
+
_dict = self.model_dump(
|
79
|
+
by_alias=True,
|
80
|
+
exclude=excluded_fields,
|
81
|
+
exclude_none=True,
|
82
|
+
)
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of each value in values (dict)
|
84
|
+
_field_dict = {}
|
85
|
+
if self.values:
|
86
|
+
for _key_values in self.values:
|
87
|
+
if self.values[_key_values]:
|
88
|
+
_field_dict[_key_values] = self.values[_key_values].to_dict()
|
89
|
+
_dict['values'] = _field_dict
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of each value in references (dict)
|
91
|
+
_field_dict = {}
|
92
|
+
if self.references:
|
93
|
+
for _key_references in self.references:
|
94
|
+
if self.references[_key_references]:
|
95
|
+
_field_dict[_key_references] = self.references[_key_references].to_dict()
|
96
|
+
_dict['references'] = _field_dict
|
97
|
+
return _dict
|
98
|
+
|
99
|
+
@classmethod
|
100
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
101
|
+
"""Create an instance of Asset from a dict"""
|
102
|
+
if obj is None:
|
103
|
+
return None
|
104
|
+
|
105
|
+
if not isinstance(obj, dict):
|
106
|
+
return cls.model_validate(obj)
|
107
|
+
|
108
|
+
_obj = cls.model_validate({
|
109
|
+
"id": obj.get("id"),
|
110
|
+
"name": obj.get("name"),
|
111
|
+
"objectType": obj.get("objectType"),
|
112
|
+
"classifications": obj.get("classifications"),
|
113
|
+
"values": dict(
|
114
|
+
(_k, Value.from_dict(_v))
|
115
|
+
for _k, _v in obj["values"].items()
|
116
|
+
)
|
117
|
+
if obj.get("values") is not None
|
118
|
+
else None,
|
119
|
+
"references": dict(
|
120
|
+
(_k, Reference.from_dict(_v))
|
121
|
+
for _k, _v in obj["references"].items()
|
122
|
+
)
|
123
|
+
if obj.get("references") is not None
|
124
|
+
else None,
|
125
|
+
"contentMetadata": obj.get("contentMetadata")
|
126
|
+
})
|
127
|
+
return _obj
|
128
|
+
|
129
|
+
|
@@ -0,0 +1,120 @@
|
|
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, StrictBool, StrictStr
|
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 Attribute(BaseModel):
|
27
|
+
"""
|
28
|
+
An attribute object
|
29
|
+
""" # noqa: E501
|
30
|
+
id: Optional[StrictStr] = Field(default=None, description="ID of the attribute object")
|
31
|
+
name: Optional[StrictStr] = Field(default=None, description="Attribute name")
|
32
|
+
multivalued: Optional[StrictBool] = Field(default=None, description="Boolean indicating whether multiple values can be set for the attribute")
|
33
|
+
calculated: Optional[StrictBool] = Field(default=None, description="Boolean indicating whether the attribute is calculated")
|
34
|
+
specification: Optional[StrictBool] = Field(default=None, description="Boolean indicating whether the attribute is a \"specification\" attribute as opposed to a \"description\" attribute")
|
35
|
+
data_type_groups: Optional[List[StrictStr]] = Field(default=None, description="An array of IDs of the data type groups (a.k.a. \"attribute groups\") that the attribute is linked into", alias="dataTypeGroups")
|
36
|
+
list_of_values: Optional[StrictStr] = Field(default=None, description="ID of a list of values if the attribute is list of values based. Otherwise \"null\".", alias="listOfValues")
|
37
|
+
units: Optional[List[StrictStr]] = Field(default=None, description="An array of IDs for the valid units")
|
38
|
+
default_unit: Optional[StrictStr] = Field(default=None, description="ID of the default unit, if any. Otherwise \"null\".", alias="defaultUnit")
|
39
|
+
values: Optional[Dict[str, Value]] = Field(default=None, description="Attribute metadata values. Keys are attribute IDs and values either a SingleValue or a MultiValue depending on whether the attribute is multivalued.")
|
40
|
+
__properties: ClassVar[List[str]] = ["id", "name", "multivalued", "calculated", "specification", "dataTypeGroups", "listOfValues", "units", "defaultUnit", "values"]
|
41
|
+
|
42
|
+
model_config = ConfigDict(
|
43
|
+
populate_by_name=True,
|
44
|
+
validate_assignment=True,
|
45
|
+
protected_namespaces=(),
|
46
|
+
)
|
47
|
+
|
48
|
+
|
49
|
+
def to_str(self) -> str:
|
50
|
+
"""Returns the string representation of the model using alias"""
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
52
|
+
|
53
|
+
def to_json(self) -> str:
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
56
|
+
return json.dumps(self.to_dict())
|
57
|
+
|
58
|
+
@classmethod
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
60
|
+
"""Create an instance of Attribute from a JSON string"""
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
62
|
+
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
65
|
+
|
66
|
+
This has the following differences from calling pydantic's
|
67
|
+
`self.model_dump(by_alias=True)`:
|
68
|
+
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
70
|
+
were set at model initialization. Other fields with value `None`
|
71
|
+
are ignored.
|
72
|
+
* OpenAPI `readOnly` fields are excluded.
|
73
|
+
"""
|
74
|
+
excluded_fields: Set[str] = set([
|
75
|
+
"id",
|
76
|
+
])
|
77
|
+
|
78
|
+
_dict = self.model_dump(
|
79
|
+
by_alias=True,
|
80
|
+
exclude=excluded_fields,
|
81
|
+
exclude_none=True,
|
82
|
+
)
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of each value in values (dict)
|
84
|
+
_field_dict = {}
|
85
|
+
if self.values:
|
86
|
+
for _key_values in self.values:
|
87
|
+
if self.values[_key_values]:
|
88
|
+
_field_dict[_key_values] = self.values[_key_values].to_dict()
|
89
|
+
_dict['values'] = _field_dict
|
90
|
+
return _dict
|
91
|
+
|
92
|
+
@classmethod
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
94
|
+
"""Create an instance of Attribute from a dict"""
|
95
|
+
if obj is None:
|
96
|
+
return None
|
97
|
+
|
98
|
+
if not isinstance(obj, dict):
|
99
|
+
return cls.model_validate(obj)
|
100
|
+
|
101
|
+
_obj = cls.model_validate({
|
102
|
+
"id": obj.get("id"),
|
103
|
+
"name": obj.get("name"),
|
104
|
+
"multivalued": obj.get("multivalued"),
|
105
|
+
"calculated": obj.get("calculated"),
|
106
|
+
"specification": obj.get("specification"),
|
107
|
+
"dataTypeGroups": obj.get("dataTypeGroups"),
|
108
|
+
"listOfValues": obj.get("listOfValues"),
|
109
|
+
"units": obj.get("units"),
|
110
|
+
"defaultUnit": obj.get("defaultUnit"),
|
111
|
+
"values": dict(
|
112
|
+
(_k, Value.from_dict(_v))
|
113
|
+
for _k, _v in obj["values"].items()
|
114
|
+
)
|
115
|
+
if obj.get("values") is not None
|
116
|
+
else None
|
117
|
+
})
|
118
|
+
return _obj
|
119
|
+
|
120
|
+
|
@@ -0,0 +1,102 @@
|
|
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, StrictStr
|
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 AttributeLink(BaseModel):
|
27
|
+
"""
|
28
|
+
A link between a product or a classification and a specification attribute
|
29
|
+
""" # noqa: E501
|
30
|
+
attribute: Optional[StrictStr] = Field(default=None, description="ID of the attribute that the link points to")
|
31
|
+
values: Optional[Dict[str, Value]] = Field(default=None, description="Attribute link metadata values. Keys are attribute IDs and values either a SingleValue or a MultiValue depending on whether the attribute is multivalued.")
|
32
|
+
__properties: ClassVar[List[str]] = ["attribute", "values"]
|
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 AttributeLink 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
|
+
return _dict
|
81
|
+
|
82
|
+
@classmethod
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
84
|
+
"""Create an instance of AttributeLink from a dict"""
|
85
|
+
if obj is None:
|
86
|
+
return None
|
87
|
+
|
88
|
+
if not isinstance(obj, dict):
|
89
|
+
return cls.model_validate(obj)
|
90
|
+
|
91
|
+
_obj = cls.model_validate({
|
92
|
+
"attribute": obj.get("attribute"),
|
93
|
+
"values": dict(
|
94
|
+
(_k, Value.from_dict(_v))
|
95
|
+
for _k, _v in obj["values"].items()
|
96
|
+
)
|
97
|
+
if obj.get("values") is not None
|
98
|
+
else None
|
99
|
+
})
|
100
|
+
return _obj
|
101
|
+
|
102
|
+
|
@@ -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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class BackgroundProcess(BaseModel):
|
26
|
+
"""
|
27
|
+
A background process instance
|
28
|
+
""" # noqa: E501
|
29
|
+
id: Optional[StrictStr] = Field(default=None, description="ID of the background process instance")
|
30
|
+
background_process_type: Optional[StrictStr] = Field(default=None, description="The background process type", alias="backgroundProcessType")
|
31
|
+
description: Optional[StrictStr] = Field(default=None, description="Background process description")
|
32
|
+
user: Optional[StrictStr] = Field(default=None, description="ID of the user who started the process")
|
33
|
+
status: Optional[StrictStr] = Field(default=None, description="Background process status")
|
34
|
+
created: Optional[StrictStr] = Field(default=None, description="Time that the process was created in yyyy-mm-ddThh:mm:ss±hh:mm format")
|
35
|
+
started: Optional[StrictStr] = Field(default=None, description="Time that the process was started in yyyy-mm-ddThh:mm:ss±hh:mm format. 'null' if the process has not yet started.")
|
36
|
+
ended: Optional[StrictStr] = Field(default=None, description="Time that the process ended in yyyy-mm-ddThh:mm:ss±hh:mm format. 'null' if the process is still active.")
|
37
|
+
number_of_warnings: Optional[StrictInt] = Field(default=None, description="Number of warnings during process execution", alias="numberOfWarnings")
|
38
|
+
number_of_errors: Optional[StrictInt] = Field(default=None, description="Number of errors during process execution", alias="numberOfErrors")
|
39
|
+
progress: Optional[StrictInt] = Field(default=None, description="Progress in percent")
|
40
|
+
__properties: ClassVar[List[str]] = ["id", "backgroundProcessType", "description", "user", "status", "created", "started", "ended", "numberOfWarnings", "numberOfErrors", "progress"]
|
41
|
+
|
42
|
+
@field_validator('status')
|
43
|
+
def status_validate_enum(cls, value):
|
44
|
+
"""Validates the enum"""
|
45
|
+
if value is None:
|
46
|
+
return value
|
47
|
+
|
48
|
+
if value not in set(['waiting', 'running', 'succeeded', 'completedwitherrors', 'failed', 'suspended', 'aborted', 'unexpected']):
|
49
|
+
raise ValueError("must be one of enum values ('waiting', 'running', 'succeeded', 'completedwitherrors', 'failed', 'suspended', 'aborted', 'unexpected')")
|
50
|
+
return value
|
51
|
+
|
52
|
+
model_config = ConfigDict(
|
53
|
+
populate_by_name=True,
|
54
|
+
validate_assignment=True,
|
55
|
+
protected_namespaces=(),
|
56
|
+
)
|
57
|
+
|
58
|
+
|
59
|
+
def to_str(self) -> str:
|
60
|
+
"""Returns the string representation of the model using alias"""
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
62
|
+
|
63
|
+
def to_json(self) -> str:
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
66
|
+
return json.dumps(self.to_dict())
|
67
|
+
|
68
|
+
@classmethod
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
70
|
+
"""Create an instance of BackgroundProcess from a JSON string"""
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
72
|
+
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
75
|
+
|
76
|
+
This has the following differences from calling pydantic's
|
77
|
+
`self.model_dump(by_alias=True)`:
|
78
|
+
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
80
|
+
were set at model initialization. Other fields with value `None`
|
81
|
+
are ignored.
|
82
|
+
* OpenAPI `readOnly` fields are excluded.
|
83
|
+
* OpenAPI `readOnly` fields are excluded.
|
84
|
+
* OpenAPI `readOnly` fields are excluded.
|
85
|
+
* OpenAPI `readOnly` fields are excluded.
|
86
|
+
* OpenAPI `readOnly` fields are excluded.
|
87
|
+
* OpenAPI `readOnly` fields are excluded.
|
88
|
+
* OpenAPI `readOnly` fields are excluded.
|
89
|
+
* OpenAPI `readOnly` fields are excluded.
|
90
|
+
* OpenAPI `readOnly` fields are excluded.
|
91
|
+
* OpenAPI `readOnly` fields are excluded.
|
92
|
+
* OpenAPI `readOnly` fields are excluded.
|
93
|
+
"""
|
94
|
+
excluded_fields: Set[str] = set([
|
95
|
+
"id",
|
96
|
+
"background_process_type",
|
97
|
+
"description",
|
98
|
+
"user",
|
99
|
+
"status",
|
100
|
+
"created",
|
101
|
+
"started",
|
102
|
+
"ended",
|
103
|
+
"number_of_warnings",
|
104
|
+
"number_of_errors",
|
105
|
+
"progress",
|
106
|
+
])
|
107
|
+
|
108
|
+
_dict = self.model_dump(
|
109
|
+
by_alias=True,
|
110
|
+
exclude=excluded_fields,
|
111
|
+
exclude_none=True,
|
112
|
+
)
|
113
|
+
return _dict
|
114
|
+
|
115
|
+
@classmethod
|
116
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
117
|
+
"""Create an instance of BackgroundProcess from a dict"""
|
118
|
+
if obj is None:
|
119
|
+
return None
|
120
|
+
|
121
|
+
if not isinstance(obj, dict):
|
122
|
+
return cls.model_validate(obj)
|
123
|
+
|
124
|
+
_obj = cls.model_validate({
|
125
|
+
"id": obj.get("id"),
|
126
|
+
"backgroundProcessType": obj.get("backgroundProcessType"),
|
127
|
+
"description": obj.get("description"),
|
128
|
+
"user": obj.get("user"),
|
129
|
+
"status": obj.get("status"),
|
130
|
+
"created": obj.get("created"),
|
131
|
+
"started": obj.get("started"),
|
132
|
+
"ended": obj.get("ended"),
|
133
|
+
"numberOfWarnings": obj.get("numberOfWarnings"),
|
134
|
+
"numberOfErrors": obj.get("numberOfErrors"),
|
135
|
+
"progress": obj.get("progress")
|
136
|
+
})
|
137
|
+
return _obj
|
138
|
+
|
139
|
+
|