@fulldivevr/workcord-cli 1.0.0 → 1.1.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.
Files changed (77) hide show
  1. package/README.md +67 -25
  2. package/dist/auth.js +38 -4
  3. package/dist/client.js +5 -5
  4. package/dist/commands/auth.js +7 -2
  5. package/dist/commands/challenges.js +2 -7
  6. package/dist/commands/custom-agents.js +3 -8
  7. package/dist/commands/dm.js +2 -3
  8. package/dist/commands/messages.js +8 -21
  9. package/dist/commands/room-agents.js +2 -7
  10. package/dist/commands/rooms.js +24 -31
  11. package/dist/commands/users.js +4 -9
  12. package/dist/commands/whoami.js +24 -7
  13. package/dist/generated/commands/activity.js +3 -6
  14. package/dist/generated/commands/ai.js +3 -6
  15. package/dist/generated/commands/ambassador.js +3 -6
  16. package/dist/generated/commands/apple-iap.js +4 -9
  17. package/dist/generated/commands/attribution.js +6 -15
  18. package/dist/generated/commands/auth.js +9 -24
  19. package/dist/generated/commands/challenges.js +13 -36
  20. package/dist/generated/commands/clips.js +3 -6
  21. package/dist/generated/commands/contact-match.js +7 -18
  22. package/dist/generated/commands/content-crawler.js +2 -3
  23. package/dist/generated/commands/custom-agents.js +22 -63
  24. package/dist/generated/commands/desktop-releases.js +5 -12
  25. package/dist/generated/commands/discover.js +9 -24
  26. package/dist/generated/commands/dm.js +10 -27
  27. package/dist/generated/commands/drafts.js +3 -6
  28. package/dist/generated/commands/embed.js +3 -6
  29. package/dist/generated/commands/explore.js +2 -3
  30. package/dist/generated/commands/feed.js +4 -9
  31. package/dist/generated/commands/feedback.js +2 -3
  32. package/dist/generated/commands/gamification.js +3 -6
  33. package/dist/generated/commands/google-play-iap.js +4 -9
  34. package/dist/generated/commands/health.js +3 -6
  35. package/dist/generated/commands/internal.js +9 -24
  36. package/dist/generated/commands/interview.js +4 -9
  37. package/dist/generated/commands/invite-redirect.js +2 -3
  38. package/dist/generated/commands/jesuscord-admin.js +3 -6
  39. package/dist/generated/commands/join.js +2 -3
  40. package/dist/generated/commands/kits.js +7 -18
  41. package/dist/generated/commands/meetings.js +6 -15
  42. package/dist/generated/commands/message-folders.js +5 -12
  43. package/dist/generated/commands/messages.js +17 -48
  44. package/dist/generated/commands/one-emulator.js +2 -3
  45. package/dist/generated/commands/pdf-export.js +2 -3
  46. package/dist/generated/commands/pin-folders.js +5 -12
  47. package/dist/generated/commands/pinned-messages.js +4 -9
  48. package/dist/generated/commands/polls.js +6 -15
  49. package/dist/generated/commands/premium-feeds.js +2 -3
  50. package/dist/generated/commands/processors.js +2 -3
  51. package/dist/generated/commands/questions.js +3 -6
  52. package/dist/generated/commands/referrals.js +2 -3
  53. package/dist/generated/commands/reports.js +2 -3
  54. package/dist/generated/commands/room-a2-a.js +6 -15
  55. package/dist/generated/commands/room-agents.js +13 -36
  56. package/dist/generated/commands/room-invites.js +9 -24
  57. package/dist/generated/commands/room-owned-agent.js +3 -6
  58. package/dist/generated/commands/room-page.js +2 -3
  59. package/dist/generated/commands/rooms.js +45 -132
  60. package/dist/generated/commands/saved-messages.js +4 -9
  61. package/dist/generated/commands/saved-stories.js +7 -18
  62. package/dist/generated/commands/search.js +2 -3
  63. package/dist/generated/commands/shadow-home-agent.js +3 -6
  64. package/dist/generated/commands/shadow.js +5 -12
  65. package/dist/generated/commands/share-cards.js +4 -9
  66. package/dist/generated/commands/share.js +2 -3
  67. package/dist/generated/commands/sponsors.js +2 -3
  68. package/dist/generated/commands/stories.js +12 -33
  69. package/dist/generated/commands/story-by-id.js +2 -3
  70. package/dist/generated/commands/submissions.js +4 -9
  71. package/dist/generated/commands/subscriptions.js +8 -21
  72. package/dist/generated/commands/tips.js +3 -6
  73. package/dist/generated/commands/users.js +16 -45
  74. package/dist/generated/commands/voice-token.js +2 -3
  75. package/dist/generated/commands/well-known.js +3 -6
  76. package/dist/generated/commands/wrapped.js +2 -3
  77. package/package.json +3 -2
