amazon-sp-cli 0.2.2__tar.gz → 0.2.3__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.2/amazon_sp_cli.egg-info → amazon_sp_cli-0.2.3}/PKG-INFO +1 -1
- amazon_sp_cli-0.2.3/amazon_sp_cli/__init__.py +2 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/models/a_plus.py +26 -1
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3/amazon_sp_cli.egg-info}/PKG-INFO +1 -1
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/setup.py +8 -1
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/tests/test_a_plus.py +20 -0
- amazon_sp_cli-0.2.2/amazon_sp_cli/__init__.py +0 -2
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/LICENSE +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/MANIFEST.in +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/README.md +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/__main__.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/auth.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/cli.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/client.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/commands/__init__.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/commands/a_plus.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/commands/auth.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/commands/pricing.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/main.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli/models/__init__.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli.egg-info/SOURCES.txt +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli.egg-info/dependency_links.txt +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli.egg-info/entry_points.txt +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli.egg-info/requires.txt +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/amazon_sp_cli.egg-info/top_level.txt +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/pyproject.toml +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/setup.cfg +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/tests/__init__.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/tests/test_auth.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/tests/test_client.py +0 -0
- {amazon_sp_cli-0.2.2 → amazon_sp_cli-0.2.3}/tests/test_pricing.py +0 -0
|
@@ -157,6 +157,19 @@ class StandardImageTextOverlayModule:
|
|
|
157
157
|
return result
|
|
158
158
|
|
|
159
159
|
|
|
160
|
+
class StandardCompanyLogoModule:
|
|
161
|
+
"""Standard Company Logo module."""
|
|
162
|
+
|
|
163
|
+
def __init__(self, company_logo=None):
|
|
164
|
+
self.company_logo = company_logo
|
|
165
|
+
|
|
166
|
+
def to_dict(self) -> dict:
|
|
167
|
+
result = {}
|
|
168
|
+
if self.company_logo:
|
|
169
|
+
result["companyLogo"] = {"image": self.company_logo.to_dict()}
|
|
170
|
+
return result
|
|
171
|
+
|
|
172
|
+
|
|
160
173
|
class ContentModule:
|
|
161
174
|
"""A+ Content module wrapper."""
|
|
162
175
|
|
|
@@ -168,6 +181,7 @@ class ContentModule:
|
|
|
168
181
|
"STANDARD_COMPARISON_TABLE": "standardComparisonTable",
|
|
169
182
|
"STANDARD_TEXT": "standardText",
|
|
170
183
|
"STANDARD_IMAGE_TEXT_OVERLAY": "standardImageTextOverlay",
|
|
184
|
+
"STANDARD_COMPANY_LOGO": "standardCompanyLogo",
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
def __init__(
|
|
@@ -180,6 +194,7 @@ class ContentModule:
|
|
|
180
194
|
standard_comparison_table: StandardComparisonTableModule = None,
|
|
181
195
|
standard_text: StandardTextModule = None,
|
|
182
196
|
standard_image_text_overlay: StandardImageTextOverlayModule = None,
|
|
197
|
+
standard_company_logo: StandardCompanyLogoModule = None,
|
|
183
198
|
):
|
|
184
199
|
self.module_type = module_type
|
|
185
200
|
self.standard_image_text = standard_image_text
|
|
@@ -189,6 +204,7 @@ class ContentModule:
|
|
|
189
204
|
self.standard_comparison_table = standard_comparison_table
|
|
190
205
|
self.standard_text = standard_text
|
|
191
206
|
self.standard_image_text_overlay = standard_image_text_overlay
|
|
207
|
+
self.standard_company_logo = standard_company_logo
|
|
192
208
|
|
|
193
209
|
def to_dict(self) -> dict:
|
|
194
210
|
result = {"contentModuleType": self.module_type}
|
|
@@ -208,6 +224,8 @@ class ContentModule:
|
|
|
208
224
|
result["standardText"] = self.standard_text.to_dict()
|
|
209
225
|
elif field_name == "standardImageTextOverlay" and self.standard_image_text_overlay:
|
|
210
226
|
result["standardImageTextOverlay"] = self.standard_image_text_overlay.to_dict()
|
|
227
|
+
elif field_name == "standardCompanyLogo" and self.standard_company_logo:
|
|
228
|
+
result["standardCompanyLogo"] = self.standard_company_logo.to_dict()
|
|
211
229
|
|
|
212
230
|
return result
|
|
213
231
|
|
|
@@ -287,7 +305,7 @@ def build_content_from_json(name: str, data: dict) -> APlusContentDocument:
|
|
|
287
305
|
|
|
288
306
|
def build_module_from_json(data: dict) -> ContentModule:
|
|
289
307
|
"""Build ContentModule from JSON dict."""
|
|
290
|
-
module_type = data.get("moduleType", "STANDARD_TEXT")
|
|
308
|
+
module_type = data.get("contentModuleType") or data.get("moduleType", "STANDARD_TEXT")
|
|
291
309
|
|
|
292
310
|
if module_type == "STANDARD_IMAGE_TEXT":
|
|
293
311
|
return ContentModule(
|
|
@@ -350,5 +368,12 @@ def build_module_from_json(data: dict) -> ContentModule:
|
|
|
350
368
|
image=ImageComponent(data["imageId"]) if data.get("imageId") else None,
|
|
351
369
|
),
|
|
352
370
|
)
|
|
371
|
+
elif module_type == "STANDARD_COMPANY_LOGO":
|
|
372
|
+
return ContentModule(
|
|
373
|
+
module_type=module_type,
|
|
374
|
+
standard_company_logo=StandardCompanyLogoModule(
|
|
375
|
+
company_logo=ImageComponent(data["imageId"]) if data.get("imageId") else None,
|
|
376
|
+
),
|
|
377
|
+
)
|
|
353
378
|
else:
|
|
354
379
|
raise ValueError(f"Unsupported moduleType: {module_type}")
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
|
|
1
4
|
from setuptools import find_packages, setup
|
|
2
5
|
|
|
6
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
7
|
+
with open(os.path.join(here, "amazon_sp_cli", "__init__.py")) as f:
|
|
8
|
+
version = re.search(r'__version__ = "([^"]+)"', f.read()).group(1)
|
|
9
|
+
|
|
3
10
|
setup(
|
|
4
11
|
name="amazon-sp-cli",
|
|
5
|
-
version=
|
|
12
|
+
version=version,
|
|
6
13
|
description="CLI tool for Amazon Selling Partner API (SP-API) operations",
|
|
7
14
|
author="Lunan Li",
|
|
8
15
|
author_email="lunan@stellaraether.com",
|
|
@@ -10,6 +10,7 @@ from amazon_sp_cli.main import cli
|
|
|
10
10
|
from amazon_sp_cli.models.a_plus import (
|
|
11
11
|
APlusContentDocument,
|
|
12
12
|
ContentModule,
|
|
13
|
+
StandardCompanyLogoModule,
|
|
13
14
|
StandardTextModule,
|
|
14
15
|
TextComponent,
|
|
15
16
|
build_content_from_json,
|
|
@@ -103,6 +104,25 @@ class TestBuildFromJson:
|
|
|
103
104
|
with pytest.raises(ValueError, match="Unsupported moduleType"):
|
|
104
105
|
build_module_from_json({"moduleType": "UNKNOWN"})
|
|
105
106
|
|
|
107
|
+
def test_build_module_from_json_uses_content_module_type(self):
|
|
108
|
+
data = {"contentModuleType": "STANDARD_TEXT", "headline": "Hello"}
|
|
109
|
+
mod = build_module_from_json(data)
|
|
110
|
+
assert mod.module_type == "STANDARD_TEXT"
|
|
111
|
+
|
|
112
|
+
def test_build_module_company_logo(self):
|
|
113
|
+
data = {
|
|
114
|
+
"contentModuleType": "STANDARD_COMPANY_LOGO",
|
|
115
|
+
"imageId": "logo-123",
|
|
116
|
+
}
|
|
117
|
+
mod = build_module_from_json(data)
|
|
118
|
+
assert mod.module_type == "STANDARD_COMPANY_LOGO"
|
|
119
|
+
result = mod.to_dict()
|
|
120
|
+
assert result["standardCompanyLogo"]["companyLogo"]["image"]["uploadDestinationId"] == "logo-123"
|
|
121
|
+
|
|
122
|
+
def test_standard_company_logo_module_to_dict_empty(self):
|
|
123
|
+
mod = StandardCompanyLogoModule()
|
|
124
|
+
assert mod.to_dict() == {}
|
|
125
|
+
|
|
106
126
|
def test_build_module_image_text(self):
|
|
107
127
|
data = {
|
|
108
128
|
"moduleType": "STANDARD_IMAGE_TEXT",
|
|
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
|