@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.
- package/.turbo/turbo-build.log +18 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1969 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +42 -0
- package/scripts/generate-cli-commands.ts +17 -0
- package/src/generated/company-contacts.ts +108 -0
- package/src/generated/compliance.ts +819 -0
- package/src/generated/customers.ts +139 -0
- package/src/generated/default.ts +35 -0
- package/src/generated/email-settings.ts +50 -0
- package/src/generated/enrollment-pack-media.ts +71 -0
- package/src/generated/fair-share-settings.ts +50 -0
- package/src/generated/index.ts +52 -0
- package/src/generated/lighthouse.ts +819 -0
- package/src/generated/media-enrollment-packs.ts +71 -0
- package/src/generated/media-products.ts +71 -0
- package/src/generated/partner-tokens.ts +184 -0
- package/src/generated/playlists.ts +202 -0
- package/src/generated/product-media.ts +69 -0
- package/src/generated/reps.ts +307 -0
- package/src/generated/share-statistics.ts +126 -0
- package/src/generated/users-contacts.ts +300 -0
- package/src/generated/users-media.ts +115 -0
- package/src/generated/users-notes.ts +114 -0
- package/src/generated/users-playlists.ts +113 -0
- package/src/generated/users-tasks.ts +118 -0
- package/src/generated/widgets.ts +423 -0
- package/src/index.ts +20 -0
- package/src/lib/types.ts +2 -0
- package/tsconfig.json +10 -0
- package/tsdown.config.ts +12 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// media-enrollment-packs.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerMediaEnrollmentPacks(
|
|
6
|
+
parent: Command,
|
|
7
|
+
ctx: CommandContext,
|
|
8
|
+
): void {
|
|
9
|
+
const resource = parent
|
|
10
|
+
.command("media-enrollment-packs")
|
|
11
|
+
.description("MediaEnrollmentPacks");
|
|
12
|
+
|
|
13
|
+
resource
|
|
14
|
+
.command("list <media-id>")
|
|
15
|
+
.description("List enrollment_packs associated with media")
|
|
16
|
+
.option("--page <value>", "page")
|
|
17
|
+
.action(async (mediaId, opts) => {
|
|
18
|
+
const client = await ctx.getClient();
|
|
19
|
+
const params: Record<string, unknown> = {};
|
|
20
|
+
if (opts.page !== undefined) params["page"] = opts.page;
|
|
21
|
+
if (ctx.verbose)
|
|
22
|
+
process.stderr.write(
|
|
23
|
+
`GET ${new URL(`/api/v2025-06/media/${mediaId}/enrollment_packs`, "https://placeholder").pathname}\n`,
|
|
24
|
+
);
|
|
25
|
+
const result = await client.get(
|
|
26
|
+
`/api/v2025-06/media/${mediaId}/enrollment_packs`,
|
|
27
|
+
params,
|
|
28
|
+
);
|
|
29
|
+
ctx.output(result);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
resource
|
|
33
|
+
.command("create <media-id>")
|
|
34
|
+
.description("Associate enrollment_pack with media")
|
|
35
|
+
.option("--body <json>", "Request body as JSON string")
|
|
36
|
+
.option("--body-file <path>", "Read request body from file")
|
|
37
|
+
.action(async (mediaId, 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
|
+
`POST ${new URL(`/api/v2025-06/media/${mediaId}/enrollment_packs`, "https://placeholder").pathname}\n`,
|
|
49
|
+
);
|
|
50
|
+
const result = await client.post(
|
|
51
|
+
`/api/v2025-06/media/${mediaId}/enrollment_packs`,
|
|
52
|
+
body,
|
|
53
|
+
);
|
|
54
|
+
ctx.output(result);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
resource
|
|
58
|
+
.command("delete <media-id> <id>")
|
|
59
|
+
.description("Enrollment Pack removed from media")
|
|
60
|
+
.action(async (mediaId, id, opts) => {
|
|
61
|
+
const client = await ctx.getClient();
|
|
62
|
+
if (ctx.verbose)
|
|
63
|
+
process.stderr.write(
|
|
64
|
+
`DELETE ${new URL(`/api/v2025-06/media/${mediaId}/enrollment_packs/${id}`, "https://placeholder").pathname}\n`,
|
|
65
|
+
);
|
|
66
|
+
const result = await client.delete(
|
|
67
|
+
`/api/v2025-06/media/${mediaId}/enrollment_packs/${id}`,
|
|
68
|
+
);
|
|
69
|
+
ctx.output(result);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// media-products.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerMediaProducts(
|
|
6
|
+
parent: Command,
|
|
7
|
+
ctx: CommandContext,
|
|
8
|
+
): void {
|
|
9
|
+
const resource = parent
|
|
10
|
+
.command("media-products")
|
|
11
|
+
.description("MediaProducts");
|
|
12
|
+
|
|
13
|
+
resource
|
|
14
|
+
.command("list <media-id>")
|
|
15
|
+
.description("List products associated with media")
|
|
16
|
+
.option("--page <value>", "page")
|
|
17
|
+
.action(async (mediaId, opts) => {
|
|
18
|
+
const client = await ctx.getClient();
|
|
19
|
+
const params: Record<string, unknown> = {};
|
|
20
|
+
if (opts.page !== undefined) params["page"] = opts.page;
|
|
21
|
+
if (ctx.verbose)
|
|
22
|
+
process.stderr.write(
|
|
23
|
+
`GET ${new URL(`/api/v2025-06/media/${mediaId}/products`, "https://placeholder").pathname}\n`,
|
|
24
|
+
);
|
|
25
|
+
const result = await client.get(
|
|
26
|
+
`/api/v2025-06/media/${mediaId}/products`,
|
|
27
|
+
params,
|
|
28
|
+
);
|
|
29
|
+
ctx.output(result);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
resource
|
|
33
|
+
.command("create <media-id>")
|
|
34
|
+
.description("Associate product with media")
|
|
35
|
+
.option("--body <json>", "Request body as JSON string")
|
|
36
|
+
.option("--body-file <path>", "Read request body from file")
|
|
37
|
+
.action(async (mediaId, 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
|
+
`POST ${new URL(`/api/v2025-06/media/${mediaId}/products`, "https://placeholder").pathname}\n`,
|
|
49
|
+
);
|
|
50
|
+
const result = await client.post(
|
|
51
|
+
`/api/v2025-06/media/${mediaId}/products`,
|
|
52
|
+
body,
|
|
53
|
+
);
|
|
54
|
+
ctx.output(result);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
resource
|
|
58
|
+
.command("delete <media-id> <id>")
|
|
59
|
+
.description("Product removed from media")
|
|
60
|
+
.action(async (mediaId, id, opts) => {
|
|
61
|
+
const client = await ctx.getClient();
|
|
62
|
+
if (ctx.verbose)
|
|
63
|
+
process.stderr.write(
|
|
64
|
+
`DELETE ${new URL(`/api/v2025-06/media/${mediaId}/products/${id}`, "https://placeholder").pathname}\n`,
|
|
65
|
+
);
|
|
66
|
+
const result = await client.delete(
|
|
67
|
+
`/api/v2025-06/media/${mediaId}/products/${id}`,
|
|
68
|
+
);
|
|
69
|
+
ctx.output(result);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// partner-tokens.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerPartnerTokens(
|
|
6
|
+
parent: Command,
|
|
7
|
+
ctx: CommandContext,
|
|
8
|
+
): void {
|
|
9
|
+
const resource = parent
|
|
10
|
+
.command("partner-tokens")
|
|
11
|
+
.description("Partner Tokens");
|
|
12
|
+
|
|
13
|
+
resource
|
|
14
|
+
.command("list-deprecated")
|
|
15
|
+
.description("returns an array of partner tokens")
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
const client = await ctx.getClient();
|
|
18
|
+
if (ctx.verbose)
|
|
19
|
+
process.stderr.write(
|
|
20
|
+
`GET ${new URL(`/api/v2025-06/partner_tokens`, "https://placeholder").pathname}\n`,
|
|
21
|
+
);
|
|
22
|
+
const result = await client.get(`/api/v2025-06/partner_tokens`);
|
|
23
|
+
ctx.output(result);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
resource
|
|
27
|
+
.command("create-deprecated")
|
|
28
|
+
.description("creates a new partner token")
|
|
29
|
+
.option("--body <json>", "Request body as JSON string")
|
|
30
|
+
.option("--body-file <path>", "Read request body from file")
|
|
31
|
+
.action(async (opts) => {
|
|
32
|
+
const client = await ctx.getClient();
|
|
33
|
+
let body: unknown;
|
|
34
|
+
if (opts.bodyFile) {
|
|
35
|
+
const { readFileSync } = await import("fs");
|
|
36
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
37
|
+
} else if (opts.body) {
|
|
38
|
+
body = ctx.parseBody(opts.body);
|
|
39
|
+
}
|
|
40
|
+
if (ctx.verbose)
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`POST ${new URL(`/api/v2025-06/partner_tokens`, "https://placeholder").pathname}\n`,
|
|
43
|
+
);
|
|
44
|
+
const result = await client.post(`/api/v2025-06/partner_tokens`, body);
|
|
45
|
+
ctx.output(result);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
resource
|
|
49
|
+
.command("get-deprecated <id>")
|
|
50
|
+
.description("returns a specific partner token")
|
|
51
|
+
.action(async (id, opts) => {
|
|
52
|
+
const client = await ctx.getClient();
|
|
53
|
+
if (ctx.verbose)
|
|
54
|
+
process.stderr.write(
|
|
55
|
+
`GET ${new URL(`/api/v2025-06/partner_tokens/${id}`, "https://placeholder").pathname}\n`,
|
|
56
|
+
);
|
|
57
|
+
const result = await client.get(`/api/v2025-06/partner_tokens/${id}`);
|
|
58
|
+
ctx.output(result);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
resource
|
|
62
|
+
.command("update-deprecated <id>")
|
|
63
|
+
.description("updates a partner token")
|
|
64
|
+
.option("--body <json>", "Request body as JSON string")
|
|
65
|
+
.option("--body-file <path>", "Read request body from file")
|
|
66
|
+
.action(async (id, opts) => {
|
|
67
|
+
const client = await ctx.getClient();
|
|
68
|
+
let body: unknown;
|
|
69
|
+
if (opts.bodyFile) {
|
|
70
|
+
const { readFileSync } = await import("fs");
|
|
71
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
72
|
+
} else if (opts.body) {
|
|
73
|
+
body = ctx.parseBody(opts.body);
|
|
74
|
+
}
|
|
75
|
+
if (ctx.verbose)
|
|
76
|
+
process.stderr.write(
|
|
77
|
+
`PUT ${new URL(`/api/v2025-06/partner_tokens/${id}`, "https://placeholder").pathname}\n`,
|
|
78
|
+
);
|
|
79
|
+
const result = await client.put(
|
|
80
|
+
`/api/v2025-06/partner_tokens/${id}`,
|
|
81
|
+
body,
|
|
82
|
+
);
|
|
83
|
+
ctx.output(result);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
resource
|
|
87
|
+
.command("delete-deprecated <id>")
|
|
88
|
+
.description("deletes a partner token")
|
|
89
|
+
.action(async (id, opts) => {
|
|
90
|
+
const client = await ctx.getClient();
|
|
91
|
+
if (ctx.verbose)
|
|
92
|
+
process.stderr.write(
|
|
93
|
+
`DELETE ${new URL(`/api/v2025-06/partner_tokens/${id}`, "https://placeholder").pathname}\n`,
|
|
94
|
+
);
|
|
95
|
+
const result = await client.delete(`/api/v2025-06/partner_tokens/${id}`);
|
|
96
|
+
ctx.output(result);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
resource
|
|
100
|
+
.command("list")
|
|
101
|
+
.description("returns an array of partner tokens")
|
|
102
|
+
.action(async (opts) => {
|
|
103
|
+
const client = await ctx.getClient();
|
|
104
|
+
if (ctx.verbose)
|
|
105
|
+
process.stderr.write(
|
|
106
|
+
`GET ${new URL(`/api/v2025-06/tokens/partner`, "https://placeholder").pathname}\n`,
|
|
107
|
+
);
|
|
108
|
+
const result = await client.get(`/api/v2025-06/tokens/partner`);
|
|
109
|
+
ctx.output(result);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
resource
|
|
113
|
+
.command("create")
|
|
114
|
+
.description("creates a new partner token")
|
|
115
|
+
.option("--body <json>", "Request body as JSON string")
|
|
116
|
+
.option("--body-file <path>", "Read request body from file")
|
|
117
|
+
.action(async (opts) => {
|
|
118
|
+
const client = await ctx.getClient();
|
|
119
|
+
let body: unknown;
|
|
120
|
+
if (opts.bodyFile) {
|
|
121
|
+
const { readFileSync } = await import("fs");
|
|
122
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
123
|
+
} else if (opts.body) {
|
|
124
|
+
body = ctx.parseBody(opts.body);
|
|
125
|
+
}
|
|
126
|
+
if (ctx.verbose)
|
|
127
|
+
process.stderr.write(
|
|
128
|
+
`POST ${new URL(`/api/v2025-06/tokens/partner`, "https://placeholder").pathname}\n`,
|
|
129
|
+
);
|
|
130
|
+
const result = await client.post(`/api/v2025-06/tokens/partner`, body);
|
|
131
|
+
ctx.output(result);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
resource
|
|
135
|
+
.command("get <id>")
|
|
136
|
+
.description("returns a specific partner token")
|
|
137
|
+
.action(async (id, opts) => {
|
|
138
|
+
const client = await ctx.getClient();
|
|
139
|
+
if (ctx.verbose)
|
|
140
|
+
process.stderr.write(
|
|
141
|
+
`GET ${new URL(`/api/v2025-06/tokens/partner/${id}`, "https://placeholder").pathname}\n`,
|
|
142
|
+
);
|
|
143
|
+
const result = await client.get(`/api/v2025-06/tokens/partner/${id}`);
|
|
144
|
+
ctx.output(result);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
resource
|
|
148
|
+
.command("update <id>")
|
|
149
|
+
.description("updates a partner token")
|
|
150
|
+
.option("--body <json>", "Request body as JSON string")
|
|
151
|
+
.option("--body-file <path>", "Read request body from file")
|
|
152
|
+
.action(async (id, opts) => {
|
|
153
|
+
const client = await ctx.getClient();
|
|
154
|
+
let body: unknown;
|
|
155
|
+
if (opts.bodyFile) {
|
|
156
|
+
const { readFileSync } = await import("fs");
|
|
157
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
158
|
+
} else if (opts.body) {
|
|
159
|
+
body = ctx.parseBody(opts.body);
|
|
160
|
+
}
|
|
161
|
+
if (ctx.verbose)
|
|
162
|
+
process.stderr.write(
|
|
163
|
+
`PUT ${new URL(`/api/v2025-06/tokens/partner/${id}`, "https://placeholder").pathname}\n`,
|
|
164
|
+
);
|
|
165
|
+
const result = await client.put(
|
|
166
|
+
`/api/v2025-06/tokens/partner/${id}`,
|
|
167
|
+
body,
|
|
168
|
+
);
|
|
169
|
+
ctx.output(result);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
resource
|
|
173
|
+
.command("delete <id>")
|
|
174
|
+
.description("deletes a partner token")
|
|
175
|
+
.action(async (id, opts) => {
|
|
176
|
+
const client = await ctx.getClient();
|
|
177
|
+
if (ctx.verbose)
|
|
178
|
+
process.stderr.write(
|
|
179
|
+
`DELETE ${new URL(`/api/v2025-06/tokens/partner/${id}`, "https://placeholder").pathname}\n`,
|
|
180
|
+
);
|
|
181
|
+
const result = await client.delete(`/api/v2025-06/tokens/partner/${id}`);
|
|
182
|
+
ctx.output(result);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// playlists.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerPlaylists(parent: Command, ctx: CommandContext): void {
|
|
6
|
+
const resource = parent.command("playlists").description("Playlists");
|
|
7
|
+
|
|
8
|
+
resource
|
|
9
|
+
.command("clone-playlist <playlist-id>")
|
|
10
|
+
.description("Clone a playlist")
|
|
11
|
+
.option("--body <json>", "Request body as JSON string")
|
|
12
|
+
.option("--body-file <path>", "Read request body from file")
|
|
13
|
+
.action(async (playlistId, 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/v2025-06/playlists/${playlistId}/clone`, "https://placeholder").pathname}\n`,
|
|
25
|
+
);
|
|
26
|
+
const result = await client.post(
|
|
27
|
+
`/api/v2025-06/playlists/${playlistId}/clone`,
|
|
28
|
+
body,
|
|
29
|
+
);
|
|
30
|
+
ctx.output(result);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
resource
|
|
34
|
+
.command("add-playlist-items <playlist-id>")
|
|
35
|
+
.description("add items to playlist")
|
|
36
|
+
.option("--body <json>", "Request body as JSON string")
|
|
37
|
+
.option("--body-file <path>", "Read request body from file")
|
|
38
|
+
.action(async (playlistId, opts) => {
|
|
39
|
+
const client = await ctx.getClient();
|
|
40
|
+
let body: unknown;
|
|
41
|
+
if (opts.bodyFile) {
|
|
42
|
+
const { readFileSync } = await import("fs");
|
|
43
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
44
|
+
} else if (opts.body) {
|
|
45
|
+
body = ctx.parseBody(opts.body);
|
|
46
|
+
}
|
|
47
|
+
if (ctx.verbose)
|
|
48
|
+
process.stderr.write(
|
|
49
|
+
`POST ${new URL(`/api/v2025-06/playlists/${playlistId}/items`, "https://placeholder").pathname}\n`,
|
|
50
|
+
);
|
|
51
|
+
const result = await client.post(
|
|
52
|
+
`/api/v2025-06/playlists/${playlistId}/items`,
|
|
53
|
+
body,
|
|
54
|
+
);
|
|
55
|
+
ctx.output(result);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
resource
|
|
59
|
+
.command("remove-playlist-items <playlist-id>")
|
|
60
|
+
.description("remove items from playlist")
|
|
61
|
+
.option("--body <json>", "Request body as JSON string")
|
|
62
|
+
.option("--body-file <path>", "Read request body from file")
|
|
63
|
+
.action(async (playlistId, opts) => {
|
|
64
|
+
const client = await ctx.getClient();
|
|
65
|
+
let body: unknown;
|
|
66
|
+
if (opts.bodyFile) {
|
|
67
|
+
const { readFileSync } = await import("fs");
|
|
68
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
69
|
+
} else if (opts.body) {
|
|
70
|
+
body = ctx.parseBody(opts.body);
|
|
71
|
+
}
|
|
72
|
+
if (ctx.verbose)
|
|
73
|
+
process.stderr.write(
|
|
74
|
+
`DELETE ${new URL(`/api/v2025-06/playlists/${playlistId}/items`, "https://placeholder").pathname}\n`,
|
|
75
|
+
);
|
|
76
|
+
const result = await client.delete(
|
|
77
|
+
`/api/v2025-06/playlists/${playlistId}/items`,
|
|
78
|
+
{ body },
|
|
79
|
+
);
|
|
80
|
+
ctx.output(result);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
resource
|
|
84
|
+
.command("create")
|
|
85
|
+
.description("create playlist")
|
|
86
|
+
.option("--body <json>", "Request body as JSON string")
|
|
87
|
+
.option("--body-file <path>", "Read request body from file")
|
|
88
|
+
.action(async (opts) => {
|
|
89
|
+
const client = await ctx.getClient();
|
|
90
|
+
let body: unknown;
|
|
91
|
+
if (opts.bodyFile) {
|
|
92
|
+
const { readFileSync } = await import("fs");
|
|
93
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
94
|
+
} else if (opts.body) {
|
|
95
|
+
body = ctx.parseBody(opts.body);
|
|
96
|
+
}
|
|
97
|
+
if (ctx.verbose)
|
|
98
|
+
process.stderr.write(
|
|
99
|
+
`POST ${new URL(`/api/v2025-06/playlists`, "https://placeholder").pathname}\n`,
|
|
100
|
+
);
|
|
101
|
+
const result = await client.post(`/api/v2025-06/playlists`, body);
|
|
102
|
+
ctx.output(result);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
resource
|
|
106
|
+
.command("list")
|
|
107
|
+
.description("list playlists")
|
|
108
|
+
.option("--page-cursor <value>", "page[cursor]")
|
|
109
|
+
.option("--page-limit <value>", "page[limit]")
|
|
110
|
+
.option("--filter-status <value>", "filter[status]")
|
|
111
|
+
.option("--filter-title <value>", "filter[title]")
|
|
112
|
+
.action(async (opts) => {
|
|
113
|
+
const client = await ctx.getClient();
|
|
114
|
+
const params: Record<string, unknown> = {};
|
|
115
|
+
if (opts.pageCursor !== undefined)
|
|
116
|
+
params["page[cursor]"] = opts.pageCursor;
|
|
117
|
+
if (opts.pageLimit !== undefined)
|
|
118
|
+
params["page[limit]"] = Number(opts.pageLimit);
|
|
119
|
+
if (opts.filterStatus !== undefined)
|
|
120
|
+
params["filter[status]"] = opts.filterStatus;
|
|
121
|
+
if (opts.filterTitle !== undefined)
|
|
122
|
+
params["filter[title]"] = opts.filterTitle;
|
|
123
|
+
if (ctx.verbose)
|
|
124
|
+
process.stderr.write(
|
|
125
|
+
`GET ${new URL(`/api/v2025-06/playlists`, "https://placeholder").pathname}\n`,
|
|
126
|
+
);
|
|
127
|
+
const result = await client.get(`/api/v2025-06/playlists`, params);
|
|
128
|
+
ctx.output(result);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
resource
|
|
132
|
+
.command("delete <id>")
|
|
133
|
+
.description("delete playlist")
|
|
134
|
+
.action(async (id, opts) => {
|
|
135
|
+
const client = await ctx.getClient();
|
|
136
|
+
if (ctx.verbose)
|
|
137
|
+
process.stderr.write(
|
|
138
|
+
`DELETE ${new URL(`/api/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
|
|
139
|
+
);
|
|
140
|
+
const result = await client.delete(`/api/v2025-06/playlists/${id}`);
|
|
141
|
+
ctx.output(result);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
resource
|
|
145
|
+
.command("get <id>")
|
|
146
|
+
.description("show playlist")
|
|
147
|
+
.action(async (id, opts) => {
|
|
148
|
+
const client = await ctx.getClient();
|
|
149
|
+
if (ctx.verbose)
|
|
150
|
+
process.stderr.write(
|
|
151
|
+
`GET ${new URL(`/api/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
|
|
152
|
+
);
|
|
153
|
+
const result = await client.get(`/api/v2025-06/playlists/${id}`);
|
|
154
|
+
ctx.output(result);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
resource
|
|
158
|
+
.command("update <id>")
|
|
159
|
+
.description("update playlist")
|
|
160
|
+
.option("--body <json>", "Request body as JSON string")
|
|
161
|
+
.option("--body-file <path>", "Read request body from file")
|
|
162
|
+
.action(async (id, opts) => {
|
|
163
|
+
const client = await ctx.getClient();
|
|
164
|
+
let body: unknown;
|
|
165
|
+
if (opts.bodyFile) {
|
|
166
|
+
const { readFileSync } = await import("fs");
|
|
167
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
168
|
+
} else if (opts.body) {
|
|
169
|
+
body = ctx.parseBody(opts.body);
|
|
170
|
+
}
|
|
171
|
+
if (ctx.verbose)
|
|
172
|
+
process.stderr.write(
|
|
173
|
+
`PATCH ${new URL(`/api/v2025-06/playlists/${id}`, "https://placeholder").pathname}\n`,
|
|
174
|
+
);
|
|
175
|
+
const result = await client.patch(`/api/v2025-06/playlists/${id}`, body);
|
|
176
|
+
ctx.output(result);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
resource
|
|
180
|
+
.command("get-shareable-items")
|
|
181
|
+
.description("search shareable items")
|
|
182
|
+
.option("--type <value>", "type")
|
|
183
|
+
.option("--search <value>", "search")
|
|
184
|
+
.option("--country-id <value>", "country_id")
|
|
185
|
+
.action(async (opts) => {
|
|
186
|
+
const client = await ctx.getClient();
|
|
187
|
+
const params: Record<string, unknown> = {};
|
|
188
|
+
if (opts.type !== undefined) params["type"] = opts.type;
|
|
189
|
+
if (opts.search !== undefined) params["search"] = opts.search;
|
|
190
|
+
if (opts.countryId !== undefined)
|
|
191
|
+
params["country_id"] = Number(opts.countryId);
|
|
192
|
+
if (ctx.verbose)
|
|
193
|
+
process.stderr.write(
|
|
194
|
+
`GET ${new URL(`/api/v2025-06/playlists/shareables`, "https://placeholder").pathname}\n`,
|
|
195
|
+
);
|
|
196
|
+
const result = await client.get(
|
|
197
|
+
`/api/v2025-06/playlists/shareables`,
|
|
198
|
+
params,
|
|
199
|
+
);
|
|
200
|
+
ctx.output(result);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// product-media.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerProductMedia(
|
|
6
|
+
parent: Command,
|
|
7
|
+
ctx: CommandContext,
|
|
8
|
+
): void {
|
|
9
|
+
const resource = parent.command("product-media").description("ProductMedia");
|
|
10
|
+
|
|
11
|
+
resource
|
|
12
|
+
.command("list <product-id>")
|
|
13
|
+
.description("List media associated with product")
|
|
14
|
+
.option("--page <value>", "page")
|
|
15
|
+
.action(async (productId, opts) => {
|
|
16
|
+
const client = await ctx.getClient();
|
|
17
|
+
const params: Record<string, unknown> = {};
|
|
18
|
+
if (opts.page !== undefined) params["page"] = opts.page;
|
|
19
|
+
if (ctx.verbose)
|
|
20
|
+
process.stderr.write(
|
|
21
|
+
`GET ${new URL(`/api/v2025-06/products/${productId}/media`, "https://placeholder").pathname}\n`,
|
|
22
|
+
);
|
|
23
|
+
const result = await client.get(
|
|
24
|
+
`/api/v2025-06/products/${productId}/media`,
|
|
25
|
+
params,
|
|
26
|
+
);
|
|
27
|
+
ctx.output(result);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
resource
|
|
31
|
+
.command("create <product-id>")
|
|
32
|
+
.description("Associate media with product")
|
|
33
|
+
.option("--body <json>", "Request body as JSON string")
|
|
34
|
+
.option("--body-file <path>", "Read request body from file")
|
|
35
|
+
.action(async (productId, opts) => {
|
|
36
|
+
const client = await ctx.getClient();
|
|
37
|
+
let body: unknown;
|
|
38
|
+
if (opts.bodyFile) {
|
|
39
|
+
const { readFileSync } = await import("fs");
|
|
40
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
41
|
+
} else if (opts.body) {
|
|
42
|
+
body = ctx.parseBody(opts.body);
|
|
43
|
+
}
|
|
44
|
+
if (ctx.verbose)
|
|
45
|
+
process.stderr.write(
|
|
46
|
+
`POST ${new URL(`/api/v2025-06/products/${productId}/media`, "https://placeholder").pathname}\n`,
|
|
47
|
+
);
|
|
48
|
+
const result = await client.post(
|
|
49
|
+
`/api/v2025-06/products/${productId}/media`,
|
|
50
|
+
body,
|
|
51
|
+
);
|
|
52
|
+
ctx.output(result);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
resource
|
|
56
|
+
.command("delete <product-id> <id>")
|
|
57
|
+
.description("Media removed from product")
|
|
58
|
+
.action(async (productId, id, opts) => {
|
|
59
|
+
const client = await ctx.getClient();
|
|
60
|
+
if (ctx.verbose)
|
|
61
|
+
process.stderr.write(
|
|
62
|
+
`DELETE ${new URL(`/api/v2025-06/products/${productId}/media/${id}`, "https://placeholder").pathname}\n`,
|
|
63
|
+
);
|
|
64
|
+
const result = await client.delete(
|
|
65
|
+
`/api/v2025-06/products/${productId}/media/${id}`,
|
|
66
|
+
);
|
|
67
|
+
ctx.output(result);
|
|
68
|
+
});
|
|
69
|
+
}
|