amazon-sp-cli 0.2.5__tar.gz → 0.2.6__tar.gz
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.
- {amazon_sp_cli-0.2.5/amazon_sp_cli.egg-info → amazon_sp_cli-0.2.6}/PKG-INFO +1 -1
- amazon_sp_cli-0.2.6/amazon_sp_cli/__init__.py +2 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/models/a_plus.py +45 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6/amazon_sp_cli.egg-info}/PKG-INFO +1 -1
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/tests/test_a_plus.py +15 -0
- amazon_sp_cli-0.2.5/amazon_sp_cli/__init__.py +0 -2
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/LICENSE +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/MANIFEST.in +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/README.md +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/__main__.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/auth.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/cli.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/client.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/commands/__init__.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/commands/a_plus.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/commands/auth.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/commands/pricing.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/main.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli/models/__init__.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli.egg-info/SOURCES.txt +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli.egg-info/dependency_links.txt +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli.egg-info/entry_points.txt +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli.egg-info/requires.txt +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/amazon_sp_cli.egg-info/top_level.txt +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/pyproject.toml +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/setup.cfg +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/setup.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/tests/__init__.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/tests/test_auth.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/tests/test_client.py +0 -0
- {amazon_sp_cli-0.2.5 → amazon_sp_cli-0.2.6}/tests/test_pricing.py +0 -0
|
@@ -76,6 +76,26 @@ class StandardSingleImageModule:
|
|
|
76
76
|
return result
|
|
77
77
|
|
|
78
78
|
|
|
79
|
+
class StandardSingleSideImageModule:
|
|
80
|
+
"""Standard Single Side Image module."""
|
|
81
|
+
|
|
82
|
+
def __init__(self, image=None, description=None, image_position_type="LEFT"):
|
|
83
|
+
self.image = image
|
|
84
|
+
self.description = description
|
|
85
|
+
self.image_position_type = image_position_type
|
|
86
|
+
|
|
87
|
+
def to_dict(self) -> dict:
|
|
88
|
+
result = {"imagePositionType": self.image_position_type}
|
|
89
|
+
block = {}
|
|
90
|
+
if self.image:
|
|
91
|
+
block["image"] = self.image.to_dict()
|
|
92
|
+
if self.description:
|
|
93
|
+
block["description"] = self.description.to_dict()
|
|
94
|
+
if block:
|
|
95
|
+
result["block"] = block
|
|
96
|
+
return result
|
|
97
|
+
|
|
98
|
+
|
|
79
99
|
class StandardMultipleImageTextModule:
|
|
80
100
|
"""Standard Multiple Image & Text module."""
|
|
81
101
|
|
|
@@ -192,6 +212,7 @@ class ContentModule:
|
|
|
192
212
|
MODULE_TYPES = {
|
|
193
213
|
"STANDARD_IMAGE_TEXT": "standardImageTextOverlay",
|
|
194
214
|
"STANDARD_SINGLE_IMAGE": "standardSingleImage",
|
|
215
|
+
"STANDARD_SINGLE_SIDE_IMAGE": "standardSingleSideImage",
|
|
195
216
|
"STANDARD_MULTIPLE_IMAGE_TEXT": "standardMultipleImageText",
|
|
196
217
|
"STANDARD_FOUR_IMAGE_TEXT": "standardFourImageText",
|
|
197
218
|
"STANDARD_COMPARISON_TABLE": "standardComparisonTable",
|
|
@@ -205,6 +226,7 @@ class ContentModule:
|
|
|
205
226
|
module_type: str,
|
|
206
227
|
standard_image_text: StandardImageTextModule = None,
|
|
207
228
|
standard_single_image: StandardSingleImageModule = None,
|
|
229
|
+
standard_single_side_image: StandardSingleSideImageModule = None,
|
|
208
230
|
standard_multiple_image_text: StandardMultipleImageTextModule = None,
|
|
209
231
|
standard_four_image_text: StandardFourImageTextModule = None,
|
|
210
232
|
standard_comparison_table: StandardComparisonTableModule = None,
|
|
@@ -215,6 +237,7 @@ class ContentModule:
|
|
|
215
237
|
self.module_type = module_type
|
|
216
238
|
self.standard_image_text = standard_image_text
|
|
217
239
|
self.standard_single_image = standard_single_image
|
|
240
|
+
self.standard_single_side_image = standard_single_side_image
|
|
218
241
|
self.standard_multiple_image_text = standard_multiple_image_text
|
|
219
242
|
self.standard_four_image_text = standard_four_image_text
|
|
220
243
|
self.standard_comparison_table = standard_comparison_table
|
|
@@ -230,6 +253,8 @@ class ContentModule:
|
|
|
230
253
|
result["standardImageTextOverlay"] = self.standard_image_text_overlay.to_dict()
|
|
231
254
|
elif field_name == "standardSingleImage" and self.standard_single_image:
|
|
232
255
|
result["standardSingleImage"] = self.standard_single_image.to_dict()
|
|
256
|
+
elif field_name == "standardSingleSideImage" and self.standard_single_side_image:
|
|
257
|
+
result["standardSingleSideImage"] = self.standard_single_side_image.to_dict()
|
|
233
258
|
elif field_name == "standardMultipleImageText" and self.standard_multiple_image_text:
|
|
234
259
|
result["standardMultipleImageText"] = self.standard_multiple_image_text.to_dict()
|
|
235
260
|
elif field_name == "standardFourImageText" and self.standard_four_image_text:
|
|
@@ -357,6 +382,26 @@ def build_module_from_json(data: dict) -> ContentModule:
|
|
|
357
382
|
image_caption=TextComponent(data["caption"]) if data.get("caption") else None,
|
|
358
383
|
),
|
|
359
384
|
)
|
|
385
|
+
elif module_type == "STANDARD_SINGLE_SIDE_IMAGE":
|
|
386
|
+
description = None
|
|
387
|
+
if data.get("description"):
|
|
388
|
+
description = ParagraphComponent(text_list=[TextComponent(data["description"])])
|
|
389
|
+
return ContentModule(
|
|
390
|
+
module_type=module_type,
|
|
391
|
+
standard_single_side_image=StandardSingleSideImageModule(
|
|
392
|
+
image=(
|
|
393
|
+
ImageComponent(
|
|
394
|
+
data["imageId"],
|
|
395
|
+
alt_text=data.get("altText"),
|
|
396
|
+
image_crop_specification=data.get("imageCropSpecification"),
|
|
397
|
+
)
|
|
398
|
+
if data.get("imageId")
|
|
399
|
+
else None
|
|
400
|
+
),
|
|
401
|
+
description=description,
|
|
402
|
+
image_position_type=data.get("imagePositionType", "LEFT"),
|
|
403
|
+
),
|
|
404
|
+
)
|
|
360
405
|
elif module_type == "STANDARD_MULTIPLE_IMAGE_TEXT":
|
|
361
406
|
return ContentModule(
|
|
362
407
|
module_type=module_type,
|
|
@@ -166,6 +166,21 @@ class TestBuildFromJson:
|
|
|
166
166
|
assert result["standardImageTextOverlay"]["block"]["headline"]["value"] == "H"
|
|
167
167
|
assert result["standardImageTextOverlay"]["block"]["body"]["textList"][0]["value"] == "B"
|
|
168
168
|
|
|
169
|
+
def test_build_module_single_side_image(self):
|
|
170
|
+
data = {
|
|
171
|
+
"moduleType": "STANDARD_SINGLE_SIDE_IMAGE",
|
|
172
|
+
"imageId": "img-1",
|
|
173
|
+
"altText": "Side",
|
|
174
|
+
"description": "Desc",
|
|
175
|
+
"imagePositionType": "RIGHT",
|
|
176
|
+
}
|
|
177
|
+
mod = build_module_from_json(data)
|
|
178
|
+
assert mod.module_type == "STANDARD_SINGLE_SIDE_IMAGE"
|
|
179
|
+
result = mod.to_dict()
|
|
180
|
+
assert result["standardSingleSideImage"]["imagePositionType"] == "RIGHT"
|
|
181
|
+
assert result["standardSingleSideImage"]["block"]["image"]["uploadDestinationId"] == "img-1"
|
|
182
|
+
assert result["standardSingleSideImage"]["block"]["description"]["textList"][0]["value"] == "Desc"
|
|
183
|
+
|
|
169
184
|
def test_build_module_comparison_table(self):
|
|
170
185
|
data = {
|
|
171
186
|
"moduleType": "STANDARD_COMPARISON_TABLE",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|