@fluid-app/v2025-06-cli-commands 0.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.
@@ -0,0 +1,300 @@
1
+ // users-contacts.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
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");
12
+
13
+ resource
14
+ .command("list-user-contact-activities <id>")
15
+ .description("List activities for a contact")
16
+ .option("--page <value>", "page")
17
+ .action(async (id, opts) => {
18
+ const client = await ctx.getClient();
19
+ const params: Record<string, unknown> = {};
20
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
21
+ if (ctx.verbose)
22
+ process.stderr.write(
23
+ `GET ${new URL(`/api/users/v2025-06/contacts/${id}/activities`, "https://placeholder").pathname}\n`,
24
+ );
25
+ const result = await client.get(
26
+ `/api/users/v2025-06/contacts/${id}/activities`,
27
+ params,
28
+ );
29
+ ctx.output(result);
30
+ });
31
+
32
+ resource
33
+ .command("bulk-delete-user-contacts")
34
+ .description("Bulk delete contacts")
35
+ .option("--body <json>", "Request body as JSON string")
36
+ .option("--body-file <path>", "Read request body from file")
37
+ .action(async (opts) => {
38
+ const client = await ctx.getClient();
39
+ let body: unknown;
40
+ if (opts.bodyFile) {
41
+ const { readFileSync } = await import("fs");
42
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
43
+ } else if (opts.body) {
44
+ body = ctx.parseBody(opts.body);
45
+ }
46
+ if (ctx.verbose)
47
+ process.stderr.write(
48
+ `DELETE ${new URL(`/api/users/v2025-06/contacts/bulk_delete`, "https://placeholder").pathname}\n`,
49
+ );
50
+ const result = await client.delete(
51
+ `/api/users/v2025-06/contacts/bulk_delete`,
52
+ { body },
53
+ );
54
+ ctx.output(result);
55
+ });
56
+
57
+ resource
58
+ .command("bulk-import-user-contacts")
59
+ .description("Bulk import contacts")
60
+ .option("--body <json>", "Request body as JSON string")
61
+ .option("--body-file <path>", "Read request body from file")
62
+ .action(async (opts) => {
63
+ const client = await ctx.getClient();
64
+ let body: unknown;
65
+ if (opts.bodyFile) {
66
+ const { readFileSync } = await import("fs");
67
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
68
+ } else if (opts.body) {
69
+ body = ctx.parseBody(opts.body);
70
+ }
71
+ if (ctx.verbose)
72
+ process.stderr.write(
73
+ `POST ${new URL(`/api/users/v2025-06/contacts/bulk`, "https://placeholder").pathname}\n`,
74
+ );
75
+ const result = await client.post(
76
+ `/api/users/v2025-06/contacts/bulk`,
77
+ body,
78
+ );
79
+ ctx.output(result);
80
+ });
81
+
82
+ resource
83
+ .command("create-user-contact")
84
+ .description("Create a contact")
85
+ .option("--body <json>", "Request body as JSON string")
86
+ .option("--body-file <path>", "Read request body from file")
87
+ .action(async (opts) => {
88
+ const client = await ctx.getClient();
89
+ let body: unknown;
90
+ if (opts.bodyFile) {
91
+ const { readFileSync } = await import("fs");
92
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
93
+ } else if (opts.body) {
94
+ body = ctx.parseBody(opts.body);
95
+ }
96
+ if (ctx.verbose)
97
+ process.stderr.write(
98
+ `POST ${new URL(`/api/users/v2025-06/contacts`, "https://placeholder").pathname}\n`,
99
+ );
100
+ const result = await client.post(`/api/users/v2025-06/contacts`, body);
101
+ ctx.output(result);
102
+ });
103
+
104
+ resource
105
+ .command("list-user-contacts")
106
+ .description("List user's contacts")
107
+ .option("--page <value>", "page")
108
+ .option("--per-page <value>", "per_page")
109
+ .option("--status <value>", "status")
110
+ .option("--search-query <value>", "search_query")
111
+ .option("--by-metadata <value>", "by_metadata")
112
+ .action(async (opts) => {
113
+ const client = await ctx.getClient();
114
+ const params: Record<string, unknown> = {};
115
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
116
+ if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
117
+ if (opts.status !== undefined) params["status"] = opts.status;
118
+ if (opts.searchQuery !== undefined)
119
+ params["search_query"] = opts.searchQuery;
120
+ if (opts.byMetadata !== undefined)
121
+ params["by_metadata"] = opts.byMetadata;
122
+ if (ctx.verbose)
123
+ process.stderr.write(
124
+ `GET ${new URL(`/api/users/v2025-06/contacts`, "https://placeholder").pathname}\n`,
125
+ );
126
+ const result = await client.get(`/api/users/v2025-06/contacts`, params);
127
+ ctx.output(result);
128
+ });
129
+
130
+ resource
131
+ .command("delete-user-contact <id>")
132
+ .description("Delete a contact")
133
+ .action(async (id, opts) => {
134
+ const client = await ctx.getClient();
135
+ if (ctx.verbose)
136
+ process.stderr.write(
137
+ `DELETE ${new URL(`/api/users/v2025-06/contacts/${id}`, "https://placeholder").pathname}\n`,
138
+ );
139
+ const result = await client.delete(`/api/users/v2025-06/contacts/${id}`);
140
+ ctx.output(result);
141
+ });
142
+
143
+ resource
144
+ .command("get-user-contact <id>")
145
+ .description("Get a contact")
146
+ .action(async (id, opts) => {
147
+ const client = await ctx.getClient();
148
+ if (ctx.verbose)
149
+ process.stderr.write(
150
+ `GET ${new URL(`/api/users/v2025-06/contacts/${id}`, "https://placeholder").pathname}\n`,
151
+ );
152
+ const result = await client.get(`/api/users/v2025-06/contacts/${id}`);
153
+ ctx.output(result);
154
+ });
155
+
156
+ resource
157
+ .command("update-user-contact <id>")
158
+ .description("Update a contact")
159
+ .option("--body <json>", "Request body as JSON string")
160
+ .option("--body-file <path>", "Read request body from file")
161
+ .action(async (id, opts) => {
162
+ const client = await ctx.getClient();
163
+ let body: unknown;
164
+ if (opts.bodyFile) {
165
+ const { readFileSync } = await import("fs");
166
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
167
+ } else if (opts.body) {
168
+ body = ctx.parseBody(opts.body);
169
+ }
170
+ if (ctx.verbose)
171
+ process.stderr.write(
172
+ `PATCH ${new URL(`/api/users/v2025-06/contacts/${id}`, "https://placeholder").pathname}\n`,
173
+ );
174
+ const result = await client.patch(
175
+ `/api/users/v2025-06/contacts/${id}`,
176
+ body,
177
+ );
178
+ ctx.output(result);
179
+ });
180
+
181
+ resource
182
+ .command("create-user-contact-note <id>")
183
+ .description("Create a note for a contact (deprecated)")
184
+ .option("--body <json>", "Request body as JSON string")
185
+ .option("--body-file <path>", "Read request body from file")
186
+ .action(async (id, opts) => {
187
+ const client = await ctx.getClient();
188
+ let body: unknown;
189
+ if (opts.bodyFile) {
190
+ const { readFileSync } = await import("fs");
191
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
192
+ } else if (opts.body) {
193
+ body = ctx.parseBody(opts.body);
194
+ }
195
+ if (ctx.verbose)
196
+ process.stderr.write(
197
+ `POST ${new URL(`/api/users/v2025-06/contacts/${id}/notes`, "https://placeholder").pathname}\n`,
198
+ );
199
+ const result = await client.post(
200
+ `/api/users/v2025-06/contacts/${id}/notes`,
201
+ body,
202
+ );
203
+ ctx.output(result);
204
+ });
205
+
206
+ resource
207
+ .command("list-user-contact-notes <id>")
208
+ .description("List notes for a contact")
209
+ .action(async (id, opts) => {
210
+ const client = await ctx.getClient();
211
+ if (ctx.verbose)
212
+ process.stderr.write(
213
+ `GET ${new URL(`/api/users/v2025-06/contacts/${id}/notes`, "https://placeholder").pathname}\n`,
214
+ );
215
+ const result = await client.get(
216
+ `/api/users/v2025-06/contacts/${id}/notes`,
217
+ );
218
+ ctx.output(result);
219
+ });
220
+
221
+ resource
222
+ .command("mark-user-contact-read <id>")
223
+ .description("Mark contact's activities as read")
224
+ .action(async (id, opts) => {
225
+ const client = await ctx.getClient();
226
+ if (ctx.verbose)
227
+ process.stderr.write(
228
+ `POST ${new URL(`/api/users/v2025-06/contacts/${id}/read`, "https://placeholder").pathname}\n`,
229
+ );
230
+ const result = await client.post(
231
+ `/api/users/v2025-06/contacts/${id}/read`,
232
+ );
233
+ ctx.output(result);
234
+ });
235
+
236
+ resource
237
+ .command("create-user-contact-task <id>")
238
+ .description("Create a task for a contact")
239
+ .option("--body <json>", "Request body as JSON string")
240
+ .option("--body-file <path>", "Read request body from file")
241
+ .action(async (id, opts) => {
242
+ const client = await ctx.getClient();
243
+ let body: unknown;
244
+ if (opts.bodyFile) {
245
+ const { readFileSync } = await import("fs");
246
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
247
+ } else if (opts.body) {
248
+ body = ctx.parseBody(opts.body);
249
+ }
250
+ if (ctx.verbose)
251
+ process.stderr.write(
252
+ `POST ${new URL(`/api/users/v2025-06/contacts/${id}/tasks`, "https://placeholder").pathname}\n`,
253
+ );
254
+ const result = await client.post(
255
+ `/api/users/v2025-06/contacts/${id}/tasks`,
256
+ body,
257
+ );
258
+ ctx.output(result);
259
+ });
260
+
261
+ resource
262
+ .command("list-user-contact-tasks <id>")
263
+ .description("List tasks for a contact")
264
+ .action(async (id, opts) => {
265
+ const client = await ctx.getClient();
266
+ if (ctx.verbose)
267
+ process.stderr.write(
268
+ `GET ${new URL(`/api/users/v2025-06/contacts/${id}/tasks`, "https://placeholder").pathname}\n`,
269
+ );
270
+ const result = await client.get(
271
+ `/api/users/v2025-06/contacts/${id}/tasks`,
272
+ );
273
+ ctx.output(result);
274
+ });
275
+
276
+ resource
277
+ .command("toggle-user-contact-note-pin <id> <note-id>")
278
+ .description("Toggle pinned status of a note (deprecated)")
279
+ .option("--body <json>", "Request body as JSON string")
280
+ .option("--body-file <path>", "Read request body from file")
281
+ .action(async (id, noteId, opts) => {
282
+ const client = await ctx.getClient();
283
+ let body: unknown;
284
+ if (opts.bodyFile) {
285
+ const { readFileSync } = await import("fs");
286
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
287
+ } else if (opts.body) {
288
+ body = ctx.parseBody(opts.body);
289
+ }
290
+ if (ctx.verbose)
291
+ process.stderr.write(
292
+ `POST ${new URL(`/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned`, "https://placeholder").pathname}\n`,
293
+ );
294
+ const result = await client.post(
295
+ `/api/users/v2025-06/contacts/${id}/notes/${noteId}/toggle_pinned`,
296
+ body,
297
+ );
298
+ ctx.output(result);
299
+ });
300
+ }
@@ -0,0 +1,115 @@
1
+ // users-media.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
4
+
5
+ function parseBooleanOption(value: string, flag: string): boolean {
6
+ const normalized = value.trim().toLowerCase();
7
+ if (["true", "1", "yes", "on"].includes(normalized)) return true;
8
+ if (["false", "0", "no", "off"].includes(normalized)) return false;
9
+ throw new Error(`Invalid value for ${flag}: ${value}. Expected true/false.`);
10
+ }
11
+
12
+ export function registerUsersMedia(parent: Command, ctx: CommandContext): void {
13
+ const resource = parent.command("users-media").description("Users Media");
14
+
15
+ resource
16
+ .command("list-user-media")
17
+ .description("List user's media")
18
+ .option("--page <value>", "page")
19
+ .option("--per-page <value>", "per_page")
20
+ .option("--sorted-by <value>", "sorted_by")
21
+ .option("--status <value>", "status")
22
+ .option("--active <value>", "active")
23
+ .option("--search-query <value>", "search_query")
24
+ .action(async (opts) => {
25
+ const client = await ctx.getClient();
26
+ const params: Record<string, unknown> = {};
27
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
28
+ if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
29
+ if (opts.sortedBy !== undefined) params["sorted_by"] = opts.sortedBy;
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(
37
+ `GET ${new URL(`/api/users/v2025-06/media`, "https://placeholder").pathname}\n`,
38
+ );
39
+ const result = await client.get(`/api/users/v2025-06/media`, params);
40
+ ctx.output(result);
41
+ });
42
+
43
+ resource
44
+ .command("create-user-media")
45
+ .description("Create a media")
46
+ .option("--body <json>", "Request body as JSON string")
47
+ .option("--body-file <path>", "Read request body from file")
48
+ .action(async (opts) => {
49
+ const client = await ctx.getClient();
50
+ let body: unknown;
51
+ if (opts.bodyFile) {
52
+ const { readFileSync } = await import("fs");
53
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
54
+ } else if (opts.body) {
55
+ body = ctx.parseBody(opts.body);
56
+ }
57
+ if (ctx.verbose)
58
+ process.stderr.write(
59
+ `POST ${new URL(`/api/users/v2025-06/media`, "https://placeholder").pathname}\n`,
60
+ );
61
+ const result = await client.post(`/api/users/v2025-06/media`, body);
62
+ ctx.output(result);
63
+ });
64
+
65
+ resource
66
+ .command("get-user-media <id>")
67
+ .description("Get a media")
68
+ .action(async (id, opts) => {
69
+ const client = await ctx.getClient();
70
+ if (ctx.verbose)
71
+ process.stderr.write(
72
+ `GET ${new URL(`/api/users/v2025-06/media/${id}`, "https://placeholder").pathname}\n`,
73
+ );
74
+ const result = await client.get(`/api/users/v2025-06/media/${id}`);
75
+ ctx.output(result);
76
+ });
77
+
78
+ resource
79
+ .command("update-user-media <id>")
80
+ .description("Update a media")
81
+ .option("--body <json>", "Request body as JSON string")
82
+ .option("--body-file <path>", "Read request body from file")
83
+ .action(async (id, opts) => {
84
+ const client = await ctx.getClient();
85
+ let body: unknown;
86
+ if (opts.bodyFile) {
87
+ const { readFileSync } = await import("fs");
88
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
89
+ } else if (opts.body) {
90
+ body = ctx.parseBody(opts.body);
91
+ }
92
+ if (ctx.verbose)
93
+ process.stderr.write(
94
+ `PATCH ${new URL(`/api/users/v2025-06/media/${id}`, "https://placeholder").pathname}\n`,
95
+ );
96
+ const result = await client.patch(
97
+ `/api/users/v2025-06/media/${id}`,
98
+ body,
99
+ );
100
+ ctx.output(result);
101
+ });
102
+
103
+ resource
104
+ .command("delete-user-media <id>")
105
+ .description("Delete a media")
106
+ .action(async (id, opts) => {
107
+ const client = await ctx.getClient();
108
+ if (ctx.verbose)
109
+ process.stderr.write(
110
+ `DELETE ${new URL(`/api/users/v2025-06/media/${id}`, "https://placeholder").pathname}\n`,
111
+ );
112
+ const result = await client.delete(`/api/users/v2025-06/media/${id}`);
113
+ ctx.output(result);
114
+ });
115
+ }
@@ -0,0 +1,114 @@
1
+ // users-notes.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
4
+
5
+ export function registerUsersNotes(parent: Command, ctx: CommandContext): void {
6
+ const resource = parent.command("users-notes").description("Users Notes");
7
+
8
+ resource
9
+ .command("create-user-note")
10
+ .description("Create a note for a contact")
11
+ .option("--body <json>", "Request body as JSON string")
12
+ .option("--body-file <path>", "Read request body from file")
13
+ .action(async (opts) => {
14
+ const client = await ctx.getClient();
15
+ let body: unknown;
16
+ if (opts.bodyFile) {
17
+ const { readFileSync } = await import("fs");
18
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
19
+ } else if (opts.body) {
20
+ body = ctx.parseBody(opts.body);
21
+ }
22
+ if (ctx.verbose)
23
+ process.stderr.write(
24
+ `POST ${new URL(`/api/users/v2025-06/notes`, "https://placeholder").pathname}\n`,
25
+ );
26
+ const result = await client.post(`/api/users/v2025-06/notes`, body);
27
+ ctx.output(result);
28
+ });
29
+
30
+ resource
31
+ .command("list-user-notes")
32
+ .description("List notes for a contact")
33
+ .option("--contact-id <value>", "contact_id")
34
+ .option("--page <value>", "page")
35
+ .option("--per-page <value>", "per_page")
36
+ .action(async (opts) => {
37
+ const client = await ctx.getClient();
38
+ const params: Record<string, unknown> = {};
39
+ if (opts.contactId !== undefined)
40
+ params["contact_id"] = Number(opts.contactId);
41
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
42
+ if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
43
+ if (ctx.verbose)
44
+ process.stderr.write(
45
+ `GET ${new URL(`/api/users/v2025-06/notes`, "https://placeholder").pathname}\n`,
46
+ );
47
+ const result = await client.get(`/api/users/v2025-06/notes`, params);
48
+ ctx.output(result);
49
+ });
50
+
51
+ resource
52
+ .command("delete-user-note <id>")
53
+ .description("Delete a note")
54
+ .option("--contact-id <value>", "contact_id")
55
+ .action(async (id, opts) => {
56
+ const client = await ctx.getClient();
57
+ const params: Record<string, unknown> = {};
58
+ if (opts.contactId !== undefined)
59
+ params["contact_id"] = Number(opts.contactId);
60
+ if (ctx.verbose)
61
+ process.stderr.write(
62
+ `DELETE ${new URL(`/api/users/v2025-06/notes/${id}`, "https://placeholder").pathname}\n`,
63
+ );
64
+ const result = await client.delete(`/api/users/v2025-06/notes/${id}`, {
65
+ params,
66
+ });
67
+ ctx.output(result);
68
+ });
69
+
70
+ resource
71
+ .command("get-user-note <id>")
72
+ .description("Get a note")
73
+ .option("--contact-id <value>", "contact_id")
74
+ .action(async (id, opts) => {
75
+ const client = await ctx.getClient();
76
+ const params: Record<string, unknown> = {};
77
+ if (opts.contactId !== undefined)
78
+ params["contact_id"] = Number(opts.contactId);
79
+ if (ctx.verbose)
80
+ process.stderr.write(
81
+ `GET ${new URL(`/api/users/v2025-06/notes/${id}`, "https://placeholder").pathname}\n`,
82
+ );
83
+ const result = await client.get(
84
+ `/api/users/v2025-06/notes/${id}`,
85
+ params,
86
+ );
87
+ ctx.output(result);
88
+ });
89
+
90
+ resource
91
+ .command("update-user-note <id>")
92
+ .description("Update a note")
93
+ .option("--body <json>", "Request body as JSON string")
94
+ .option("--body-file <path>", "Read request body from file")
95
+ .action(async (id, opts) => {
96
+ const client = await ctx.getClient();
97
+ let body: unknown;
98
+ if (opts.bodyFile) {
99
+ const { readFileSync } = await import("fs");
100
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
101
+ } else if (opts.body) {
102
+ body = ctx.parseBody(opts.body);
103
+ }
104
+ if (ctx.verbose)
105
+ process.stderr.write(
106
+ `PATCH ${new URL(`/api/users/v2025-06/notes/${id}`, "https://placeholder").pathname}\n`,
107
+ );
108
+ const result = await client.patch(
109
+ `/api/users/v2025-06/notes/${id}`,
110
+ body,
111
+ );
112
+ ctx.output(result);
113
+ });
114
+ }
@@ -0,0 +1,113 @@
1
+ // users-playlists.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
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");
12
+
13
+ resource
14
+ .command("create-user-playlist")
15
+ .description("Create a playlist")
16
+ .option("--body <json>", "Request body as JSON string")
17
+ .option("--body-file <path>", "Read request body from file")
18
+ .action(async (opts) => {
19
+ const client = await ctx.getClient();
20
+ let body: unknown;
21
+ if (opts.bodyFile) {
22
+ const { readFileSync } = await import("fs");
23
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
24
+ } else if (opts.body) {
25
+ body = ctx.parseBody(opts.body);
26
+ }
27
+ if (ctx.verbose)
28
+ process.stderr.write(
29
+ `POST ${new URL(`/api/users/v2025-06/playlists`, "https://placeholder").pathname}\n`,
30
+ );
31
+ const result = await client.post(`/api/users/v2025-06/playlists`, body);
32
+ ctx.output(result);
33
+ });
34
+
35
+ resource
36
+ .command("list-user-playlists")
37
+ .description("List user's playlists")
38
+ .option("--page-cursor <value>", "page[cursor]")
39
+ .option("--page-limit <value>", "page[limit]")
40
+ .option("--filter-status <value>", "filter[status]")
41
+ .option("--filter-title <value>", "filter[title]")
42
+ .option("--sort <value>", "sort")
43
+ .action(async (opts) => {
44
+ const client = await ctx.getClient();
45
+ const params: Record<string, unknown> = {};
46
+ if (opts.pageCursor !== undefined)
47
+ params["page[cursor]"] = opts.pageCursor;
48
+ if (opts.pageLimit !== undefined)
49
+ params["page[limit]"] = Number(opts.pageLimit);
50
+ if (opts.filterStatus !== undefined)
51
+ params["filter[status]"] = opts.filterStatus;
52
+ if (opts.filterTitle !== undefined)
53
+ params["filter[title]"] = opts.filterTitle;
54
+ if (opts.sort !== undefined) params["sort"] = opts.sort;
55
+ if (ctx.verbose)
56
+ process.stderr.write(
57
+ `GET ${new URL(`/api/users/v2025-06/playlists`, "https://placeholder").pathname}\n`,
58
+ );
59
+ const result = await client.get(`/api/users/v2025-06/playlists`, params);
60
+ ctx.output(result);
61
+ });
62
+
63
+ resource
64
+ .command("delete-user-playlist <id>")
65
+ .description("Delete a playlist")
66
+ .action(async (id, opts) => {
67
+ const client = await ctx.getClient();
68
+ if (ctx.verbose)
69
+ process.stderr.write(
70
+ `DELETE ${new URL(`/api/users/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
71
+ );
72
+ const result = await client.delete(`/api/users/v2025-06/playlists/${id}`);
73
+ ctx.output(result);
74
+ });
75
+
76
+ resource
77
+ .command("get-user-playlist <id>")
78
+ .description("Get a playlist")
79
+ .action(async (id, opts) => {
80
+ const client = await ctx.getClient();
81
+ if (ctx.verbose)
82
+ process.stderr.write(
83
+ `GET ${new URL(`/api/users/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
84
+ );
85
+ const result = await client.get(`/api/users/v2025-06/playlists/${id}`);
86
+ ctx.output(result);
87
+ });
88
+
89
+ resource
90
+ .command("update-user-playlist <id>")
91
+ .description("Update a playlist")
92
+ .option("--body <json>", "Request body as JSON string")
93
+ .option("--body-file <path>", "Read request body from file")
94
+ .action(async (id, opts) => {
95
+ const client = await ctx.getClient();
96
+ let body: unknown;
97
+ if (opts.bodyFile) {
98
+ const { readFileSync } = await import("fs");
99
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
100
+ } else if (opts.body) {
101
+ body = ctx.parseBody(opts.body);
102
+ }
103
+ if (ctx.verbose)
104
+ process.stderr.write(
105
+ `PATCH ${new URL(`/api/users/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
106
+ );
107
+ const result = await client.patch(
108
+ `/api/users/v2025-06/playlists/${id}`,
109
+ body,
110
+ );
111
+ ctx.output(result);
112
+ });
113
+ }