amazon-creatorsapi-python-sdk 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. amazon_creatorsapi_python_sdk-1.0.0.dist-info/METADATA +99 -0
  2. amazon_creatorsapi_python_sdk-1.0.0.dist-info/RECORD +108 -0
  3. amazon_creatorsapi_python_sdk-1.0.0.dist-info/WHEEL +5 -0
  4. amazon_creatorsapi_python_sdk-1.0.0.dist-info/licenses/LICENSE.txt +202 -0
  5. amazon_creatorsapi_python_sdk-1.0.0.dist-info/licenses/NOTICE.txt +2 -0
  6. amazon_creatorsapi_python_sdk-1.0.0.dist-info/top_level.txt +1 -0
  7. creatorsapi_python_sdk/__init__.py +127 -0
  8. creatorsapi_python_sdk/api/__init__.py +5 -0
  9. creatorsapi_python_sdk/api/default_api.py +2412 -0
  10. creatorsapi_python_sdk/api_client.py +912 -0
  11. creatorsapi_python_sdk/api_response.py +21 -0
  12. creatorsapi_python_sdk/auth/__init__.py +21 -0
  13. creatorsapi_python_sdk/auth/oauth2_config.py +123 -0
  14. creatorsapi_python_sdk/auth/oauth2_token_manager.py +120 -0
  15. creatorsapi_python_sdk/configuration.py +455 -0
  16. creatorsapi_python_sdk/exceptions.py +204 -0
  17. creatorsapi_python_sdk/models/__init__.py +110 -0
  18. creatorsapi_python_sdk/models/access_denied_exception_response_content.py +97 -0
  19. creatorsapi_python_sdk/models/access_denied_reason.py +45 -0
  20. creatorsapi_python_sdk/models/availability.py +44 -0
  21. creatorsapi_python_sdk/models/browse_node.py +116 -0
  22. creatorsapi_python_sdk/models/browse_node_ancestor.py +103 -0
  23. creatorsapi_python_sdk/models/browse_node_child.py +96 -0
  24. creatorsapi_python_sdk/models/browse_node_info.py +106 -0
  25. creatorsapi_python_sdk/models/browse_nodes_result.py +100 -0
  26. creatorsapi_python_sdk/models/by_line_info.py +111 -0
  27. creatorsapi_python_sdk/models/classifications.py +101 -0
  28. creatorsapi_python_sdk/models/condition.py +44 -0
  29. creatorsapi_python_sdk/models/content_info.py +113 -0
  30. creatorsapi_python_sdk/models/content_rating.py +96 -0
  31. creatorsapi_python_sdk/models/contributor.py +98 -0
  32. creatorsapi_python_sdk/models/customer_reviews.py +98 -0
  33. creatorsapi_python_sdk/models/deal_details.py +102 -0
  34. creatorsapi_python_sdk/models/delivery_flag.py +46 -0
  35. creatorsapi_python_sdk/models/dimension_based_attribute.py +111 -0
  36. creatorsapi_python_sdk/models/error_data.py +94 -0
  37. creatorsapi_python_sdk/models/external_ids.py +106 -0
  38. creatorsapi_python_sdk/models/feed.py +98 -0
  39. creatorsapi_python_sdk/models/get_browse_nodes_request_content.py +107 -0
  40. creatorsapi_python_sdk/models/get_browse_nodes_resource.py +44 -0
  41. creatorsapi_python_sdk/models/get_browse_nodes_response_content.py +106 -0
  42. creatorsapi_python_sdk/models/get_feed_request_content.py +93 -0
  43. creatorsapi_python_sdk/models/get_feed_response_content.py +92 -0
  44. creatorsapi_python_sdk/models/get_items_request_content.py +124 -0
  45. creatorsapi_python_sdk/models/get_items_resource.py +76 -0
  46. creatorsapi_python_sdk/models/get_items_response_content.py +106 -0
  47. creatorsapi_python_sdk/models/get_report_request_content.py +93 -0
  48. creatorsapi_python_sdk/models/get_report_response_content.py +92 -0
  49. creatorsapi_python_sdk/models/get_variations_request_content.py +135 -0
  50. creatorsapi_python_sdk/models/get_variations_resource.py +79 -0
  51. creatorsapi_python_sdk/models/get_variations_response_content.py +106 -0
  52. creatorsapi_python_sdk/models/image_size.py +96 -0
  53. creatorsapi_python_sdk/models/image_type.py +111 -0
  54. creatorsapi_python_sdk/models/images.py +105 -0
  55. creatorsapi_python_sdk/models/internal_server_exception_response_content.py +94 -0
  56. creatorsapi_python_sdk/models/item.py +138 -0
  57. creatorsapi_python_sdk/models/item_info.py +156 -0
  58. creatorsapi_python_sdk/models/items_result.py +100 -0
  59. creatorsapi_python_sdk/models/language_type.py +94 -0
  60. creatorsapi_python_sdk/models/languages.py +104 -0
  61. creatorsapi_python_sdk/models/list_feeds_response_content.py +100 -0
  62. creatorsapi_python_sdk/models/list_reports_response_content.py +100 -0
  63. creatorsapi_python_sdk/models/manufacture_info.py +106 -0
  64. creatorsapi_python_sdk/models/money.py +96 -0
  65. creatorsapi_python_sdk/models/multi_valued_attribute.py +96 -0
  66. creatorsapi_python_sdk/models/offer_availability_v2.py +98 -0
  67. creatorsapi_python_sdk/models/offer_condition_v2.py +96 -0
  68. creatorsapi_python_sdk/models/offer_listing_v2.py +133 -0
  69. creatorsapi_python_sdk/models/offer_loyalty_points_v2.py +92 -0
  70. creatorsapi_python_sdk/models/offer_merchant_info_v2.py +94 -0
  71. creatorsapi_python_sdk/models/offer_price_v2.py +113 -0
  72. creatorsapi_python_sdk/models/offer_saving_basis.py +101 -0
  73. creatorsapi_python_sdk/models/offer_savings.py +98 -0
  74. creatorsapi_python_sdk/models/offer_type.py +45 -0
  75. creatorsapi_python_sdk/models/offers_v2.py +100 -0
  76. creatorsapi_python_sdk/models/product_info.py +124 -0
  77. creatorsapi_python_sdk/models/rating.py +92 -0
  78. creatorsapi_python_sdk/models/refinement.py +104 -0
  79. creatorsapi_python_sdk/models/refinement_bin.py +94 -0
  80. creatorsapi_python_sdk/models/report_metadata.py +98 -0
  81. creatorsapi_python_sdk/models/resource_not_found_exception_response_content.py +98 -0
  82. creatorsapi_python_sdk/models/saving_basis_type.py +46 -0
  83. creatorsapi_python_sdk/models/search_items_request_content.py +242 -0
  84. creatorsapi_python_sdk/models/search_items_resource.py +77 -0
  85. creatorsapi_python_sdk/models/search_items_response_content.py +106 -0
  86. creatorsapi_python_sdk/models/search_refinements.py +110 -0
  87. creatorsapi_python_sdk/models/search_result.py +110 -0
  88. creatorsapi_python_sdk/models/single_boolean_valued_attribute.py +96 -0
  89. creatorsapi_python_sdk/models/single_integer_valued_attribute.py +96 -0
  90. creatorsapi_python_sdk/models/single_string_valued_attribute.py +96 -0
  91. creatorsapi_python_sdk/models/sort_by.py +48 -0
  92. creatorsapi_python_sdk/models/technical_info.py +102 -0
  93. creatorsapi_python_sdk/models/throttle_exception_response_content.py +98 -0
  94. creatorsapi_python_sdk/models/trade_in_info.py +98 -0
  95. creatorsapi_python_sdk/models/trade_in_price.py +96 -0
  96. creatorsapi_python_sdk/models/unauthorized_exception_reason.py +51 -0
  97. creatorsapi_python_sdk/models/unauthorized_exception_response_content.py +97 -0
  98. creatorsapi_python_sdk/models/unit_based_attribute.py +98 -0
  99. creatorsapi_python_sdk/models/validation_exception_field.py +94 -0
  100. creatorsapi_python_sdk/models/validation_exception_reason.py +48 -0
  101. creatorsapi_python_sdk/models/validation_exception_response_content.py +107 -0
  102. creatorsapi_python_sdk/models/variation_attribute.py +94 -0
  103. creatorsapi_python_sdk/models/variation_dimension.py +98 -0
  104. creatorsapi_python_sdk/models/variation_summary.py +104 -0
  105. creatorsapi_python_sdk/models/variations_result.py +106 -0
  106. creatorsapi_python_sdk/models/website_sales_rank.py +98 -0
  107. creatorsapi_python_sdk/py.typed +0 -0
  108. creatorsapi_python_sdk/rest.py +262 -0
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
27
+ from typing import Any, ClassVar, Dict, List, Optional, Union
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+ class OfferLoyaltyPointsV2(BaseModel):
32
+ """
33
+ Specifies loyalty points in any region against an offer. Right now, only supporting JP marketplace.
34
+ """ # noqa: E501
35
+ points: Optional[Union[StrictFloat, StrictInt]] = None
36
+ __properties: ClassVar[List[str]] = ["points"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=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 self.model_dump_json(by_alias=True, exclude_unset=True)
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of OfferLoyaltyPointsV2 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 OfferLoyaltyPointsV2 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
+ "points": obj.get("points")
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, StrictStr
27
+ from typing import Any, ClassVar, Dict, List, Optional
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+ class OfferMerchantInfoV2(BaseModel):
32
+ """
33
+ Specifies seller information of an offer.
34
+ """ # noqa: E501
35
+ name: Optional[StrictStr] = None
36
+ id: Optional[StrictStr] = None
37
+ __properties: ClassVar[List[str]] = ["name", "id"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of OfferMerchantInfoV2 from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of OfferMerchantInfoV2 from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "name": obj.get("name"),
90
+ "id": obj.get("id")
91
+ })
92
+ return _obj
93
+
94
+
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, Field
27
+ from typing import Any, ClassVar, Dict, List, Optional
28
+ from creatorsapi_python_sdk.models.money import Money
29
+ from creatorsapi_python_sdk.models.offer_saving_basis import OfferSavingBasis
30
+ from creatorsapi_python_sdk.models.offer_savings import OfferSavings
31
+ from typing import Optional, Set
32
+ from typing_extensions import Self
33
+
34
+ class OfferPriceV2(BaseModel):
35
+ """
36
+ Specifies buying price of an offer.
37
+ """ # noqa: E501
38
+ money: Optional[Money] = None
39
+ price_per_unit: Optional[Money] = Field(default=None, alias="pricePerUnit")
40
+ savings: Optional[OfferSavings] = None
41
+ saving_basis: Optional[OfferSavingBasis] = Field(default=None, alias="savingBasis")
42
+ __properties: ClassVar[List[str]] = ["money", "pricePerUnit", "savings", "savingBasis"]
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=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 self.model_dump_json(by_alias=True, exclude_unset=True)
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of OfferPriceV2 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
+ # override the default output from pydantic by calling `to_dict()` of money
83
+ if self.money:
84
+ _dict['money'] = self.money.to_dict()
85
+ # override the default output from pydantic by calling `to_dict()` of price_per_unit
86
+ if self.price_per_unit:
87
+ _dict['pricePerUnit'] = self.price_per_unit.to_dict()
88
+ # override the default output from pydantic by calling `to_dict()` of savings
89
+ if self.savings:
90
+ _dict['savings'] = self.savings.to_dict()
91
+ # override the default output from pydantic by calling `to_dict()` of saving_basis
92
+ if self.saving_basis:
93
+ _dict['savingBasis'] = self.saving_basis.to_dict()
94
+ return _dict
95
+
96
+ @classmethod
97
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
98
+ """Create an instance of OfferPriceV2 from a dict"""
99
+ if obj is None:
100
+ return None
101
+
102
+ if not isinstance(obj, dict):
103
+ return cls.model_validate(obj)
104
+
105
+ _obj = cls.model_validate({
106
+ "money": Money.from_dict(obj["money"]) if obj.get("money") is not None else None,
107
+ "pricePerUnit": Money.from_dict(obj["pricePerUnit"]) if obj.get("pricePerUnit") is not None else None,
108
+ "savings": OfferSavings.from_dict(obj["savings"]) if obj.get("savings") is not None else None,
109
+ "savingBasis": OfferSavingBasis.from_dict(obj["savingBasis"]) if obj.get("savingBasis") is not None else None
110
+ })
111
+ return _obj
112
+
113
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
27
+ from typing import Any, ClassVar, Dict, List, Optional
28
+ from creatorsapi_python_sdk.models.money import Money
29
+ from creatorsapi_python_sdk.models.saving_basis_type import SavingBasisType
30
+ from typing import Optional, Set
31
+ from typing_extensions import Self
32
+
33
+ class OfferSavingBasis(BaseModel):
34
+ """
35
+ Specifies Saving Basis of an offer
36
+ """ # noqa: E501
37
+ money: Optional[Money] = None
38
+ saving_basis_type: Optional[SavingBasisType] = Field(default=None, alias="savingBasisType")
39
+ saving_basis_type_label: Optional[StrictStr] = Field(default=None, alias="savingBasisTypeLabel")
40
+ __properties: ClassVar[List[str]] = ["money", "savingBasisType", "savingBasisTypeLabel"]
41
+
42
+ model_config = ConfigDict(
43
+ populate_by_name=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of OfferSavingBasis from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of money
81
+ if self.money:
82
+ _dict['money'] = self.money.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of OfferSavingBasis 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
+ "money": Money.from_dict(obj["money"]) if obj.get("money") is not None else None,
96
+ "savingBasisType": obj.get("savingBasisType"),
97
+ "savingBasisTypeLabel": obj.get("savingBasisTypeLabel")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
27
+ from typing import Any, ClassVar, Dict, List, Optional, Union
28
+ from creatorsapi_python_sdk.models.money import Money
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
31
+
32
+ class OfferSavings(BaseModel):
33
+ """
34
+ Specifies savings on an offer. This is calculated by taking reference as saving basis price.
35
+ """ # noqa: E501
36
+ money: Optional[Money] = None
37
+ percentage: Optional[Union[StrictFloat, StrictInt]] = None
38
+ __properties: ClassVar[List[str]] = ["money", "percentage"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of OfferSavings 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
+ # override the default output from pydantic by calling `to_dict()` of money
79
+ if self.money:
80
+ _dict['money'] = self.money.to_dict()
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of OfferSavings 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
+ "money": Money.from_dict(obj["money"]) if obj.get("money") is not None else None,
94
+ "percentage": obj.get("percentage")
95
+ })
96
+ return _obj
97
+
98
+
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import json
23
+ from enum import Enum
24
+ from typing_extensions import Self
25
+
26
+
27
+ class OfferType(str, Enum):
28
+ """
29
+ The OfferType is an optional parameter that indicates the type of offer. We only use this for special callouts. Standard Offers will not have a particular type.
30
+ """
31
+
32
+ """
33
+ allowed enum values
34
+ """
35
+ HAUL = 'HAUL'
36
+ SUBSCRIBE_AND_SAVE = 'SUBSCRIBE_AND_SAVE'
37
+ LIGHTNING_DEAL = 'LIGHTNING_DEAL'
38
+
39
+ @classmethod
40
+ def from_json(cls, json_str: str) -> Self:
41
+ """Create an instance of OfferType from a JSON string"""
42
+ return cls(json.loads(json_str))
43
+
44
+
45
+
@@ -0,0 +1,100 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License").
7
+ You may not use this file except in compliance with the License.
8
+ A copy of the License is located at
9
+
10
+ http://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ or in the "license" file accompanying this file. This file is distributed
13
+ on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
+ express or implied. See the License for the specific language governing
15
+ permissions and limitations under the License.
16
+
17
+ """ # noqa: E501
18
+
19
+
20
+
21
+ from __future__ import annotations
22
+ import pprint
23
+ import re # noqa: F401
24
+ import json
25
+
26
+ from pydantic import BaseModel, ConfigDict, Field
27
+ from typing import Any, ClassVar, Dict, List, Optional
28
+ from creatorsapi_python_sdk.models.offer_listing_v2 import OfferListingV2
29
+ from typing import Optional, Set
30
+ from typing_extensions import Self
31
+
32
+ class OffersV2(BaseModel):
33
+ """
34
+ The Offers resource contains various resources related to offer listings and summaries for an item.
35
+ """ # noqa: E501
36
+ listings: Optional[List[OfferListingV2]] = Field(default=None, description="List of offer listing associated with a product.")
37
+ __properties: ClassVar[List[str]] = ["listings"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ return self.model_dump_json(by_alias=True, exclude_unset=True)
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of OffersV2 from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of each item in listings (list)
78
+ _items = []
79
+ if self.listings:
80
+ for _item_listings in self.listings:
81
+ if _item_listings:
82
+ _items.append(_item_listings.to_dict())
83
+ _dict['listings'] = _items
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of OffersV2 from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "listings": [OfferListingV2.from_dict(_item) for _item in obj["listings"]] if obj.get("listings") is not None else None
97
+ })
98
+ return _obj
99
+
100
+