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,114 @@
|
|
|
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, Optional, Union
|
|
23
|
+
from typing_extensions import Annotated
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class PricesRequestLinesInner(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PricesRequestLinesInner
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
customer_id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="customerId")
|
|
33
|
+
customer_external_id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="customerExternalId")
|
|
34
|
+
product_sku: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="productSku")
|
|
35
|
+
product_external_id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="productExternalId")
|
|
36
|
+
quantity: Optional[Union[Annotated[float, Field(le=1000000, strict=True, gt=0)], Annotated[int, Field(le=1000000, strict=True, gt=0)]]] = 1
|
|
37
|
+
order_value_cents: Optional[Annotated[int, Field(le=1000000000000, strict=True, ge=0)]] = Field(default=None, alias="orderValueCents")
|
|
38
|
+
order_total_quantity: Optional[Annotated[int, Field(le=100000000, strict=True, ge=0)]] = Field(default=None, alias="orderTotalQuantity")
|
|
39
|
+
urgency: Optional[StrictStr] = None
|
|
40
|
+
__properties: ClassVar[List[str]] = ["customerId", "customerExternalId", "productSku", "productExternalId", "quantity", "orderValueCents", "orderTotalQuantity", "urgency"]
|
|
41
|
+
|
|
42
|
+
@field_validator('urgency')
|
|
43
|
+
def urgency_validate_enum(cls, value):
|
|
44
|
+
"""Validates the enum"""
|
|
45
|
+
if value is None:
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
if value not in set(['standard', 'expedited', 'rush']):
|
|
49
|
+
raise ValueError("must be one of enum values ('standard', 'expedited', 'rush')")
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
validate_by_name=True,
|
|
54
|
+
validate_by_alias=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_str(self) -> str:
|
|
61
|
+
"""Returns the string representation of the model using alias"""
|
|
62
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
|
+
|
|
64
|
+
def to_json(self) -> str:
|
|
65
|
+
"""Returns the JSON representation of the model using alias"""
|
|
66
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of PricesRequestLinesInner 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
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude=excluded_fields,
|
|
89
|
+
exclude_none=True,
|
|
90
|
+
)
|
|
91
|
+
return _dict
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
95
|
+
"""Create an instance of PricesRequestLinesInner from a dict"""
|
|
96
|
+
if obj is None:
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
if not isinstance(obj, dict):
|
|
100
|
+
return cls.model_validate(obj)
|
|
101
|
+
|
|
102
|
+
_obj = cls.model_validate({
|
|
103
|
+
"customerId": obj.get("customerId"),
|
|
104
|
+
"customerExternalId": obj.get("customerExternalId"),
|
|
105
|
+
"productSku": obj.get("productSku"),
|
|
106
|
+
"productExternalId": obj.get("productExternalId"),
|
|
107
|
+
"quantity": obj.get("quantity") if obj.get("quantity") is not None else 1,
|
|
108
|
+
"orderValueCents": obj.get("orderValueCents"),
|
|
109
|
+
"orderTotalQuantity": obj.get("orderTotalQuantity"),
|
|
110
|
+
"urgency": obj.get("urgency")
|
|
111
|
+
})
|
|
112
|
+
return _obj
|
|
113
|
+
|
|
114
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from elastly.models.prices_response_lines_inner import PricesResponseLinesInner
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
from pydantic_core import to_jsonable_python
|
|
27
|
+
|
|
28
|
+
class PricesResponse(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
PricesResponse
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
lines: List[PricesResponseLinesInner]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["lines"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
validate_by_name=True,
|
|
37
|
+
validate_by_alias=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of PricesResponse from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of each item in lines (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.lines:
|
|
77
|
+
for _item_lines in self.lines:
|
|
78
|
+
if _item_lines:
|
|
79
|
+
_items.append(_item_lines.to_dict())
|
|
80
|
+
_dict['lines'] = _items
|
|
81
|
+
return _dict
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
85
|
+
"""Create an instance of PricesResponse from a dict"""
|
|
86
|
+
if obj is None:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
if not isinstance(obj, dict):
|
|
90
|
+
return cls.model_validate(obj)
|
|
91
|
+
|
|
92
|
+
_obj = cls.model_validate({
|
|
93
|
+
"lines": [PricesResponseLinesInner.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,138 @@
|
|
|
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.prices_response_lines_inner_one_of import PricesResponseLinesInnerOneOf
|
|
22
|
+
from elastly.models.prices_response_lines_inner_one_of1 import PricesResponseLinesInnerOneOf1
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
PRICESRESPONSELINESINNER_ONE_OF_SCHEMAS = ["PricesResponseLinesInnerOneOf", "PricesResponseLinesInnerOneOf1"]
|
|
28
|
+
|
|
29
|
+
class PricesResponseLinesInner(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PricesResponseLinesInner
|
|
32
|
+
"""
|
|
33
|
+
# data type: PricesResponseLinesInnerOneOf
|
|
34
|
+
oneof_schema_1_validator: Optional[PricesResponseLinesInnerOneOf] = None
|
|
35
|
+
# data type: PricesResponseLinesInnerOneOf1
|
|
36
|
+
oneof_schema_2_validator: Optional[PricesResponseLinesInnerOneOf1] = None
|
|
37
|
+
actual_instance: Optional[Union[PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1]] = None
|
|
38
|
+
one_of_schemas: Set[str] = { "PricesResponseLinesInnerOneOf", "PricesResponseLinesInnerOneOf1" }
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_assignment=True,
|
|
42
|
+
protected_namespaces=(),
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
47
|
+
if args:
|
|
48
|
+
if len(args) > 1:
|
|
49
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
50
|
+
if kwargs:
|
|
51
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
52
|
+
super().__init__(actual_instance=args[0])
|
|
53
|
+
else:
|
|
54
|
+
super().__init__(**kwargs)
|
|
55
|
+
|
|
56
|
+
@field_validator('actual_instance')
|
|
57
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
58
|
+
instance = PricesResponseLinesInner.model_construct()
|
|
59
|
+
error_messages = []
|
|
60
|
+
match = 0
|
|
61
|
+
# validate data type: PricesResponseLinesInnerOneOf
|
|
62
|
+
if not isinstance(v, PricesResponseLinesInnerOneOf):
|
|
63
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PricesResponseLinesInnerOneOf`")
|
|
64
|
+
else:
|
|
65
|
+
match += 1
|
|
66
|
+
# validate data type: PricesResponseLinesInnerOneOf1
|
|
67
|
+
if not isinstance(v, PricesResponseLinesInnerOneOf1):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PricesResponseLinesInnerOneOf1`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
71
|
+
if match > 1:
|
|
72
|
+
# more than 1 match
|
|
73
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in PricesResponseLinesInner with oneOf schemas: PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1. Details: " + ", ".join(error_messages))
|
|
74
|
+
elif match == 0:
|
|
75
|
+
# no match
|
|
76
|
+
raise ValueError("No match found when setting `actual_instance` in PricesResponseLinesInner with oneOf schemas: PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1. Details: " + ", ".join(error_messages))
|
|
77
|
+
else:
|
|
78
|
+
return v
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
82
|
+
return cls.from_json(json.dumps(obj))
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_json(cls, json_str: str) -> Self:
|
|
86
|
+
"""Returns the object represented by the json string"""
|
|
87
|
+
instance = cls.model_construct()
|
|
88
|
+
error_messages = []
|
|
89
|
+
match = 0
|
|
90
|
+
|
|
91
|
+
# deserialize data into PricesResponseLinesInnerOneOf
|
|
92
|
+
try:
|
|
93
|
+
instance.actual_instance = PricesResponseLinesInnerOneOf.from_json(json_str)
|
|
94
|
+
match += 1
|
|
95
|
+
except (ValidationError, ValueError) as e:
|
|
96
|
+
error_messages.append(str(e))
|
|
97
|
+
# deserialize data into PricesResponseLinesInnerOneOf1
|
|
98
|
+
try:
|
|
99
|
+
instance.actual_instance = PricesResponseLinesInnerOneOf1.from_json(json_str)
|
|
100
|
+
match += 1
|
|
101
|
+
except (ValidationError, ValueError) as e:
|
|
102
|
+
error_messages.append(str(e))
|
|
103
|
+
|
|
104
|
+
if match > 1:
|
|
105
|
+
# more than 1 match
|
|
106
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into PricesResponseLinesInner with oneOf schemas: PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1. Details: " + ", ".join(error_messages))
|
|
107
|
+
elif match == 0:
|
|
108
|
+
# no match
|
|
109
|
+
raise ValueError("No match found when deserializing the JSON string into PricesResponseLinesInner with oneOf schemas: PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1. Details: " + ", ".join(error_messages))
|
|
110
|
+
else:
|
|
111
|
+
return instance
|
|
112
|
+
|
|
113
|
+
def to_json(self) -> str:
|
|
114
|
+
"""Returns the JSON representation of the actual instance"""
|
|
115
|
+
if self.actual_instance is None:
|
|
116
|
+
return "null"
|
|
117
|
+
|
|
118
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
119
|
+
return self.actual_instance.to_json()
|
|
120
|
+
else:
|
|
121
|
+
return json.dumps(self.actual_instance)
|
|
122
|
+
|
|
123
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], PricesResponseLinesInnerOneOf, PricesResponseLinesInnerOneOf1]]:
|
|
124
|
+
"""Returns the dict representation of the actual instance"""
|
|
125
|
+
if self.actual_instance is None:
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
129
|
+
return self.actual_instance.to_dict()
|
|
130
|
+
else:
|
|
131
|
+
# primitive type
|
|
132
|
+
return self.actual_instance
|
|
133
|
+
|
|
134
|
+
def to_str(self) -> str:
|
|
135
|
+
"""Returns the string representation of the actual instance"""
|
|
136
|
+
return pprint.pformat(self.model_dump())
|
|
137
|
+
|
|
138
|
+
|
|
@@ -0,0 +1,131 @@
|
|
|
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, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from elastly.models.prices_response_lines_inner_one_of_explanation import PricesResponseLinesInnerOneOfExplanation
|
|
24
|
+
from elastly.models.prices_response_lines_inner_one_of_reason_inner import PricesResponseLinesInnerOneOfReasonInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class PricesResponseLinesInnerOneOf(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
PricesResponseLinesInnerOneOf
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
price_cents: Union[StrictFloat, StrictInt] = Field(alias="priceCents")
|
|
34
|
+
currency: StrictStr
|
|
35
|
+
pricing_decision_id: Optional[StrictStr] = Field(alias="pricingDecisionId")
|
|
36
|
+
reason: List[PricesResponseLinesInnerOneOfReasonInner]
|
|
37
|
+
reason_summary: StrictStr = Field(alias="reasonSummary")
|
|
38
|
+
explanation: PricesResponseLinesInnerOneOfExplanation
|
|
39
|
+
guardrails_applied: List[StrictStr] = Field(alias="guardrailsApplied")
|
|
40
|
+
confidence: StrictStr
|
|
41
|
+
confidence_score: Union[StrictFloat, StrictInt] = Field(alias="confidenceScore")
|
|
42
|
+
ok: StrictBool
|
|
43
|
+
__properties: ClassVar[List[str]] = ["priceCents", "currency", "pricingDecisionId", "reason", "reasonSummary", "explanation", "guardrailsApplied", "confidence", "confidenceScore", "ok"]
|
|
44
|
+
|
|
45
|
+
@field_validator('confidence')
|
|
46
|
+
def confidence_validate_enum(cls, value):
|
|
47
|
+
"""Validates the enum"""
|
|
48
|
+
if value not in set(['high', 'medium', 'low']):
|
|
49
|
+
raise ValueError("must be one of enum values ('high', 'medium', 'low')")
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
model_config = ConfigDict(
|
|
53
|
+
validate_by_name=True,
|
|
54
|
+
validate_by_alias=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def to_str(self) -> str:
|
|
61
|
+
"""Returns the string representation of the model using alias"""
|
|
62
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
63
|
+
|
|
64
|
+
def to_json(self) -> str:
|
|
65
|
+
"""Returns the JSON representation of the model using alias"""
|
|
66
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of PricesResponseLinesInnerOneOf 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
|
+
"""
|
|
83
|
+
excluded_fields: Set[str] = set([
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
_dict = self.model_dump(
|
|
87
|
+
by_alias=True,
|
|
88
|
+
exclude=excluded_fields,
|
|
89
|
+
exclude_none=True,
|
|
90
|
+
)
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each item in reason (list)
|
|
92
|
+
_items = []
|
|
93
|
+
if self.reason:
|
|
94
|
+
for _item_reason in self.reason:
|
|
95
|
+
if _item_reason:
|
|
96
|
+
_items.append(_item_reason.to_dict())
|
|
97
|
+
_dict['reason'] = _items
|
|
98
|
+
# override the default output from pydantic by calling `to_dict()` of explanation
|
|
99
|
+
if self.explanation:
|
|
100
|
+
_dict['explanation'] = self.explanation.to_dict()
|
|
101
|
+
# set to None if pricing_decision_id (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.pricing_decision_id is None and "pricing_decision_id" in self.model_fields_set:
|
|
104
|
+
_dict['pricingDecisionId'] = None
|
|
105
|
+
|
|
106
|
+
return _dict
|
|
107
|
+
|
|
108
|
+
@classmethod
|
|
109
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
110
|
+
"""Create an instance of PricesResponseLinesInnerOneOf from a dict"""
|
|
111
|
+
if obj is None:
|
|
112
|
+
return None
|
|
113
|
+
|
|
114
|
+
if not isinstance(obj, dict):
|
|
115
|
+
return cls.model_validate(obj)
|
|
116
|
+
|
|
117
|
+
_obj = cls.model_validate({
|
|
118
|
+
"priceCents": obj.get("priceCents"),
|
|
119
|
+
"currency": obj.get("currency"),
|
|
120
|
+
"pricingDecisionId": obj.get("pricingDecisionId"),
|
|
121
|
+
"reason": [PricesResponseLinesInnerOneOfReasonInner.from_dict(_item) for _item in obj["reason"]] if obj.get("reason") is not None else None,
|
|
122
|
+
"reasonSummary": obj.get("reasonSummary"),
|
|
123
|
+
"explanation": PricesResponseLinesInnerOneOfExplanation.from_dict(obj["explanation"]) if obj.get("explanation") is not None else None,
|
|
124
|
+
"guardrailsApplied": obj.get("guardrailsApplied"),
|
|
125
|
+
"confidence": obj.get("confidence"),
|
|
126
|
+
"confidenceScore": obj.get("confidenceScore"),
|
|
127
|
+
"ok": obj.get("ok")
|
|
128
|
+
})
|
|
129
|
+
return _obj
|
|
130
|
+
|
|
131
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
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, StrictBool, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
from pydantic_core import to_jsonable_python
|
|
26
|
+
|
|
27
|
+
class PricesResponseLinesInnerOneOf1(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
PricesResponseLinesInnerOneOf1
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
ok: StrictBool
|
|
32
|
+
code: Optional[StrictStr] = 'internal_error'
|
|
33
|
+
message: StrictStr
|
|
34
|
+
param: Optional[StrictStr] = None
|
|
35
|
+
__properties: ClassVar[List[str]] = ["ok", "code", "message", "param"]
|
|
36
|
+
|
|
37
|
+
@field_validator('code')
|
|
38
|
+
def code_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value is None:
|
|
41
|
+
return value
|
|
42
|
+
|
|
43
|
+
if value not in set(['unauthorized', 'forbidden', 'feature_not_enabled', 'subscription_inactive', 'rate_limited', 'monthly_volume_exceeded', 'invalid_request', 'invalid_json', 'unknown_product', 'unknown_customer', 'no_cost_basis', 'fx_rate_unavailable', 'fx_rate_stale', 'idempotency_key_reused', 'idempotency_key_in_flight', 'batch_not_found', 'batch_already_committed', 'batch_entity_order_violation', 'entity_not_supported', 'writeback_lease_expired', 'internal_error']):
|
|
44
|
+
raise ValueError("must be one of enum values ('unauthorized', 'forbidden', 'feature_not_enabled', 'subscription_inactive', 'rate_limited', 'monthly_volume_exceeded', 'invalid_request', 'invalid_json', 'unknown_product', 'unknown_customer', 'no_cost_basis', 'fx_rate_unavailable', 'fx_rate_stale', 'idempotency_key_reused', 'idempotency_key_in_flight', 'batch_not_found', 'batch_already_committed', 'batch_entity_order_violation', 'entity_not_supported', 'writeback_lease_expired', 'internal_error')")
|
|
45
|
+
return value
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
validate_by_name=True,
|
|
49
|
+
validate_by_alias=True,
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
protected_namespaces=(),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of PricesResponseLinesInnerOneOf1 from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
return _dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
90
|
+
"""Create an instance of PricesResponseLinesInnerOneOf1 from a dict"""
|
|
91
|
+
if obj is None:
|
|
92
|
+
return None
|
|
93
|
+
|
|
94
|
+
if not isinstance(obj, dict):
|
|
95
|
+
return cls.model_validate(obj)
|
|
96
|
+
|
|
97
|
+
_obj = cls.model_validate({
|
|
98
|
+
"ok": obj.get("ok"),
|
|
99
|
+
"code": obj.get("code") if obj.get("code") is not None else 'internal_error',
|
|
100
|
+
"message": obj.get("message"),
|
|
101
|
+
"param": obj.get("param")
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|