makea-cli 0.2.23__py3-none-any.whl → 0.2.25__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.23"
1
+ __version__ = "0.2.25"
makea_cli/api_client.py CHANGED
@@ -907,32 +907,6 @@ def update_production_order_details(
907
907
  )
908
908
 
909
909
 
910
- def get_cumulative_payment_and_platform_revenue(
911
- *,
912
- start_date: str,
913
- end_date: str,
914
- granularity: str | None = None,
915
- currency: str | None = None,
916
- order_type: str | None = None,
917
- ) -> Any:
918
- """
919
- GET /admin/business-metrics/cumulative-payment-and-platform-revenue —
920
- platform-wide cumulative payment received and platform revenue (service fee +
921
- transaction fee) within a date range, bucketed by day/week/month.
922
- """
923
- params: dict[str, Any] = {"start_date": start_date, "end_date": end_date}
924
- if granularity is not None:
925
- params["granularity"] = granularity
926
- if currency is not None:
927
- params["currency"] = currency
928
- if order_type is not None:
929
- params["order_type"] = order_type
930
- return get_json(
931
- "/admin/business-metrics/cumulative-payment-and-platform-revenue",
932
- params=params,
933
- )
934
-
935
-
936
910
  def list_growth_snapshots() -> Any:
937
911
  """GET /admin/growth/snapshots — published Growth Analysis snapshots, newest first."""
938
912
  return get_json("/admin/growth/snapshots")
@@ -1760,6 +1734,13 @@ def designer_approve_proposal(note_id: str, proposal_id: str) -> Any:
1760
1734
  )
1761
1735
 
1762
1736
 
1737
+ def designer_create_proposals(product_id: str, proposals: list[dict[str, Any]]) -> Any:
1738
+ """POST /designer/products/{id}/tech_spec/proposals — change cards on the tech pack."""
1739
+ return post_json(
1740
+ f"/designer/products/{product_id}/tech_spec/proposals", {"proposals": proposals}
1741
+ )
1742
+
1743
+
1763
1744
  def designer_bulk_accept_actions(channel_id: str, actions: list[dict[str, str]]) -> Any:
1764
1745
  """POST /designer/channels/{id}/suggested_actions/bulk_accept — accept several at once."""
