@fluid-app/v2025-06-cli-commands 0.1.31 → 0.1.33

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.
@@ -2,13 +2,8 @@
2
2
  import { Command } from "commander";
3
3
  import type { CommandContext } from "../lib/types.js";
4
4
 
5
- export function registerUsersContacts(
6
- parent: Command,
7
- ctx: CommandContext,
8
- ): void {
9
- const resource = parent
10
- .command("users-contacts")
11
- .description("Users Contacts");
5
+ export function registerUsersContacts(parent: Command, ctx: CommandContext): void {
6
+ const resource = parent.command("users-contacts").description("Users Contacts");
12
7
 
13
8
  resource
14
9
  .command("list-user-contact-activities <id>")
@@ -18,14 +13,8 @@ export function registerUsersContacts(
18
13
  const client = await ctx.getClient();
19
14
  const params: Record<string, unknown> = {};
20
15
  if (opts.page !== undefined) params["page"] = Number(opts.page);
21
- if (ctx.verbose)
22
- process.stderr.write(
23
- "GET " + `/api/users/v2025-06/contacts/${id}/activities` + "\n",
24
- );
25
- const result = await client.get(
26
- `/api/users/v2025-06/contacts/${id}/activities`,
27
- params,
28
- );
16
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}/activities` + "\n");
17
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}/activities`, params);
29
18
  ctx.output(result);
30
19
  });
31
20
 
@@ -43,14 +32,8 @@ export function registerUsersContacts(
43
32
  } else if (opts.body) {
44
33
  body = ctx.parseBody(opts.body);
45
34
  }
46
- if (ctx.verbose)
47
- process.stderr.write(
48
- "DELETE " + `/api/users/v2025-06/contacts/bulk_delete` + "\n",
49
- );
50
- const result = await client.delete(
51
- `/api/users/v2025-06/contacts/bulk_delete`,
52
- { body },
53
- );
35
+ if (ctx.verbose) process.stderr.write("DELETE " + `/api/users/v2025-06/contacts/bulk_delete` + "\n");
36
+ const result = await client.delete(`/api/users/v2025-06/contacts/bulk_delete`, { body });
54
37
  ctx.output(result);
55
38
  });
56
39
 
@@ -68,14 +51,8 @@ export function registerUsersContacts(
68
51
  } else if (opts.body) {
69
52
  body = ctx.parseBody(opts.body);
70
53
  }
71
- if (ctx.verbose)
72
- process.stderr.write(
73
- "POST " + `/api/users/v2025-06/contacts/bulk` + "\n",
74
- );
75
- const result = await client.post(
76
- `/api/users/v2025-06/contacts/bulk`,
77
- body,
78
- );
54
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts/bulk` + "\n");
55
+ const result = await client.post(`/api/users/v2025-06/contacts/bulk`, body);
79
56
  ctx.output(result);
80
57
  });
81
58
 
@@ -93,8 +70,7 @@ export function registerUsersContacts(
93
70
  } else if (opts.body) {
94
71
  body = ctx.parseBody(opts.body);
95
72
  }
96
- if (ctx.verbose)
97
- process.stderr.write("POST " + `/api/users/v2025-06/contacts` + "\n");
73
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts` + "\n");
98
74
  const result = await client.post(`/api/users/v2025-06/contacts`, body);
99
75
  ctx.output(result);
100
76
  });
