makea-cli 0.2.37__py3-none-any.whl → 0.2.38__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.37"
1
+ __version__ = "0.2.38"
makea_cli/api_client.py CHANGED
@@ -1480,6 +1480,19 @@ def designer_get_order_flow(product_id: str) -> Any:
1480
1480
  return get_json(f"/designer/products/{product_id}/order_flow")
1481
1481
 
1482
1482
 
1483
+ def designer_step_library(product_id: str) -> Any:
1484
+ """GET /designer/products/{id}/order_flow/step_library — the steps the brand
1485
+ used on its other orders, its step rules, and this order's steps a new one
1486
+ may follow."""
1487
+ return get_json(f"/designer/products/{product_id}/order_flow/step_library")
1488
+
1489
+
1490
+ def designer_add_custom_steps(product_id: str, steps: list[dict[str, Any]]) -> Any:
1491
+ """POST /designer/products/{id}/order_flow/custom_steps/batch — several
1492
+ steps at once; each names ``after`` or ``anchor_type``."""
1493
+ return post_json(f"{_designer_step_path(product_id)}/batch", {"steps": steps})
1494
+
1495
+
1483
1496
  def designer_add_custom_step(product_id: str, body: dict[str, Any]) -> Any:
1484
1497
  """POST /designer/products/{id}/order_flow/custom_steps — {label, after, who,
1485
1498
  completion, due, hold, note, placement?, joins?}."""
@@ -23,6 +23,7 @@ them.
23
23
 
24
24
  from __future__ import annotations
25
25
 
26
+ import json
26
27
  from pathlib import Path
27
28
  from typing import Any
28
29
 
@@ -492,6 +493,66 @@ def _register_designer(app: typer.Typer) -> None:
492
493
  )
493
494
  print_json_or_exit(console, lambda: api_client.designer_add_custom_step(product_id, body))
494
495
 