1765
1746
  return post_json(
@@ -666,6 +666,90 @@ def register(app: typer.Typer) -> None:
666
666
  """Approve one assistant proposal."""
667
667
  print_json_or_exit(console, lambda: api_client.designer_approve_proposal(note, proposal_id))
668
668
 
669
+ @command(
670
+ app,
671
+ "designer",
672
+ "create",
673
+ "proposal",
674
+ api="POST /designer/products/{product_id}/tech_spec/proposals",
675
+ side_effects=[
676
+ "puts a change card on the tech pack; the pack changes only when the user applies it"
677
+ ],
678
+ approval="auto",
679
+ help=(
680
+ "POST /designer/products/{id}/tech_spec/proposals — propose a tech-pack change as a "
681
+ "card on the field it changes. Name the section and field as `get tech-pack "
682
+ "--readable` shows them; pick a row with --item (a value it holds) or --entry, a line "
683
+ "with --was. A refusal lists the sections, fields, rows or lines that exist. "
684
+ "--file takes a JSON list of the same keys for several changes at once."
685
+ ),
686
+ )
687
+ def create_proposal(
688
+ product: str = typer.Option(..., "--product", "-p", help="Product id."),
689
+ section: str | None = typer.Option(
690
+ None, "--section", help='Section, by label or key (e.g. "Trims & hardware").'
691
+ ),
692
+ field: str | None = typer.Option(
693
+ None, "--field", help="Field, by label or key (field-based packs)."
694
+ ),
695
+ value: str | None = typer.Option(None, "--value", help="The new value or line."),
696
+ reason: str | None = typer.Option(
697
+ None, "--reason", help="One line the user reads on the card."
698
+ ),
699
+ action: str = typer.Option(
700
+ "update", "--action", help="update (default), add (a new row or line) or delete."
701
+ ),
702
+ entry: int | None = typer.Option(
703
+ None, "--entry", help="Row number in a repeating section, 0 = first."
704
+ ),
705
+ item: str | None = typer.Option(
706
+ None, "--item", help='Pick the row that holds this value now (e.g. "cord lock").'
707
+ ),
708
+ was: str | None = typer.Option(
709
+ None, "--was", help="Current text of the line to change (line-based packs)."
710
+ ),
711
+ kind: str | None = typer.Option(
712
+ None, "--kind", help="For a new line: spec (default) or note."
713
+ ),
714
+ replaces: list[str] = typer.Option(
715
+ [], "--replaces", help="line_id a new line replaces (repeat)."
716
+ ),
717
+ document: list[str] = typer.Option(
718
+ [], "--document", help="document_id the change comes from (repeat)."
719
+ ),
720
+ file: Path | None = typer.Option(
721
+ None,
722
+ "--file",
723
+ "-f",
724
+ exists=True,
725
+ dir_okay=False,
726
+ help="JSON list of proposals with the keys above, instead of the flags.",
727
+ ),
728
+ ) -> None:
729
+ """Propose tech-pack changes."""
730
+ if file is not None:
731
+ items = json.loads(file.read_text(encoding="utf-8"))
732
+ if not isinstance(items, list):
733
+ raise typer.BadParameter("--file must hold a JSON list of proposals")
734
+ else:
735
+ if not section or not reason:
736
+ raise typer.BadParameter("--section and --reason are required (or --file)")
737
+ one: dict[str, Any] = {
738
+ "section": section,
739
+ "field": field,
740
+ "value": value,
741
+ "reason": reason,
742
+ "action": action,
743
+ "entry": entry,
744
+ "item": item,
745
+ "was": was,
746
+ "kind": kind,
747
+ "replaces": replaces or None,
748
+ "documents": document or None,
749
+ }
750
+ items = [{k: v for k, v in one.items() if v is not None}]
751
+ print_json_or_exit(console, lambda: api_client.designer_create_proposals(product, items))
752
+
669
753
  @command(
670
754
  app,
671
755
  "designer",
@@ -14,96 +14,8 @@ from makea_cli.commands._util import print_json_or_exit
14
14
 
15
15
  console = Console()
16
16
 
17
- _GRANULARITIES = ("day", "week", "month")
18
- _ORDER_TYPES = ("all", "sampling", "production")
19
-
20
17
 
21
18
  def register(app: typer.Typer) -> None:
22
- @command(
23
- app,
24
- "admin",
25
- "get",
26
- "revenue-metrics",
27
- legacy="get-cumulative-payment-and-platform-revenue",
28
- api="GET /admin/business-metrics/cumulative-payment-and-platform-revenue",
29
- help=(
30
- "GET /admin/business-metrics/cumulative-payment-and-platform-revenue — "
31
- "platform-wide payment received and platform revenue (service fee + "
32
- "transaction fee) bucketed over a date range."
33
- ),
34
- )
35
- def get_cumulative_payment_and_platform_revenue(
36
- start_date: str = typer.Option(
37
- ...,
38
- "--start-date",
39
- help="Start date (inclusive), ISO format YYYY-MM-DD.",
40
- ),
41
- end_date: str = typer.Option(
42
- ...,
43
- "--end-date",
44
- help="End date (inclusive), ISO format YYYY-MM-DD.",
45
- ),
46
- granularity: str = typer.Option(
47
- "day",
48
- "--granularity",
49
- "-g",
50
- help="Time bucket: day, week, or month. Default: day.",
51
- ),
52
- currency: str = typer.Option(
53
- "GBP",
54
- "--currency",
55
- "-c",
56
- help="Target currency for conversion. Default: GBP.",
57
- ),
58
- order_type: str = typer.Option(
59
- "all",
60
- "--order-type",
61
- "-t",
62
- help="Filter: all, sampling, or production. Default: all.",
63
- ),
64
- ) -> None:
65
- """
66
- Platform-wide cumulative payment received and platform revenue over a date range.
67
-
68
- Calls GET /admin/business-metrics/cumulative-payment-and-platform-revenue.
69
-
70
- Platform revenue = service fee + transaction fee (the 2.8% transaction fee is
71
- applied by the server). The response contains two siblings under ``result``:
72
-
73
- - ``payment_received``: cumulative/period amounts per bucket, plus a
74
- ``payment_breakdown`` (sampling / production_deposit / production_final).
75
- - ``platform_revenue``: cumulative/period amounts per bucket.
76
-
77
- Input: required --start-date and --end-date (YYYY-MM-DD); optional
78
- --granularity (day|week|month), --currency, --order-type (all|sampling|production).
79
-
80
- Output: raw JSON body from the admin business-metrics endpoint.
81
-
82
- This endpoint is **platform-wide only** and does not support filtering by
83
- user_id, product, or category. For per-user / per-product drill-downs, use
84
- admin list product-order / admin list sampling-order --product /
85
- admin list production-order --product and aggregate client-side.
86
- """
87
- g = granularity.strip().lower()
88
- if g not in _GRANULARITIES:
89
- console.print(f"[red]--granularity must be one of: {', '.join(_GRANULARITIES)}.[/red]")
90
- raise typer.Exit(1)
91
- ot = order_type.strip().lower()
92
- if ot not in _ORDER_TYPES:
93
- console.print(f"[red]--order-type must be one of: {', '.join(_ORDER_TYPES)}.[/red]")
94
- raise typer.Exit(1)
95
-
96
- print_json_or_exit(
97
- console,
98
- lambda: api_client.get_cumulative_payment_and_platform_revenue(
99
- start_date=start_date,
100
- end_date=end_date,
101
- granularity=g,
102
- currency=currency,
103
- order_type=ot,
104
- ),
105
- )
106
-
107
19
  @command(
108
20
  app,
109
21
  "admin",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.23
3
+ Version: 0.2.25
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
@@ -119,7 +119,6 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
119
119
  | `makea-cli admin get playbook-preview` | read | `GET /admin/playbook/preview` | the playbook block one AI surface would get for a person or factory, and every rule left out with its reason; --product previews a conversation about one product, --rule answers for one rule. | — |
120
120
  | `makea-cli admin get production-pricing` | read | `GET /admin/production_orders/{id}/details` | show a production order's price tiers, MOQ, sizes/colours, pricing groups and cart coverage. | `production-pricing-show` |
121
121
  | `makea-cli admin get quote-request` | read | `GET /admin/quote_requests/{quote_request_id}` | one quote request in full. | — |
122
- | `makea-cli admin get revenue-metrics` | read | `GET /admin/business-metrics/cumulative-payment-and-platform-revenue` | platform-wide payment received and platform revenue (service fee + transaction fee) bucketed over a date range. | `get-cumulative-payment-and-platform-revenue` |
123
122
  | `makea-cli admin get rule` | read | `GET /admin/playbook/{target}/rules/{rule_id}` | one rule in full (`--user` / `--supplier` / `--global`), with its evidence: where it came from, who changed it and why. | — |
124
123
  | `makea-cli admin get rule-history` | read | `GET /admin/playbook/rules/{rule_id}/history` | every revision of one rule: its words, who changed it and why, and the rule that replaced it. | — |
125
124
  | `makea-cli admin get shipping-order` | read | `GET /admin/shipping_orders/{shipping_order_id}/details` | one shipment with its production and sampling orders, freight quotes, fees, tracking and address. | — |
@@ -211,6 +210,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
211
210
  | `makea-cli designer update note` | write(ask) | `POST /designer/products/{product_id}/notes/{note_id}/{accept\|reject}` | decide on a task the assistant proposed on a product. | — |
212
211
  | `makea-cli designer update product` | write(auto) | `POST /designer/product/update_basic_info` | patch fields on a product. --cover-image / --back-image take a document id and are what the assistant's set_product_i… | — |
213
212
  | `makea-cli designer update production-order` | write(ask) | `POST /designer/production_orders/{production_order_id}/complete` | POST /designer/production_orders/{id}/complete, or PUT the order to re-pick which supplier links it covers (--links-f… | — |
213
+ | `makea-cli designer create proposal` | write(auto) | `POST /designer/products/{product_id}/tech_spec/proposals` | propose a tech-pack change as a card on the field it changes; the user applies it. Name section/field as `get tech-pack --readable` shows them; --item / --entry pick a row, --was a line. | — |
214
214
  | `makea-cli designer update proposal` | write(ask) | `POST /designer/beeboo_proposals/approve` | apply one spec change the assistant proposed. This edits the pack, so read the proposal first. | — |
215
215
  | `makea-cli designer update sampling-order` | write(never) | `POST /designer/sampling_orders/{sampling_order_id}/cancel` | cancel a sample order. Graded `never`: an agent must not do this on its own, a person runs it. | — |
216
216
  | `makea-cli designer update shipping-order` | write(ask) | `POST /designer/shipping_orders/{shipping_order_id}/confirm_receive` | say the goods arrived. The backend accepts this only while the shipment is IN_TRANSIT. | — |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=drfF0qMRjoB2RacyqP-NkNmDOIBrys6RWHvqSTpZLuc,23
1
+ makea_cli/__init__.py,sha256=kx2V3mL-5OE7Q8rQ4rG5_RJEWOoZ9gDri5puJRGkRm8,23
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=SQWPYQzIrm9BqWrraHkhAQeFZjljLHZm_ioSnlcz9ss,75766
3
+ makea_cli/api_client.py,sha256=aWyyfs11bozLIoX1_q8J6lsT0_PsHcp52M50o7YwhJ8,75192
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=hz8MnJSkhxcIEZkcpHR005JrDceo1Xmi8qwIUq50cMU,3003
@@ -19,7 +19,7 @@ makea_cli/commands/analytics/cmd.py,sha256=KVLUtYSeyYZ8_09jIuIAmePjQqcpQS2mb5PBB
19
19
  makea_cli/commands/auth/__init__.py,sha256=NXoKGfkY2X_hb8GnAyzhoI_qDXfpwKZPqt4HnOrXW3Y,73
20
20
  makea_cli/commands/auth/cmd.py,sha256=G9ZeiaJwzUUTptIyynr0V-82wI7eV0qVX0pD6rdPSXg,1321
21
21
  makea_cli/commands/brand/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- makea_cli/commands/brand/cmd.py,sha256=I2L1F-OGoLkwZ6xNXAuM-KWTXhp1ebPNxTjmr7lQtmQ,45364
22
+ makea_cli/commands/brand/cmd.py,sha256=qwocVgpUhOd1SRCmaxPF5yVuH-PcL8InvOvVOidHrn8,49011
23
23
  makea_cli/commands/designer/__init__.py,sha256=Tc3Ju4-BKX2euBljhlrEd-Ksirk6JSPNixq4x0IbQYI,77
24
24
  makea_cli/commands/designer/cmd.py,sha256=4oOJ5tWYojUs8FBj3QRmgpwbicpsU1XqswoNlJpLLS8,23615
25
25
  makea_cli/commands/directory/__init__.py,sha256=rQHBc0JOFXynlzrBm_YfqoRuNsS-JOl-OOvPjgDbnIA,78
@@ -33,7 +33,7 @@ makea_cli/commands/factory/cmd.py,sha256=k_UGkqpzxxZhN9WjKt1rb95KOTGHMpMJRpfNHTG
33
33
  makea_cli/commands/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-IPuSU,11187
35
35
  makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- makea_cli/commands/metrics/cmd.py,sha256=GvJe83vQu8XSCEulsfDvA60eKnvpIA5ItyMbvxjHQss,12069
36
+ makea_cli/commands/metrics/cmd.py,sha256=gAYNztkhvdK8miP3ayDu0JgYzxLr42-ToeiXBCrAQeA,8656
37
37
  makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
38
38
  makea_cli/commands/orders/cmd.py,sha256=Nh5lGv5k4SIwsr_hg-ndah8eTorZCYIMpTAz4CCi6oY,13352
39
39
  makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -49,7 +49,7 @@ makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNL
49
49
  makea_cli/commands/supplier/cmd.py,sha256=crRCy9WfhkryHMIL3iufoiT90_SG3-mKChAtdhd06uc,58076
50
50
  makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  makea_cli/commands/tasks/cmd.py,sha256=SRvv4Ovtcf5-me-8AdKcZ_z_gSrdgC0pbswYbMz7oY4,6539
52
- makea_cli-0.2.23.dist-info/METADATA,sha256=R8vXTZWjsjKrw0eGacTTpI3gCFT3xv8uV41cJ5wqau4,38087
53
- makea_cli-0.2.23.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
54
- makea_cli-0.2.23.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
55
- makea_cli-0.2.23.dist-info/RECORD,,
52
+ makea_cli-0.2.25.dist-info/METADATA,sha256=x42PNOt3Os342LDGYdWs-o7t-c0qw8oLGuV_PXcs3ng,38119
53
+ makea_cli-0.2.25.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
54
+ makea_cli-0.2.25.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
55
+ makea_cli-0.2.25.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.32.4
2
+ Generator: hatchling 1.33.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any