@@ -105,26 +81,17 @@ export function registerUsersContacts(
105
81
  .option("--page <value>", "Page number for pagination")
106
82
  .option("--per-page <value>", "Number of records per page")
107
83
  .option("--status <value>", "Filter contacts by status")
108
- .option(
109
- "--search-query <value>",
110
- "Search contacts by name, email, or phone",
111
- )
112
- .option(
113
- "--by-metadata <value>",
114
- "Filter contacts by metadata (JSON string)",
115
- )
84
+ .option("--search-query <value>", "Search contacts by name, email, or phone")
85
+ .option("--by-metadata <value>", "Filter contacts by metadata (JSON string)")
116
86
  .action(async (opts) => {
117
87
  const client = await ctx.getClient();
118
88
  const params: Record<string, unknown> = {};
119
89
  if (opts.page !== undefined) params["page"] = Number(opts.page);
120
90
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
121
91
  if (opts.status !== undefined) params["status"] = opts.status;
122
- if (opts.searchQuery !== undefined)
123
- params["search_query"] = opts.searchQuery;
124
- if (opts.byMetadata !== undefined)
125
- params["by_metadata"] = opts.byMetadata;
126
- if (ctx.verbose)
127
- process.stderr.write("GET " + `/api/users/v2025-06/contacts` + "\n");
92
+ if (opts.searchQuery !== undefined) params["search_query"] = opts.searchQuery;
93
+ if (opts.byMetadata !== undefined) params["by_metadata"] = opts.byMetadata;
94
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts` + "\n");
128
95
  const result = await client.get(`/api/users/v2025-06/contacts`, params);
129
96
  ctx.output(result);
130
97
  });
@@ -134,10 +101,7 @@ export function registerUsersContacts(
134
101
  .description("Delete a contact")
135
102
  .action(async (id) => {
136
103
  const client = await ctx.getClient();
137
- if (ctx.verbose)
138
- process.stderr.write(
139
- "DELETE " + `/api/users/v2025-06/contacts/${id}` + "\n",
140
- );
104
+ if (ctx.verbose) process.stderr.write("DELETE " + `/api/users/v2025-06/contacts/${id}` + "\n");
141
105
  const result = await client.delete(`/api/users/v2025-06/contacts/${id}`);
142
106
  ctx.output(result);
143
107
  });
@@ -147,10 +111,7 @@ export function registerUsersContacts(
147
111
  .description("Get a contact")
148
112
  .action(async (id) => {
149
113
  const client = await ctx.getClient();
150
- if (ctx.verbose)
151
- process.stderr.write(
152
- "GET " + `/api/users/v2025-06/contacts/${id}` + "\n",
153
- );
114
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}` + "\n");
154
115
  const result = await client.get(`/api/users/v2025-06/contacts/${id}`);
155
116
  ctx.output(result);
156
117
  });
@@ -169,14 +130,8 @@ export function registerUsersContacts(
169
130
  } else if (opts.body) {
170
131
  body = ctx.parseBody(opts.body);
171
132
  }
172
- if (ctx.verbose)
173
- process.stderr.write(
174
- "PATCH " + `/api/users/v2025-06/contacts/${id}` + "\n",
175
- );
176
- const result = await client.patch(
177
- `/api/users/v2025-06/contacts/${id}`,
178
- body,
179
- );
133
+ if (ctx.verbose) process.stderr.write("PATCH " + `/api/users/v2025-06/contacts/${id}` + "\n");
134
+ const result = await client.patch(`/api/users/v2025-06/contacts/${id}`, body);
180
135
  ctx.output(result);
181
136
  });
182
137
 
@@ -194,14 +149,8 @@ export function registerUsersContacts(
194
149
  } else if (opts.body) {
195
150
  body = ctx.parseBody(opts.body);
196
151
  }
