@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/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@fluid-app/v2025-06-cli-commands",
3
+ "version": "0.1.0",
4
+ "description": "Auto-generated CLI commands for Fluid v2025-06 API",
5
+ "type": "module",
6
+ "main": "./dist/index.mjs",
7
+ "types": "./dist/index.d.mts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ }
14
+ }
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "commander": "^12.0.0",
21
+ "@fluid-app/fluid-cli": "0.1.0"
22
+ },
23
+ "devDependencies": {
24
+ "@types/node": "^24",
25
+ "tsdown": "^0.21.0",
26
+ "tsx": "^4.21.0",
27
+ "typescript": "^5",
28
+ "@fluid-app/typescript-config": "0.0.0",
29
+ "@fluid-app/api-client-scripts": "0.0.0"
30
+ },
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ },
34
+ "scripts": {
35
+ "build": "tsdown",
36
+ "dev": "tsdown --watch",
37
+ "generate": "tsx scripts/generate-cli-commands.ts",
38
+ "lint": "oxlint",
39
+ "lint:fix": "oxlint --fix",
40
+ "typecheck": "tsgo --noEmit"
41
+ }
42
+ }
@@ -0,0 +1,17 @@
1
+ import { resolve } from "path";
2
+ import { generateCLICommands } from "@fluid-app/api-client-scripts";
3
+
4
+ const packageDir = resolve(import.meta.dirname, "..");
5
+ const specPath = resolve(
6
+ packageDir,
7
+ "..",
8
+ "..",
9
+ "v2025-06",
10
+ "api-client",
11
+ "v2025-06.json",
12
+ );
13
+
14
+ await generateCLICommands({
15
+ packageDir,
16
+ specPath,
17
+ });
@@ -0,0 +1,108 @@
1
+ // company-contacts.ts — AUTO-GENERATED, DO NOT EDIT
2
+ import { Command } from "commander";
3
+ import type { CommandContext } from "../lib/types.js";
4
+
5
+ export function registerCompanyContacts(
6
+ parent: Command,
7
+ ctx: CommandContext,
8
+ ): void {
9
+ const resource = parent
10
+ .command("company-contacts")
11
+ .description("Company Contacts");
12
+
13
+ resource
14
+ .command("create")
15
+ .description("Create a company contact")
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/company/contacts`, "https://placeholder").pathname}\n`,
30
+ );
31
+ const result = await client.post(`/api/company/contacts`, body);
32
+ ctx.output(result);
33
+ });
34
+
35
+ resource
36
+ .command("list")
37
+ .description("List company contacts")
38
+ .option("--page <value>", "page")
39
+ .option("--per-page <value>", "per_page")
40
+ .option("--status <value>", "status")
41
+ .option("--search-query <value>", "search_query")
42
+ .option("--by-metadata <value>", "by_metadata")
43
+ .action(async (opts) => {
44
+ const client = await ctx.getClient();
45
+ const params: Record<string, unknown> = {};
46
+ if (opts.page !== undefined) params["page"] = Number(opts.page);
47
+ if (opts.perPage !== undefined) params["per_page"] = Number(opts.perPage);
48
+ if (opts.status !== undefined) params["status"] = opts.status;
49
+ if (opts.searchQuery !== undefined)
50
+ params["search_query"] = opts.searchQuery;
51
+ if (opts.byMetadata !== undefined)
52
+ params["by_metadata"] = opts.byMetadata;
53
+ if (ctx.verbose)
54
+ process.stderr.write(
55
+ `GET ${new URL(`/api/company/contacts`, "https://placeholder").pathname}\n`,
56
+ );
57
+ const result = await client.get(`/api/company/contacts`, params);
58
+ ctx.output(result);
59
+ });
60
+
61
+ resource
62
+ .command("delete <id>")
63
+ .description("Delete a company contact")
64
+ .action(async (id, opts) => {
65
+ const client = await ctx.getClient();
66
+ if (ctx.verbose)
67
+ process.stderr.write(
68
+ `DELETE ${new URL(`/api/company/contacts/${id}`, "https://placeholder").pathname}\n`,
69
+ );
70
+ const result = await client.delete(`/api/company/contacts/${id}`);
71
+ ctx.output(result);
72
+ });
73
+
74
+ resource
75
+ .command("get <id>")
76
+ .description("Get a company contact")
77
+ .action(async (id, opts) => {
78
+ const client = await ctx.getClient();
79
+ if (ctx.verbose)
80
+ process.stderr.write(
81
+ `GET ${new URL(`/api/company/contacts/${id}`, "https://placeholder").pathname}\n`,
82
+ );
83
+ const result = await client.get(`/api/company/contacts/${id}`);
84
+ ctx.output(result);
85
+ });
86
+
87
+ resource
88
+ .command("update <id>")
89
+ .description("Update a company contact")
90
+ .option("--body <json>", "Request body as JSON string")
91
+ .option("--body-file <path>", "Read request body from file")
92
+ .action(async (id, opts) => {
93
+ const client = await ctx.getClient();
94
+ let body: unknown;
95
+ if (opts.bodyFile) {
96
+ const { readFileSync } = await import("fs");
97
+ body = ctx.parseBody(readFileSync(opts.bodyFile, "utf-8"));
98
+ } else if (opts.body) {
99
+ body = ctx.parseBody(opts.body);
100
+ }
101
+ if (ctx.verbose)
102
+ process.stderr.write(
103
+ `PATCH ${new URL(`/api/company/contacts/${id}`, "https://placeholder").pathname}\n`,
104
+ );
105
+ const result = await client.patch(`/api/company/contacts/${id}`, body);
106
+ ctx.output(result);
107
+ });
108
+ }