@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,307 @@
1
+ // reps.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 registerReps(parent: Command, ctx: CommandContext): void {
13
+ const resource = parent.command("reps").description("Reps");
14
+
15
+ resource
16
+ .command("create")
17
+ .description("Create a rep")
18
+ .option("--body <json>", "Request body as JSON string")
19
+ .option("--body-file <path>", "Read request body from file")
20
+ .action(async (opts) => {
21
+ const client = await ctx.getClient();
22
+ let body: unknown;
23
+ if (opts.bodyFile) {
24
+ const { readFileSync } = await import("fs");
25
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
26
+ } else if (opts.body) {
27
+ body = ctx.parseBody(opts.body);
28
+ }
29
+ if (ctx.verbose)
30
+ process.stderr.write(
31
+ `POST ${new URL(`/api/v2025-06/reps`, "https://placeholder").pathname}\n`,
32
+ );
33
+ const result = await client.post(`/api/v2025-06/reps`, body);
34
+ ctx.output(result);
35
+ });
36
+
37
+ resource
38
+ .command("list")
39
+ .description("List reps")
40
+ .option("--params <value>", "params")
41
+ .action(async (opts) => {
42
+ const client = await ctx.getClient();
43
+ const params: Record<string, unknown> = {};
44
+ if (opts.params !== undefined) params["params"] = opts.params;
45
+ if (ctx.verbose)
46
+ process.stderr.write(
47
+ `GET ${new URL(`/api/v2025-06/reps`, "https://placeholder").pathname}\n`,
48
+ );
49
+ const result = await client.get(`/api/v2025-06/reps`, params);
50
+ ctx.output(result);
51
+ });
52
+
53
+ resource
54
+ .command("get-credited-orders <rep-id>")
55
+ .description("List credited orders for a rep")
56
+ .option("--start-date <value>", "start_date")
57
+ .option("--end-date <value>", "end_date")
58
+ .option("--page <value>", "page")
59
+ .option("--per-page <value>", "per_page")
60
+ .option("--customer-id <value>", "customer_id")
61
+ .option("--user-company-id <value>", "user_company_id")
62
+ .option("--unfulfilled <value>", "unfulfilled")
63
+ .option("--unpaid <value>", "unpaid")
64
+ .option("--search-query <value>", "search_query")
65
+ .option("--within-days <value>", "within_days")
66
+ .option("--metadata <value>", "metadata")
67
+ .option("--subscription-id <value>", "subscription_id")
68
+ .option("--sorted-by <value>", "sorted_by")
69
+ .option("--status <value>", "status")
70
+ .option("--type <value>", "type")
71
+ .option("--cart-source <value>", "cart_source")
72
+ .option("--country-isos <value>", "country_isos")
73
+ .option("--force-stats <value>", "force_stats")
74
+ .action(async (repId, opts) => {
75
+ const client = await ctx.getClient();
76
+ const params: Record<string, unknown> = {};
77
+ if (opts.startDate !== undefined) params["start_date"] = opts.startDate;
78
+ if (opts.endDate !== undefined) params["end_date"] = opts.endDate;
79
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
80
+ if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
81
+ if (opts.customerId !== undefined)
82
+ params["customer_id"] = Number(opts.customerId);
83
+ if (opts.userCompanyId !== undefined)
84
+ params["user_company_id"] = Number(opts.userCompanyId);
85
+ if (opts.unfulfilled !== undefined)
86
+ params["unfulfilled"] = parseBooleanOption(
87
+ opts.unfulfilled,
88
+ "--unfulfilled",
89
+ );
90
+ if (opts.unpaid !== undefined)
91
+ params["unpaid"] = parseBooleanOption(opts.unpaid, "--unpaid");
92
+ if (opts.searchQuery !== undefined)
93
+ params["search_query"] = opts.searchQuery;
94
+ if (opts.withinDays !== undefined)
95
+ params["within_days"] = Number(opts.withinDays);
96
+ if (opts.metadata !== undefined) params["metadata"] = opts.metadata;
97
+ if (opts.subscriptionId !== undefined)
98
+ params["subscription_id"] = Number(opts.subscriptionId);
99
+ if (opts.sortedBy !== undefined) params["sorted_by"] = opts.sortedBy;
100
+ if (opts.status !== undefined) params["status"] = opts.status;
101
+ if (opts.type !== undefined) params["type"] = opts.type;
102
+ if (opts.cartSource !== undefined)
103
+ params["cart_source"] = opts.cartSource;
104
+ if (opts.countryIsos !== undefined)
105
+ params["country_isos"] = opts.countryIsos;
106
+ if (opts.forceStats !== undefined)
107
+ params["force_stats"] = parseBooleanOption(
108
+ opts.forceStats,
109
+ "--force-stats",
110
+ );
111
+ if (ctx.verbose)
112
+ process.stderr.write(
113
+ `GET ${new URL(`/api/v2025-06/reps/${repId}/credited_orders`, "https://placeholder").pathname}\n`,
114
+ );
115
+ const result = await client.get(
116
+ `/api/v2025-06/reps/${repId}/credited_orders`,
117
+ params,
118
+ );
119
+ ctx.output(result);
120
+ });
121
+
122
+ resource
123
+ .command("delete <id>")
124
+ .description("Delete a rep")
125
+ .action(async (id, opts) => {
126
+ const client = await ctx.getClient();
127
+ if (ctx.verbose)
128
+ process.stderr.write(
129
+ `DELETE ${new URL(`/api/v2025-06/reps/${id}`, "https://placeholder").pathname}\n`,
130
+ );
131
+ const result = await client.delete(`/api/v2025-06/reps/${id}`);
132
+ ctx.output(result);
133
+ });
134
+
135
+ resource
136
+ .command("get <id>")
137
+ .description("Get a rep")
138
+ .action(async (id, opts) => {
139
+ const client = await ctx.getClient();
140
+ if (ctx.verbose)
141
+ process.stderr.write(
142
+ `GET ${new URL(`/api/v2025-06/reps/${id}`, "https://placeholder").pathname}\n`,
143
+ );
144
+ const result = await client.get(`/api/v2025-06/reps/${id}`);
145
+ ctx.output(result);
146
+ });
147
+
148
+ resource
149
+ .command("update <id>")
150
+ .description("Update a rep")
151
+ .option("--body <json>", "Request body as JSON string")
152
+ .option("--body-file <path>", "Read request body from file")
153
+ .action(async (id, opts) => {
154
+ const client = await ctx.getClient();
155
+ let body: unknown;
156
+ if (opts.bodyFile) {
157
+ const { readFileSync } = await import("fs");
158
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
159
+ } else if (opts.body) {
160
+ body = ctx.parseBody(opts.body);
161
+ }
162
+ if (ctx.verbose)
163
+ process.stderr.write(
164
+ `PATCH ${new URL(`/api/v2025-06/reps/${id}`, "https://placeholder").pathname}\n`,
165
+ );
166
+ const result = await client.patch(`/api/v2025-06/reps/${id}`, body);
167
+ ctx.output(result);
168
+ });
169
+
170
+ resource
171
+ .command("get-most-shared <rep-id>")
172
+ .description("Get most shared resources")
173
+ .option("--limit <value>", "limit")
174
+ .option("--period <value>", "period")
175
+ .option("--shareable-type <value>", "shareable_type")
176
+ .option("--language-iso <value>", "language_iso")
177
+ .action(async (repId, opts) => {
178
+ const client = await ctx.getClient();
179
+ const params: Record<string, unknown> = {};
180
+ if (opts.limit !== undefined) params["limit"] = Number(opts.limit);
181
+ if (opts.period !== undefined) params["period"] = opts.period;
182
+ if (opts.shareableType !== undefined)
183
+ params["shareable_type"] = opts.shareableType;
184
+ if (opts.languageIso !== undefined)
185
+ params["language_iso"] = opts.languageIso;
186
+ if (ctx.verbose)
187
+ process.stderr.write(
188
+ `GET ${new URL(`/api/v2025-06/reps/${repId}/most_shared`, "https://placeholder").pathname}\n`,
189
+ );
190
+ const result = await client.get(
191
+ `/api/v2025-06/reps/${repId}/most_shared`,
192
+ params,
193
+ );
194
+ ctx.output(result);
195
+ });
196
+
197
+ resource
198
+ .command("get-most-viewed <rep-id>")
199
+ .description("Get most viewed resources")
200
+ .option("--limit <value>", "limit")
201
+ .option("--period <value>", "period")
202
+ .option("--shareable-type <value>", "shareable_type")
203
+ .option("--language-iso <value>", "language_iso")
204
+ .action(async (repId, opts) => {
205
+ const client = await ctx.getClient();
206
+ const params: Record<string, unknown> = {};
207
+ if (opts.limit !== undefined) params["limit"] = Number(opts.limit);
208
+ if (opts.period !== undefined) params["period"] = opts.period;
209
+ if (opts.shareableType !== undefined)
210
+ params["shareable_type"] = opts.shareableType;
211
+ if (opts.languageIso !== undefined)
212
+ params["language_iso"] = opts.languageIso;
213
+ if (ctx.verbose)
214
+ process.stderr.write(
215
+ `GET ${new URL(`/api/v2025-06/reps/${repId}/most_viewed`, "https://placeholder").pathname}\n`,
216
+ );
217
+ const result = await client.get(
218
+ `/api/v2025-06/reps/${repId}/most_viewed`,
219
+ params,
220
+ );
221
+ ctx.output(result);
222
+ });
223
+
224
+ resource
225
+ .command("get-shared-assets <rep-id>")
226
+ .description("List shared assets for a rep")
227
+ .option("--limit <value>", "limit")
228
+ .action(async (repId, opts) => {
229
+ const client = await ctx.getClient();
230
+ const params: Record<string, unknown> = {};
231
+ if (opts.limit !== undefined) params["limit"] = Number(opts.limit);
232
+ if (ctx.verbose)
233
+ process.stderr.write(
234
+ `GET ${new URL(`/api/v2025-06/reps/${repId}/shared_assets`, "https://placeholder").pathname}\n`,
235
+ );
236
+ const result = await client.get(
237
+ `/api/v2025-06/reps/${repId}/shared_assets`,
238
+ params,
239
+ );
240
+ ctx.output(result);
241
+ });
242
+
243
+ resource
244
+ .command("get-top-products-sold <rep-id>")
245
+ .description("Get top products sold by rep")
246
+ .option("--limit <value>", "limit")
247
+ .option("--period <value>", "period")
248
+ .action(async (repId, opts) => {
249
+ const client = await ctx.getClient();
250
+ const params: Record<string, unknown> = {};
251
+ if (opts.limit !== undefined) params["limit"] = Number(opts.limit);
252
+ if (opts.period !== undefined) params["period"] = opts.period;
253
+ if (ctx.verbose)
254
+ process.stderr.write(
255
+ `GET ${new URL(`/api/v2025-06/reps/${repId}/top_products_sold`, "https://placeholder").pathname}\n`,
256
+ );
257
+ const result = await client.get(
258
+ `/api/v2025-06/reps/${repId}/top_products_sold`,
259
+ params,
260
+ );
261
+ ctx.output(result);
262
+ });
263
+
264
+ resource
265
+ .command("create-bulk")
266
+ .description("Create multiple reps")
267
+ .option("--body <json>", "Request body as JSON string")
268
+ .option("--body-file <path>", "Read request body from file")
269
+ .action(async (opts) => {
270
+ const client = await ctx.getClient();
271
+ let body: unknown;
272
+ if (opts.bodyFile) {
273
+ const { readFileSync } = await import("fs");
274
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
275
+ } else if (opts.body) {
276
+ body = ctx.parseBody(opts.body);
277
+ }
278
+ if (ctx.verbose)
279
+ process.stderr.write(
280
+ `POST ${new URL(`/api/v2025-06/reps/bulk`, "https://placeholder").pathname}\n`,
281
+ );
282
+ const result = await client.post(`/api/v2025-06/reps/bulk`, body);
283
+ ctx.output(result);
284
+ });
285
+
286
+ resource
287
+ .command("delete-bulk")
288
+ .description("Delete multiple reps")
289
+ .option("--body <json>", "Request body as JSON string")
290
+ .option("--body-file <path>", "Read request body from file")
291
+ .action(async (opts) => {
292
+ const client = await ctx.getClient();
293
+ let body: unknown;
294
+ if (opts.bodyFile) {
295
+ const { readFileSync } = await import("fs");
296
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
297
+ } else if (opts.body) {
298
+ body = ctx.parseBody(opts.body);
299
+ }
300
+ if (ctx.verbose)
301
+ process.stderr.write(
302
+ `DELETE ${new URL(`/api/v2025-06/reps/bulk`, "https://placeholder").pathname}\n`,
303
+ );
304
+ const result = await client.delete(`/api/v2025-06/reps/bulk`, { body });
305
+ ctx.output(result);
306
+ });
307
+ }
@@ -0,0 +1,126 @@
1
+ // share-statistics.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
4
+
5
+ export function registerShareStatistics(
6
+ parent: Command,
7
+ ctx: CommandContext,
8
+ ): void {
9
+ const resource = parent
10
+ .command("share-statistics")
11
+ .description("Share Statistics");
12
+
13
+ resource
14
+ .command("get-media-share-stats <id>")
15
+ .description("Get share statistics for media")
16
+ .action(async (id, opts) => {
17
+ const client = await ctx.getClient();
18
+ if (ctx.verbose)
19
+ process.stderr.write(
20
+ `GET ${new URL(`/api/v2025-06/media/${id}/share_stats`, "https://placeholder").pathname}\n`,
21
+ );
22
+ const result = await client.get(`/api/v2025-06/media/${id}/share_stats`);
23
+ ctx.output(result);
24
+ });
25
+
26
+ resource
27
+ .command("get-product-share-stats <id>")
28
+ .description("Get share statistics for product")
29
+ .action(async (id, opts) => {
30
+ const client = await ctx.getClient();
31
+ if (ctx.verbose)
32
+ process.stderr.write(
33
+ `GET ${new URL(`/api/v2025-06/products/${id}/share_stats`, "https://placeholder").pathname}\n`,
34
+ );
35
+ const result = await client.get(
36
+ `/api/v2025-06/products/${id}/share_stats`,
37
+ );
38
+ ctx.output(result);
39
+ });
40
+
41
+ resource
42
+ .command("get-playlist-share-stats <id>")
43
+ .description("Get share statistics for playlist")
44
+ .action(async (id, opts) => {
45
+ const client = await ctx.getClient();
46
+ if (ctx.verbose)
47
+ process.stderr.write(
48
+ `GET ${new URL(`/api/v2025-06/playlists/${id}/share_stats`, "https://placeholder").pathname}\n`,
49
+ );
50
+ const result = await client.get(
51
+ `/api/v2025-06/playlists/${id}/share_stats`,
52
+ );
53
+ ctx.output(result);
54
+ });
55
+
56
+ resource
57
+ .command("get-category-share-stats <id>")
58
+ .description("Get share statistics for category")
59
+ .action(async (id, opts) => {
60
+ const client = await ctx.getClient();
61
+ if (ctx.verbose)
62
+ process.stderr.write(
63
+ `GET ${new URL(`/api/v2025-06/categories/${id}/share_stats`, "https://placeholder").pathname}\n`,
64
+ );
65
+ const result = await client.get(
66
+ `/api/v2025-06/categories/${id}/share_stats`,
67
+ );
68
+ ctx.output(result);
69
+ });
70
+
71
+ resource
72
+ .command("get-collection-share-stats <id>")
73
+ .description("Get share statistics for collection")
74
+ .action(async (id, opts) => {
75
+ const client = await ctx.getClient();
76
+ if (ctx.verbose)
77
+ process.stderr.write(
78
+ `GET ${new URL(`/api/v2025-06/collections/${id}/share_stats`, "https://placeholder").pathname}\n`,
79
+ );
80
+ const result = await client.get(
81
+ `/api/v2025-06/collections/${id}/share_stats`,
82
+ );
83
+ ctx.output(result);
84
+ });
85
+
86
+ resource
87
+ .command("get-post-share-stats <id>")
88
+ .description("Get share statistics for post")
89
+ .action(async (id, opts) => {
90
+ const client = await ctx.getClient();
91
+ if (ctx.verbose)
92
+ process.stderr.write(
93
+ `GET ${new URL(`/api/v2025-06/posts/${id}/share_stats`, "https://placeholder").pathname}\n`,
94
+ );
95
+ const result = await client.get(`/api/v2025-06/posts/${id}/share_stats`);
96
+ ctx.output(result);
97
+ });
98
+
99
+ resource
100
+ .command("get-page-share-stats <id>")
101
+ .description("Get share statistics for page")
102
+ .action(async (id, opts) => {
103
+ const client = await ctx.getClient();
104
+ if (ctx.verbose)
105
+ process.stderr.write(
106
+ `GET ${new URL(`/api/v2025-06/pages/${id}/share_stats`, "https://placeholder").pathname}\n`,
107
+ );
108
+ const result = await client.get(`/api/v2025-06/pages/${id}/share_stats`);
109
+ ctx.output(result);
110
+ });
111
+
112
+ resource
113
+ .command("get-enrollment-pack-share-stats <id>")
114
+ .description("Get share statistics for enrollment pack")
115
+ .action(async (id, opts) => {
116
+ const client = await ctx.getClient();
117
+ if (ctx.verbose)
118
+ process.stderr.write(
119
+ `GET ${new URL(`/api/v2025-06/enrollment_packs/${id}/share_stats`, "https://placeholder").pathname}\n`,
120
+ );
121
+ const result = await client.get(
122
+ `/api/v2025-06/enrollment_packs/${id}/share_stats`,
123
+ );
124
+ ctx.output(result);
125
+ });
126
+ }