197
- if (ctx.verbose)
198
- process.stderr.write(
199
- "POST " + `/api/users/v2025-06/contacts/${id}/notes` + "\n",
200
- );
201
- const result = await client.post(
202
- `/api/users/v2025-06/contacts/${id}/notes`,
203
- body,
204
- );
152
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts/${id}/notes` + "\n");
153
+ const result = await client.post(`/api/users/v2025-06/contacts/${id}/notes`, body);
205
154
  ctx.output(result);
206
155
  });
207
156
 
@@ -210,13 +159,8 @@ export function registerUsersContacts(
210
159
  .description("List notes for a contact")
211
160
  .action(async (id) => {
212
161
  const client = await ctx.getClient();
213
- if (ctx.verbose)
214
- process.stderr.write(
215
- "GET " + `/api/users/v2025-06/contacts/${id}/notes` + "\n",
216
- );
217
- const result = await client.get(
218
- `/api/users/v2025-06/contacts/${id}/notes`,
219
- );
162
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}/notes` + "\n");
163
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}/notes`);
220
164
  ctx.output(result);
221
165
  });
222
166
 
@@ -232,14 +176,8 @@ export function registerUsersContacts(
232
176
  if (opts.page !== undefined) params["page"] = Number(opts.page);
233
177
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
234
178
  if (opts.status !== undefined) params["status"] = opts.status;
235
- if (ctx.verbose)
236
- process.stderr.write(
237
- "GET " + `/api/users/v2025-06/contacts/${id}/orders` + "\n",
238
- );
239
- const result = await client.get(
240
- `/api/users/v2025-06/contacts/${id}/orders`,
241
- params,
242
- );
179
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}/orders` + "\n");
180
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}/orders`, params);
243
181
  ctx.output(result);
244
182
  });
245
183
 
@@ -248,13 +186,8 @@ export function registerUsersContacts(
248
186
  .description("Mark contact's activities as read")
249
187
  .action(async (id) => {
250
188
  const client = await ctx.getClient();
251
- if (ctx.verbose)
252
- process.stderr.write(
253
- "POST " + `/api/users/v2025-06/contacts/${id}/read` + "\n",
254
- );
255
- const result = await client.post(
256
- `/api/users/v2025-06/contacts/${id}/read`,
257
- );
189
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts/${id}/read` + "\n");
190
+ const result = await client.post(`/api/users/v2025-06/contacts/${id}/read`);
258
191
  ctx.output(result);
259
192
  });
260
193
 
@@ -262,10 +195,7 @@ export function registerUsersContacts(
262
195
  .command("list-user-contact-subscription-orders <id>")
263
196
  .description("List subscription orders for a contact")
264
197
  .option("--page <value>", "Page number for pagination")
265
- .option(
266
- "--per-page <value>",
267
- "Number of subscription orders per page (max 100)",
268
- )
198
+ .option("--per-page <value>", "Number of subscription orders per page (max 100)")
269
199
  .option("--status <value>", "Filter by subscription order status")
270
200
  .action(async (id, opts) => {
271
201
  const client = await ctx.getClient();
@@ -273,16 +203,8 @@ export function registerUsersContacts(
273
203
  if (opts.page !== undefined) params["page"] = Number(opts.page);
274
204
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
275
205
  if (opts.status !== undefined) params["status"] = opts.status;
276
- if (ctx.verbose)
277
- process.stderr.write(
278
- "GET " +
279
- `/api/users/v2025-06/contacts/${id}/subscription_orders` +
280
- "\n",
281
- );
282
- const result = await client.get(
283
- `/api/users/v2025-06/contacts/${id}/subscription_orders`,
284
- params,
285
- );
206
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}/subscription_orders` + "\n");
207
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}/subscription_orders`, params);
286
208
  ctx.output(result);
287
209
  });
288
210
 
@@ -300,14 +222,8 @@ export function registerUsersContacts(
300
222
  } else if (opts.body) {
301
223
  body = ctx.parseBody(opts.body);
302
224
  }
303
- if (ctx.verbose)
304
- process.stderr.write(
305
- "POST " + `/api/users/v2025-06/contacts/${id}/tasks` + "\n",
306
- );
307
- const result = await client.post(
308
- `/api/users/v2025-06/contacts/${id}/tasks`,
309
- body,
310
- );
225
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts/${id}/tasks` + "\n");
226
+ const result = await client.post(`/api/users/v2025-06/contacts/${id}/tasks`, body);
311
227
  ctx.output(result);
312
228
  });
313
229
 
@@ -316,13 +232,8 @@ export function registerUsersContacts(
316
232
  .description("List tasks for a contact")
317
233
  .action(async (id) => {
318
234
  const client = await ctx.getClient();
319
- if (ctx.verbose)
320
- process.stderr.write(
321
- "GET " + `/api/users/v2025-06/contacts/${id}/tasks` + "\n",
322
- );
323
- const result = await client.get(
324
- `/api/users/v2025-06/contacts/${id}/tasks`,
325
- );
235
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/contacts/${id}/tasks` + "\n");
236
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}/tasks`);
326
237
  ctx.output(result);
327
238
  });
328
239
 
@@ -340,16 +251,9 @@ export function registerUsersContacts(
340
251
  } else if (opts.body) {
341
252
  body = ctx.parseBody(opts.body);
342
253
  }
343
- if (ctx.verbose)
344
- process.stderr.write(
345
- "POST " +
346
- `/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned` +
347
- "\n",
348
- );
349
- const result = await client.post(
350
- `/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned`,
351
- body,
352
- );
254
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned` + "\n");
255
+ const result = await client.post(`/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned`, body);
353
256
  ctx.output(result);
