@usethrottle/cli 1.0.3 → 2.0.0
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.
- package/README.md +179 -33
- package/dist/cli.js +650 -328
- package/dist/cli.js.map +1 -1
- package/package.json +12 -11
package/README.md
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
# @usethrottle/cli
|
|
7
7
|
|
|
8
|
-
Command-line tool for the Throttle multi-tenant payments platform
|
|
8
|
+
Command-line tool for the Throttle multi-tenant payments platform — manage
|
|
9
|
+
orders, payments, customers, subscriptions, discounts, webhooks, events, and
|
|
10
|
+
embed config from your terminal.
|
|
9
11
|
|
|
10
12
|
## Install
|
|
11
13
|
|
|
@@ -13,56 +15,200 @@ Command-line tool for the Throttle multi-tenant payments platform.
|
|
|
13
15
|
npm install -g @usethrottle/cli
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
This installs a `throttle` binary (Node >= 20).
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
## Auth & profiles
|
|
21
|
+
|
|
22
|
+
The CLI authenticates every request with a Throttle secret key (`sk_test_…` /
|
|
23
|
+
`sk_live_…`). You can supply that key on every invocation, via an environment
|
|
24
|
+
variable, or once via a saved local profile.
|
|
25
|
+
|
|
26
|
+
Create a profile:
|
|
19
27
|
|
|
20
28
|
```bash
|
|
21
|
-
throttle
|
|
29
|
+
throttle config set prod --api-key sk_live_xxxxxxxxxxxx --label "Production"
|
|
22
30
|
```
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
`--api <url>` may be added to point a profile at a non-default API base URL
|
|
33
|
+
(defaults to `https://api.usethrottle.dev`). Manage profiles with:
|
|
25
34
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
```bash
|
|
36
|
+
throttle config use <profile> # set the default profile
|
|
37
|
+
throttle config list # list profiles (keys masked)
|
|
38
|
+
throttle config remove <profile> # delete a profile
|
|
39
|
+
```
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
The first profile you create becomes the default automatically.
|
|
42
|
+
|
|
43
|
+
### Auth precedence
|
|
44
|
+
|
|
45
|
+
For both the API key and the API base URL, the CLI resolves the effective
|
|
46
|
+
value in this order:
|
|
47
|
+
|
|
48
|
+
1. `--api-key` / `--api` flag passed on the command line
|
|
49
|
+
2. `$THROTTLE_API_KEY` / `$THROTTLE_API_URL` environment variable
|
|
50
|
+
3. The selected profile (`--profile <name>`, or the default profile if
|
|
51
|
+
`--profile` is omitted)
|
|
52
|
+
|
|
53
|
+
If no key is found through any of these, the command fails with an error
|
|
54
|
+
telling you how to set one.
|
|
55
|
+
|
|
56
|
+
### Where config is stored
|
|
57
|
+
|
|
58
|
+
Profiles live in `~/.throttle/config.json` (override the directory with
|
|
59
|
+
`$THROTTLE_CONFIG_HOME`). The file is written with `chmod 0600`.
|
|
60
|
+
|
|
61
|
+
**Keys are stored in plaintext** inside that file — the same posture as the
|
|
62
|
+
Stripe CLI and GitHub CLI credential stores. Anyone with read access to your
|
|
63
|
+
`$HOME` can read the raw key; treat the machine you run this on accordingly.
|
|
64
|
+
|
|
65
|
+
## Global flags
|
|
66
|
+
|
|
67
|
+
These apply to any subcommand:
|
|
68
|
+
|
|
69
|
+
| Flag | Description |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `--json` | Machine-readable JSON output (implies non-interactive; skips confirmation prompts) |
|
|
72
|
+
| `-q, --quiet` | Suppress the startup banner |
|
|
73
|
+
| `--profile <name>` | Config profile to use |
|
|
74
|
+
| `--api-key <sk_>` | API key (overrides profile / `$THROTTLE_API_KEY`) |
|
|
75
|
+
| `--api <url>` | API base URL (overrides profile / `$THROTTLE_API_URL`) |
|
|
76
|
+
| `-y, --yes` | Skip confirmation prompts |
|
|
77
|
+
| `-v, --version` | Print the CLI version |
|
|
78
|
+
|
|
79
|
+
## Command reference
|
|
80
|
+
|
|
81
|
+
Money-moving and other state-changing commands (cancel, refund, capture,
|
|
82
|
+
delete, rotate-secret, replay, etc.) prompt for confirmation before acting.
|
|
83
|
+
Pass `-y`/`--yes` to skip the prompt for scripting or CI. Add `--json` to any
|
|
84
|
+
read command to get machine-readable output instead of a table.
|
|
85
|
+
|
|
86
|
+
### `config` — local profiles
|
|
31
87
|
|
|
32
|
-
```
|
|
33
|
-
throttle
|
|
88
|
+
```
|
|
89
|
+
throttle config set <profile> --api-key sk_... [--api <url>] [--label <text>]
|
|
90
|
+
throttle config use <profile>
|
|
91
|
+
throttle config list [--json]
|
|
92
|
+
throttle config remove <profile>
|
|
34
93
|
```
|
|
35
94
|
|
|
36
|
-
###
|
|
95
|
+
### `whoami` — active key context
|
|
37
96
|
|
|
38
|
-
```
|
|
39
|
-
throttle
|
|
97
|
+
```
|
|
98
|
+
throttle whoami
|
|
40
99
|
```
|
|
41
100
|
|
|
42
|
-
|
|
101
|
+
Shows the environment and granted scopes for the resolved API key.
|
|
43
102
|
|
|
44
|
-
###
|
|
103
|
+
### `orders` (+ `fulfillments`)
|
|
45
104
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
105
|
+
```
|
|
106
|
+
throttle orders list --status completed
|
|
107
|
+
throttle orders get <id>
|
|
108
|
+
throttle orders cancel <id>
|
|
109
|
+
throttle orders export [--status <s>] [--payment-status <s>] [--type <t>] [--source <s>] [-o, --out <file>]
|
|
110
|
+
throttle orders line-items <id> [--add <json>] [--update <json>] [--remove <ids>]
|
|
111
|
+
|
|
112
|
+
throttle orders fulfillments list <orderId>
|
|
113
|
+
throttle orders fulfillments get <orderId> <id>
|
|
114
|
+
throttle orders fulfillments create <orderId> [--items <json>]
|
|
115
|
+
throttle orders fulfillments processing|complete|cancel <orderId> <id>
|
|
116
|
+
throttle orders fulfillments ship <orderId> <id> --carrier <c> --tracking <t>
|
|
117
|
+
```
|
|
49
118
|
|
|
50
|
-
|
|
51
|
-
|
|
119
|
+
`orders list` also accepts `--payment-status`, `--type`, `--source`,
|
|
120
|
+
`-q/--query`, `--limit`, `--cursor`. `orders export` writes CSV to stdout, or
|
|
121
|
+
to `--out <file>` when given.
|
|
122
|
+
|
|
123
|
+
### `returns` — RMA / exchanges
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
throttle returns list --order <orderId>
|
|
127
|
+
throttle returns open --order <orderId> --items <json> [--reason <r>] [--restock]
|
|
128
|
+
throttle returns get <id>
|
|
129
|
+
throttle returns transition <id> --action approve|receive|complete|reject|cancel
|
|
130
|
+
throttle returns exchange <id> --items <json>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### `payments`
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
throttle payments refund pay_1 --amount 500 --reason "partial"
|
|
137
|
+
throttle payments get <id>
|
|
138
|
+
throttle payments capture <id> [--amount <cents>]
|
|
139
|
+
throttle payments resend-invoice <id>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--amount` is in minor units; omit it on `refund`/`capture` to act on the full
|
|
143
|
+
balance / full authorized amount.
|
|
144
|
+
|
|
145
|
+
### `customers` (+ `addresses`)
|
|
52
146
|
|
|
53
|
-
throttle embed-config set \
|
|
54
|
-
--origins https://shop.example.com,https://staging.shop.example.com \
|
|
55
|
-
--primary "#ff6b00" \
|
|
56
|
-
--logo https://shop.example.com/logo.png \
|
|
57
|
-
--merchant-name "Shop"
|
|
58
147
|
```
|
|
148
|
+
throttle customers list [-q, --query <text>] [--limit <n>] [--cursor <c>]
|
|
149
|
+
throttle customers get <id>
|
|
150
|
+
throttle customers create --email <e> [--name <n>] [--external-id <x>]
|
|
151
|
+
throttle customers update <id> [--email <e>] [--name <n>] [--external-id <x>]
|
|
152
|
+
|
|
153
|
+
throttle customers addresses list <id>
|
|
154
|
+
throttle customers addresses add <id> --json-body <json>
|
|
155
|
+
throttle customers addresses update <id> <addrId> --json-body <json>
|
|
156
|
+
throttle customers addresses remove <id> <addrId>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `subscriptions`
|
|
59
160
|
|
|
60
|
-
|
|
61
|
-
|
|
161
|
+
```
|
|
162
|
+
throttle subscriptions list [--customer <id>] [--limit <n>] [--cursor <c>]
|
|
163
|
+
throttle subscriptions get <id>
|
|
164
|
+
throttle subscriptions cancel <id> [--at-period-end]
|
|
165
|
+
throttle subscriptions pause <id>
|
|
166
|
+
throttle subscriptions resume <id>
|
|
167
|
+
throttle subscriptions change-plan <id> --amount <cents> --interval <i> [--plan-reference <r>] [--plan-name <n>] [--effective now|period_end]
|
|
168
|
+
throttle subscriptions cancel-pending-change <id>
|
|
169
|
+
```
|
|
62
170
|
|
|
63
|
-
|
|
171
|
+
### `discounts`
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
throttle discounts list
|
|
175
|
+
throttle discounts create --json-body <json>
|
|
176
|
+
throttle discounts toggle <id> --active|--inactive
|
|
177
|
+
throttle discounts delete <id>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### `webhooks` (`endpoints` + `deliveries`)
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
throttle webhooks endpoints create --url https://x/hook --events order.created
|
|
184
|
+
throttle webhooks endpoints list
|
|
185
|
+
throttle webhooks endpoints update <id> [--url <u>] [--events <list>] [--active <bool>]
|
|
186
|
+
throttle webhooks endpoints delete <id>
|
|
187
|
+
throttle webhooks endpoints send-test <id>
|
|
188
|
+
throttle webhooks endpoints rotate-secret <id>
|
|
189
|
+
|
|
190
|
+
throttle webhooks deliveries list [--endpoint <id>] [--status <s>]
|
|
191
|
+
throttle webhooks deliveries get <id>
|
|
192
|
+
throttle webhooks deliveries replay <id>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
`--events` is a comma-separated list of event types.
|
|
196
|
+
|
|
197
|
+
### `events` — emitted events + catalog
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
throttle events list [--type <t>] [--limit <n>] [--cursor <c>]
|
|
201
|
+
throttle events get <id>
|
|
202
|
+
throttle events types
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### `embed` — allowlist + branding
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
throttle embed set --origins https://shop.example.com
|
|
209
|
+
throttle embed show
|
|
210
|
+
```
|
|
64
211
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
| `--api-key` | `THROTTLE_API_KEY` | (interactive prompt) |
|
|
212
|
+
`embed set` also accepts `--primary <hex>`, `--logo <url>`, and
|
|
213
|
+
`--merchant-name <name>`; pass at least one flag. Origins are a comma-separated
|
|
214
|
+
list of `https://host[:port]` (no paths, no wildcards, up to 20 entries).
|