@fulldivevr/workcord-cli 1.0.0 → 1.1.1

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.
Files changed (81) hide show
  1. package/README.md +88 -30
  2. package/dist/auth.js +38 -4
  3. package/dist/cli.js +3 -1
  4. package/dist/client.js +21 -12
  5. package/dist/commands/auth.js +33 -14
  6. package/dist/commands/challenges.js +2 -7
  7. package/dist/commands/custom-agents.js +3 -8
  8. package/dist/commands/dm.js +2 -3
  9. package/dist/commands/health.js +29 -0
  10. package/dist/commands/messages.js +8 -21
  11. package/dist/commands/room-agents.js +2 -7
  12. package/dist/commands/rooms.js +24 -31
  13. package/dist/commands/users.js +4 -9
  14. package/dist/commands/whoami.js +24 -7
  15. package/dist/config.js +34 -0
  16. package/dist/generated/commands/activity.js +3 -6
  17. package/dist/generated/commands/ai.js +3 -6
  18. package/dist/generated/commands/ambassador.js +3 -6
  19. package/dist/generated/commands/apple-iap.js +4 -9
  20. package/dist/generated/commands/attribution.js +6 -15
  21. package/dist/generated/commands/auth.js +9 -24
  22. package/dist/generated/commands/challenges.js +13 -36
  23. package/dist/generated/commands/clips.js +3 -6
  24. package/dist/generated/commands/contact-match.js +7 -18
  25. package/dist/generated/commands/content-crawler.js +2 -3
  26. package/dist/generated/commands/custom-agents.js +22 -63
  27. package/dist/generated/commands/desktop-releases.js +5 -12
  28. package/dist/generated/commands/discover.js +9 -24
  29. package/dist/generated/commands/dm.js +10 -27
  30. package/dist/generated/commands/drafts.js +3 -6
  31. package/dist/generated/commands/embed.js +3 -6
  32. package/dist/generated/commands/explore.js +2 -3
  33. package/dist/generated/commands/feed.js +4 -9
  34. package/dist/generated/commands/feedback.js +2 -3
  35. package/dist/generated/commands/gamification.js +3 -6
  36. package/dist/generated/commands/google-play-iap.js +4 -9
  37. package/dist/generated/commands/internal.js +9 -24
  38. package/dist/generated/commands/interview.js +4 -9
  39. package/dist/generated/commands/invite-redirect.js +2 -3
  40. package/dist/generated/commands/jesuscord-admin.js +3 -6
  41. package/dist/generated/commands/join.js +2 -3
  42. package/dist/generated/commands/kits.js +7 -18
  43. package/dist/generated/commands/meetings.js +6 -15
  44. package/dist/generated/commands/message-folders.js +5 -12
  45. package/dist/generated/commands/messages.js +17 -48
  46. package/dist/generated/commands/one-emulator.js +2 -3
  47. package/dist/generated/commands/pdf-export.js +2 -3
  48. package/dist/generated/commands/pin-folders.js +5 -12
  49. package/dist/generated/commands/pinned-messages.js +4 -9
  50. package/dist/generated/commands/polls.js +6 -15
  51. package/dist/generated/commands/premium-feeds.js +2 -3
  52. package/dist/generated/commands/processors.js +2 -3
  53. package/dist/generated/commands/questions.js +3 -6
  54. package/dist/generated/commands/referrals.js +2 -3
  55. package/dist/generated/commands/reports.js +2 -3
  56. package/dist/generated/commands/room-a2-a.js +6 -15
  57. package/dist/generated/commands/room-agents.js +13 -36
  58. package/dist/generated/commands/room-invites.js +9 -24
  59. package/dist/generated/commands/room-owned-agent.js +3 -6
  60. package/dist/generated/commands/room-page.js +2 -3
  61. package/dist/generated/commands/rooms.js +45 -132
  62. package/dist/generated/commands/saved-messages.js +4 -9
  63. package/dist/generated/commands/saved-stories.js +7 -18
  64. package/dist/generated/commands/search.js +2 -3
  65. package/dist/generated/commands/shadow-home-agent.js +3 -6
  66. package/dist/generated/commands/shadow.js +5 -12
  67. package/dist/generated/commands/share-cards.js +4 -9
  68. package/dist/generated/commands/share.js +2 -3
  69. package/dist/generated/commands/sponsors.js +2 -3
  70. package/dist/generated/commands/stories.js +12 -33
  71. package/dist/generated/commands/story-by-id.js +2 -3
  72. package/dist/generated/commands/submissions.js +4 -9
  73. package/dist/generated/commands/subscriptions.js +8 -21
  74. package/dist/generated/commands/tips.js +3 -6
  75. package/dist/generated/commands/users.js +16 -45
  76. package/dist/generated/commands/voice-token.js +2 -3
  77. package/dist/generated/commands/well-known.js +3 -6
  78. package/dist/generated/commands/wrapped.js +2 -3
  79. package/dist/generated/index.js +0 -2
  80. package/package.json +3 -2
  81. package/dist/generated/commands/health.js +0 -32
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "shadow", "Shadow operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/shadow/context")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/shadow/context`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -22,9 +21,7 @@ export function register(program) {
22
21
  .command("context-status")
23
22
  .description("GET /api/v1/shadow/context/status")
24
23
  .action(async (opts) => {
25
- const { as } = program.opts();
26
- if (!as)
27
- throw new Error("--as <userId> is required");
24
+ const as = actingUserId(program);
28
25
  const path = `/api/v1/shadow/context/status`;
29
26
  const data = await call({ method: "GET", path, asUserId: as });
30
27
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -36,9 +33,7 @@ export function register(program) {
36
33
  .description("POST /api/v1/shadow/draft")
37
34
  .option("--body <json>", "request body as JSON (no schema available)")
38
35
  .action(async (opts) => {
39
- const { as } = program.opts();
40
- if (!as)
41
- throw new Error("--as <userId> is required");
36
+ const as = actingUserId(program);
42
37
  const path = `/api/v1/shadow/draft`;
43
38
  const body = opts.body ? JSON.parse(opts.body) : undefined;
44
39
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -51,9 +46,7 @@ export function register(program) {
51
46
  .description("POST /api/v1/shadow/welcome")
52
47
  .option("--body <json>", "request body as JSON (no schema available)")
53
48
  .action(async (opts) => {
54
- const { as } = program.opts();
55
- if (!as)
56
- throw new Error("--as <userId> is required");
49
+ const as = actingUserId(program);
57
50
  const path = `/api/v1/shadow/welcome`;
58
51
  const body = opts.body ? JSON.parse(opts.body) : undefined;
59
52
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "share-cards", "ShareCards operations");
@@ -12,9 +13,7 @@ export function register(program) {
12
13
  .option("--show-attribution <true|false>", "boolean")
13
14
  .option("--caption <value>", "string")
14
15
  .action(async (opts) => {
15
- const { as } = program.opts();
16
- if (!as)
17
- throw new Error("--as <userId> is required");
16
+ const as = actingUserId(program);
18
17
  const path = `/api/v1/stories/${encodeURIComponent(opts.storyId)}/share-cards`;
19
18
  const body = {};
20
19
  {
@@ -48,9 +47,7 @@ export function register(program) {
48
47
  .option("--cursor <value>", "string")
49
48
  .option("--limit <value>", "string")
50
49
  .action(async (opts) => {
51
- const { as } = program.opts();
52
- if (!as)
53
- throw new Error("--as <userId> is required");
50
+ const as = actingUserId(program);
54
51
  const path = `/api/v1/users/me/share-cards`;
55
52
  const query = {};
56
53
  {
@@ -73,9 +70,7 @@ export function register(program) {
73
70
  .description("GET /api/v1/share-cards/{cardId}/public")
74
71
  .requiredOption("--card-id <value>", "cardId (path param)")
75
72
  .action(async (opts) => {
76
- const { as } = program.opts();
77
- if (!as)
78
- throw new Error("--as <userId> is required");
73
+ const as = actingUserId(program);
79
74
  const path = `/api/v1/share-cards/${encodeURIComponent(opts.cardId)}/public`;
80
75
  const data = await call({ method: "GET", path, asUserId: as });
81
76
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "share", "Share operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /s/{cardId}")
9
10
  .requiredOption("--card-id <value>", "cardId (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/s/${encodeURIComponent(opts.cardId)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "sponsors", "Sponsors operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/rooms/{roomId}/sponsor")
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/sponsor`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "stories", "Stories operations");
@@ -22,9 +23,7 @@ export function register(program) {
22
23
  .option("--meme-top-text <value>", "string")
23
24
  .option("--meme-bottom-text <value>", "string")
24
25
  .action(async (opts) => {
25
- const { as } = program.opts();
26
- if (!as)
27
- throw new Error("--as <userId> is required");
26
+ const as = actingUserId(program);
28
27
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories`;
29
28
  const body = {};
30
29
  {
@@ -112,9 +111,7 @@ export function register(program) {
112
111
  .option("--limit <value>", "string")
113
112
  .option("--ids <value>", "string")
114
113
  .action(async (opts) => {
115
- const { as } = program.opts();
116
- if (!as)
117
- throw new Error("--as <userId> is required");
114
+ const as = actingUserId(program);
118
115
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories`;
119
116
  const query = {};
120
117
  {
@@ -153,9 +150,7 @@ export function register(program) {
153
150
  .requiredOption("--room-id <value>", "roomId (path param)")
154
151
  .requiredOption("--story-id <value>", "storyId (path param)")
155
152
  .action(async (opts) => {
156
- const { as } = program.opts();
157
- if (!as)
158
- throw new Error("--as <userId> is required");
153
+ const as = actingUserId(program);
159
154
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}`;
160
155
  const data = await call({ method: "GET", path, asUserId: as });
161
156
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -168,9 +163,7 @@ export function register(program) {
168
163
  .requiredOption("--room-id <value>", "roomId (path param)")
169
164
  .requiredOption("--story-id <value>", "storyId (path param)")
170
165
  .action(async (opts) => {
171
- const { as } = program.opts();
172
- if (!as)
173
- throw new Error("--as <userId> is required");
166
+ const as = actingUserId(program);
174
167
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/sources`;
175
168
  const data = await call({ method: "GET", path, asUserId: as });
176
169
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -183,9 +176,7 @@ export function register(program) {
183
176
  .requiredOption("--room-id <value>", "roomId (path param)")
184
177
  .requiredOption("--story-id <value>", "storyId (path param)")
185
178
  .action(async (opts) => {
186
- const { as } = program.opts();
187
- if (!as)
188
- throw new Error("--as <userId> is required");
179
+ const as = actingUserId(program);
189
180
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/claims`;
190
181
  const data = await call({ method: "GET", path, asUserId: as });
191
182
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -199,9 +190,7 @@ export function register(program) {
199
190
  .requiredOption("--story-id <value>", "storyId (path param)")
200
191
  .requiredOption("--type <value>", "string")
201
192
  .action(async (opts) => {
202
- const { as } = program.opts();
203
- if (!as)
204
- throw new Error("--as <userId> is required");
193
+ const as = actingUserId(program);
205
194
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/reactions`;
206
195
  const body = {};
207
196
  {
@@ -219,9 +208,7 @@ export function register(program) {
219
208
  .description("DELETE /api/v1/rooms/{roomId}/stories/{storyId}/reactions/{reactionId}")
220
209
  .requiredOption("--reaction-id <value>", "reactionId (path param)")
221
210
  .action(async (opts) => {
222
- const { as } = program.opts();
223
- if (!as)
224
- throw new Error("--as <userId> is required");
211
+ const as = actingUserId(program);
225
212
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/reactions/${encodeURIComponent(opts.reactionId)}`;
226
213
  const data = await call({ method: "DELETE", path, asUserId: as });
227
214
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -234,9 +221,7 @@ export function register(program) {
234
221
  .requiredOption("--room-id <value>", "roomId (path param)")
235
222
  .requiredOption("--story-id <value>", "storyId (path param)")
236
223
  .action(async (opts) => {
237
- const { as } = program.opts();
238
- if (!as)
239
- throw new Error("--as <userId> is required");
224
+ const as = actingUserId(program);
240
225
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/disputes`;
241
226
  const data = await call({ method: "GET", path, asUserId: as });
242
227
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -252,9 +237,7 @@ export function register(program) {
252
237
  .option("--note <value>", "string")
253
238
  .option("--counter-source-url <value>", "string")
254
239
  .action(async (opts) => {
255
- const { as } = program.opts();
256
- if (!as)
257
- throw new Error("--as <userId> is required");
240
+ const as = actingUserId(program);
258
241
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/disputes`;
259
242
  const body = {};
260
243
  {
@@ -284,9 +267,7 @@ export function register(program) {
284
267
  .requiredOption("--story-id <value>", "storyId (path param)")
285
268
  .requiredOption("--target-room-id <value>", "string")
286
269
  .action(async (opts) => {
287
- const { as } = program.opts();
288
- if (!as)
289
- throw new Error("--as <userId> is required");
270
+ const as = actingUserId(program);
290
271
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/syndicate`;
291
272
  const body = {};
292
273
  {
@@ -306,9 +287,7 @@ export function register(program) {
306
287
  .requiredOption("--story-id <value>", "storyId (path param)")
307
288
  .requiredOption("--question <value>", "string")
308
289
  .action(async (opts) => {
309
- const { as } = program.opts();
310
- if (!as)
311
- throw new Error("--as <userId> is required");
290
+ const as = actingUserId(program);
312
291
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/stories/${encodeURIComponent(opts.storyId)}/questions`;
313
292
  const body = {};
314
293
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "story-by-id", "StoryById operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/stories/{storyId}")
9
10
  .requiredOption("--story-id <value>", "storyId (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/stories/${encodeURIComponent(opts.storyId)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "submissions", "Submissions operations");
@@ -15,9 +16,7 @@ export function register(program) {
15
16
  .option("--image-url <value>", "string")
16
17
  .option("--image-urls <comma-separated>", "array, ≤5 items")
17
18
  .action(async (opts) => {
18
- const { as } = program.opts();
19
- if (!as)
20
- throw new Error("--as <userId> is required");
19
+ const as = actingUserId(program);
21
20
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions`;
22
21
  const body = {};
23
22
  {
@@ -67,9 +66,7 @@ export function register(program) {
67
66
  .option("--cursor <value>", "string")
68
67
  .option("--limit <value>", "string")
69
68
  .action(async (opts) => {
70
- const { as } = program.opts();
71
- if (!as)
72
- throw new Error("--as <userId> is required");
69
+ const as = actingUserId(program);
73
70
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions`;
74
71
  const query = {};
75
72
  {
@@ -94,9 +91,7 @@ export function register(program) {
94
91
  .requiredOption("--submission-id <value>", "submissionId (path param)")
95
92
  .requiredOption("--status <value>", "string")
96
93
  .action(async (opts) => {
97
- const { as } = program.opts();
98
- if (!as)
99
- throw new Error("--as <userId> is required");
94
+ const as = actingUserId(program);
100
95
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/submissions/${encodeURIComponent(opts.submissionId)}`;
101
96
  const body = {};
102
97
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "subscriptions", "Subscriptions operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("list-plans")
8
9
  .description("GET /api/v1/plans")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/v1/plans`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -20,9 +19,7 @@ export function register(program) {
20
19
  .command("get")
21
20
  .description("GET /api/v1/users/me/subscription")
22
21
  .action(async (opts) => {
23
- const { as } = program.opts();
24
- if (!as)
25
- throw new Error("--as <userId> is required");
22
+ const as = actingUserId(program);
26
23
  const path = `/api/v1/users/me/subscription`;
27
24
  const data = await call({ method: "GET", path, asUserId: as });
28
25
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -34,9 +31,7 @@ export function register(program) {
34
31
  .description("POST /api/v1/subscriptions/checkout-session")
35
32
  .option("--body <json>", "request body as JSON (no schema available)")
36
33
  .action(async (opts) => {
37
- const { as } = program.opts();
38
- if (!as)
39
- throw new Error("--as <userId> is required");
34
+ const as = actingUserId(program);
40
35
  const path = `/api/v1/subscriptions/checkout-session`;
41
36
  const body = opts.body ? JSON.parse(opts.body) : undefined;
42
37
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -49,9 +44,7 @@ export function register(program) {
49
44
  .description("POST /api/v1/subscriptions/portal-session")
50
45
  .option("--body <json>", "request body as JSON (no schema available)")
51
46
  .action(async (opts) => {
52
- const { as } = program.opts();
53
- if (!as)
54
- throw new Error("--as <userId> is required");
47
+ const as = actingUserId(program);
55
48
  const path = `/api/v1/subscriptions/portal-session`;
56
49
  const body = opts.body ? JSON.parse(opts.body) : undefined;
57
50
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -64,9 +57,7 @@ export function register(program) {
64
57
  .description("POST /api/v1/webhooks/stripe")
65
58
  .option("--body <json>", "request body as JSON (no schema available)")
66
59
  .action(async (opts) => {
67
- const { as } = program.opts();
68
- if (!as)
69
- throw new Error("--as <userId> is required");
60
+ const as = actingUserId(program);
70
61
  const path = `/api/v1/webhooks/stripe`;
71
62
  const body = opts.body ? JSON.parse(opts.body) : undefined;
72
63
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -78,9 +69,7 @@ export function register(program) {
78
69
  .command("success-page")
79
70
  .description("GET /api/v1/subscriptions/success")
80
71
  .action(async (opts) => {
81
- const { as } = program.opts();
82
- if (!as)
83
- throw new Error("--as <userId> is required");
72
+ const as = actingUserId(program);
84
73
  const path = `/api/v1/subscriptions/success`;
85
74
  const data = await call({ method: "GET", path, asUserId: as });
86
75
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -91,9 +80,7 @@ export function register(program) {
91
80
  .command("cancel-page")
92
81
  .description("GET /api/v1/subscriptions/cancel")
93
82
  .action(async (opts) => {
94
- const { as } = program.opts();
95
- if (!as)
96
- throw new Error("--as <userId> is required");
83
+ const as = actingUserId(program);
97
84
  const path = `/api/v1/subscriptions/cancel`;
98
85
  const data = await call({ method: "GET", path, asUserId: as });
99
86
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "tips", "Tips operations");
@@ -12,9 +13,7 @@ export function register(program) {
12
13
  .requiredOption("--amount <n>", "number")
13
14
  .requiredOption("--currency <value>", "string")
14
15
  .action(async (opts) => {
15
- const { as } = program.opts();
16
- if (!as)
17
- throw new Error("--as <userId> is required");
16
+ const as = actingUserId(program);
18
17
  const path = `/api/v1/tips`;
19
18
  const body = {};
20
19
  {
@@ -53,9 +52,7 @@ export function register(program) {
53
52
  .option("--cursor <value>", "string")
54
53
  .option("--limit <value>", "string")
55
54
  .action(async (opts) => {
56
- const { as } = program.opts();
57
- if (!as)
58
- throw new Error("--as <userId> is required");
55
+ const as = actingUserId(program);
59
56
  const path = `/api/v1/users/me/tips/received`;
60
57
  const query = {};
61
58
  {
@@ -1,6 +1,7 @@
1
1
  // Auto-generated. Do not edit by hand. Regenerate via `npm run generate`.
2
2
  import { Option } from "commander";
3
3
  import { call } from "../../client.js";
4
+ import { actingUserId } from "../../auth.js";
4
5
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
5
6
  export function register(program) {
6
7
  const group = getOrCreateGroup(program, "users", "Users operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .command("get-me")
10
11
  .description("GET /api/v1/users/me")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/users/me`;
16
15
  const data = await call({ method: "GET", path, asUserId: as });
17
16
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("PATCH /api/v1/users/me")
24
23
  .option("--body <json>", "request body as JSON (no schema available)")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/users/me`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -37,9 +34,7 @@ export function register(program) {
37
34
  .command("delete-me")
38
35
  .description("DELETE /api/v1/users/me")
39
36
  .action(async (opts) => {
40
- const { as } = program.opts();
41
- if (!as)
42
- throw new Error("--as <userId> is required");
37
+ const as = actingUserId(program);
43
38
  const path = `/api/v1/users/me`;
44
39
  const data = await call({ method: "DELETE", path, asUserId: as });
45
40
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -51,9 +46,7 @@ export function register(program) {
51
46
  .description("POST /api/v1/users/me/avatar")
52
47
  .option("--body <json>", "request body as JSON (no schema available)")
53
48
  .action(async (opts) => {
54
- const { as } = program.opts();
55
- if (!as)
56
- throw new Error("--as <userId> is required");
49
+ const as = actingUserId(program);
57
50
  const path = `/api/v1/users/me/avatar`;
58
51
  const body = opts.body ? JSON.parse(opts.body) : undefined;
59
52
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -65,9 +58,7 @@ export function register(program) {
65
58
  .command("get-level")
66
59
  .description("GET /api/v1/users/me/level")
67
60
  .action(async (opts) => {
68
- const { as } = program.opts();
69
- if (!as)
70
- throw new Error("--as <userId> is required");
61
+ const as = actingUserId(program);
71
62
  const path = `/api/v1/users/me/level`;
72
63
  const data = await call({ method: "GET", path, asUserId: as });
73
64
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -78,9 +69,7 @@ export function register(program) {
78
69
  .command("get-credibility")
79
70
  .description("GET /api/v1/users/me/credibility")
80
71
  .action(async (opts) => {
81
- const { as } = program.opts();
82
- if (!as)
83
- throw new Error("--as <userId> is required");
72
+ const as = actingUserId(program);
84
73
  const path = `/api/v1/users/me/credibility`;
85
74
  const data = await call({ method: "GET", path, asUserId: as });
86
75
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -113,9 +102,7 @@ export function register(program) {
113
102
  .option("--ai-auto-sort <true|false>", "boolean")
114
103
  .addOption(new Option("--inbox-sort-mode <value>", "string, enum").choices(["category", "activity"]))
115
104
  .action(async (opts) => {
116
- const { as } = program.opts();
117
- if (!as)
118
- throw new Error("--as <userId> is required");
105
+ const as = actingUserId(program);
119
106
  const path = `/api/v1/users/me/settings`;
120
107
  const body = {};
121
108
  {
@@ -237,9 +224,7 @@ export function register(program) {
237
224
  .command("list-children")
238
225
  .description("GET /api/v1/users/me/children")
239
226
  .action(async (opts) => {
240
- const { as } = program.opts();
241
- if (!as)
242
- throw new Error("--as <userId> is required");
227
+ const as = actingUserId(program);
243
228
  const path = `/api/v1/users/me/children`;
244
229
  const data = await call({ method: "GET", path, asUserId: as });
245
230
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -252,9 +237,7 @@ export function register(program) {
252
237
  .requiredOption("--display-name <value>", "string")
253
238
  .requiredOption("--age <n>", "number")
254
239
  .action(async (opts) => {
255
- const { as } = program.opts();
256
- if (!as)
257
- throw new Error("--as <userId> is required");
240
+ const as = actingUserId(program);
258
241
  const path = `/api/v1/users/me/children`;
259
242
  const body = {};
260
243
  {
@@ -278,9 +261,7 @@ export function register(program) {
278
261
  .option("--cursor <value>", "string")
279
262
  .option("--limit <value>", "string")
280
263
  .action(async (opts) => {
281
- const { as } = program.opts();
282
- if (!as)
283
- throw new Error("--as <userId> is required");
264
+ const as = actingUserId(program);
284
265
  const path = `/api/v1/users/me/notifications`;
285
266
  const query = {};
286
267
  {
@@ -304,9 +285,7 @@ export function register(program) {
304
285
  .requiredOption("--id <value>", "id (path param)")
305
286
  .option("--body <json>", "request body as JSON (no schema available)")
306
287
  .action(async (opts) => {
307
- const { as } = program.opts();
308
- if (!as)
309
- throw new Error("--as <userId> is required");
288
+ const as = actingUserId(program);
310
289
  const path = `/api/v1/users/me/notifications/${encodeURIComponent(opts.id)}/read`;
311
290
  const body = opts.body ? JSON.parse(opts.body) : undefined;
312
291
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -319,9 +298,7 @@ export function register(program) {
319
298
  .description("POST /api/v1/users/me/fcm-token")
320
299
  .option("--body <json>", "request body as JSON (no schema available)")
321
300
  .action(async (opts) => {
322
- const { as } = program.opts();
323
- if (!as)
324
- throw new Error("--as <userId> is required");
301
+ const as = actingUserId(program);
325
302
  const path = `/api/v1/users/me/fcm-token`;
326
303
  const body = opts.body ? JSON.parse(opts.body) : undefined;
327
304
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -333,9 +310,7 @@ export function register(program) {
333
310
  .command("remove-fcm-token")
334
311
  .description("DELETE /api/v1/users/me/fcm-token")
335
312
  .action(async (opts) => {
336
- const { as } = program.opts();
337
- if (!as)
338
- throw new Error("--as <userId> is required");
313
+ const as = actingUserId(program);
339
314
  const path = `/api/v1/users/me/fcm-token`;
340
315
  const data = await call({ method: "DELETE", path, asUserId: as });
341
316
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -347,9 +322,7 @@ export function register(program) {
347
322
  .description("GET /api/v1/users/{userId}/public")
348
323
  .requiredOption("--user-id <value>", "userId (path param)")
349
324
  .action(async (opts) => {
350
- const { as } = program.opts();
351
- if (!as)
352
- throw new Error("--as <userId> is required");
325
+ const as = actingUserId(program);
353
326
  const path = `/api/v1/users/${encodeURIComponent(opts.userId)}/public`;
354
327
  const data = await call({ method: "GET", path, asUserId: as });
355
328
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -361,9 +334,7 @@ export function register(program) {
361
334
  .description("GET /api/v1/users/{userId}")
362
335
  .requiredOption("--user-id <value>", "userId (path param)")
363
336
  .action(async (opts) => {
364
- const { as } = program.opts();
365
- if (!as)
366
- throw new Error("--as <userId> is required");
337
+ const as = actingUserId(program);
367
338
  const path = `/api/v1/users/${encodeURIComponent(opts.userId)}`;
368
339
  const data = await call({ method: "GET", path, asUserId: as });
369
340
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "voice-token", "VoiceToken operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/voice/token")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/voice/token`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "well-known", "WellKnown operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("apple-app-site-association")
8
9
  .description("GET /.well-known/apple-app-site-association")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/.well-known/apple-app-site-association`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -20,9 +19,7 @@ export function register(program) {
20
19
  .command("asset-links")
21
20
  .description("GET /.well-known/assetlinks.json")
22
21
  .action(async (opts) => {
23
- const { as } = program.opts();
24
- if (!as)
25
- throw new Error("--as <userId> is required");
22
+ const as = actingUserId(program);
26
23
  const path = `/.well-known/assetlinks.json`;
27
24
  const data = await call({ method: "GET", path, asUserId: as });
28
25
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "wrapped", "Wrapped operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/users/me/wrapped/{year}")
9
10
  .requiredOption("--year <value>", "year (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/users/me/wrapped/${encodeURIComponent(opts.year)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");