354
257
  });
258
+
355
259
  }
@@ -28,12 +28,9 @@ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
28
28
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
29
29
  if (opts.sortedBy !== undefined) params["sorted_by"] = opts.sortedBy;
30
30
  if (opts.status !== undefined) params["status"] = opts.status;
31
- if (opts.active !== undefined)
32
- params["active"] = parseBooleanOption(opts.active, "--active");
33
- if (opts.searchQuery !== undefined)
34
- params["search_query"] = opts.searchQuery;
35
- if (ctx.verbose)
36
- process.stderr.write("GET " + `/api/users/v2025-06/media` + "\n");
31
+ if (opts.active !== undefined) params["active"] = parseBooleanOption(opts.active, "--active");
32
+ if (opts.searchQuery !== undefined) params["search_query"] = opts.searchQuery;
33
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/media` + "\n");
37
34
  const result = await client.get(`/api/users/v2025-06/media`, params);
38
35
  ctx.output(result);
39
36
  });
@@ -52,8 +49,7 @@ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
52
49
  } else if (opts.body) {
53
50
  body = ctx.parseBody(opts.body);
54
51
  }
55
- if (ctx.verbose)
56
- process.stderr.write("POST " + `/api/users/v2025-06/media` + "\n");
52
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/media` + "\n");
57
53
  const result = await client.post(`/api/users/v2025-06/media`, body);
58
54
  ctx.output(result);
59
55
  });
@@ -63,8 +59,7 @@ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
63
59
  .description("Get a media")
64
60
  .action(async (id) => {
65
61
  const client = await ctx.getClient();
66
- if (ctx.verbose)
67
- process.stderr.write("GET " + `/api/users/v2025-06/media/${id}` + "\n");
62
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/media/${id}` + "\n");
68
63
  const result = await client.get(`/api/users/v2025-06/media/${id}`);
69
64
  ctx.output(result);
70
65
  });
@@ -83,14 +78,8 @@ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
83
78
  } else if (opts.body) {
84
79
  body = ctx.parseBody(opts.body);
85
80
  }
86
- if (ctx.verbose)
87
- process.stderr.write(
88
- "PATCH " + `/api/users/v2025-06/media/${id}` + "\n",
89
- );
90
- const result = await client.patch(
91
- `/api/users/v2025-06/media/${id}`,
92
- body,
93
- );
81
+ if (ctx.verbose) process.stderr.write("PATCH " + `/api/users/v2025-06/media/${id}` + "\n");
82
+ const result = await client.patch(`/api/users/v2025-06/media/${id}`, body);
94
83
  ctx.output(result);
95
84
  });
96
85
 
@@ -99,11 +88,9 @@ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
99
88
  .description("Delete a media")
100
89
  .action(async (id) => {
101
90
  const client = await ctx.getClient();
102
- if (ctx.verbose)
103
- process.stderr.write(
104
- "DELETE " + `/api/users/v2025-06/media/${id}` + "\n",
105
- );
91
+ if (ctx.verbose) process.stderr.write("DELETE " + `/api/users/v2025-06/media/${id}` + "\n");
106
92
  const result = await client.delete(`/api/users/v2025-06/media/${id}`);
107
93
  ctx.output(result);
108
94
  });
95
+
109
96
  }
@@ -19,8 +19,7 @@ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
19
19
  } else if (opts.body) {
20
20
  body = ctx.parseBody(opts.body);
21
21
  }
22
- if (ctx.verbose)
23
- process.stderr.write("POST " + `/api/users/v2025-06/notes` + "\n");
22
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/notes` + "\n");
24
23
  const result = await client.post(`/api/users/v2025-06/notes`, body);
25
24
  ctx.output(result);
26
25
  });
