elastly 0.1.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.
- elastly/__init__.py +117 -0
- elastly/api/__init__.py +7 -0
- elastly/api/ingest_api.py +1167 -0
- elastly/api/prices_api.py +349 -0
- elastly/api/writebacks_api.py +618 -0
- elastly/api_client.py +805 -0
- elastly/api_response.py +21 -0
- elastly/configuration.py +606 -0
- elastly/exceptions.py +219 -0
- elastly/models/__init__.py +49 -0
- elastly/models/ack_writebacks_response.py +94 -0
- elastly/models/api_error.py +93 -0
- elastly/models/api_error_error.py +102 -0
- elastly/models/batch_created_response.py +91 -0
- elastly/models/batch_status_response.py +110 -0
- elastly/models/claim_writebacks_request.py +90 -0
- elastly/models/claim_writebacks_response.py +97 -0
- elastly/models/claim_writebacks_response_tasks_inner.py +122 -0
- elastly/models/commit_batch_response.py +89 -0
- elastly/models/prices_request.py +98 -0
- elastly/models/prices_request_lines_inner.py +114 -0
- elastly/models/prices_response.py +97 -0
- elastly/models/prices_response_lines_inner.py +138 -0
- elastly/models/prices_response_lines_inner_one_of.py +131 -0
- elastly/models/prices_response_lines_inner_one_of1.py +105 -0
- elastly/models/prices_response_lines_inner_one_of_explanation.py +121 -0
- elastly/models/prices_response_lines_inner_one_of_explanation_drivers_inner.py +102 -0
- elastly/models/prices_response_lines_inner_one_of_reason_inner.py +95 -0
- elastly/models/stage_records_request.py +166 -0
- elastly/models/stage_records_request_one_of.py +107 -0
- elastly/models/stage_records_request_one_of1.py +107 -0
- elastly/models/stage_records_request_one_of1_records_inner.py +126 -0
- elastly/models/stage_records_request_one_of2.py +107 -0
- elastly/models/stage_records_request_one_of2_records_inner.py +160 -0
- elastly/models/stage_records_request_one_of2_records_inner_lines_inner.py +119 -0
- elastly/models/stage_records_request_one_of3.py +107 -0
- elastly/models/stage_records_request_one_of3_records_inner.py +131 -0
- elastly/models/stage_records_request_one_of3_records_inner_lines_inner.py +98 -0
- elastly/models/stage_records_request_one_of_records_inner.py +118 -0
- elastly/models/stage_records_response.py +90 -0
- elastly/models/writeback_ack_request.py +98 -0
- elastly/models/writeback_ack_request_results_inner.py +93 -0
- elastly/py.typed +0 -0
- elastly/rest.py +264 -0
- elastly-0.1.0.dist-info/METADATA +100 -0
- elastly-0.1.0.dist-info/RECORD +49 -0
- elastly-0.1.0.dist-info/WHEEL +5 -0
- elastly-0.1.0.dist-info/licenses/LICENSE +21 -0
- elastly-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Elastly API
|
|
5
|
+
|
|
6
|
+
Elastly public API v1: price serving, canonical ingest, write-back claims and webhooks. Authenticate every request with an API key: Authorization: Bearer elastly_live_...
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: support@elastly.io
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
23
|
+
from elastly.models.prices_response_lines_inner_one_of_explanation_drivers_inner import PricesResponseLinesInnerOneOfExplanationDriversInner
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class PricesResponseLinesInnerOneOfExplanation(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PricesResponseLinesInnerOneOfExplanation
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
short: StrictStr
|
|
33
|
+
drivers: List[PricesResponseLinesInnerOneOfExplanationDriversInner]
|
|
34
|
+
stance: StrictStr
|
|
35
|
+
margin_pct: Union[StrictFloat, StrictInt] = Field(alias="marginPct")
|
|
36
|
+
target_margin_pct: Union[StrictFloat, StrictInt] = Field(alias="targetMarginPct")
|
|
37
|
+
confidence: StrictStr
|
|
38
|
+
__properties: ClassVar[List[str]] = ["short", "drivers", "stance", "marginPct", "targetMarginPct", "confidence"]
|
|
39
|
+
|
|
40
|
+
@field_validator('stance')
|
|
41
|
+
def stance_validate_enum(cls, value):
|
|
42
|
+
"""Validates the enum"""
|
|
43
|
+
if value not in set(['hold_firm', 'at_floor', 'held_near_last', 'flexible', 'standard']):
|
|
44
|
+
raise ValueError("must be one of enum values ('hold_firm', 'at_floor', 'held_near_last', 'flexible', 'standard')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
@field_validator('confidence')
|
|
48
|
+
def confidence_validate_enum(cls, value):
|
|
49
|
+
"""Validates the enum"""
|
|
50
|
+
if value not in set(['high', 'medium', 'low']):
|
|
51
|
+
raise ValueError("must be one of enum values ('high', 'medium', 'low')")
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
model_config = ConfigDict(
|
|
55
|
+
validate_by_name=True,
|
|
56
|
+
validate_by_alias=True,
|
|
57
|
+
validate_assignment=True,
|
|
58
|
+
protected_namespaces=(),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def to_str(self) -> str:
|
|
63
|
+
"""Returns the string representation of the model using alias"""
|
|
64
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
65
|
+
|
|
66
|
+
def to_json(self) -> str:
|
|
67
|
+
"""Returns the JSON representation of the model using alias"""
|
|
68
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
72
|
+
"""Create an instance of PricesResponseLinesInnerOneOfExplanation from a JSON string"""
|
|
73
|
+
return cls.from_dict(json.loads(json_str))
|
|
74
|
+
|
|
75
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
76
|
+
"""Return the dictionary representation of the model using alias.
|
|
77
|
+
|
|
78
|
+
This has the following differences from calling pydantic's
|
|
79
|
+
`self.model_dump(by_alias=True)`:
|
|
80
|
+
|
|
81
|
+
* `None` is only added to the output dict for nullable fields that
|
|
82
|
+
were set at model initialization. Other fields with value `None`
|
|
83
|
+
are ignored.
|
|
84
|
+
"""
|
|
85
|
+
excluded_fields: Set[str] = set([
|
|
86
|
+
])
|
|
87
|
+
|
|
88
|
+
_dict = self.model_dump(
|
|
89
|
+
by_alias=True,
|
|
90
|
+
exclude=excluded_fields,
|
|
91
|
+
exclude_none=True,
|
|
92
|
+
)
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of each item in drivers (list)
|
|
94
|
+
_items = []
|
|
95
|
+
if self.drivers:
|
|
96
|
+
for _item_drivers in self.drivers:
|
|
97
|
+
if _item_drivers:
|
|
98
|
+
_items.append(_item_drivers.to_dict())
|
|
99
|
+
_dict['drivers'] = _items
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of PricesResponseLinesInnerOneOfExplanation from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj)
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate({
|
|
112
|
+
"short": obj.get("short"),
|
|
113
|
+
"drivers": [PricesResponseLinesInnerOneOfExplanationDriversInner.from_dict(_item) for _item in obj["drivers"]] if obj.get("drivers") is not None else None,
|
|
114
|
+
"stance": obj.get("stance"),
|
|
115
|
+
"marginPct": obj.get("marginPct"),
|
|
116
|
+
"targetMarginPct": obj.get("targetMarginPct"),
|
|
117
|
+
"confidence": obj.get("confidence")
|
|
118
|
+
})
|
|
119
|
+
return _obj
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Elastly API
|
|
5
|
+
|
|
6
|
+
Elastly public API v1: price serving, canonical ingest, write-back claims and webhooks. Authenticate every request with an API key: Authorization: Bearer elastly_live_...
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: support@elastly.io
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class PricesResponseLinesInnerOneOfExplanationDriversInner(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PricesResponseLinesInnerOneOfExplanationDriversInner
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
param: StrictStr
|
|
32
|
+
label: StrictStr
|
|
33
|
+
points: Union[StrictFloat, StrictInt]
|
|
34
|
+
direction: StrictStr
|
|
35
|
+
__properties: ClassVar[List[str]] = ["param", "label", "points", "direction"]
|
|
36
|
+
|
|
37
|
+
@field_validator('direction')
|
|
38
|
+
def direction_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(['up', 'down']):
|
|
41
|
+
raise ValueError("must be one of enum values ('up', 'down')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
validate_by_name=True,
|
|
46
|
+
validate_by_alias=True,
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of PricesResponseLinesInnerOneOfExplanationDriversInner from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
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 PricesResponseLinesInnerOneOfExplanationDriversInner 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
|
+
"param": obj.get("param"),
|
|
96
|
+
"label": obj.get("label"),
|
|
97
|
+
"points": obj.get("points"),
|
|
98
|
+
"direction": obj.get("direction")
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Elastly API
|
|
5
|
+
|
|
6
|
+
Elastly public API v1: price serving, canonical ingest, write-back claims and webhooks. Authenticate every request with an API key: Authorization: Bearer elastly_live_...
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: support@elastly.io
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class PricesResponseLinesInnerOneOfReasonInner(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PricesResponseLinesInnerOneOfReasonInner
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
param: StrictStr
|
|
32
|
+
margin_delta_bps: Union[StrictFloat, StrictInt] = Field(alias="marginDeltaBps")
|
|
33
|
+
label: Optional[StrictStr] = None
|
|
34
|
+
scope: Optional[StrictStr] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["param", "marginDeltaBps", "label", "scope"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
validate_by_name=True,
|
|
39
|
+
validate_by_alias=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of PricesResponseLinesInnerOneOfReasonInner from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
return _dict
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
80
|
+
"""Create an instance of PricesResponseLinesInnerOneOfReasonInner from a dict"""
|
|
81
|
+
if obj is None:
|
|
82
|
+
return None
|
|
83
|
+
|
|
84
|
+
if not isinstance(obj, dict):
|
|
85
|
+
return cls.model_validate(obj)
|
|
86
|
+
|
|
87
|
+
_obj = cls.model_validate({
|
|
88
|
+
"param": obj.get("param"),
|
|
89
|
+
"marginDeltaBps": obj.get("marginDeltaBps"),
|
|
90
|
+
"label": obj.get("label"),
|
|
91
|
+
"scope": obj.get("scope")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Elastly API
|
|
5
|
+
|
|
6
|
+
Elastly public API v1: price serving, canonical ingest, write-back claims and webhooks. Authenticate every request with an API key: Authorization: Bearer elastly_live_...
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: support@elastly.io
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
20
|
+
from typing import Any, List, Optional
|
|
21
|
+
from elastly.models.stage_records_request_one_of import StageRecordsRequestOneOf
|
|
22
|
+
from elastly.models.stage_records_request_one_of1 import StageRecordsRequestOneOf1
|
|
23
|
+
from elastly.models.stage_records_request_one_of2 import StageRecordsRequestOneOf2
|
|
24
|
+
from elastly.models.stage_records_request_one_of3 import StageRecordsRequestOneOf3
|
|
25
|
+
from pydantic import StrictStr, Field
|
|
26
|
+
from typing import Union, List, Set, Optional, Dict
|
|
27
|
+
from typing_extensions import Literal, Self
|
|
28
|
+
|
|
29
|
+
STAGERECORDSREQUEST_ONE_OF_SCHEMAS = ["StageRecordsRequestOneOf", "StageRecordsRequestOneOf1", "StageRecordsRequestOneOf2", "StageRecordsRequestOneOf3"]
|
|
30
|
+
|
|
31
|
+
class StageRecordsRequest(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
StageRecordsRequest
|
|
34
|
+
"""
|
|
35
|
+
# data type: StageRecordsRequestOneOf
|
|
36
|
+
oneof_schema_1_validator: Optional[StageRecordsRequestOneOf] = None
|
|
37
|
+
# data type: StageRecordsRequestOneOf1
|
|
38
|
+
oneof_schema_2_validator: Optional[StageRecordsRequestOneOf1] = None
|
|
39
|
+
# data type: StageRecordsRequestOneOf2
|
|
40
|
+
oneof_schema_3_validator: Optional[StageRecordsRequestOneOf2] = None
|
|
41
|
+
# data type: StageRecordsRequestOneOf3
|
|
42
|
+
oneof_schema_4_validator: Optional[StageRecordsRequestOneOf3] = None
|
|
43
|
+
actual_instance: Optional[Union[StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3]] = None
|
|
44
|
+
one_of_schemas: Set[str] = { "StageRecordsRequestOneOf", "StageRecordsRequestOneOf1", "StageRecordsRequestOneOf2", "StageRecordsRequestOneOf3" }
|
|
45
|
+
|
|
46
|
+
model_config = ConfigDict(
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
53
|
+
if args:
|
|
54
|
+
if len(args) > 1:
|
|
55
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
56
|
+
if kwargs:
|
|
57
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
58
|
+
super().__init__(actual_instance=args[0])
|
|
59
|
+
else:
|
|
60
|
+
super().__init__(**kwargs)
|
|
61
|
+
|
|
62
|
+
@field_validator('actual_instance')
|
|
63
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
64
|
+
instance = StageRecordsRequest.model_construct()
|
|
65
|
+
error_messages = []
|
|
66
|
+
match = 0
|
|
67
|
+
# validate data type: StageRecordsRequestOneOf
|
|
68
|
+
if not isinstance(v, StageRecordsRequestOneOf):
|
|
69
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StageRecordsRequestOneOf`")
|
|
70
|
+
else:
|
|
71
|
+
match += 1
|
|
72
|
+
# validate data type: StageRecordsRequestOneOf1
|
|
73
|
+
if not isinstance(v, StageRecordsRequestOneOf1):
|
|
74
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StageRecordsRequestOneOf1`")
|
|
75
|
+
else:
|
|
76
|
+
match += 1
|
|
77
|
+
# validate data type: StageRecordsRequestOneOf2
|
|
78
|
+
if not isinstance(v, StageRecordsRequestOneOf2):
|
|
79
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StageRecordsRequestOneOf2`")
|
|
80
|
+
else:
|
|
81
|
+
match += 1
|
|
82
|
+
# validate data type: StageRecordsRequestOneOf3
|
|
83
|
+
if not isinstance(v, StageRecordsRequestOneOf3):
|
|
84
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `StageRecordsRequestOneOf3`")
|
|
85
|
+
else:
|
|
86
|
+
match += 1
|
|
87
|
+
if match > 1:
|
|
88
|
+
# more than 1 match
|
|
89
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in StageRecordsRequest with oneOf schemas: StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3. Details: " + ", ".join(error_messages))
|
|
90
|
+
elif match == 0:
|
|
91
|
+
# no match
|
|
92
|
+
raise ValueError("No match found when setting `actual_instance` in StageRecordsRequest with oneOf schemas: StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3. Details: " + ", ".join(error_messages))
|
|
93
|
+
else:
|
|
94
|
+
return v
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
98
|
+
return cls.from_json(json.dumps(obj))
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_json(cls, json_str: str) -> Self:
|
|
102
|
+
"""Returns the object represented by the json string"""
|
|
103
|
+
instance = cls.model_construct()
|
|
104
|
+
error_messages = []
|
|
105
|
+
match = 0
|
|
106
|
+
|
|
107
|
+
# deserialize data into StageRecordsRequestOneOf
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = StageRecordsRequestOneOf.from_json(json_str)
|
|
110
|
+
match += 1
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
113
|
+
# deserialize data into StageRecordsRequestOneOf1
|
|
114
|
+
try:
|
|
115
|
+
instance.actual_instance = StageRecordsRequestOneOf1.from_json(json_str)
|
|
116
|
+
match += 1
|
|
117
|
+
except (ValidationError, ValueError) as e:
|
|
118
|
+
error_messages.append(str(e))
|
|
119
|
+
# deserialize data into StageRecordsRequestOneOf2
|
|
120
|
+
try:
|
|
121
|
+
instance.actual_instance = StageRecordsRequestOneOf2.from_json(json_str)
|
|
122
|
+
match += 1
|
|
123
|
+
except (ValidationError, ValueError) as e:
|
|
124
|
+
error_messages.append(str(e))
|
|
125
|
+
# deserialize data into StageRecordsRequestOneOf3
|
|
126
|
+
try:
|
|
127
|
+
instance.actual_instance = StageRecordsRequestOneOf3.from_json(json_str)
|
|
128
|
+
match += 1
|
|
129
|
+
except (ValidationError, ValueError) as e:
|
|
130
|
+
error_messages.append(str(e))
|
|
131
|
+
|
|
132
|
+
if match > 1:
|
|
133
|
+
# more than 1 match
|
|
134
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into StageRecordsRequest with oneOf schemas: StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3. Details: " + ", ".join(error_messages))
|
|
135
|
+
elif match == 0:
|
|
136
|
+
# no match
|
|
137
|
+
raise ValueError("No match found when deserializing the JSON string into StageRecordsRequest with oneOf schemas: StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3. Details: " + ", ".join(error_messages))
|
|
138
|
+
else:
|
|
139
|
+
return instance
|
|
140
|
+
|
|
141
|
+
def to_json(self) -> str:
|
|
142
|
+
"""Returns the JSON representation of the actual instance"""
|
|
143
|
+
if self.actual_instance is None:
|
|
144
|
+
return "null"
|
|
145
|
+
|
|
146
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
147
|
+
return self.actual_instance.to_json()
|
|
148
|
+
else:
|
|
149
|
+
return json.dumps(self.actual_instance)
|
|
150
|
+
|
|
151
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], StageRecordsRequestOneOf, StageRecordsRequestOneOf1, StageRecordsRequestOneOf2, StageRecordsRequestOneOf3]]:
|
|
152
|
+
"""Returns the dict representation of the actual instance"""
|
|
153
|
+
if self.actual_instance is None:
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
157
|
+
return self.actual_instance.to_dict()
|
|
158
|
+
else:
|
|
159
|
+
# primitive type
|
|
160
|
+
return self.actual_instance
|
|
161
|
+
|
|
162
|
+
def to_str(self) -> str:
|
|
163
|
+
"""Returns the string representation of the actual instance"""
|
|
164
|
+
return pprint.pformat(self.model_dump())
|
|
165
|
+
|
|
166
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Elastly API
|
|
5
|
+
|
|
6
|
+
Elastly public API v1: price serving, canonical ingest, write-back claims and webhooks. Authenticate every request with an API key: Authorization: Bearer elastly_live_...
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: support@elastly.io
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from elastly.models.stage_records_request_one_of_records_inner import StageRecordsRequestOneOfRecordsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class StageRecordsRequestOneOf(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
StageRecordsRequestOneOf
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
entity: StrictStr
|
|
34
|
+
records: Annotated[List[StageRecordsRequestOneOfRecordsInner], Field(min_length=1, max_length=1000)]
|
|
35
|
+
__properties: ClassVar[List[str]] = ["entity", "records"]
|
|
36
|
+
|
|
37
|
+
@field_validator('entity')
|
|
38
|
+
def entity_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(['product']):
|
|
41
|
+
raise ValueError("must be one of enum values ('product')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
validate_by_name=True,
|
|
46
|
+
validate_by_alias=True,
|
|
47
|
+
validate_assignment=True,
|
|
48
|
+
protected_namespaces=(),
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of StageRecordsRequestOneOf from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
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 item in records (list)
|
|
84
|
+
_items = []
|
|
85
|
+
if self.records:
|
|
86
|
+
for _item_records in self.records:
|
|
87
|
+
if _item_records:
|
|
88
|
+
_items.append(_item_records.to_dict())
|
|
89
|
+
_dict['records'] = _items
|
|
90
|
+
return _dict
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
94
|
+
"""Create an instance of StageRecordsRequestOneOf 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
|
+
"entity": obj.get("entity"),
|
|
103
|
+
"records": [StageRecordsRequestOneOfRecordsInner.from_dict(_item) for _item in obj["records"]] if obj.get("records") is not None else None
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|