@@ -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, "meetings", "Meetings operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/meetings")
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/meetings`;
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("trial-status")
23
22
  .description("GET /api/v1/meetings/trial")
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/meetings/trial`;
29
26
  const data = await call({ method: "GET", path, asUserId: as });
30
27
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -38,9 +35,7 @@ export function register(program) {
38
35
  .requiredOption("--index <value>", "index (path param)")
39
36
  .option("--body <json>", "request body as JSON (no schema available)")
40
37
  .action(async (opts) => {
41
- const { as } = program.opts();
42
- if (!as)
43
- throw new Error("--as <userId> is required");
38
+ const as = actingUserId(program);
44
39
  const path = `/api/v1/meetings/${encodeURIComponent(opts.id)}/chunks/${encodeURIComponent(opts.index)}`;
45
40
  const body = opts.body ? JSON.parse(opts.body) : undefined;
46
41
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -54,9 +49,7 @@ export function register(program) {
54
49
  .requiredOption("--id <value>", "id (path param)")
55
50
  .option("--body <json>", "request body as JSON (no schema available)")
56
51
  .action(async (opts) => {
57
- const { as } = program.opts();
58
- if (!as)
59
- throw new Error("--as <userId> is required");
52
+ const as = actingUserId(program);
60
53
  const path = `/api/v1/meetings/${encodeURIComponent(opts.id)}/complete`;
61
54
  const body = opts.body ? JSON.parse(opts.body) : undefined;
62
55
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -69,9 +62,7 @@ export function register(program) {
69
62
  .description("GET /api/v1/meetings/{id}/transcript")
70
63
  .requiredOption("--id <value>", "id (path param)")
71
64
  .action(async (opts) => {
72
- const { as } = program.opts();
73
- if (!as)
74
- throw new Error("--as <userId> is required");
65
+ const as = actingUserId(program);
75
66
  const path = `/api/v1/meetings/${encodeURIComponent(opts.id)}/transcript`;
76
67
  const data = await call({ method: "GET", path, asUserId: as });
77
68
  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, "message-folders", "MessageFolders operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("list-folders")
8
9
  .description("GET /api/v1/users/me/message-folders")
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/users/me/message-folders`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -21,9 +20,7 @@ export function register(program) {
21
20
  .description("POST /api/v1/users/me/message-folders")
22
21
  .requiredOption("--name <value>", "string")
23
22
  .action(async (opts) => {
24
- const { as } = program.opts();
25
- if (!as)
26
- throw new Error("--as <userId> is required");
23
+ const as = actingUserId(program);
27
24
  const path = `/api/v1/users/me/message-folders`;
28
25
  const body = {};
29
26
  {
@@ -41,9 +38,7 @@ export function register(program) {
41
38
  .description("DELETE /api/v1/users/me/message-folders/{folderId}")
42
39
  .requiredOption("--folder-id <value>", "folderId (path param)")
43
40
  .action(async (opts) => {
44
- const { as } = program.opts();
45
- if (!as)
46
- throw new Error("--as <userId> is required");
41
+ const as = actingUserId(program);
47
42
  const path = `/api/v1/users/me/message-folders/${encodeURIComponent(opts.folderId)}`;
48
43
  const data = await call({ method: "DELETE", path, asUserId: as });
49
44
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -55,9 +50,7 @@ export function register(program) {
55
50
  .description("POST /api/v1/users/me/message-folders/ensure-default")
56
51
  .option("--body <json>", "request body as JSON (no schema available)")
57
52
  .action(async (opts) => {
58
- const { as } = program.opts();
59
- if (!as)
60
- throw new Error("--as <userId> is required");
53
+ const as = actingUserId(program);
61
54
  const path = `/api/v1/users/me/message-folders/ensure-default`;
62
55
  const body = opts.body ? JSON.parse(opts.body) : undefined;
63
56
  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, "messages", "Messages operations");
@@ -12,9 +13,7 @@ export function register(program) {
12
13
  .option("--filter <value>", "string")
13
14
  .option("--after <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/rooms/${encodeURIComponent(opts.roomId)}/messages`;
19
18
  const query = {};
20
19
  {
@@ -59,9 +58,7 @@ export function register(program) {
59
58
  .option("--file-attachments <json>", "array, ≤10 items (JSON)")
60
59
  .option("--mentions <json>", "array, ≤50 items (JSON)")
61
60
  .action(async (opts) => {
62
- const { as } = program.opts();
63
- if (!as)
64
- throw new Error("--as <userId> is required");
61
+ const as = actingUserId(program);
65
62
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages`;
66
63
  const body = {};
67
64
  {
@@ -136,9 +133,7 @@ export function register(program) {
136
133
  .option("--q <value>", "string")
137
134
  .option("--limit <value>", "string")
138
135
  .action(async (opts) => {
139
- const { as } = program.opts();
140
- if (!as)
141
- throw new Error("--as <userId> is required");
136
+ const as = actingUserId(program);
142
137
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/search`;
143
138
  const query = {};
144
139
  {
@@ -162,9 +157,7 @@ export function register(program) {
162
157
  .requiredOption("--room-id <value>", "roomId (path param)")
163
158
  .requiredOption("--message-id <value>", "messageId (path param)")
164
159
  .action(async (opts) => {
165
- const { as } = program.opts();
166
- if (!as)
167
- throw new Error("--as <userId> is required");
160
+ const as = actingUserId(program);
168
161
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/public-meta`;
169
162
  const data = await call({ method: "GET", path, asUserId: as });
170
163
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -178,9 +171,7 @@ export function register(program) {
178
171
  .requiredOption("--message-id <value>", "messageId (path param)")
179
172
  .option("--limit <value>", "string")
180
173
  .action(async (opts) => {
181
- const { as } = program.opts();
182
- if (!as)
183
- throw new Error("--as <userId> is required");
174
+ const as = actingUserId(program);
184
175
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/around/${encodeURIComponent(opts.messageId)}`;
185
176
  const query = {};
186
177
  {
@@ -199,9 +190,7 @@ export function register(program) {
199
190
  .requiredOption("--room-id <value>", "roomId (path param)")
200
191
  .requiredOption("--message-id <value>", "messageId (path param)")
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)}/messages/${encodeURIComponent(opts.messageId)}/a2ui`;
206
195
  const data = await call({ method: "GET", path, asUserId: as });
207
196
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -217,9 +206,7 @@ export function register(program) {
217
206
  .option("--cursor <value>", "string")
218
207
  .option("--limit <value>", "string")
219
208
  .action(async (opts) => {
220
- const { as } = program.opts();
221
- if (!as)
222
- throw new Error("--as <userId> is required");
209
+ const as = actingUserId(program);
223
210
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/thread`;
224
211
  const query = {};
225
212
  {
@@ -249,9 +236,7 @@ export function register(program) {
249
236
  .requiredOption("--message-id <value>", "messageId (path param)")
250
237
  .option("--body <json>", "request body as JSON (no schema available)")
251
238
  .action(async (opts) => {
252
- const { as } = program.opts();
253
- if (!as)
254
- throw new Error("--as <userId> is required");
239
+ const as = actingUserId(program);
255
240
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/thread/read`;
256
241
  const body = opts.body ? JSON.parse(opts.body) : undefined;
257
242
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -265,9 +250,7 @@ export function register(program) {
265
250
  .requiredOption("--room-id <value>", "roomId (path param)")
266
251
  .requiredOption("--message-id <value>", "messageId (path param)")
267
252
  .action(async (opts) => {
268
- const { as } = program.opts();
269
- if (!as)
270
- throw new Error("--as <userId> is required");
253
+ const as = actingUserId(program);
271
254
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/read-by`;
272
255
  const data = await call({ method: "GET", path, asUserId: as });
273
256
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -282,9 +265,7 @@ export function register(program) {
282
265
  .requiredOption("--content <value>", "string, ≤50000 chars")
283
266
  .option("--mentions <json>", "array, ≤50 items (JSON)")
284
267
  .action(async (opts) => {
285
- const { as } = program.opts();
286
- if (!as)
287
- throw new Error("--as <userId> is required");
268
+ const as = actingUserId(program);
288
269
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}`;
289
270
  const body = {};
290
271
  {
@@ -308,9 +289,7 @@ export function register(program) {
308
289
  .requiredOption("--room-id <value>", "roomId (path param)")
309
290
  .requiredOption("--message-id <value>", "messageId (path param)")
310
291
  .action(async (opts) => {
311
- const { as } = program.opts();
312
- if (!as)
313
- throw new Error("--as <userId> is required");
292
+ const as = actingUserId(program);
314
293
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}`;
315
294
  const data = await call({ method: "DELETE", path, asUserId: as });
316
295
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -324,9 +303,7 @@ export function register(program) {
324
303
  .requiredOption("--message-id <value>", "messageId (path param)")
325
304
  .option("--body <json>", "request body as JSON (no schema available)")
326
305
  .action(async (opts) => {
327
- const { as } = program.opts();
328
- if (!as)
329
- throw new Error("--as <userId> is required");
306
+ const as = actingUserId(program);
330
307
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/unsend`;
331
308
  const body = opts.body ? JSON.parse(opts.body) : undefined;
332
309
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -341,9 +318,7 @@ export function register(program) {
341
318
  .requiredOption("--message-id <value>", "messageId (path param)")
342
319
  .requiredOption("--type <value>", "string")
343
320
  .action(async (opts) => {
344
- const { as } = program.opts();
345
- if (!as)
346
- throw new Error("--as <userId> is required");
321
+ const as = actingUserId(program);
347
322
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/reactions`;
348
323
  const body = {};
349
324
  {
@@ -361,9 +336,7 @@ export function register(program) {
361
336
  .description("DELETE /api/v1/rooms/{roomId}/messages/{messageId}/reactions/{reactionId}")
362
337
  .requiredOption("--reaction-id <value>", "reactionId (path param)")
363
338
  .action(async (opts) => {
364
- const { as } = program.opts();
365
- if (!as)
366
- throw new Error("--as <userId> is required");
339
+ const as = actingUserId(program);
367
340
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/reactions/${encodeURIComponent(opts.reactionId)}`;
368
341
  const data = await call({ method: "DELETE", path, asUserId: as });
369
342
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -377,9 +350,7 @@ export function register(program) {
377
350
  .requiredOption("--message-id <value>", "messageId (path param)")
378
351
  .option("--body <json>", "request body as JSON (no schema available)")
379
352
  .action(async (opts) => {
380
- const { as } = program.opts();
381
- if (!as)
382
- throw new Error("--as <userId> is required");
353
+ const as = actingUserId(program);
383
354
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/accept-suggestion`;
384
355
  const body = opts.body ? JSON.parse(opts.body) : undefined;
385
356
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -395,9 +366,7 @@ export function register(program) {
395
366
  .requiredOption("--reason <value>", "string")
396
367
  .option("--description <value>", "string, ≤500 chars")
397
368
  .action(async (opts) => {
398
- const { as } = program.opts();
399
- if (!as)
400
- throw new Error("--as <userId> is required");
369
+ const as = actingUserId(program);
401
370
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/messages/${encodeURIComponent(opts.messageId)}/report`;
402
371
  const body = {};
403
372
  {
@@ -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, "one-emulator", "OneEmulator operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--ref <value>", "string")
10
11
  .requiredOption("--challenge <value>", "string")
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/get/one-emulator`;
16
15
  const query = {};
17
16
  {
@@ -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, "pdf-export", "PdfExport operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("export-saved-stories")
8
9
  .description("GET /api/v1/users/me/saved-stories/export")
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/users/me/saved-stories/export`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  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, "pin-folders", "PinFolders operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/rooms/{roomId}/pin-folders")
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)}/pin-folders`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .requiredOption("--room-id <value>", "roomId (path param)")
24
23
  .requiredOption("--name <value>", "string")
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/rooms/${encodeURIComponent(opts.roomId)}/pin-folders`;
30
27
  const body = {};
31
28
  {
@@ -44,9 +41,7 @@ export function register(program) {
44
41
  .requiredOption("--room-id <value>", "roomId (path param)")
45
42
  .requiredOption("--folder-id <value>", "folderId (path param)")
46
43
  .action(async (opts) => {
47
- const { as } = program.opts();
48
- if (!as)
49
- throw new Error("--as <userId> is required");
44
+ const as = actingUserId(program);
50
45
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/pin-folders/${encodeURIComponent(opts.folderId)}`;
51
46
  const data = await call({ method: "DELETE", path, asUserId: as });
52
47
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -59,9 +54,7 @@ export function register(program) {
59
54
  .requiredOption("--room-id <value>", "roomId (path param)")
60
55
  .option("--body <json>", "request body as JSON (no schema available)")
61
56
  .action(async (opts) => {
62
- const { as } = program.opts();
63
- if (!as)
64
- throw new Error("--as <userId> is required");
57
+ const as = actingUserId(program);
65
58
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/pin-folders/ensure-default`;
66
59
  const body = opts.body ? JSON.parse(opts.body) : undefined;
67
60
  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, "pinned-messages", "PinnedMessages operations");
@@ -10,9 +11,7 @@ export function register(program) {
10
11
  .requiredOption("--message-id <value>", "string")
11
12
  .option("--folder-id <value>", "string")
12
13
  .action(async (opts) => {
13
- const { as } = program.opts();
14
- if (!as)
15
- throw new Error("--as <userId> is required");
14
+ const as = actingUserId(program);
16
15
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/pins`;
17
16
  const body = {};
18
17
  {
@@ -38,9 +37,7 @@ export function register(program) {
38
37
  .option("--cursor <value>", "string")
39
38
  .option("--limit <value>", "string")
40
39
  .action(async (opts) => {
41
- const { as } = program.opts();
42
- if (!as)
43
- throw new Error("--as <userId> is required");
40
+ const as = actingUserId(program);
44
41
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/pins`;
45
42
  const query = {};
46
43
  {
@@ -69,9 +66,7 @@ export function register(program) {
69
66
  .requiredOption("--room-id <value>", "roomId (path param)")
70
67
  .requiredOption("--pin-id <value>", "pinId (path param)")
71
68
  .action(async (opts) => {
72
- const { as } = program.opts();
73
- if (!as)
74
- throw new Error("--as <userId> is required");
69
+ const as = actingUserId(program);
75
70
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/pins/${encodeURIComponent(opts.pinId)}`;
76
71
  const data = await call({ method: "DELETE", path, asUserId: as });
77
72
  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, "polls", "Polls operations");
@@ -15,9 +16,7 @@ export function register(program) {
15
16
  .option("--correct-option-index <n>", "number")
16
17
  .option("--is-feature-request <true|false>", "boolean")
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)}/polls`;
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)}/polls`;
74
71
  const query = {};
75
72
  {
@@ -94,9 +91,7 @@ export function register(program) {
94
91
  .option("--cursor <value>", "string")
95
92
  .option("--limit <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)}/polls/feature-requests`;
101
96
  const query = {};
102
97
  {
@@ -120,9 +115,7 @@ export function register(program) {
120
115
  .requiredOption("--poll-id <value>", "pollId (path param)")
121
116
  .requiredOption("--option-id <value>", "string")
122
117
  .action(async (opts) => {
123
- const { as } = program.opts();
124
- if (!as)
125
- throw new Error("--as <userId> is required");
118
+ const as = actingUserId(program);
126
119
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/polls/${encodeURIComponent(opts.pollId)}/vote`;
127
120
  const body = {};
128
121
  {
@@ -140,9 +133,7 @@ export function register(program) {
140
133
  .description("DELETE /api/v1/rooms/{roomId}/polls/{pollId}")
141
134
  .requiredOption("--poll-id <value>", "pollId (path param)")
142
135
  .action(async (opts) => {
143
- const { as } = program.opts();
144
- if (!as)
145
- throw new Error("--as <userId> is required");
136
+ const as = actingUserId(program);
146
137
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/polls/${encodeURIComponent(opts.pollId)}`;
147
138
  const data = await call({ method: "DELETE", path, asUserId: as });
148
139
  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, "premium-feeds", "PremiumFeeds operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .option("--cursor <value>", "string")
10
11
  .option("--limit <value>", "string")
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/premium-feeds`;
16
15
  const query = {};
17
16
  {
@@ -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, "processors", "Processors operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .option("--body <json>", "request body as JSON (no schema available)")
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/rooms/${encodeURIComponent(opts.roomId)}/processors/verify`;
16
15
  const body = opts.body ? JSON.parse(opts.body) : undefined;
17
16
  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, "questions", "Questions operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .requiredOption("--text <value>", "string")
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/rooms/${encodeURIComponent(opts.roomId)}/questions`;
16
15
  const body = {};
17
16
  {
@@ -31,9 +30,7 @@ export function register(program) {
31
30
  .option("--cursor <value>", "string")
32
31
  .option("--limit <value>", "string")
33
32
  .action(async (opts) => {
34
- const { as } = program.opts();
35
- if (!as)
36
- throw new Error("--as <userId> is required");
33
+ const as = actingUserId(program);
37
34
  const path = `/api/v1/rooms/${encodeURIComponent(opts.roomId)}/questions`;
38
35
  const query = {};
39
36
  {
@@ -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, "referrals", "Referrals operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("dashboard")
8
9
  .description("GET /api/v1/users/me/referrals")
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/users/me/referrals`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  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, "reports", "Reports operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/reports")
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/reports`;
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, "room-a2-a", "RoomA2A operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/rooms/{id}/.well-known/agent.json")
9
10
  .requiredOption("--id <value>", "id (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.id)}/.well-known/agent.json`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .requiredOption("--id <value>", "id (path param)")
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/rooms/${encodeURIComponent(opts.id)}/a2a`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -39,9 +36,7 @@ export function register(program) {
39
36
  .requiredOption("--id <value>", "id (path param)")
40
37
  .option("--body <json>", "request body as JSON (no schema available)")
41
38
  .action(async (opts) => {
42
- const { as } = program.opts();
43
- if (!as)
44
- throw new Error("--as <userId> is required");
39
+ const as = actingUserId(program);
45
40
  const path = `/api/v1/rooms/${encodeURIComponent(opts.id)}/a2a-keys`;
46
41
  const body = opts.body ? JSON.parse(opts.body) : undefined;
47
42
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -54,9 +49,7 @@ export function register(program) {
54
49
  .description("GET /api/v1/rooms/{id}/a2a-keys")
55
50
  .requiredOption("--id <value>", "id (path param)")
56
51
  .action(async (opts) => {
57
- const { as } = program.opts();
58
- if (!as)
59
- throw new Error("--as <userId> is required");
52
+ const as = actingUserId(program);
60
53
  const path = `/api/v1/rooms/${encodeURIComponent(opts.id)}/a2a-keys`;
61
54
  const data = await call({ method: "GET", path, asUserId: as });
62
55
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -69,9 +62,7 @@ export function register(program) {
69
62
  .requiredOption("--id <value>", "id (path param)")
70
63
  .requiredOption("--key-id <value>", "keyId (path param)")
71
64
  .action(async (opts) => {
72
- const { as } = program.opts();
73
- if (!as)
74
- throw new Error("--as <userId> is required");
65
+ const as = actingUserId(program);
75
66
  const path = `/api/v1/rooms/${encodeURIComponent(opts.id)}/a2a-keys/${encodeURIComponent(opts.keyId)}`;
76
67
  const data = await call({ method: "DELETE", path, asUserId: as });
77
68
  process.stdout.write(JSON.stringify(data) + "\n");