@@ -34,12 +33,10 @@ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
34
33
  .action(async (opts) => {
35
34
  const client = await ctx.getClient();
36
35
  const params: Record<string, unknown> = {};
37
- if (opts.contactId !== undefined)
38
- params["contact_id"] = Number(opts.contactId);
36
+ if (opts.contactId !== undefined) params["contact_id"] = Number(opts.contactId);
39
37
  if (opts.page !== undefined) params["page"] = Number(opts.page);
40
38
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
41
- if (ctx.verbose)
42
- process.stderr.write("GET " + `/api/users/v2025-06/notes` + "\n");
39
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/notes` + "\n");
43
40
  const result = await client.get(`/api/users/v2025-06/notes`, params);
44
41
  ctx.output(result);
45
42
  });
@@ -51,15 +48,9 @@ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
51
48
  .action(async (id, opts) => {
52
49
  const client = await ctx.getClient();
53
50
  const params: Record<string, unknown> = {};
54
- if (opts.contactId !== undefined)
55
- params["contact_id"] = Number(opts.contactId);
56
- if (ctx.verbose)
57
- process.stderr.write(
58
- "DELETE " + `/api/users/v2025-06/notes/${id}` + "\n",
59
- );
60
- const result = await client.delete(`/api/users/v2025-06/notes/${id}`, {
61
- params,
62
- });
51
+ if (opts.contactId !== undefined) params["contact_id"] = Number(opts.contactId);
52
+ if (ctx.verbose) process.stderr.write("DELETE " + `/api/users/v2025-06/notes/${id}` + "\n");
53
+ const result = await client.delete(`/api/users/v2025-06/notes/${id}`, { params });
63
54
  ctx.output(result);
64
55
  });
65
56
 
@@ -70,14 +61,9 @@ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
70
61
  .action(async (id, opts) => {
71
62
  const client = await ctx.getClient();
72
63
  const params: Record<string, unknown> = {};
73
- if (opts.contactId !== undefined)
74
- params["contact_id"] = Number(opts.contactId);
75
- if (ctx.verbose)
76
- process.stderr.write("GET " + `/api/users/v2025-06/notes/${id}` + "\n");
77
- const result = await client.get(
78
- `/api/users/v2025-06/notes/${id}`,
79
- params,
80
- );
64
+ if (opts.contactId !== undefined) params["contact_id"] = Number(opts.contactId);
65
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/notes/${id}` + "\n");
66
+ const result = await client.get(`/api/users/v2025-06/notes/${id}`, params);
81
67
  ctx.output(result);
82
68
  });
83
69
 
@@ -95,14 +81,9 @@ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
95
81
  } else if (opts.body) {
96
82
  body = ctx.parseBody(opts.body);
97
83
  }
98
- if (ctx.verbose)
99
- process.stderr.write(
100
- "PATCH " + `/api/users/v2025-06/notes/${id}` + "\n",
101
- );
102
- const result = await client.patch(
103
- `/api/users/v2025-06/notes/${id}`,
104
- body,
105
- );
84
+ if (ctx.verbose) process.stderr.write("PATCH " + `/api/users/v2025-06/notes/${id}` + "\n");
85
+ const result = await client.patch(`/api/users/v2025-06/notes/${id}`, body);
106
86
  ctx.output(result);
107
87
  });
88
+
108
89
  }
@@ -2,13 +2,8 @@
2
2
  import { Command } from "commander";
3
3
  import type { CommandContext } from "../lib/types.js";
4
4
 
5
- export function registerUsersPlaylists(
6
- parent: Command,
7
- ctx: CommandContext,
8
- ): void {
9
- const resource = parent
10
- .command("users-playlists")
11
- .description("Users Playlists");
5
+ export function registerUsersPlaylists(parent: Command, ctx: CommandContext): void {
6
+ const resource = parent.command("users-playlists").description("Users Playlists");
12
7
 
13
8
  resource
14
9
  .command("create-user-playlist")
@@ -24,8 +19,7 @@ export function registerUsersPlaylists(
24
19
  } else if (opts.body) {
25
20
  body = ctx.parseBody(opts.body);
26
21
  }
27
- if (ctx.verbose)
28
- process.stderr.write("POST " + `/api/users/v2025-06/playlists` + "\n");
22
+ if (ctx.verbose) process.stderr.write("POST " + `/api/users/v2025-06/playlists` + "\n");
29
23
  const result = await client.post(`/api/users/v2025-06/playlists`, body);
30
24
  ctx.output(result);
31
25
  });
