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.
Files changed (49) hide show
  1. elastly/__init__.py +117 -0
  2. elastly/api/__init__.py +7 -0
  3. elastly/api/ingest_api.py +1167 -0
  4. elastly/api/prices_api.py +349 -0
  5. elastly/api/writebacks_api.py +618 -0
  6. elastly/api_client.py +805 -0
  7. elastly/api_response.py +21 -0
  8. elastly/configuration.py +606 -0
  9. elastly/exceptions.py +219 -0
  10. elastly/models/__init__.py +49 -0
  11. elastly/models/ack_writebacks_response.py +94 -0
  12. elastly/models/api_error.py +93 -0
  13. elastly/models/api_error_error.py +102 -0
  14. elastly/models/batch_created_response.py +91 -0
  15. elastly/models/batch_status_response.py +110 -0
  16. elastly/models/claim_writebacks_request.py +90 -0
  17. elastly/models/claim_writebacks_response.py +97 -0
  18. elastly/models/claim_writebacks_response_tasks_inner.py +122 -0
  19. elastly/models/commit_batch_response.py +89 -0
  20. elastly/models/prices_request.py +98 -0
  21. elastly/models/prices_request_lines_inner.py +114 -0
  22. elastly/models/prices_response.py +97 -0
  23. elastly/models/prices_response_lines_inner.py +138 -0
  24. elastly/models/prices_response_lines_inner_one_of.py +131 -0
  25. elastly/models/prices_response_lines_inner_one_of1.py +105 -0
  26. elastly/models/prices_response_lines_inner_one_of_explanation.py +121 -0
  27. elastly/models/prices_response_lines_inner_one_of_explanation_drivers_inner.py +102 -0
  28. elastly/models/prices_response_lines_inner_one_of_reason_inner.py +95 -0
  29. elastly/models/stage_records_request.py +166 -0
  30. elastly/models/stage_records_request_one_of.py +107 -0
  31. elastly/models/stage_records_request_one_of1.py +107 -0
  32. elastly/models/stage_records_request_one_of1_records_inner.py +126 -0
  33. elastly/models/stage_records_request_one_of2.py +107 -0
  34. elastly/models/stage_records_request_one_of2_records_inner.py +160 -0
  35. elastly/models/stage_records_request_one_of2_records_inner_lines_inner.py +119 -0
  36. elastly/models/stage_records_request_one_of3.py +107 -0
  37. elastly/models/stage_records_request_one_of3_records_inner.py +131 -0
  38. elastly/models/stage_records_request_one_of3_records_inner_lines_inner.py +98 -0
  39. elastly/models/stage_records_request_one_of_records_inner.py +118 -0
  40. elastly/models/stage_records_response.py +90 -0
  41. elastly/models/writeback_ack_request.py +98 -0
  42. elastly/models/writeback_ack_request_results_inner.py +93 -0
  43. elastly/py.typed +0 -0
  44. elastly/rest.py +264 -0
  45. elastly-0.1.0.dist-info/METADATA +100 -0
  46. elastly-0.1.0.dist-info/RECORD +49 -0
  47. elastly-0.1.0.dist-info/WHEEL +5 -0
  48. elastly-0.1.0.dist-info/licenses/LICENSE +21 -0
  49. 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_of3_records_inner import StageRecordsRequestOneOf3RecordsInner
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class StageRecordsRequestOneOf3(BaseModel):
30
+ """
31
+ StageRecordsRequestOneOf3
32
+ """ # noqa: E501
33
+ entity: StrictStr
34
+ records: Annotated[List[StageRecordsRequestOneOf3RecordsInner], 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(['order']):
41
+ raise ValueError("must be one of enum values ('order')")
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 StageRecordsRequestOneOf3 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 StageRecordsRequestOneOf3 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": [StageRecordsRequestOneOf3RecordsInner.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,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 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_of3_records_inner_lines_inner import StageRecordsRequestOneOf3RecordsInnerLinesInner
26
+ from typing import Optional, Set
27
+ from typing_extensions import Self
28
+ from pydantic_core import to_jsonable_python
29
+
30
+ class StageRecordsRequestOneOf3RecordsInner(BaseModel):
31
+ """
32
+ StageRecordsRequestOneOf3RecordsInner
33
+ """ # noqa: E501
34
+ external_id: Annotated[str, Field(min_length=1, strict=True)] = Field(alias="externalId")
35
+ customer_external_id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="customerExternalId")
36
+ source_quote_external_id: Optional[StrictStr] = Field(default=None, alias="sourceQuoteExternalId")
37
+ currency: StrictStr
38
+ exchange_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="exchangeRate")
39
+ sold_at: datetime = Field(alias="soldAt")
40
+ lines: Annotated[List[StageRecordsRequestOneOf3RecordsInnerLinesInner], Field(min_length=1)]
41
+ __properties: ClassVar[List[str]] = ["externalId", "customerExternalId", "sourceQuoteExternalId", "currency", "exchangeRate", "soldAt", "lines"]
42
+
43
+ @field_validator('sold_at')
44
+ def sold_at_validate_regular_expression(cls, value):
45
+ """Validates the regular expression"""
46
+ if not isinstance(value, str):
47
+ value = str(value)
48
+
49
+ 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):
50
+ 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)))$/")
51
+ return value
52
+
53
+ model_config = ConfigDict(
54
+ validate_by_name=True,
55
+ validate_by_alias=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+
61
+ def to_str(self) -> str:
62
+ """Returns the string representation of the model using alias"""
63
+ return pprint.pformat(self.model_dump(by_alias=True))
64
+
65
+ def to_json(self) -> str:
66
+ """Returns the JSON representation of the model using alias"""
67
+ return json.dumps(to_jsonable_python(self.to_dict()))
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of StageRecordsRequestOneOf3RecordsInner from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([
85
+ ])
86
+
87
+ _dict = self.model_dump(
88
+ by_alias=True,
89
+ exclude=excluded_fields,
90
+ exclude_none=True,
91
+ )
92
+ # override the default output from pydantic by calling `to_dict()` of each item in lines (list)
93
+ _items = []
94
+ if self.lines:
95
+ for _item_lines in self.lines:
96
+ if _item_lines:
97
+ _items.append(_item_lines.to_dict())
98
+ _dict['lines'] = _items
99
+ # set to None if customer_external_id (nullable) is None
100
+ # and model_fields_set contains the field
101
+ if self.customer_external_id is None and "customer_external_id" in self.model_fields_set:
102
+ _dict['customerExternalId'] = None
103
+
104
+ # set to None if exchange_rate (nullable) is None
105
+ # and model_fields_set contains the field
106
+ if self.exchange_rate is None and "exchange_rate" in self.model_fields_set:
107
+ _dict['exchangeRate'] = None
108
+
109
+ return _dict
110
+
111
+ @classmethod
112
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
113
+ """Create an instance of StageRecordsRequestOneOf3RecordsInner from a dict"""
114
+ if obj is None:
115
+ return None
116
+
117
+ if not isinstance(obj, dict):
118
+ return cls.model_validate(obj)
119
+
120
+ _obj = cls.model_validate({
121
+ "externalId": obj.get("externalId"),
122
+ "customerExternalId": obj.get("customerExternalId"),
123
+ "sourceQuoteExternalId": obj.get("sourceQuoteExternalId"),
124
+ "currency": obj.get("currency"),
125
+ "exchangeRate": obj.get("exchangeRate"),
126
+ "soldAt": obj.get("soldAt"),
127
+ "lines": [StageRecordsRequestOneOf3RecordsInnerLinesInner.from_dict(_item) for _item in obj["lines"]] if obj.get("lines") is not None else None
128
+ })
129
+ return _obj
130
+
131
+
@@ -0,0 +1,98 @@
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
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 StageRecordsRequestOneOf3RecordsInnerLinesInner(BaseModel):
29
+ """
30
+ StageRecordsRequestOneOf3RecordsInnerLinesInner
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
+ sold_price_cents: Annotated[int, Field(le=9007199254740991, strict=True, ge=0)] = Field(alias="soldPriceCents")
36
+ attributes: Optional[Dict[str, Any]] = None
37
+ __properties: ClassVar[List[str]] = ["productSku", "quantity", "costCents", "soldPriceCents", "attributes"]
38
+
39
+ model_config = ConfigDict(
40
+ validate_by_name=True,
41
+ validate_by_alias=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
+ return json.dumps(to_jsonable_python(self.to_dict()))
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of StageRecordsRequestOneOf3RecordsInnerLinesInner from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of StageRecordsRequestOneOf3RecordsInnerLinesInner from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({
90
+ "productSku": obj.get("productSku"),
91
+ "quantity": obj.get("quantity"),
92
+ "costCents": obj.get("costCents"),
93
+ "soldPriceCents": obj.get("soldPriceCents"),
94
+ "attributes": obj.get("attributes")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,118 @@
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 StageRecordsRequestOneOfRecordsInner(BaseModel):
29
+ """
30
+ StageRecordsRequestOneOfRecordsInner
31
+ """ # noqa: E501
32
+ sku: Annotated[str, Field(min_length=1, strict=True)]
33
+ external_id: Optional[Annotated[str, Field(min_length=1, strict=True)]] = Field(default=None, alias="externalId")
34
+ name: StrictStr
35
+ category: StrictStr
36
+ cost_cents: Annotated[int, Field(le=9007199254740991, strict=True, ge=0)] = Field(alias="costCents")
37
+ current_price_cents: Annotated[int, Field(le=9007199254740991, strict=True, ge=0)] = Field(alias="currentPriceCents")
38
+ map_cents: Optional[Annotated[int, Field(le=9007199254740991, strict=True, ge=0)]] = Field(default=None, alias="mapCents")
39
+ floor_cents: Optional[Annotated[int, Field(le=9007199254740991, strict=True, ge=0)]] = Field(default=None, alias="floorCents")
40
+ ceiling_cents: Optional[Annotated[int, Field(le=9007199254740991, strict=True, ge=0)]] = Field(default=None, alias="ceilingCents")
41
+ is_active: Optional[StrictBool] = Field(default=None, alias="isActive")
42
+ in_stock: Optional[StrictBool] = Field(default=None, alias="inStock")
43
+ stock_on_hand: Optional[Annotated[int, Field(le=9007199254740991, strict=True, ge=-9007199254740991)]] = Field(default=None, alias="stockOnHand")
44
+ brand: Optional[StrictStr] = None
45
+ currency: Optional[StrictStr] = None
46
+ attributes: Optional[Dict[str, Any]] = None
47
+ __properties: ClassVar[List[str]] = ["sku", "externalId", "name", "category", "costCents", "currentPriceCents", "mapCents", "floorCents", "ceilingCents", "isActive", "inStock", "stockOnHand", "brand", "currency", "attributes"]
48
+
49
+ model_config = ConfigDict(
50
+ validate_by_name=True,
51
+ validate_by_alias=True,
52
+ validate_assignment=True,
53
+ protected_namespaces=(),
54
+ )
55
+
56
+
57
+ def to_str(self) -> str:
58
+ """Returns the string representation of the model using alias"""
59
+ return pprint.pformat(self.model_dump(by_alias=True))
60
+
61
+ def to_json(self) -> str:
62
+ """Returns the JSON representation of the model using alias"""
63
+ return json.dumps(to_jsonable_python(self.to_dict()))
64
+
65
+ @classmethod
66
+ def from_json(cls, json_str: str) -> Optional[Self]:
67
+ """Create an instance of StageRecordsRequestOneOfRecordsInner from a JSON string"""
68
+ return cls.from_dict(json.loads(json_str))
69
+
70
+ def to_dict(self) -> Dict[str, Any]:
71
+ """Return the dictionary representation of the model using alias.
72
+
73
+ This has the following differences from calling pydantic's
74
+ `self.model_dump(by_alias=True)`:
75
+
76
+ * `None` is only added to the output dict for nullable fields that
77
+ were set at model initialization. Other fields with value `None`
78
+ are ignored.
79
+ """
80
+ excluded_fields: Set[str] = set([
81
+ ])
82
+
83
+ _dict = self.model_dump(
84
+ by_alias=True,
85
+ exclude=excluded_fields,
86
+ exclude_none=True,
87
+ )
88
+ return _dict
89
+
90
+ @classmethod
91
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
+ """Create an instance of StageRecordsRequestOneOfRecordsInner from a dict"""
93
+ if obj is None:
94
+ return None
95
+
96
+ if not isinstance(obj, dict):
97
+ return cls.model_validate(obj)
98
+
99
+ _obj = cls.model_validate({
100
+ "sku": obj.get("sku"),
101
+ "externalId": obj.get("externalId"),
102
+ "name": obj.get("name"),
103
+ "category": obj.get("category"),
104
+ "costCents": obj.get("costCents"),
105
+ "currentPriceCents": obj.get("currentPriceCents"),
106
+ "mapCents": obj.get("mapCents"),
107
+ "floorCents": obj.get("floorCents"),
108
+ "ceilingCents": obj.get("ceilingCents"),
109
+ "isActive": obj.get("isActive"),
110
+ "inStock": obj.get("inStock"),
111
+ "stockOnHand": obj.get("stockOnHand"),
112
+ "brand": obj.get("brand"),
113
+ "currency": obj.get("currency"),
114
+ "attributes": obj.get("attributes")
115
+ })
116
+ return _obj
117
+
118
+
@@ -0,0 +1,90 @@
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
22
+ from typing import Any, ClassVar, Dict, List
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 StageRecordsResponse(BaseModel):
29
+ """
30
+ StageRecordsResponse
31
+ """ # noqa: E501
32
+ staged: Annotated[int, Field(le=9007199254740991, strict=True, ge=-9007199254740991)]
33
+ __properties: ClassVar[List[str]] = ["staged"]
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 StageRecordsResponse 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
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of StageRecordsResponse from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "staged": obj.get("staged")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,98 @@
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
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing_extensions import Annotated
24
+ from elastly.models.writeback_ack_request_results_inner import WritebackAckRequestResultsInner
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class WritebackAckRequest(BaseModel):
30
+ """
31
+ WritebackAckRequest
32
+ """ # noqa: E501
33
+ results: Annotated[List[WritebackAckRequestResultsInner], Field(min_length=1, max_length=500)]
34
+ __properties: ClassVar[List[str]] = ["results"]
35
+
36
+ model_config = ConfigDict(
37
+ validate_by_name=True,
38
+ validate_by_alias=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ return json.dumps(to_jsonable_python(self.to_dict()))
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of WritebackAckRequest from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ ])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of each item in results (list)
76
+ _items = []
77
+ if self.results:
78
+ for _item_results in self.results:
79
+ if _item_results:
80
+ _items.append(_item_results.to_dict())
81
+ _dict['results'] = _items
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of WritebackAckRequest from a dict"""
87
+ if obj is None:
88
+ return None
89
+
90
+ if not isinstance(obj, dict):
91
+ return cls.model_validate(obj)
92
+
93
+ _obj = cls.model_validate({
94
+ "results": [WritebackAckRequestResultsInner.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
95
+ })
96
+ return _obj
97
+
98
+