496
+ @command(
497
+ app,
498
+ "designer",
499
+ "list",
500
+ "step-library",
501
+ api="GET /designer/products/{product_id}/order_flow/step_library",
502
+ help=(
503
+ "Steps you used on your other orders (most used first: name, who does "
504
+ "it, how it is done, the kind of step it came after as anchor_type, how "
505
+ "many orders and which), your rules that add a step to every order, and "
506
+ "this order's steps a new one can follow. Read it before setting an "
507
+ "order up like your last ones."
508
+ ),
509
+ )
510
+ def designer_list_step_library(
511
+ product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
512
+ ) -> None:
513
+ """Steps you used on other orders, to set this one up."""
514
+ print_json_or_exit(console, lambda: api_client.designer_step_library(product_id))
515
+
516
+ @command(
517
+ app,
518
+ "designer",
519
+ "create",
520
+ "custom-steps",
521
+ api="POST /designer/products/{product_id}/order_flow/custom_steps/batch",
522
+ side_effects=[
523
+ "every step shows on your order page, and the factory's when it does it",
524
+ "whoever does a step gets an action card once it opens",
525
+ ],
526
+ approval="ask",
527
+ help=(
528
+ "Add several steps to your order at once, from a JSON list in --file. "
529
+ "Each item: label, who (BRAND, SUPPLIER, MAKEA), completion (check, "
530
+ "upload, send), and either after (a step id) or anchor_type (the kind "
531
+ "of step it follows, as step-library gives it); optional placement "
532
+ "(inline, alongside), hold, note, due ({mode: before, key, days} or "
533
+ "{mode: date, date})."
534
+ ),
535
+ )
536
+ def designer_create_custom_steps(
537
+ product_id: str = typer.Argument(..., help=_PRODUCT_HELP),
538
+ file: Path = typer.Option(
539
+ ...,
540
+ "--file",
541
+ "-f",
542
+ exists=True,
543
+ dir_okay=False,
544
+ help="JSON list of steps.",
545
+ ),
546
+ ) -> None:
547
+ """Add several steps to your order at once."""
548
+ try:
549
+ steps = json.loads(file.read_text(encoding="utf-8"))
550
+ except ValueError as e:
551
+ raise typer.BadParameter(f"--file is not valid JSON: {e}") from e
552
+ if not isinstance(steps, list) or not steps:
553
+ raise typer.BadParameter("--file must hold a JSON list of steps")
554
+ print_json_or_exit(console, lambda: api_client.designer_add_custom_steps(product_id, steps))
555
+
495
556
  @command(
496
557
  app,
497
558
  "designer",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.37
3
+ Version: 0.2.38
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
@@ -213,6 +213,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
213
213
  | `makea-cli designer create checkout` | write(ask) | `POST /designer/payments/basket/create-session` | a Stripe checkout link for one or more charges. --key repeats: sampling:<sampling_order_id>, production:<production_o… | — |
214
214
  | `makea-cli designer create collection` | write(auto) | `POST /designer/collections/create` | create or update a designer collection. | `designer-create-collection` |
215
215
  | `makea-cli designer create custom-step` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps` | add a step to your order: `--after`, `--placement inline\|alongside\|beside` (default alongside), `--joins` / `--no-joins`, `--who`, `--done-when`, due, `--note`. | — |
216
+ | `makea-cli designer create custom-steps` | write(ask) | `POST /designer/products/{product_id}/order_flow/custom_steps/batch` | add several steps at once from `--file` (a JSON list; each item names `after` or `anchor_type`). | — |
217
+ | `makea-cli designer list step-library` | read | `GET /designer/products/{product_id}/order_flow/step_library` | steps used on your other orders, your step rules, and this order's steps a new one can follow. | — |
216
218
  | `makea-cli designer create library-element` | write(auto) | `POST /designer/library_components` | add a fabric, trim or other part to the brand's library; --document attaches a photo or data sheet, --draft when required fields are unknown. | — |
217
219
  | `makea-cli designer create note` | write(ask) | `POST /designer/products/{product_id}/notes` | post a message into a product's conversation. | — |
218
220
  | `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. | — |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=5cBA1BOigyaIjTZkiKDnt-MqIStCt3LXAj1D5m_PUbg,23
1
+ makea_cli/__init__.py,sha256=GFASnxYQos3wXWEnb0SyWm8AN1_G5QGZbYyzzpVOW0E,23
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=5HmLZuY1ljqbSDd-BpGFyWLFZt2iCCYENAjBX11EwGU,90271
3
+ makea_cli/api_client.py,sha256=gKRzN9m53_VTcsdAhtGR6UxP70sUeCTKioFU7_TwbHk,90895
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
@@ -41,7 +41,7 @@ makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-I
41
41
  makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
42
  makea_cli/commands/metrics/cmd.py,sha256=gAYNztkhvdK8miP3ayDu0JgYzxLr42-ToeiXBCrAQeA,8656
43
43
  makea_cli/commands/order_flow/__init__.py,sha256=SmD-TaDbNZLeu8q1nkPi2H6gJaKCrNAyW3Ejj6-UBog,79
44
- makea_cli/commands/order_flow/cmd.py,sha256=3kUelbdFDDaxxLp0GMjtSG__CbV_aQQDhswxeJCR4aY,30960
44
+ makea_cli/commands/order_flow/cmd.py,sha256=epZ7E8vsVzy8bGLQ0e4MmqwvBqp2da1kpFVsXUjwiLg,33479
45
45
  makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
46
46
  makea_cli/commands/orders/cmd.py,sha256=LgYPmC-eXEIvKhDYLKxo03DsJ2529-yKPKFPixnMBu0,23072
47
47
  makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -59,7 +59,7 @@ makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNL
59
59
  makea_cli/commands/supplier/cmd.py,sha256=12YzQIz8478ksOUbuI7pSwSAwQAqLTvXu-AKjyrwLgA,64039
60
60
  makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  makea_cli/commands/tasks/cmd.py,sha256=72MrVigmjjQCpDVF2a3aJn_gclw2iBbJdFmyd87mXec,8549
62
- makea_cli-0.2.37.dist-info/METADATA,sha256=ls1R_knOZuxyOxXZnERi-rPst9gUhmTpxBg629G4z7Q,51096
63
- makea_cli-0.2.37.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
- makea_cli-0.2.37.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
65
- makea_cli-0.2.37.dist-info/RECORD,,
62
+ makea_cli-0.2.38.dist-info/METADATA,sha256=CX23ythdy0eJLfeCUG9mYlcjMdqCnVmh7hfEkZQjtco,51551
63
+ makea_cli-0.2.38.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
+ makea_cli-0.2.38.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
65
+ makea_cli-0.2.38.dist-info/RECORD,,