makea-cli 0.2.40__py3-none-any.whl → 0.2.41__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.
- makea_cli/__init__.py +1 -1
- makea_cli/api_client.py +5 -0
- makea_cli/commands/brand/cmd.py +94 -2
- {makea_cli-0.2.40.dist-info → makea_cli-0.2.41.dist-info}/METADATA +3 -2
- {makea_cli-0.2.40.dist-info → makea_cli-0.2.41.dist-info}/RECORD +7 -7
- {makea_cli-0.2.40.dist-info → makea_cli-0.2.41.dist-info}/WHEEL +0 -0
- {makea_cli-0.2.40.dist-info → makea_cli-0.2.41.dist-info}/entry_points.txt +0 -0
makea_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.41"
|
makea_cli/api_client.py
CHANGED
|
@@ -1960,6 +1960,11 @@ def designer_list_tasks() -> Any:
|
|
|
1960
1960
|
return get_json("/designer/tasks")
|
|
1961
1961
|
|
|
1962
1962
|
|
|
1963
|
+
def designer_get_address_book() -> Any:
|
|
1964
|
+
"""GET /designer/address-book — the brand's saved addresses (ids for --ships-to)."""
|
|
1965
|
+
return get_json("/designer/address-book")
|
|
1966
|
+
|
|
1967
|
+
|
|
1963
1968
|
def designer_list_payments() -> Any:
|
|
1964
1969
|
"""GET /designer/payments — the brand's charges and their state."""
|
|
1965
1970
|
return get_json("/designer/payments")
|
makea_cli/commands/brand/cmd.py
CHANGED
|
@@ -21,8 +21,56 @@ from rich.console import Console
|
|
|
21
21
|
|
|
22
22
|
from makea_cli import api_client
|
|
23
23
|
from makea_cli.commands._util import print_json_or_exit
|
|
24
|
+
from makea_cli.errors import ApiError
|
|
24
25
|
from makea_cli.registry import command
|
|
25
26
|
|
|
27
|
+
# What `designer create rfq` can answer itself when the server says the
|
|
28
|
+
# request still owes it (TECH-232); the rest is answered on the order page.
|
|
29
|
+
RFQ_FLAGS = {
|
|
30
|
+
"Ships to": "--ships-to",
|
|
31
|
+
"Physical sample": "--physical-sample",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _ships_to_value(raw: str) -> Any:
|
|
36
|
+
"""A saved address id, or the address as a JSON object."""
|
|
37
|
+
text = raw.strip()
|
|
38
|
+
if not text.startswith("{"):
|
|
39
|
+
return text
|
|
40
|
+
try:
|
|
41
|
+
value = json.loads(text)
|
|
42
|
+
except json.JSONDecodeError as e:
|
|
43
|
+
raise typer.BadParameter(f"--ships-to is not valid JSON: {e}") from e
|
|
44
|
+
if not isinstance(value, dict):
|
|
45
|
+
raise typer.BadParameter("--ships-to JSON must be an object")
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _yes_no(raw: str, flag: str) -> bool:
|
|
50
|
+
word = raw.strip().lower()
|
|
51
|
+
if word in ("yes", "y", "true"):
|
|
52
|
+
return True
|
|
53
|
+
if word in ("no", "n", "false"):
|
|
54
|
+
return False
|
|
55
|
+
raise typer.BadParameter(f"{flag} is yes or no")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _owed_error(e: ApiError) -> ApiError:
|
|
59
|
+
"""The server's RFQ_INCOMPLETE, said as what to answer and how."""
|
|
60
|
+
detail = e.detail if isinstance(e.detail, dict) else {}
|
|
61
|
+
if detail.get("code") != "RFQ_INCOMPLETE":
|
|
62
|
+
return e
|
|
63
|
+
missing = [str(m) for m in detail.get("missing") or []]
|
|
64
|
+
named = [f"{m} ({RFQ_FLAGS[m]})" if m in RFQ_FLAGS else m for m in missing]
|
|
65
|
+
message = "The request can't go yet. Still to answer: " + ", ".join(named) + "."
|
|
66
|
+
if any(m not in RFQ_FLAGS for m in missing):
|
|
67
|
+
message += " The others are answered on the order's request card."
|
|
68
|
+
out = ApiError(e.status, {**detail, "missing": missing}, method=e.method, path=e.path)
|
|
69
|
+
out.message = message
|
|
70
|
+
out.args = (message,)
|
|
71
|
+
return out
|
|
72
|
+
|
|
73
|
+
|
|
26
74
|
console = Console()
|
|
27
75
|
|
|
28
76
|
|
|
@@ -458,6 +506,21 @@ def register(app: typer.Typer) -> None:
|
|
|
458
506
|
"""List the brand's payments."""
|
|
459
507
|
print_json_or_exit(console, lambda: api_client.designer_list_payments())
|
|
460
508
|
|
|
509
|
+
@command(
|
|
510
|
+
app,
|
|
511
|
+
"designer",
|
|
512
|
+
"list",
|
|
513
|
+
"address",
|
|
514
|
+
api="GET /designer/address-book",
|
|
515
|
+
help=(
|
|
516
|
+
"GET /designer/address-book — the brand's saved addresses. Each shipping "
|
|
517
|
+
"address_id is what `designer create rfq --ships-to` takes."
|
|
518
|
+
),
|
|
519
|
+
)
|
|
520
|
+
def list_addresses() -> None:
|
|
521
|
+
"""List the brand's saved addresses."""
|
|
522
|
+
print_json_or_exit(console, lambda: api_client.designer_get_address_book())
|
|
523
|
+
|
|
461
524
|
@command(
|
|
462
525
|
app,
|
|
463
526
|
"designer",
|
|
@@ -1149,7 +1212,12 @@ def register(app: typer.Typer) -> None:
|
|
|
1149
1212
|
approval="ask",
|
|
1150
1213
|
help=(
|
|
1151
1214
|
"POST /designer/product/send_rfq — ask the chosen suppliers to quote on a product. "
|
|
1152
|
-
"--supplier repeats; --makea-sourcing also asks Makea to source."
|
|
1215
|
+
"--supplier repeats; --makea-sourcing also asks Makea to source. A first send "
|
|
1216
|
+
"needs where bulk ships to and whether a physical sample comes: pass "
|
|
1217
|
+
"--ships-to (a saved address_id from `designer list address`, or the address as "
|
|
1218
|
+
'JSON: \'{"street": "...", "city": "...", "postal_code": "...", "country": "..."}\') '
|
|
1219
|
+
"and --physical-sample yes|no, unless the product already has them. Anything "
|
|
1220
|
+
"still owed is refused (exit 4) with each answer named."
|
|
1153
1221
|
),
|
|
1154
1222
|
)
|
|
1155
1223
|
def create_rfq(
|
|
@@ -1163,6 +1231,19 @@ def register(app: typer.Typer) -> None:
|
|
|
1163
1231
|
makea_sourcing: bool = typer.Option(
|
|
1164
1232
|
False, "--makea-sourcing", help="Also ask Makea to source suppliers."
|
|
1165
1233
|
),
|
|
1234
|
+
ships_to: str | None = typer.Option(
|
|
1235
|
+
None,
|
|
1236
|
+
"--ships-to",
|
|
1237
|
+
help=(
|
|
1238
|
+
"Where bulk ships to: a saved address_id (`designer list address`), or "
|
|
1239
|
+
"the address as a JSON object with street, city, postal_code, country."
|
|
1240
|
+
),
|
|
1241
|
+
),
|
|
1242
|
+
physical_sample: str | None = typer.Option(
|
|
1243
|
+
None,
|
|
1244
|
+
"--physical-sample",
|
|
1245
|
+
help="yes: the brand sends the factory a physical sample; no: the tech pack is enough.",
|
|
1246
|
+
),
|
|
1166
1247
|
) -> None:
|
|
1167
1248
|
"""Send an RFQ."""
|
|
1168
1249
|
if not supplier and not makea_sourcing:
|
|
@@ -1172,7 +1253,18 @@ def register(app: typer.Typer) -> None:
|
|
|
1172
1253
|
body["production_types"] = list(production_type)
|
|
1173
1254
|
if makea_sourcing:
|
|
1174
1255
|
body["makea_sourcing"] = True
|
|
1175
|
-
|
|
1256
|
+
if ships_to:
|
|
1257
|
+
body["ships_to"] = _ships_to_value(ships_to)
|
|
1258
|
+
if physical_sample is not None:
|
|
1259
|
+
body["physical_sample"] = _yes_no(physical_sample, "--physical-sample")
|
|
1260
|
+
|
|
1261
|
+
def send() -> Any:
|
|
1262
|
+
try:
|
|
1263
|
+
return api_client.designer_send_rfq(body)
|
|
1264
|
+
except ApiError as e:
|
|
1265
|
+
raise _owed_error(e) from e
|
|
1266
|
+
|
|
1267
|
+
print_json_or_exit(console, send)
|
|
1176
1268
|
|
|
1177
1269
|
# --- the sampling journey: confirm the pack, award a quote, pay -------------
|
|
1178
1270
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: makea-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.41
|
|
4
4
|
Summary: Makea admin CLI (browser login + Makea admin HTTP API)
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: click<9,>=8.1
|
|
@@ -223,7 +223,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
223
223
|
| `makea-cli designer create pack-file` | write(auto) | `POST /designer/products/{product_id}/tech_spec/files` | put an uploaded file on a tech pack section; a pattern file (DXF, RUL, PLT) goes on Patterns when no section is named. | — |
|
|
224
224
|
| `makea-cli designer create product` | write(ask) | `POST /designer/product/create_or_update_product` | payload must match manufacture/specifications (all frontend fields; categories/subcategories + collection_id in --hel… | `designer-upsert-product` |
|
|
225
225
|
| `makea-cli designer create quote-award` | write(ask) | `POST /designer/quotes/group_pay_prepare` | choose the supplier quote to sample with. --quote is the supplier link id from `designer list supplier-link`; repeat … | — |
|
|
226
|
-
| `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. | — |
|
|
226
|
+
| `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. A first send needs --ships-to (a saved address_id, or the address as JSON) and --physical-sample yes\|no unless the product has them; anything still owed is refused (exit 4) with each answer named. | — |
|
|
227
227
|
| `makea-cli designer create sampling-order` | write(ask) | `POST /designer/sampling_orders` | order samples. --file is the full order payload (product_order_id, items, fees …); run --dry-run first and read the b… | — |
|
|
228
228
|
| `makea-cli designer delete sampling-order` | write(never) | `DELETE /designer/sampling_orders/{sampling_order_id}` | delete a DRAFT sample order. The backend refuses any other status. Graded `never`. | — |
|
|
229
229
|
| `makea-cli designer delete shipping-order` | write(never) | `POST /designer/shipping_orders/{shipping_order_id}/cancel` | the endpoint is called cancel but it unlinks every production order and removes the shipment, so it is a delete here.… | — |
|
|
@@ -239,6 +239,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
239
239
|
| `makea-cli designer get tech-pack-history` | read | `GET /designer/products/{product_id}/specification-change-history` | who changed which spec field, when, and from what. | — |
|
|
240
240
|
| `makea-cli designer list action` | read | `GET /designer/actions` | the pending actions on you, optionally for one product. An action is closed by the fact it asks for, not by acknowled… | — |
|
|
241
241
|
| `makea-cli designer list channel` | read | `GET /designer/products/{product_id}/channels` | the product's conversation channels. | — |
|
|
242
|
+
| `makea-cli designer list address` | read | `GET /designer/address-book` | the brand's saved addresses; each shipping address_id is what `designer create rfq --ships-to` takes. | — |
|
|
242
243
|
| `makea-cli designer list collection` | read | `GET /designer/collections` | the brand's collections. | — |
|
|
243
244
|
| `makea-cli designer list library-element` | read | `GET /designer/library_components` | the brand's own shelf (fabrics, trims, colours, artwork); --section narrows to one kind. | — |
|
|
244
245
|
| `makea-cli designer list payment` | read | `GET /designer/payments` | your charges and whether they are paid. | — |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
makea_cli/__init__.py,sha256=
|
|
1
|
+
makea_cli/__init__.py,sha256=UkGL-D0-v_DX57sRI36Kdzv0WFcOY0k8ej2uP2XX_X4,23
|
|
2
2
|
makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
|
|
3
|
-
makea_cli/api_client.py,sha256=
|
|
3
|
+
makea_cli/api_client.py,sha256=VGpKTPcX-PBaia1zh5gH1gChgc34PXQMfnhoCpVrZkg,92754
|
|
4
4
|
makea_cli/auth_pkce.py,sha256=iXSyJ7DM3qVuj-3FwPiqM25CxXz9ebFs9FNthZdw3ws,7315
|
|
5
5
|
makea_cli/broker.py,sha256=5O650nAdRuF-u9E1MuVM2jVv796iBdxJGIaJasxHij0,3019
|
|
6
6
|
makea_cli/companion.py,sha256=lEEMRDbS-5-CWPawlkPDeCij08pAYW8MsXLVSG3_8V0,10116
|
|
@@ -21,7 +21,7 @@ makea_cli/commands/analytics/cmd.py,sha256=KVLUtYSeyYZ8_09jIuIAmePjQqcpQS2mb5PBB
|
|
|
21
21
|
makea_cli/commands/auth/__init__.py,sha256=NXoKGfkY2X_hb8GnAyzhoI_qDXfpwKZPqt4HnOrXW3Y,73
|
|
22
22
|
makea_cli/commands/auth/cmd.py,sha256=G9ZeiaJwzUUTptIyynr0V-82wI7eV0qVX0pD6rdPSXg,1321
|
|
23
23
|
makea_cli/commands/brand/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
makea_cli/commands/brand/cmd.py,sha256=
|
|
24
|
+
makea_cli/commands/brand/cmd.py,sha256=VlHzF44xcW4xS-nSmQiRxvY6Hp-ytmvNVyvCPGMVINY,57334
|
|
25
25
|
makea_cli/commands/closures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
26
|
makea_cli/commands/closures/cmd.py,sha256=ZMXP-nhm_l5kPf9ZzkpYnhb2wCcNlr89Pbqsc-0Ggjk,8056
|
|
27
27
|
makea_cli/commands/designer/__init__.py,sha256=Tc3Ju4-BKX2euBljhlrEd-Ksirk6JSPNixq4x0IbQYI,77
|
|
@@ -61,7 +61,7 @@ makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNL
|
|
|
61
61
|
makea_cli/commands/supplier/cmd.py,sha256=12YzQIz8478ksOUbuI7pSwSAwQAqLTvXu-AKjyrwLgA,64039
|
|
62
62
|
makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
63
|
makea_cli/commands/tasks/cmd.py,sha256=72MrVigmjjQCpDVF2a3aJn_gclw2iBbJdFmyd87mXec,8549
|
|
64
|
-
makea_cli-0.2.
|
|
65
|
-
makea_cli-0.2.
|
|
66
|
-
makea_cli-0.2.
|
|
67
|
-
makea_cli-0.2.
|
|
64
|
+
makea_cli-0.2.41.dist-info/METADATA,sha256=pAHTXZi4-3hkIL3_jYV90Y02g1_M0G5lU5lluj0VEOU,53257
|
|
65
|
+
makea_cli-0.2.41.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
66
|
+
makea_cli-0.2.41.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
|
|
67
|
+
makea_cli-0.2.41.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|