makea-cli 0.2.4__py3-none-any.whl → 0.2.5__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.4"
1
+ __version__ = "0.2.5"
makea_cli/api_client.py CHANGED
@@ -1213,6 +1213,27 @@ def designer_create_checkout(body: dict[str, Any]) -> Any:
1213
1213
  return post_json("/designer/payments/basket/create-session", body)
1214
1214
 
1215
1215
 
1216
+ def designer_production_price(production_order_id: str, phase: str) -> Any:
1217
+ """GET /designer/production_orders/{id}/calculate_price — deposit or balance, itemised."""
1218
+ return get_json(
1219
+ f"/designer/production_orders/{production_order_id}/calculate_price",
1220
+ params={"payment_type": phase},
1221
+ )
1222
+
1223
+
1224
+ def designer_set_production_cart(production_order_id: str, cart: dict[str, int]) -> Any:
1225
+ """PUT /designer/production_orders/{id}/cart — replace the size x colour quantities."""
1226
+ return put_json(f"/designer/production_orders/{production_order_id}/cart", {"cart_items": cart})
1227
+
1228
+
1229
+ def designer_set_production_lock(production_order_id: str, locked: bool) -> Any:
1230
+ """POST /designer/production_orders/{id}/configuration-lock — place or reopen the run."""
1231
+ return post_json(
1232
+ f"/designer/production_orders/{production_order_id}/configuration-lock",
1233
+ {"locked": locked},
1234
+ )
1235
+
1236
+
1216
1237
  def designer_list_collections() -> Any:
1217
1238
  """GET /designer/collections — the brand's collections."""
1218
1239
  return get_json("/designer/collections")
@@ -914,3 +914,99 @@ def register(app: typer.Typer) -> None:
914
914
  if accept_terms:
915
915
  body["terms_accepted"] = True
916
916
  print_json_or_exit(console, lambda: api_client.designer_create_checkout(body))