@@ -41,17 +35,12 @@ export function registerUsersPlaylists(
41
35
  .action(async (opts) => {
42
36
  const client = await ctx.getClient();
43
37
  const params: Record<string, unknown> = {};
44
- if (opts.pageCursor !== undefined)
45
- params["page[cursor]"] = opts.pageCursor;
46
- if (opts.pageLimit !== undefined)
47
- params["page[limit]"] = Number(opts.pageLimit);
48
- if (opts.filterStatus !== undefined)
49
- params["filter[status]"] = opts.filterStatus;
50
- if (opts.filterTitle !== undefined)
51
- params["filter[title]"] = opts.filterTitle;
38
+ if (opts.pageCursor !== undefined) params["page[cursor]"] = opts.pageCursor;
39
+ if (opts.pageLimit !== undefined) params["page[limit]"] = Number(opts.pageLimit);
40
+ if (opts.filterStatus !== undefined) params["filter[status]"] = opts.filterStatus;
41
+ if (opts.filterTitle !== undefined) params["filter[title]"] = opts.filterTitle;
52
42
  if (opts.sort !== undefined) params["sort"] = opts.sort;
53
- if (ctx.verbose)
54
- process.stderr.write("GET " + `/api/users/v2025-06/playlists` + "\n");
43
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/playlists` + "\n");
55
44
  const result = await client.get(`/api/users/v2025-06/playlists`, params);
56
45
  ctx.output(result);
57
46
  });
@@ -61,10 +50,7 @@ export function registerUsersPlaylists(
61
50
  .description("Delete a playlist")
62
51
  .action(async (id) => {
63
52
  const client = await ctx.getClient();
64
- if (ctx.verbose)
65
- process.stderr.write(
66
- "DELETE " + `/api/users/v2025-06/playlists/${id}` + "\n",
67
- );
53
+ if (ctx.verbose) process.stderr.write("DELETE " + `/api/users/v2025-06/playlists/${id}` + "\n");
68
54
  const result = await client.delete(`/api/users/v2025-06/playlists/${id}`);
69
55
  ctx.output(result);
70
56
  });
@@ -74,10 +60,7 @@ export function registerUsersPlaylists(
74
60
  .description("Get a playlist")
75
61
  .action(async (id) => {
76
62
  const client = await ctx.getClient();
77
- if (ctx.verbose)
78
- process.stderr.write(
79
- "GET " + `/api/users/v2025-06/playlists/${id}` + "\n",
80
- );
63
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/playlists/${id}` + "\n");
81
64
  const result = await client.get(`/api/users/v2025-06/playlists/${id}`);
82
65
  ctx.output(result);
83
66
  });
@@ -96,14 +79,9 @@ export function registerUsersPlaylists(
96
79
  } else if (opts.body) {
97
80
  body = ctx.parseBody(opts.body);
98
81
  }
99
- if (ctx.verbose)
100
- process.stderr.write(
101
- "PATCH " + `/api/users/v2025-06/playlists/${id}` + "\n",
102
- );
103
- const result = await client.patch(
104
- `/api/users/v2025-06/playlists/${id}`,
105
- body,
106
- );
82
+ if (ctx.verbose) process.stderr.write("PATCH " + `/api/users/v2025-06/playlists/${id}` + "\n");
83
+ const result = await client.patch(`/api/users/v2025-06/playlists/${id}`, body);
107
84
  ctx.output(result);
108
85
  });
86
+
109
87
  }
@@ -9,60 +9,36 @@ function parseBooleanOption(value: string, flag: string): boolean {
9
9
  throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
10
10
  }
11
11
 
