@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,118 @@
|
|
|
1
|
+
// users-tasks.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerUsersTasks(parent: Command, ctx: CommandContext): void {
|
|
6
|
+
const resource = parent.command("users-tasks").description("Users Tasks");
|
|
7
|
+
|
|
8
|
+
resource
|
|
9
|
+
.command("complete-user-task <id>")
|
|
10
|
+
.description("Toggle task completion")
|
|
11
|
+
.action(async (id, opts) => {
|
|
12
|
+
const client = await ctx.getClient();
|
|
13
|
+
if (ctx.verbose)
|
|
14
|
+
process.stderr.write(
|
|
15
|
+
`POST ${new URL(`/api/users/v2025-06/tasks/${id}/complete`, "https://placeholder").pathname}\n`,
|
|
16
|
+
);
|
|
17
|
+
const result = await client.post(
|
|
18
|
+
`/api/users/v2025-06/tasks/${id}/complete`,
|
|
19
|
+
);
|
|
20
|
+
ctx.output(result);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
resource
|
|
24
|
+
.command("create-user-task")
|
|
25
|
+
.description("Create a task")
|
|
26
|
+
.option("--body <json>", "Request body as JSON string")
|
|
27
|
+
.option("--body-file <path>", "Read request body from file")
|
|
28
|
+
.action(async (opts) => {
|
|
29
|
+
const client = await ctx.getClient();
|
|
30
|
+
let body: unknown;
|
|
31
|
+
if (opts.bodyFile) {
|
|
32
|
+
const { readFileSync } = await import("fs");
|
|
33
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
34
|
+
} else if (opts.body) {
|
|
35
|
+
body = ctx.parseBody(opts.body);
|
|
36
|
+
}
|
|
37
|
+
if (ctx.verbose)
|
|
38
|
+
process.stderr.write(
|
|
39
|
+
`POST ${new URL(`/api/users/v2025-06/tasks`, "https://placeholder").pathname}\n`,
|
|
40
|
+
);
|
|
41
|
+
const result = await client.post(`/api/users/v2025-06/tasks`, body);
|
|
42
|
+
ctx.output(result);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
resource
|
|
46
|
+
.command("list-user-tasks")
|
|
47
|
+
.description("List tasks for the current user")
|
|
48
|
+
.option("--page <value>", "page")
|
|
49
|
+
.option("--per-page <value>", "per_page")
|
|
50
|
+
.option("--contact-id <value>", "contact_id")
|
|
51
|
+
.option("--status <value>", "status")
|
|
52
|
+
.action(async (opts) => {
|
|
53
|
+
const client = await ctx.getClient();
|
|
54
|
+
const params: Record<string, unknown> = {};
|
|
55
|
+
if (opts.page !== undefined) params["page"] = Number(opts.page);
|
|
56
|
+
if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
|
|
57
|
+
if (opts.contactId !== undefined)
|
|
58
|
+
params["contact_id"] = Number(opts.contactId);
|
|
59
|
+
if (opts.status !== undefined) params["status"] = opts.status;
|
|
60
|
+
if (ctx.verbose)
|
|
61
|
+
process.stderr.write(
|
|
62
|
+
`GET ${new URL(`/api/users/v2025-06/tasks`, "https://placeholder").pathname}\n`,
|
|
63
|
+
);
|
|
64
|
+
const result = await client.get(`/api/users/v2025-06/tasks`, params);
|
|
65
|
+
ctx.output(result);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
resource
|
|
69
|
+
.command("delete-user-task <id>")
|
|
70
|
+
.description("Delete a task")
|
|
71
|
+
.action(async (id, opts) => {
|
|
72
|
+
const client = await ctx.getClient();
|
|
73
|
+
if (ctx.verbose)
|
|
74
|
+
process.stderr.write(
|
|
75
|
+
`DELETE ${new URL(`/api/users/v2025-06/tasks/${id}`, "https://placeholder").pathname}\n`,
|
|
76
|
+
);
|
|
77
|
+
const result = await client.delete(`/api/users/v2025-06/tasks/${id}`);
|
|
78
|
+
ctx.output(result);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
resource
|
|
82
|
+
.command("get-user-task <id>")
|
|
83
|
+
.description("Get a task")
|
|
84
|
+
.action(async (id, opts) => {
|
|
85
|
+
const client = await ctx.getClient();
|
|
86
|
+
if (ctx.verbose)
|
|
87
|
+
process.stderr.write(
|
|
88
|
+
`GET ${new URL(`/api/users/v2025-06/tasks/${id}`, "https://placeholder").pathname}\n`,
|
|
89
|
+
);
|
|
90
|
+
const result = await client.get(`/api/users/v2025-06/tasks/${id}`);
|
|
91
|
+
ctx.output(result);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
resource
|
|
95
|
+
.command("update-user-task <id>")
|
|
96
|
+
.description("Update a task")
|
|
97
|
+
.option("--body <json>", "Request body as JSON string")
|
|
98
|
+
.option("--body-file <path>", "Read request body from file")
|
|
99
|
+
.action(async (id, opts) => {
|
|
100
|
+
const client = await ctx.getClient();
|
|
101
|
+
let body: unknown;
|
|
102
|
+
if (opts.bodyFile) {
|
|
103
|
+
const { readFileSync } = await import("fs");
|
|
104
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
105
|
+
} else if (opts.body) {
|
|
106
|
+
body = ctx.parseBody(opts.body);
|
|
107
|
+
}
|
|
108
|
+
if (ctx.verbose)
|
|
109
|
+
process.stderr.write(
|
|
110
|
+
`PATCH ${new URL(`/api/users/v2025-06/tasks/${id}`, "https://placeholder").pathname}\n`,
|
|
111
|
+
);
|
|
112
|
+
const result = await client.patch(
|
|
113
|
+
`/api/users/v2025-06/tasks/${id}`,
|
|
114
|
+
body,
|
|
115
|
+
);
|
|
116
|
+
ctx.output(result);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
// widgets.ts — AUTO-GENERATED, DO NOT EDIT
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import type { CommandContext } from "../lib/types.js";
|
|
4
|
+
|
|
5
|
+
export function registerWidgets(parent: Command, ctx: CommandContext): void {
|
|
6
|
+
const resource = parent.command("widgets").description("Widgets");
|
|
7
|
+
|
|
8
|
+
resource
|
|
9
|
+
.command("create-banner-widget")
|
|
10
|
+
.description("Create a banner widget")
|
|
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/v2025-06/widgets/banners`, "https://placeholder").pathname}\n`,
|
|
25
|
+
);
|
|
26
|
+
const result = await client.post(`/api/v2025-06/widgets/banners`, body);
|
|
27
|
+
ctx.output(result);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
resource
|
|
31
|
+
.command("list-banner-widgets")
|
|
32
|
+
.description("List banner widgets")
|
|
33
|
+
.option("--filter-status <value>", "filter[status]")
|
|
34
|
+
.option("--filter-placement <value>", "filter[placement]")
|
|
35
|
+
.option("--filter-behavior <value>", "filter[behavior]")
|
|
36
|
+
.option("--filter-name <value>", "filter[name]")
|
|
37
|
+
.option("--page-cursor <value>", "page[cursor]")
|
|
38
|
+
.option("--page-limit <value>", "page[limit]")
|
|
39
|
+
.option("--sort <value>", "sort")
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
const client = await ctx.getClient();
|
|
42
|
+
const params: Record<string, unknown> = {};
|
|
43
|
+
if (opts.filterStatus !== undefined)
|
|
44
|
+
params["filter[status]"] = opts.filterStatus;
|
|
45
|
+
if (opts.filterPlacement !== undefined)
|
|
46
|
+
params["filter[placement]"] = opts.filterPlacement;
|
|
47
|
+
if (opts.filterBehavior !== undefined)
|
|
48
|
+
params["filter[behavior]"] = opts.filterBehavior;
|
|
49
|
+
if (opts.filterName !== undefined)
|
|
50
|
+
params["filter[name]"] = opts.filterName;
|
|
51
|
+
if (opts.pageCursor !== undefined)
|
|
52
|
+
params["page[cursor]"] = opts.pageCursor;
|
|
53
|
+
if (opts.pageLimit !== undefined)
|
|
54
|
+
params["page[limit]"] = Number(opts.pageLimit);
|
|
55
|
+
if (opts.sort !== undefined) params["sort"] = opts.sort;
|
|
56
|
+
if (ctx.verbose)
|
|
57
|
+
process.stderr.write(
|
|
58
|
+
`GET ${new URL(`/api/v2025-06/widgets/banners`, "https://placeholder").pathname}\n`,
|
|
59
|
+
);
|
|
60
|
+
const result = await client.get(`/api/v2025-06/widgets/banners`, params);
|
|
61
|
+
ctx.output(result);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
resource
|
|
65
|
+
.command("delete-banner-widget <id>")
|
|
66
|
+
.description("Delete a banner widget")
|
|
67
|
+
.action(async (id, opts) => {
|
|
68
|
+
const client = await ctx.getClient();
|
|
69
|
+
if (ctx.verbose)
|
|
70
|
+
process.stderr.write(
|
|
71
|
+
`DELETE ${new URL(`/api/v2025-06/widgets/banners/${id}`, "https://placeholder").pathname}\n`,
|
|
72
|
+
);
|
|
73
|
+
const result = await client.delete(`/api/v2025-06/widgets/banners/${id}`);
|
|
74
|
+
ctx.output(result);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
resource
|
|
78
|
+
.command("get-banner-widget <id>")
|
|
79
|
+
.description("Get a banner widget")
|
|
80
|
+
.action(async (id, opts) => {
|
|
81
|
+
const client = await ctx.getClient();
|
|
82
|
+
if (ctx.verbose)
|
|
83
|
+
process.stderr.write(
|
|
84
|
+
`GET ${new URL(`/api/v2025-06/widgets/banners/${id}`, "https://placeholder").pathname}\n`,
|
|
85
|
+
);
|
|
86
|
+
const result = await client.get(`/api/v2025-06/widgets/banners/${id}`);
|
|
87
|
+
ctx.output(result);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
resource
|
|
91
|
+
.command("update-banner-widget <id>")
|
|
92
|
+
.description("Update a banner widget")
|
|
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/v2025-06/widgets/banners/${id}`, "https://placeholder").pathname}\n`,
|
|
107
|
+
);
|
|
108
|
+
const result = await client.patch(
|
|
109
|
+
`/api/v2025-06/widgets/banners/${id}`,
|
|
110
|
+
body,
|
|
111
|
+
);
|
|
112
|
+
ctx.output(result);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
resource
|
|
116
|
+
.command("create-cart-widget")
|
|
117
|
+
.description("Create a cart widget")
|
|
118
|
+
.option("--body <json>", "Request body as JSON string")
|
|
119
|
+
.option("--body-file <path>", "Read request body from file")
|
|
120
|
+
.action(async (opts) => {
|
|
121
|
+
const client = await ctx.getClient();
|
|
122
|
+
let body: unknown;
|
|
123
|
+
if (opts.bodyFile) {
|
|
124
|
+
const { readFileSync } = await import("fs");
|
|
125
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
126
|
+
} else if (opts.body) {
|
|
127
|
+
body = ctx.parseBody(opts.body);
|
|
128
|
+
}
|
|
129
|
+
if (ctx.verbose)
|
|
130
|
+
process.stderr.write(
|
|
131
|
+
`POST ${new URL(`/api/v2025-06/widgets/carts`, "https://placeholder").pathname}\n`,
|
|
132
|
+
);
|
|
133
|
+
const result = await client.post(`/api/v2025-06/widgets/carts`, body);
|
|
134
|
+
ctx.output(result);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
resource
|
|
138
|
+
.command("list-cart-widgets")
|
|
139
|
+
.description("List cart widgets")
|
|
140
|
+
.option("--filter-status <value>", "filter[status]")
|
|
141
|
+
.option("--filter-placement <value>", "filter[placement]")
|
|
142
|
+
.option("--filter-name <value>", "filter[name]")
|
|
143
|
+
.option("--page-cursor <value>", "page[cursor]")
|
|
144
|
+
.option("--page-limit <value>", "page[limit]")
|
|
145
|
+
.option("--sort <value>", "sort")
|
|
146
|
+
.action(async (opts) => {
|
|
147
|
+
const client = await ctx.getClient();
|
|
148
|
+
const params: Record<string, unknown> = {};
|
|
149
|
+
if (opts.filterStatus !== undefined)
|
|
150
|
+
params["filter[status]"] = opts.filterStatus;
|
|
151
|
+
if (opts.filterPlacement !== undefined)
|
|
152
|
+
params["filter[placement]"] = opts.filterPlacement;
|
|
153
|
+
if (opts.filterName !== undefined)
|
|
154
|
+
params["filter[name]"] = opts.filterName;
|
|
155
|
+
if (opts.pageCursor !== undefined)
|
|
156
|
+
params["page[cursor]"] = opts.pageCursor;
|
|
157
|
+
if (opts.pageLimit !== undefined)
|
|
158
|
+
params["page[limit]"] = Number(opts.pageLimit);
|
|
159
|
+
if (opts.sort !== undefined) params["sort"] = opts.sort;
|
|
160
|
+
if (ctx.verbose)
|
|
161
|
+
process.stderr.write(
|
|
162
|
+
`GET ${new URL(`/api/v2025-06/widgets/carts`, "https://placeholder").pathname}\n`,
|
|
163
|
+
);
|
|
164
|
+
const result = await client.get(`/api/v2025-06/widgets/carts`, params);
|
|
165
|
+
ctx.output(result);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
resource
|
|
169
|
+
.command("delete-cart-widget <id>")
|
|
170
|
+
.description("Delete a cart widget")
|
|
171
|
+
.action(async (id, opts) => {
|
|
172
|
+
const client = await ctx.getClient();
|
|
173
|
+
if (ctx.verbose)
|
|
174
|
+
process.stderr.write(
|
|
175
|
+
`DELETE ${new URL(`/api/v2025-06/widgets/carts/${id}`, "https://placeholder").pathname}\n`,
|
|
176
|
+
);
|
|
177
|
+
const result = await client.delete(`/api/v2025-06/widgets/carts/${id}`);
|
|
178
|
+
ctx.output(result);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
resource
|
|
182
|
+
.command("get-cart-widget <id>")
|
|
183
|
+
.description("Show a cart widget")
|
|
184
|
+
.action(async (id, opts) => {
|
|
185
|
+
const client = await ctx.getClient();
|
|
186
|
+
if (ctx.verbose)
|
|
187
|
+
process.stderr.write(
|
|
188
|
+
`GET ${new URL(`/api/v2025-06/widgets/carts/${id}`, "https://placeholder").pathname}\n`,
|
|
189
|
+
);
|
|
190
|
+
const result = await client.get(`/api/v2025-06/widgets/carts/${id}`);
|
|
191
|
+
ctx.output(result);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
resource
|
|
195
|
+
.command("update-cart-widget <id>")
|
|
196
|
+
.description("Update a cart widget")
|
|
197
|
+
.option("--body <json>", "Request body as JSON string")
|
|
198
|
+
.option("--body-file <path>", "Read request body from file")
|
|
199
|
+
.action(async (id, opts) => {
|
|
200
|
+
const client = await ctx.getClient();
|
|
201
|
+
let body: unknown;
|
|
202
|
+
if (opts.bodyFile) {
|
|
203
|
+
const { readFileSync } = await import("fs");
|
|
204
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
205
|
+
} else if (opts.body) {
|
|
206
|
+
body = ctx.parseBody(opts.body);
|
|
207
|
+
}
|
|
208
|
+
if (ctx.verbose)
|
|
209
|
+
process.stderr.write(
|
|
210
|
+
`PUT ${new URL(`/api/v2025-06/widgets/carts/${id}`, "https://placeholder").pathname}\n`,
|
|
211
|
+
);
|
|
212
|
+
const result = await client.put(
|
|
213
|
+
`/api/v2025-06/widgets/carts/${id}`,
|
|
214
|
+
body,
|
|
215
|
+
);
|
|
216
|
+
ctx.output(result);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
resource
|
|
220
|
+
.command("create-chat-widget")
|
|
221
|
+
.description("Create a chat widget")
|
|
222
|
+
.option("--body <json>", "Request body as JSON string")
|
|
223
|
+
.option("--body-file <path>", "Read request body from file")
|
|
224
|
+
.action(async (opts) => {
|
|
225
|
+
const client = await ctx.getClient();
|
|
226
|
+
let body: unknown;
|
|
227
|
+
if (opts.bodyFile) {
|
|
228
|
+
const { readFileSync } = await import("fs");
|
|
229
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
230
|
+
} else if (opts.body) {
|
|
231
|
+
body = ctx.parseBody(opts.body);
|
|
232
|
+
}
|
|
233
|
+
if (ctx.verbose)
|
|
234
|
+
process.stderr.write(
|
|
235
|
+
`POST ${new URL(`/api/v2025-06/widgets/chats`, "https://placeholder").pathname}\n`,
|
|
236
|
+
);
|
|
237
|
+
const result = await client.post(`/api/v2025-06/widgets/chats`, body);
|
|
238
|
+
ctx.output(result);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
resource
|
|
242
|
+
.command("list-chat-widgets")
|
|
243
|
+
.description("List chat widgets")
|
|
244
|
+
.option("--filter-status <value>", "filter[status]")
|
|
245
|
+
.option("--filter-name <value>", "filter[name]")
|
|
246
|
+
.option("--page-cursor <value>", "page[cursor]")
|
|
247
|
+
.option("--page-limit <value>", "page[limit]")
|
|
248
|
+
.option("--sort <value>", "sort")
|
|
249
|
+
.action(async (opts) => {
|
|
250
|
+
const client = await ctx.getClient();
|
|
251
|
+
const params: Record<string, unknown> = {};
|
|
252
|
+
if (opts.filterStatus !== undefined)
|
|
253
|
+
params["filter[status]"] = opts.filterStatus;
|
|
254
|
+
if (opts.filterName !== undefined)
|
|
255
|
+
params["filter[name]"] = opts.filterName;
|
|
256
|
+
if (opts.pageCursor !== undefined)
|
|
257
|
+
params["page[cursor]"] = opts.pageCursor;
|
|
258
|
+
if (opts.pageLimit !== undefined)
|
|
259
|
+
params["page[limit]"] = Number(opts.pageLimit);
|
|
260
|
+
if (opts.sort !== undefined) params["sort"] = opts.sort;
|
|
261
|
+
if (ctx.verbose)
|
|
262
|
+
process.stderr.write(
|
|
263
|
+
`GET ${new URL(`/api/v2025-06/widgets/chats`, "https://placeholder").pathname}\n`,
|
|
264
|
+
);
|
|
265
|
+
const result = await client.get(`/api/v2025-06/widgets/chats`, params);
|
|
266
|
+
ctx.output(result);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
resource
|
|
270
|
+
.command("delete-chat-widget <id>")
|
|
271
|
+
.description("Delete a chat widget")
|
|
272
|
+
.action(async (id, opts) => {
|
|
273
|
+
const client = await ctx.getClient();
|
|
274
|
+
if (ctx.verbose)
|
|
275
|
+
process.stderr.write(
|
|
276
|
+
`DELETE ${new URL(`/api/v2025-06/widgets/chats/${id}`, "https://placeholder").pathname}\n`,
|
|
277
|
+
);
|
|
278
|
+
const result = await client.delete(`/api/v2025-06/widgets/chats/${id}`);
|
|
279
|
+
ctx.output(result);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
resource
|
|
283
|
+
.command("get-chat-widget <id>")
|
|
284
|
+
.description("Show a chat widget")
|
|
285
|
+
.action(async (id, opts) => {
|
|
286
|
+
const client = await ctx.getClient();
|
|
287
|
+
if (ctx.verbose)
|
|
288
|
+
process.stderr.write(
|
|
289
|
+
`GET ${new URL(`/api/v2025-06/widgets/chats/${id}`, "https://placeholder").pathname}\n`,
|
|
290
|
+
);
|
|
291
|
+
const result = await client.get(`/api/v2025-06/widgets/chats/${id}`);
|
|
292
|
+
ctx.output(result);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
resource
|
|
296
|
+
.command("update-chat-widget <id>")
|
|
297
|
+
.description("Update a chat widget")
|
|
298
|
+
.option("--body <json>", "Request body as JSON string")
|
|
299
|
+
.option("--body-file <path>", "Read request body from file")
|
|
300
|
+
.action(async (id, opts) => {
|
|
301
|
+
const client = await ctx.getClient();
|
|
302
|
+
let body: unknown;
|
|
303
|
+
if (opts.bodyFile) {
|
|
304
|
+
const { readFileSync } = await import("fs");
|
|
305
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
306
|
+
} else if (opts.body) {
|
|
307
|
+
body = ctx.parseBody(opts.body);
|
|
308
|
+
}
|
|
309
|
+
if (ctx.verbose)
|
|
310
|
+
process.stderr.write(
|
|
311
|
+
`PUT ${new URL(`/api/v2025-06/widgets/chats/${id}`, "https://placeholder").pathname}\n`,
|
|
312
|
+
);
|
|
313
|
+
const result = await client.put(
|
|
314
|
+
`/api/v2025-06/widgets/chats/${id}`,
|
|
315
|
+
body,
|
|
316
|
+
);
|
|
317
|
+
ctx.output(result);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
resource
|
|
321
|
+
.command("create-popup-widget")
|
|
322
|
+
.description("Create a popup widget")
|
|
323
|
+
.option("--body <json>", "Request body as JSON string")
|
|
324
|
+
.option("--body-file <path>", "Read request body from file")
|
|
325
|
+
.action(async (opts) => {
|
|
326
|
+
const client = await ctx.getClient();
|
|
327
|
+
let body: unknown;
|
|
328
|
+
if (opts.bodyFile) {
|
|
329
|
+
const { readFileSync } = await import("fs");
|
|
330
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
331
|
+
} else if (opts.body) {
|
|
332
|
+
body = ctx.parseBody(opts.body);
|
|
333
|
+
}
|
|
334
|
+
if (ctx.verbose)
|
|
335
|
+
process.stderr.write(
|
|
336
|
+
`POST ${new URL(`/api/v2025-06/widgets/popups`, "https://placeholder").pathname}\n`,
|
|
337
|
+
);
|
|
338
|
+
const result = await client.post(`/api/v2025-06/widgets/popups`, body);
|
|
339
|
+
ctx.output(result);
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
resource
|
|
343
|
+
.command("list-popup-widgets")
|
|
344
|
+
.description("List popup widgets")
|
|
345
|
+
.option("--filter-status <value>", "filter[status]")
|
|
346
|
+
.option("--filter-placement <value>", "filter[placement]")
|
|
347
|
+
.option("--filter-name <value>", "filter[name]")
|
|
348
|
+
.option("--page-cursor <value>", "page[cursor]")
|
|
349
|
+
.option("--page-limit <value>", "page[limit]")
|
|
350
|
+
.option("--sort <value>", "sort")
|
|
351
|
+
.action(async (opts) => {
|
|
352
|
+
const client = await ctx.getClient();
|
|
353
|
+
const params: Record<string, unknown> = {};
|
|
354
|
+
if (opts.filterStatus !== undefined)
|
|
355
|
+
params["filter[status]"] = opts.filterStatus;
|
|
356
|
+
if (opts.filterPlacement !== undefined)
|
|
357
|
+
params["filter[placement]"] = opts.filterPlacement;
|
|
358
|
+
if (opts.filterName !== undefined)
|
|
359
|
+
params["filter[name]"] = opts.filterName;
|
|
360
|
+
if (opts.pageCursor !== undefined)
|
|
361
|
+
params["page[cursor]"] = opts.pageCursor;
|
|
362
|
+
if (opts.pageLimit !== undefined)
|
|
363
|
+
params["page[limit]"] = Number(opts.pageLimit);
|
|
364
|
+
if (opts.sort !== undefined) params["sort"] = opts.sort;
|
|
365
|
+
if (ctx.verbose)
|
|
366
|
+
process.stderr.write(
|
|
367
|
+
`GET ${new URL(`/api/v2025-06/widgets/popups`, "https://placeholder").pathname}\n`,
|
|
368
|
+
);
|
|
369
|
+
const result = await client.get(`/api/v2025-06/widgets/popups`, params);
|
|
370
|
+
ctx.output(result);
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
resource
|
|
374
|
+
.command("delete-popup-widget <id>")
|
|
375
|
+
.description("Delete a popup widget")
|
|
376
|
+
.action(async (id, opts) => {
|
|
377
|
+
const client = await ctx.getClient();
|
|
378
|
+
if (ctx.verbose)
|
|
379
|
+
process.stderr.write(
|
|
380
|
+
`DELETE ${new URL(`/api/v2025-06/widgets/popups/${id}`, "https://placeholder").pathname}\n`,
|
|
381
|
+
);
|
|
382
|
+
const result = await client.delete(`/api/v2025-06/widgets/popups/${id}`);
|
|
383
|
+
ctx.output(result);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
resource
|
|
387
|
+
.command("get-popup-widget <id>")
|
|
388
|
+
.description("Get a popup widget")
|
|
389
|
+
.action(async (id, opts) => {
|
|
390
|
+
const client = await ctx.getClient();
|
|
391
|
+
if (ctx.verbose)
|
|
392
|
+
process.stderr.write(
|
|
393
|
+
`GET ${new URL(`/api/v2025-06/widgets/popups/${id}`, "https://placeholder").pathname}\n`,
|
|
394
|
+
);
|
|
395
|
+
const result = await client.get(`/api/v2025-06/widgets/popups/${id}`);
|
|
396
|
+
ctx.output(result);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
resource
|
|
400
|
+
.command("update-popup-widget <id>")
|
|
401
|
+
.description("Update a popup widget")
|
|
402
|
+
.option("--body <json>", "Request body as JSON string")
|
|
403
|
+
.option("--body-file <path>", "Read request body from file")
|
|
404
|
+
.action(async (id, opts) => {
|
|
405
|
+
const client = await ctx.getClient();
|
|
406
|
+
let body: unknown;
|
|
407
|
+
if (opts.bodyFile) {
|
|
408
|
+
const { readFileSync } = await import("fs");
|
|
409
|
+
body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
|
|
410
|
+
} else if (opts.body) {
|
|
411
|
+
body = ctx.parseBody(opts.body);
|
|
412
|
+
}
|
|
413
|
+
if (ctx.verbose)
|
|
414
|
+
process.stderr.write(
|
|
415
|
+
`PATCH ${new URL(`/api/v2025-06/widgets/popups/${id}`, "https://placeholder").pathname}\n`,
|
|
416
|
+
);
|
|
417
|
+
const result = await client.patch(
|
|
418
|
+
`/api/v2025-06/widgets/popups/${id}`,
|
|
419
|
+
body,
|
|
420
|
+
);
|
|
421
|
+
ctx.output(result);
|
|
422
|
+
});
|
|
423
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FluidPlugin } from "@fluid-app/fluid-cli";
|
|
2
|
+
import { createDomainCommand } from "@fluid-app/fluid-cli";
|
|
3
|
+
|
|
4
|
+
import { registerAllCommands } from "./generated/index.js";
|
|
5
|
+
|
|
6
|
+
const plugin: FluidPlugin = {
|
|
7
|
+
name: "@fluid-app/v2025-06-cli-commands",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
register(ctx) {
|
|
10
|
+
ctx.program.addCommand(
|
|
11
|
+
createDomainCommand(
|
|
12
|
+
"api",
|
|
13
|
+
"Execute Fluid v2025-06 API operations",
|
|
14
|
+
registerAllCommands,
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default plugin;
|
package/src/lib/types.ts
ADDED
package/tsconfig.json
ADDED
package/tsdown.config.ts
ADDED