917
+
918
+ # --- the production journey: quantities, place the order, pay the deposit ---
919
+
920
+ @command(
921
+ app,
922
+ "designer",
923
+ "get",
924
+ "production-price",
925
+ api="GET /designer/production_orders/{production_order_id}/calculate_price",
926
+ help=(
927
+ "GET /designer/production_orders/{id}/calculate_price — what the deposit (or the "
928
+ "balance, --phase final) comes to for the quantities on the run right now, line "
929
+ "by line."
930
+ ),
931
+ )
932
+ def get_production_price(
933
+ production_order_id: str = typer.Argument(..., help="Production order id."),
934
+ phase: str = typer.Option("deposit", "--phase", help="deposit or final."),
935
+ ) -> None:
936
+ """Price a production order's deposit or balance."""
937
+ if phase not in ("deposit", "final"):
938
+ raise typer.BadParameter("--phase is deposit or final")
939
+ print_json_or_exit(
940
+ console,
941
+ lambda: api_client.designer_production_price(production_order_id, phase),
942
+ )
943
+
944
+ @command(
945
+ app,
946
+ "designer",
947
+ "set",
948
+ "production-cart",
949
+ api="PUT /designer/production_orders/{production_order_id}/cart",
950
+ side_effects=["replaces the run's quantities; nothing is ordered until it is locked"],
951
+ approval="auto",
952
+ help=(
953
+ "PUT /designer/production_orders/{id}/cart — the quantity of every size and "
954
+ "colour on the run. Replaces the whole cart: pass every cell you want kept. "
955
+ "--qty repeats as 'SIZE,#RRGGBB=COUNT' (quote it: # starts a shell comment), "
956
+ "with the sizes and colour hex codes from "
957
+ "the order's available_sizes / available_colors (`designer list "
958
+ "production-order --product <id>`). Refused once the run is locked."
959
+ ),
960
+ )
961
+ def set_production_cart(
962
+ production_order_id: str = typer.Argument(..., help="Production order id."),
963
+ qty: list[str] = typer.Option(
964
+ ..., "--qty", help="SIZE,#RRGGBB=COUNT for one cell (repeat)."
965
+ ),
966
+ ) -> None:
967
+ """Set a production order's size x colour quantities."""
968
+ cart: dict[str, int] = {}
969
+ for cell in qty:
970
+ key, sep, count = cell.rpartition("=")
971
+ if not sep or "," not in key:
972
+ raise typer.BadParameter(f"--qty {cell!r}: expected SIZE,#RRGGBB=COUNT")
973
+ try:
974
+ n = int(count)
975
+ except ValueError as e:
976
+ raise typer.BadParameter(f"--qty {cell!r}: COUNT must be a whole number") from e
977
+ if n < 0:
978
+ raise typer.BadParameter(f"--qty {cell!r}: COUNT cannot be negative")
979
+ size, _, colour = key.partition(",")
980
+ cart[f"{size.strip()},{colour.strip()}"] = n
981
+ print_json_or_exit(
982
+ console,
983
+ lambda: api_client.designer_set_production_cart(production_order_id, cart),
984
+ )
985
+
986
+ @command(
987
+ app,
988
+ "designer",
989
+ "set",
990
+ "production-lock",
991
+ api="POST /designer/production_orders/{production_order_id}/configuration-lock",
992
+ side_effects=[
993
+ "places the order: the quantities are final and the deposit becomes payable",
994
+ "can be unlocked again until the deposit is paid",
995
+ ],
996
+ approval="ask",
997
+ help=(
998
+ "POST /designer/production_orders/{id}/configuration-lock — place the order "
999
+ "with the quantities on the run (--unlock to reopen them). Locking is what makes "
1000
+ "the deposit payable: `designer create checkout --key "
1001
+ "production:<id>:deposit --accept-terms`."
1002
+ ),
1003
+ )
1004
+ def set_production_lock(
1005
+ production_order_id: str = typer.Argument(..., help="Production order id."),
1006
+ unlock: bool = typer.Option(False, "--unlock", help="Reopen the quantities instead."),
1007
+ ) -> None:
1008
+ """Lock (place) or unlock a production order's configuration."""
1009
+ print_json_or_exit(
1010
+ console,
1011
+ lambda: api_client.designer_set_production_lock(production_order_id, not unlock),
1012
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.4
3
+ Version: 0.2.5
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
@@ -157,6 +157,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
157
157
  | `makea-cli designer get collection` | read | `GET /designer/collections/{collection_id}/overview` | one collection with its products, orders and lifecycle in a single read. | — |
158
158
  | `makea-cli designer get lifecycle` | read | `GET /designer/product_orders/{product_order_id}/lifecycle` | which stage this product is in. | — |
159
159
  | `makea-cli designer get product` | read | `GET /designer/get_product` | one product: status, documents, prices, links. | — |
160
+ | `makea-cli designer get production-price` | read | `GET /designer/production_orders/{production_order_id}/calculate_price` | what the deposit (or the balance, --phase final) comes to for the quantities on the run right now, line by line. | — |
160
161
  | `makea-cli designer get quote-advice` | read | `GET /designer/product/quote_advice` | which quote to award and why, from cache. Reading never spends a model call; the web app is what asks for a fresh one. | — |
161
162
  | `makea-cli designer get tech-pack` | read | `GET /designer/products/{product_id}/technical-specifications` | the product's tech pack. | — |
162
163
  | `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. | — |
@@ -173,6 +174,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
173
174
  | `makea-cli designer list task` | read | `GET /designer/tasks` | what the platform is waiting on you for. | — |
174
175
  | `makea-cli designer search note` | read | `GET /designer/products/{product_id}/channel_search` | full-text search across a product's conversation; --channel narrows to one channel key. | — |
175
176
  | `makea-cli designer set product-collection` | write(auto) | `POST /designer/products/{id}/link-to-collection` | assign product to a collection. | `designer-link-product-to-collection` |
177
+ | `makea-cli designer set production-cart` | write(auto) | `PUT /designer/production_orders/{production_order_id}/cart` | the quantity of every size and colour on the run. Replaces the whole cart: pass every cell you want kept. --qty repea… | — |
178
+ | `makea-cli designer set production-lock` | write(ask) | `POST /designer/production_orders/{production_order_id}/configuration-lock` | place the order with the quantities on the run (--unlock to reopen them). Locking is what makes the deposit payable: … | — |
176
179
  | `makea-cli designer submit production-order` | write(ask) | `POST /designer/production_orders/{production_order_id}/submit` | submit a 大货 order. This is the commitment, so --dry-run and confirm with the user first. | — |
177
180
  | `makea-cli designer submit sampling-order` | write(ask) | `POST /designer/sampling_orders/{sampling_order_id}/confirm` | confirm a sample order so the supplier starts. Run --dry-run first and read it back to the user. | — |
178
181
  | `makea-cli designer submit tech-pack` | write(ask) | `POST /designer/products/{product_id}/technical-specifications/confirm` | confirm the tech pack, the step before anyone is asked to quote. | — |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=SBl2EPFW-ltPvQ7vbVWItyAsz3aKYIpjO7vcfr84GkU,22
1
+ makea_cli/__init__.py,sha256=Xsa3ayOMVkhUWm4t06YeyHE0apjpZefxLH4ylp0CDtU,22
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=rm_0M09oNte-4U_E81k2L9JeHd0NfampHOoH0Ub5-A4,49562
3
+ makea_cli/api_client.py,sha256=Q17LkGpWs_W87Y8ArFBT2l8LfBfsc_OUGPazOaJhQas,50484
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/config.py,sha256=lVPsp-44V9pPyUNbcG-uQNV8srCrBVMZnb0HF38Paks,2906
@@ -17,7 +17,7 @@ makea_cli/commands/analytics/cmd.py,sha256=_I5fBlomTalAxRpB-jculS01AbjEC5cVG3lAN
17
17
  makea_cli/commands/auth/__init__.py,sha256=NXoKGfkY2X_hb8GnAyzhoI_qDXfpwKZPqt4HnOrXW3Y,73
18
18
  makea_cli/commands/auth/cmd.py,sha256=G9ZeiaJwzUUTptIyynr0V-82wI7eV0qVX0pD6rdPSXg,1321
19
19
  makea_cli/commands/brand/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- makea_cli/commands/brand/cmd.py,sha256=WLX3zixuUbQCT6gMT2hMg5qlRgyNJDWYDi15dTsQ99g,35050
20
+ makea_cli/commands/brand/cmd.py,sha256=khcU-vVYKh6fKs43bQTgGHdMCIYG5QP9lkgVnwsrAew,39177
21
21
  makea_cli/commands/designer/__init__.py,sha256=Tc3Ju4-BKX2euBljhlrEd-Ksirk6JSPNixq4x0IbQYI,77
22
22
  makea_cli/commands/designer/cmd.py,sha256=4oOJ5tWYojUs8FBj3QRmgpwbicpsU1XqswoNlJpLLS8,23615
23
23
  makea_cli/commands/directory/__init__.py,sha256=rQHBc0JOFXynlzrBm_YfqoRuNsS-JOl-OOvPjgDbnIA,78
@@ -41,7 +41,7 @@ makea_cli/commands/production/cmd.py,sha256=s6fVAGzOvokF6Va5WKGEA2vw2x2hDQ3PrsF0
41
41
  makea_cli/commands/production/pricing_spec.py,sha256=xGbj7-ps3PcKuU6Oc59A70b62FjF6Awhr5IY3ymZveU,27174
42
42
  makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNLu3ipsZ7dfs,77
43
43
  makea_cli/commands/supplier/cmd.py,sha256=crRCy9WfhkryHMIL3iufoiT90_SG3-mKChAtdhd06uc,58076
44
- makea_cli-0.2.4.dist-info/METADATA,sha256=YNBpGwq6K0GXZF9xNELy1AOgvJykyKD2w7VcuE1ryHs,30554
45
- makea_cli-0.2.4.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
46
- makea_cli-0.2.4.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
47
- makea_cli-0.2.4.dist-info/RECORD,,
44
+ makea_cli-0.2.5.dist-info/METADATA,sha256=mTZNiArC7YmVvHGgAzYXb0roUsba0HVRvUpMcg7hhow,31326
45
+ makea_cli-0.2.5.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
46
+ makea_cli-0.2.5.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
47
+ makea_cli-0.2.5.dist-info/RECORD,,