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,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_of1_records_inner import StageRecordsRequestOneOf1RecordsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class StageRecordsRequestOneOf1(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
StageRecordsRequestOneOf1
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
entity: StrictStr
|
|
34
|
+
records: Annotated[List[StageRecordsRequestOneOf1RecordsInner], 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(['customer']):
|
|
41
|
+
raise ValueError("must be one of enum values ('customer')")
|
|
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 StageRecordsRequestOneOf1 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 StageRecordsRequestOneOf1 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": [StageRecordsRequestOneOf1RecordsInner.from_dict(_item) for _item in obj["records"]] if obj.get("records") is not None else None
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
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, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
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 StageRecordsRequestOneOf1RecordsInner(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
StageRecordsRequestOneOf1RecordsInner
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
name: StrictStr
|
|
33
|
+
external_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="externalId")
|
|
34
|
+
segment: Optional[StrictStr] = None
|
|
35
|
+
region: Optional[StrictStr] = None
|
|
36
|
+
country: Optional[StrictStr] = None
|
|
37
|
+
credit_terms: Optional[StrictStr] = Field(default=None, alias="creditTerms")
|
|
38
|
+
currency: Optional[StrictStr] = None
|
|
39
|
+
is_active: Optional[StrictBool] = Field(default=None, alias="isActive")
|
|
40
|
+
attributes: Optional[Dict[str, Any]] = None
|
|
41
|
+
__properties: ClassVar[List[str]] = ["name", "externalId", "segment", "region", "country", "creditTerms", "currency", "isActive", "attributes"]
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
validate_by_name=True,
|
|
45
|
+
validate_by_alias=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
58
|
+
|
|
59
|
+
@classmethod
|
|
60
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
61
|
+
"""Create an instance of StageRecordsRequestOneOf1RecordsInner from a JSON string"""
|
|
62
|
+
return cls.from_dict(json.loads(json_str))
|
|
63
|
+
|
|
64
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
65
|
+
"""Return the dictionary representation of the model using alias.
|
|
66
|
+
|
|
67
|
+
This has the following differences from calling pydantic's
|
|
68
|
+
`self.model_dump(by_alias=True)`:
|
|
69
|
+
|
|
70
|
+
* `None` is only added to the output dict for nullable fields that
|
|
71
|
+
were set at model initialization. Other fields with value `None`
|
|
72
|
+
are ignored.
|
|
73
|
+
"""
|
|
74
|
+
excluded_fields: Set[str] = set([
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
# set to None if region (nullable) is None
|
|
83
|
+
# and model_fields_set contains the field
|
|
84
|
+
if self.region is None and "region" in self.model_fields_set:
|
|
85
|
+
_dict['region'] = None
|
|
86
|
+
|
|
87
|
+
# set to None if country (nullable) is None
|
|
88
|
+
# and model_fields_set contains the field
|
|
89
|
+
if self.country is None and "country" in self.model_fields_set:
|
|
90
|
+
_dict['country'] = None
|
|
91
|
+
|
|
92
|
+
# set to None if credit_terms (nullable) is None
|
|
93
|
+
# and model_fields_set contains the field
|
|
94
|
+
if self.credit_terms is None and "credit_terms" in self.model_fields_set:
|
|
95
|
+
_dict['creditTerms'] = None
|
|
96
|
+
|
|
97
|
+
# set to None if currency (nullable) is None
|
|
98
|
+
# and model_fields_set contains the field
|
|
99
|
+
if self.currency is None and "currency" in self.model_fields_set:
|
|
100
|
+
_dict['currency'] = None
|
|
101
|
+
|
|
102
|
+
return _dict
|
|
103
|
+
|
|
104
|
+
@classmethod
|
|
105
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
106
|
+
"""Create an instance of StageRecordsRequestOneOf1RecordsInner from a dict"""
|
|
107
|
+
if obj is None:
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
if not isinstance(obj, dict):
|
|
111
|
+
return cls.model_validate(obj)
|
|
112
|
+
|
|
113
|
+
_obj = cls.model_validate({
|
|
114
|
+
"name": obj.get("name"),
|
|
115
|
+
"externalId": obj.get("externalId"),
|
|
116
|
+
"segment": obj.get("segment"),
|
|
117
|
+
"region": obj.get("region"),
|
|
118
|
+
"country": obj.get("country"),
|
|
119
|
+
"creditTerms": obj.get("creditTerms"),
|
|
120
|
+
"currency": obj.get("currency"),
|
|
121
|
+
"isActive": obj.get("isActive"),
|
|
122
|
+
"attributes": obj.get("attributes")
|
|
123
|
+
})
|
|
124
|
+
return _obj
|
|
125
|
+
|
|
126
|
+
|
|
@@ -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_of2_records_inner import StageRecordsRequestOneOf2RecordsInner
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
from pydantic_core import to_jsonable_python
|
|
28
|
+
|
|
29
|
+
class StageRecordsRequestOneOf2(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
StageRecordsRequestOneOf2
|
|
32
|
+
""" # noqa: E501
|
|
33
|
+
entity: StrictStr
|
|
34
|
+
records: Annotated[List[StageRecordsRequestOneOf2RecordsInner], 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(['quote']):
|
|
41
|
+
raise ValueError("must be one of enum values ('quote')")
|
|
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 StageRecordsRequestOneOf2 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 StageRecordsRequestOneOf2 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": [StageRecordsRequestOneOf2RecordsInner.from_dict(_item) for _item in obj["records"]] if obj.get("records") is not None else None
|
|
104
|
+
})
|
|
105
|
+
return _obj
|
|
106
|
+
|
|
107
|
+
|
|
@@ -0,0 +1,160 @@
|
|
|
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 datetime import datetime
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr, field_validator
|
|
23
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
24
|
+
from typing_extensions import Annotated
|
|
25
|
+
from elastly.models.stage_records_request_one_of2_records_inner_lines_inner import StageRecordsRequestOneOf2RecordsInnerLinesInner
|
|
26
|
+
from typing import Optional, Set
|
|
27
|
+
from typing_extensions import Self
|
|
28
|
+
from pydantic_core import to_jsonable_python
|
|
29
|
+
|
|
30
|
+
class StageRecordsRequestOneOf2RecordsInner(BaseModel):
|
|
31
|
+
"""
|
|
32
|
+
StageRecordsRequestOneOf2RecordsInner
|
|
33
|
+
""" # noqa: E501
|
|
34
|
+
external_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="externalId")
|
|
35
|
+
customer_external_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="customerExternalId")
|
|
36
|
+
outcome: StrictStr
|
|
37
|
+
currency: Optional[StrictStr] = None
|
|
38
|
+
exchange_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="exchangeRate")
|
|
39
|
+
created_at: datetime = Field(alias="createdAt")
|
|
40
|
+
decided_at: Optional[datetime] = Field(default=None, alias="decidedAt")
|
|
41
|
+
lost_reason: Optional[StrictStr] = Field(default=None, alias="lostReason")
|
|
42
|
+
lines: Annotated[List[StageRecordsRequestOneOf2RecordsInnerLinesInner], Field(min_length=1)]
|
|
43
|
+
__properties: ClassVar[List[str]] = ["externalId", "customerExternalId", "outcome", "currency", "exchangeRate", "createdAt", "decidedAt", "lostReason", "lines"]
|
|
44
|
+
|
|
45
|
+
@field_validator('outcome')
|
|
46
|
+
def outcome_validate_enum(cls, value):
|
|
47
|
+
"""Validates the enum"""
|
|
48
|
+
if value not in set(['open', 'won', 'lost']):
|
|
49
|
+
raise ValueError("must be one of enum values ('open', 'won', 'lost')")
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
@field_validator('created_at')
|
|
53
|
+
def created_at_validate_regular_expression(cls, value):
|
|
54
|
+
"""Validates the regular expression"""
|
|
55
|
+
if not isinstance(value, str):
|
|
56
|
+
value = str(value)
|
|
57
|
+
|
|
58
|
+
if not re.match(r"^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$", value):
|
|
59
|
+
raise ValueError(r"must validate the regular expression /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/")
|
|
60
|
+
return value
|
|
61
|
+
|
|
62
|
+
@field_validator('decided_at')
|
|
63
|
+
def decided_at_validate_regular_expression(cls, value):
|
|
64
|
+
"""Validates the regular expression"""
|
|
65
|
+
if value is None:
|
|
66
|
+
return value
|
|
67
|
+
|
|
68
|
+
if not isinstance(value, str):
|
|
69
|
+
value = str(value)
|
|
70
|
+
|
|
71
|
+
if not re.match(r"^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$", value):
|
|
72
|
+
raise ValueError(r"must validate the regular expression /^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$/")
|
|
73
|
+
return value
|
|
74
|
+
|
|
75
|
+
model_config = ConfigDict(
|
|
76
|
+
validate_by_name=True,
|
|
77
|
+
validate_by_alias=True,
|
|
78
|
+
validate_assignment=True,
|
|
79
|
+
protected_namespaces=(),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def to_str(self) -> str:
|
|
84
|
+
"""Returns the string representation of the model using alias"""
|
|
85
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
86
|
+
|
|
87
|
+
def to_json(self) -> str:
|
|
88
|
+
"""Returns the JSON representation of the model using alias"""
|
|
89
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
93
|
+
"""Create an instance of StageRecordsRequestOneOf2RecordsInner from a JSON string"""
|
|
94
|
+
return cls.from_dict(json.loads(json_str))
|
|
95
|
+
|
|
96
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
97
|
+
"""Return the dictionary representation of the model using alias.
|
|
98
|
+
|
|
99
|
+
This has the following differences from calling pydantic's
|
|
100
|
+
`self.model_dump(by_alias=True)`:
|
|
101
|
+
|
|
102
|
+
* `None` is only added to the output dict for nullable fields that
|
|
103
|
+
were set at model initialization. Other fields with value `None`
|
|
104
|
+
are ignored.
|
|
105
|
+
"""
|
|
106
|
+
excluded_fields: Set[str] = set([
|
|
107
|
+
])
|
|
108
|
+
|
|
109
|
+
_dict = self.model_dump(
|
|
110
|
+
by_alias=True,
|
|
111
|
+
exclude=excluded_fields,
|
|
112
|
+
exclude_none=True,
|
|
113
|
+
)
|
|
114
|
+
# override the default output from pydantic by calling `to_dict()` of each item in lines (list)
|
|
115
|
+
_items = []
|
|
116
|
+
if self.lines:
|
|
117
|
+
for _item_lines in self.lines:
|
|
118
|
+
if _item_lines:
|
|
119
|
+
_items.append(_item_lines.to_dict())
|
|
120
|
+
_dict['lines'] = _items
|
|
121
|
+
# set to None if currency (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.currency is None and "currency" in self.model_fields_set:
|
|
124
|
+
_dict['currency'] = None
|
|
125
|
+
|
|
126
|
+
# set to None if exchange_rate (nullable) is None
|
|
127
|
+
# and model_fields_set contains the field
|
|
128
|
+
if self.exchange_rate is None and "exchange_rate" in self.model_fields_set:
|
|
129
|
+
_dict['exchangeRate'] = None
|
|
130
|
+
|
|
131
|
+
# set to None if lost_reason (nullable) is None
|
|
132
|
+
# and model_fields_set contains the field
|
|
133
|
+
if self.lost_reason is None and "lost_reason" in self.model_fields_set:
|
|
134
|
+
_dict['lostReason'] = None
|
|
135
|
+
|
|
136
|
+
return _dict
|
|
137
|
+
|
|
138
|
+
@classmethod
|
|
139
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
140
|
+
"""Create an instance of StageRecordsRequestOneOf2RecordsInner from a dict"""
|
|
141
|
+
if obj is None:
|
|
142
|
+
return None
|
|
143
|
+
|
|
144
|
+
if not isinstance(obj, dict):
|
|
145
|
+
return cls.model_validate(obj)
|
|
146
|
+
|
|
147
|
+
_obj = cls.model_validate({
|
|
148
|
+
"externalId": obj.get("externalId"),
|
|
149
|
+
"customerExternalId": obj.get("customerExternalId"),
|
|
150
|
+
"outcome": obj.get("outcome"),
|
|
151
|
+
"currency": obj.get("currency"),
|
|
152
|
+
"exchangeRate": obj.get("exchangeRate"),
|
|
153
|
+
"createdAt": obj.get("createdAt"),
|
|
154
|
+
"decidedAt": obj.get("decidedAt"),
|
|
155
|
+
"lostReason": obj.get("lostReason"),
|
|
156
|
+
"lines": [StageRecordsRequestOneOf2RecordsInnerLinesInner.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None
|
|
157
|
+
})
|
|
158
|
+
return _obj
|
|
159
|
+
|
|
160
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
|
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 StageRecordsRequestOneOf2RecordsInnerLinesInner(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
StageRecordsRequestOneOf2RecordsInnerLinesInner
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
product_sku: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="productSku")
|
|
33
|
+
quantity: Union[Annotated[float, Field(strict=True, gt=0)], Annotated[int, Field(strict=True, gt=0)]]
|
|
34
|
+
cost_cents: Annotated[int, Field(le=9007199254740991, strict=True, ge=0)] = Field(alias="costCents")
|
|
35
|
+
quoted_price_cents: Annotated[int, Field(le=9007199254740991, strict=True, ge=0)] = Field(alias="quotedPriceCents")
|
|
36
|
+
pricing_decision_id: Optional[StrictStr] = Field(alias="pricingDecisionId")
|
|
37
|
+
elastly_quoted_price_cents: Optional[Annotated[int, Field(le=9007199254740991, strict=True, ge=-9007199254740991)]] = Field(default=None, alias="elastlyQuotedPriceCents")
|
|
38
|
+
salesperson_price_reason: Optional[StrictStr] = Field(default=None, alias="salespersonPriceReason")
|
|
39
|
+
attributes: Optional[Dict[str, Any]] = None
|
|
40
|
+
__properties: ClassVar[List[str]] = ["productSku", "quantity", "costCents", "quotedPriceCents", "pricingDecisionId", "elastlyQuotedPriceCents", "salespersonPriceReason", "attributes"]
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
validate_by_name=True,
|
|
44
|
+
validate_by_alias=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def to_str(self) -> str:
|
|
51
|
+
"""Returns the string representation of the model using alias"""
|
|
52
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
53
|
+
|
|
54
|
+
def to_json(self) -> str:
|
|
55
|
+
"""Returns the JSON representation of the model using alias"""
|
|
56
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of StageRecordsRequestOneOf2RecordsInnerLinesInner 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
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# set to None if pricing_decision_id (nullable) is None
|
|
82
|
+
# and model_fields_set contains the field
|
|
83
|
+
if self.pricing_decision_id is None and "pricing_decision_id" in self.model_fields_set:
|
|
84
|
+
_dict['pricingDecisionId'] = None
|
|
85
|
+
|
|
86
|
+
# set to None if elastly_quoted_price_cents (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.elastly_quoted_price_cents is None and "elastly_quoted_price_cents" in self.model_fields_set:
|
|
89
|
+
_dict['elastlyQuotedPriceCents'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if salesperson_price_reason (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.salesperson_price_reason is None and "salesperson_price_reason" in self.model_fields_set:
|
|
94
|
+
_dict['salespersonPriceReason'] = None
|
|
95
|
+
|
|
96
|
+
return _dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
+
"""Create an instance of StageRecordsRequestOneOf2RecordsInnerLinesInner from a dict"""
|
|
101
|
+
if obj is None:
|
|
102
|
+
return None
|
|
103
|
+
|
|
104
|
+
if not isinstance(obj, dict):
|
|
105
|
+
return cls.model_validate(obj)
|
|
106
|
+
|
|
107
|
+
_obj = cls.model_validate({
|
|
108
|
+
"productSku": obj.get("productSku"),
|
|
109
|
+
"quantity": obj.get("quantity"),
|
|
110
|
+
"costCents": obj.get("costCents"),
|
|
111
|
+
"quotedPriceCents": obj.get("quotedPriceCents"),
|
|
112
|
+
"pricingDecisionId": obj.get("pricingDecisionId"),
|
|
113
|
+
"elastlyQuotedPriceCents": obj.get("elastlyQuotedPriceCents"),
|
|
114
|
+
"salespersonPriceReason": obj.get("salespersonPriceReason"),
|
|
115
|
+
"attributes": obj.get("attributes")
|
|
116
|
+
})
|
|
117
|
+
return _obj
|
|
118
|
+
|
|
119
|
+
|