12
- export function registerUsersProducts(
13
- parent: Command,
14
- ctx: CommandContext,
15
- ): void {
16
- const resource = parent
17
- .command("users-products")
18
- .description("Users Products");
12
+ export function registerUsersProducts(parent: Command, ctx: CommandContext): void {
13
+ const resource = parent.command("users-products").description("Users Products");
19
14
 
20
15
  resource
21
16
  .command("list-user-products")
22
17
  .description("List products")
23
18
  .option("--page <value>", "Page number for pagination")
24
19
  .option("--per-page <value>", "Number of records per page")
25
- .option(
26
- "--status <value>",
27
- "Filter by status. Supported values: 'active', 'draft', 'archived'.",
28
- )
29
- .option(
30
- "--availability <value>",
31
- "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products.",
32
- )
20
+ .option("--status <value>", "Filter by status. Supported values: 'active', 'draft', 'archived'.")
21
+ .option("--availability <value>", "Filter by availability. Supported values: 'All', 'in_stock'. If not specified, returns all products.")
33
22
  .option("--search-query <value>", "Search products by title or variant SKU")
34
23
  .option("--category-ids <value>", "Filter by category IDs")
35
24
  .option("--collection-ids <value>", "Filter by collection IDs")
36
25
  .option("--country-code <value>", "Filter by country codes")
37
- .option(
38
- "--bundle <value>",
39
- "Filter by bundle status. true returns only bundles, false returns only non-bundles.",
40
- )
41
- .option(
42
- "--order-by <value>",
43
- "Sort results by specified field and direction (e.g. ['price', 'asc'])",
44
- )
26
+ .option("--bundle <value>", "Filter by bundle status. true returns only bundles, false returns only non-bundles.")
27
+ .option("--order-by <value>", "Sort results by specified field and direction (e.g. ['price', 'asc'])")
45
28
  .action(async (opts) => {
46
29
  const client = await ctx.getClient();
47
30
  const params: Record<string, unknown> = {};
48
31
  if (opts.page !== undefined) params["page"] = Number(opts.page);
49
32
  if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
50
33
  if (opts.status !== undefined) params["status[]"] = opts.status;
51
- if (opts.availability !== undefined)
52
- params["availability[]"] = opts.availability;
53
- if (opts.searchQuery !== undefined)
54
- params["search_query"] = opts.searchQuery;
55
- if (opts.categoryIds !== undefined)
56
- params["category_ids[]"] = opts.categoryIds;
57
- if (opts.collectionIds !== undefined)
58
- params["collection_ids[]"] = opts.collectionIds;
59
- if (opts.countryCode !== undefined)
60
- params["country_code[]"] = opts.countryCode;
61
- if (opts.bundle !== undefined)
62
- params["bundle"] = parseBooleanOption(opts.bundle, "--bundle");
34
+ if (opts.availability !== undefined) params["availability[]"] = opts.availability;
35
+ if (opts.searchQuery !== undefined) params["search_query"] = opts.searchQuery;
36
+ if (opts.categoryIds !== undefined) params["category_ids[]"] = opts.categoryIds;
37
+ if (opts.collectionIds !== undefined) params["collection_ids[]"] = opts.collectionIds;
38
+ if (opts.countryCode !== undefined) params["country_code[]"] = opts.countryCode;
39
+ if (opts.bundle !== undefined) params["bundle"] = parseBooleanOption(opts.bundle, "--bundle");
63
40
  if (opts.orderBy !== undefined) params["order_by[]"] = opts.orderBy;
64
- if (ctx.verbose)
65
- process.stderr.write("GET " + `/api/users/v2025-06/products` + "\n");
41
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/products` + "\n");
66
42
  const result = await client.get(`/api/users/v2025-06/products`, params);
67
43
  ctx.output(result);
68
44
  });
@@ -72,11 +48,9 @@ export function registerUsersProducts(
72
48
  .description("Get a product")
73
49
  .action(async (id) => {
74
50
  const client = await ctx.getClient();
75
- if (ctx.verbose)
76
- process.stderr.write(
77
- "GET " + `/api/users/v2025-06/products/${id}` + "\n",
78
- );
51
+ if (ctx.verbose) process.stderr.write("GET " + `/api/users/v2025-06/products/${id}` + "\n");
79
52
  const result = await client.get(`/api/users/v2025-06/products/${id}`);
80
53
  ctx.output(result);
81
54
  });
55
+
82
56
  }