@zapier/trello-connector 0.0.0 → 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/LICENSE +93 -0
- package/NOTICE +8 -0
- package/README.md +135 -2
- package/SKILL.md +139 -0
- package/cli.js +71 -0
- package/cli.ts +5 -0
- package/connections.ts +26 -0
- package/dist/cli.js +4 -0
- package/dist/index.js +2654 -0
- package/index.ts +145 -0
- package/package.json +59 -4
- package/preflight.sh +157 -0
- package/references/trello-api-gotchas.md +81 -0
- package/scripts/.gitkeep +0 -0
- package/scripts/addCardAttachment.ts +107 -0
- package/scripts/addCardLabel.ts +93 -0
- package/scripts/addCardMember.ts +93 -0
- package/scripts/addChecklistItem.ts +98 -0
- package/scripts/addMemberToBoard.ts +57 -0
- package/scripts/archiveCard.ts +67 -0
- package/scripts/closeBoard.ts +62 -0
- package/scripts/completeChecklistItem.ts +56 -0
- package/scripts/copyBoard.ts +81 -0
- package/scripts/createBoard.ts +72 -0
- package/scripts/createCard.ts +266 -0
- package/scripts/createChecklist.ts +50 -0
- package/scripts/createComment.ts +71 -0
- package/scripts/createLabel.ts +72 -0
- package/scripts/createList.ts +100 -0
- package/scripts/deleteChecklist.ts +38 -0
- package/scripts/findBoard.ts +62 -0
- package/scripts/findChecklist.ts +51 -0
- package/scripts/findChecklistItem.ts +49 -0
- package/scripts/findLabel.ts +54 -0
- package/scripts/findList.ts +55 -0
- package/scripts/findOrganizationMember.ts +59 -0
- package/scripts/getAction.ts +58 -0
- package/scripts/getBoard.ts +52 -0
- package/scripts/getCard.ts +79 -0
- package/scripts/getChecklist.ts +45 -0
- package/scripts/getChecklistItem.ts +48 -0
- package/scripts/getCurrentMember.ts +52 -0
- package/scripts/getLabel.ts +46 -0
- package/scripts/getList.ts +47 -0
- package/scripts/getMember.ts +52 -0
- package/scripts/getOrganization.ts +46 -0
- package/scripts/listBoardMembers.ts +58 -0
- package/scripts/listBoards.ts +78 -0
- package/scripts/listCardAttachments.ts +55 -0
- package/scripts/listCards.ts +129 -0
- package/scripts/listCustomFields.ts +62 -0
- package/scripts/listLabels.ts +52 -0
- package/scripts/listLists.ts +61 -0
- package/scripts/listOrganizations.ts +50 -0
- package/scripts/moveCard.ts +68 -0
- package/scripts/removeCardLabel.ts +43 -0
- package/scripts/searchCards.ts +153 -0
- package/scripts/updateCard.ts +184 -0
- package/tsup.config.ts +63 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z.object({ id: z.string() }).strict();
|
|
8
|
+
const outputSchema = z.object({
|
|
9
|
+
id: z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
12
|
+
.describe("Trello object id (24 hex chars)."),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
closed: z.boolean().nullable().optional(),
|
|
15
|
+
idBoard: z.string(),
|
|
16
|
+
pos: z.number().nullable().optional(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const definition = defineTool({
|
|
20
|
+
name: "getList",
|
|
21
|
+
title: "Get List",
|
|
22
|
+
description: "Get a list by id.",
|
|
23
|
+
inputSchema,
|
|
24
|
+
outputSchema,
|
|
25
|
+
annotations: {
|
|
26
|
+
readOnlyHint: true,
|
|
27
|
+
destructiveHint: false,
|
|
28
|
+
idempotentHint: true,
|
|
29
|
+
openWorldHint: true,
|
|
30
|
+
},
|
|
31
|
+
connection: "trello",
|
|
32
|
+
run: async (input, ctx) => {
|
|
33
|
+
const url = `https://api.trello.com/1/lists/${encodeURIComponent(input.id)}`;
|
|
34
|
+
const res = await ctx.fetch(url, {
|
|
35
|
+
method: "GET",
|
|
36
|
+
});
|
|
37
|
+
if (!res.ok) {
|
|
38
|
+
const errBody = await res.text();
|
|
39
|
+
throw new Error(`Trello getList ${res.status}: ${errBody}`);
|
|
40
|
+
}
|
|
41
|
+
return res.json();
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export default definition;
|
|
46
|
+
|
|
47
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z.object({ id: z.string() }).strict();
|
|
8
|
+
const outputSchema = z.object({
|
|
9
|
+
id: z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
12
|
+
.describe("Trello object id (24 hex chars)."),
|
|
13
|
+
username: z.string(),
|
|
14
|
+
fullName: z.string().nullable().optional(),
|
|
15
|
+
initials: z.string().nullable().optional(),
|
|
16
|
+
avatarUrl: z.string().nullable().optional(),
|
|
17
|
+
email: z
|
|
18
|
+
.string()
|
|
19
|
+
.nullable()
|
|
20
|
+
.describe("Present only when token has account read scope.")
|
|
21
|
+
.optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const definition = defineTool({
|
|
25
|
+
name: "getMember",
|
|
26
|
+
title: "Get Member",
|
|
27
|
+
description: "Get a member by id.",
|
|
28
|
+
inputSchema,
|
|
29
|
+
outputSchema,
|
|
30
|
+
annotations: {
|
|
31
|
+
readOnlyHint: true,
|
|
32
|
+
destructiveHint: false,
|
|
33
|
+
idempotentHint: true,
|
|
34
|
+
openWorldHint: true,
|
|
35
|
+
},
|
|
36
|
+
connection: "trello",
|
|
37
|
+
run: async (input, ctx) => {
|
|
38
|
+
const url = `https://api.trello.com/1/members/${encodeURIComponent(input.id)}`;
|
|
39
|
+
const res = await ctx.fetch(url, {
|
|
40
|
+
method: "GET",
|
|
41
|
+
});
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
const errBody = await res.text();
|
|
44
|
+
throw new Error(`Trello getMember ${res.status}: ${errBody}`);
|
|
45
|
+
}
|
|
46
|
+
return res.json();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default definition;
|
|
51
|
+
|
|
52
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z.object({ id: z.string() }).strict();
|
|
8
|
+
const outputSchema = z.object({
|
|
9
|
+
id: z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
12
|
+
.describe("Trello object id (24 hex chars)."),
|
|
13
|
+
name: z.string(),
|
|
14
|
+
displayName: z.string(),
|
|
15
|
+
url: z.string().nullable().optional(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const definition = defineTool({
|
|
19
|
+
name: "getOrganization",
|
|
20
|
+
title: "Get Organization",
|
|
21
|
+
description: "Get a workspace (organization) by id.",
|
|
22
|
+
inputSchema,
|
|
23
|
+
outputSchema,
|
|
24
|
+
annotations: {
|
|
25
|
+
readOnlyHint: true,
|
|
26
|
+
destructiveHint: false,
|
|
27
|
+
idempotentHint: true,
|
|
28
|
+
openWorldHint: true,
|
|
29
|
+
},
|
|
30
|
+
connection: "trello",
|
|
31
|
+
run: async (input, ctx) => {
|
|
32
|
+
const url = `https://api.trello.com/1/organizations/${encodeURIComponent(input.id)}`;
|
|
33
|
+
const res = await ctx.fetch(url, {
|
|
34
|
+
method: "GET",
|
|
35
|
+
});
|
|
36
|
+
if (!res.ok) {
|
|
37
|
+
const errBody = await res.text();
|
|
38
|
+
throw new Error(`Trello getOrganization ${res.status}: ${errBody}`);
|
|
39
|
+
}
|
|
40
|
+
return res.json();
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default definition;
|
|
45
|
+
|
|
46
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({ id: z.string().describe("24-char hex board id.") })
|
|
9
|
+
.strict();
|
|
10
|
+
const itemSchema = z.array(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
15
|
+
.describe("Trello object id (24 hex chars)."),
|
|
16
|
+
username: z.string(),
|
|
17
|
+
fullName: z.string().nullable().optional(),
|
|
18
|
+
initials: z.string().nullable().optional(),
|
|
19
|
+
avatarUrl: z.string().nullable().optional(),
|
|
20
|
+
email: z
|
|
21
|
+
.string()
|
|
22
|
+
.nullable()
|
|
23
|
+
.describe("Present only when token has account read scope.")
|
|
24
|
+
.optional(),
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
28
|
+
|
|
29
|
+
const definition = defineTool({
|
|
30
|
+
name: "listBoardMembers",
|
|
31
|
+
title: "List Board Members",
|
|
32
|
+
description: "List members of a board.",
|
|
33
|
+
inputSchema,
|
|
34
|
+
outputSchema,
|
|
35
|
+
annotations: {
|
|
36
|
+
readOnlyHint: true,
|
|
37
|
+
destructiveHint: false,
|
|
38
|
+
idempotentHint: true,
|
|
39
|
+
openWorldHint: true,
|
|
40
|
+
},
|
|
41
|
+
connection: "trello",
|
|
42
|
+
run: async (input, ctx) => {
|
|
43
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/members`;
|
|
44
|
+
const res = await ctx.fetch(url, {
|
|
45
|
+
method: "GET",
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok) {
|
|
48
|
+
const errBody = await res.text();
|
|
49
|
+
throw new Error(`Trello listBoardMembers ${res.status}: ${errBody}`);
|
|
50
|
+
}
|
|
51
|
+
const data = await res.json();
|
|
52
|
+
return { items: data };
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export default definition;
|
|
57
|
+
|
|
58
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
filter: z
|
|
10
|
+
.enum([
|
|
11
|
+
"all",
|
|
12
|
+
"closed",
|
|
13
|
+
"members",
|
|
14
|
+
"none",
|
|
15
|
+
"open",
|
|
16
|
+
"organization",
|
|
17
|
+
"pinned",
|
|
18
|
+
"public",
|
|
19
|
+
"starred",
|
|
20
|
+
"unpinned",
|
|
21
|
+
])
|
|
22
|
+
.default("all"),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
const itemSchema = z.array(
|
|
26
|
+
z.object({
|
|
27
|
+
id: z
|
|
28
|
+
.string()
|
|
29
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
30
|
+
.describe("Trello object id (24 hex chars)."),
|
|
31
|
+
name: z.string(),
|
|
32
|
+
desc: z.string().nullable().optional(),
|
|
33
|
+
closed: z.boolean().nullable().optional(),
|
|
34
|
+
idOrganization: z.string().nullable().optional(),
|
|
35
|
+
url: z.string().nullable().optional(),
|
|
36
|
+
shortUrl: z.string().nullable().optional(),
|
|
37
|
+
dateLastActivity: z
|
|
38
|
+
.string()
|
|
39
|
+
.datetime({ offset: true })
|
|
40
|
+
.nullable()
|
|
41
|
+
.optional(),
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
45
|
+
|
|
46
|
+
const definition = defineTool({
|
|
47
|
+
name: "listBoards",
|
|
48
|
+
title: "List Boards",
|
|
49
|
+
description: "List boards the authenticated member can access.",
|
|
50
|
+
inputSchema,
|
|
51
|
+
outputSchema,
|
|
52
|
+
annotations: {
|
|
53
|
+
readOnlyHint: true,
|
|
54
|
+
destructiveHint: false,
|
|
55
|
+
idempotentHint: true,
|
|
56
|
+
openWorldHint: true,
|
|
57
|
+
},
|
|
58
|
+
connection: "trello",
|
|
59
|
+
run: async (input, ctx) => {
|
|
60
|
+
const url = new URL(`https://api.trello.com/1/members/me/boards`);
|
|
61
|
+
if (input.filter !== undefined) {
|
|
62
|
+
url.searchParams.set("filter", String(input.filter));
|
|
63
|
+
}
|
|
64
|
+
const res = await ctx.fetch(url.toString(), {
|
|
65
|
+
method: "GET",
|
|
66
|
+
});
|
|
67
|
+
if (!res.ok) {
|
|
68
|
+
const errBody = await res.text();
|
|
69
|
+
throw new Error(`Trello listBoards ${res.status}: ${errBody}`);
|
|
70
|
+
}
|
|
71
|
+
const data = await res.json();
|
|
72
|
+
return { items: data };
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export default definition;
|
|
77
|
+
|
|
78
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({ id: z.string().describe("24-char hex card id.") })
|
|
9
|
+
.strict();
|
|
10
|
+
const itemSchema = z.array(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
15
|
+
.describe("Trello object id (24 hex chars)."),
|
|
16
|
+
name: z.string(),
|
|
17
|
+
url: z.string().nullable().optional(),
|
|
18
|
+
mimeType: z.string().nullable().optional(),
|
|
19
|
+
bytes: z.union([z.number().int(), z.null()]).optional(),
|
|
20
|
+
isUpload: z.boolean().nullable().optional(),
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
23
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
24
|
+
|
|
25
|
+
const definition = defineTool({
|
|
26
|
+
name: "listCardAttachments",
|
|
27
|
+
title: "List Card Attachments",
|
|
28
|
+
description:
|
|
29
|
+
"List attachments on a card (metadata only; use download URLs from response).",
|
|
30
|
+
inputSchema,
|
|
31
|
+
outputSchema,
|
|
32
|
+
annotations: {
|
|
33
|
+
readOnlyHint: true,
|
|
34
|
+
destructiveHint: false,
|
|
35
|
+
idempotentHint: true,
|
|
36
|
+
openWorldHint: true,
|
|
37
|
+
},
|
|
38
|
+
connection: "trello",
|
|
39
|
+
run: async (input, ctx) => {
|
|
40
|
+
const url = `https://api.trello.com/1/cards/${encodeURIComponent(input.id)}/attachments`;
|
|
41
|
+
const res = await ctx.fetch(url, {
|
|
42
|
+
method: "GET",
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
const errBody = await res.text();
|
|
46
|
+
throw new Error(`Trello listCardAttachments ${res.status}: ${errBody}`);
|
|
47
|
+
}
|
|
48
|
+
const data = await res.json();
|
|
49
|
+
return { items: data };
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default definition;
|
|
54
|
+
|
|
55
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string().describe("24-char hex board id."),
|
|
10
|
+
filter: z
|
|
11
|
+
.enum(["all", "closed", "none", "open", "visible"])
|
|
12
|
+
.default("open"),
|
|
13
|
+
before: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe("Return cards older than this card id (cursor for next page).")
|
|
16
|
+
.optional(),
|
|
17
|
+
limit: z
|
|
18
|
+
.number()
|
|
19
|
+
.int()
|
|
20
|
+
.gte(1)
|
|
21
|
+
.lte(1000)
|
|
22
|
+
.describe(
|
|
23
|
+
"Defaults to 20 when omitted; pass a value when you need a specific number of results.",
|
|
24
|
+
)
|
|
25
|
+
.optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
const outputSchema = z.object({
|
|
29
|
+
items: z
|
|
30
|
+
.array(
|
|
31
|
+
z.object({
|
|
32
|
+
id: z
|
|
33
|
+
.string()
|
|
34
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
35
|
+
.describe("Trello object id (24 hex chars)."),
|
|
36
|
+
name: z.string(),
|
|
37
|
+
desc: z.string().nullable().optional(),
|
|
38
|
+
closed: z.boolean().nullable().optional(),
|
|
39
|
+
idBoard: z.string(),
|
|
40
|
+
idList: z.string(),
|
|
41
|
+
idShort: z.number().int().nullable().optional(),
|
|
42
|
+
shortLink: z.string().nullable().optional(),
|
|
43
|
+
shortUrl: z.string().nullable().optional(),
|
|
44
|
+
url: z.string().nullable().optional(),
|
|
45
|
+
due: z
|
|
46
|
+
.union([z.string().datetime({ offset: true }), z.null()])
|
|
47
|
+
.optional(),
|
|
48
|
+
dueComplete: z.boolean().nullable().optional(),
|
|
49
|
+
dateLastActivity: z
|
|
50
|
+
.string()
|
|
51
|
+
.datetime({ offset: true })
|
|
52
|
+
.nullable()
|
|
53
|
+
.optional(),
|
|
54
|
+
idLabels: z
|
|
55
|
+
.any()
|
|
56
|
+
.nullable()
|
|
57
|
+
.describe("Nested object — shape passes through.")
|
|
58
|
+
.optional(),
|
|
59
|
+
idMembers: z
|
|
60
|
+
.any()
|
|
61
|
+
.nullable()
|
|
62
|
+
.describe("Nested object — shape passes through.")
|
|
63
|
+
.optional(),
|
|
64
|
+
labels: z
|
|
65
|
+
.any()
|
|
66
|
+
.nullable()
|
|
67
|
+
.describe("Nested object — shape passes through.")
|
|
68
|
+
.optional(),
|
|
69
|
+
pos: z.number().nullable().optional(),
|
|
70
|
+
customFields: z
|
|
71
|
+
.any()
|
|
72
|
+
.nullable()
|
|
73
|
+
.describe("Nested object — shape passes through.")
|
|
74
|
+
.optional(),
|
|
75
|
+
}),
|
|
76
|
+
)
|
|
77
|
+
.nullable()
|
|
78
|
+
.optional(),
|
|
79
|
+
has_more: z
|
|
80
|
+
.boolean()
|
|
81
|
+
.nullable()
|
|
82
|
+
.describe(
|
|
83
|
+
"True when the page is full and before-cursor paging may return more.",
|
|
84
|
+
)
|
|
85
|
+
.optional(),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const definition = defineTool({
|
|
89
|
+
name: "listCards",
|
|
90
|
+
title: "List Cards",
|
|
91
|
+
description:
|
|
92
|
+
"List cards on a board with optional filter and before-cursor pagination.",
|
|
93
|
+
inputSchema,
|
|
94
|
+
outputSchema,
|
|
95
|
+
annotations: {
|
|
96
|
+
readOnlyHint: true,
|
|
97
|
+
destructiveHint: false,
|
|
98
|
+
idempotentHint: true,
|
|
99
|
+
openWorldHint: true,
|
|
100
|
+
},
|
|
101
|
+
connection: "trello",
|
|
102
|
+
run: async (input, ctx) => {
|
|
103
|
+
const url = new URL(
|
|
104
|
+
`https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/cards`,
|
|
105
|
+
);
|
|
106
|
+
if (input.filter !== undefined) {
|
|
107
|
+
url.searchParams.set("filter", String(input.filter));
|
|
108
|
+
}
|
|
109
|
+
if (input.before !== undefined) {
|
|
110
|
+
url.searchParams.set("before", String(input.before));
|
|
111
|
+
}
|
|
112
|
+
url.searchParams.set("limit", String(input.limit ?? 20));
|
|
113
|
+
const res = await ctx.fetch(url.toString(), {
|
|
114
|
+
method: "GET",
|
|
115
|
+
});
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
const errBody = await res.text();
|
|
118
|
+
throw new Error(`Trello listCards ${res.status}: ${errBody}`);
|
|
119
|
+
}
|
|
120
|
+
const limit = input.limit ?? 20;
|
|
121
|
+
const cards = (await res.json()) as unknown[];
|
|
122
|
+
const items = Array.isArray(cards) ? cards : [];
|
|
123
|
+
return { items, has_more: items.length >= limit };
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export default definition;
|
|
128
|
+
|
|
129
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({ id: z.string().describe("24-char hex board id.") })
|
|
9
|
+
.strict();
|
|
10
|
+
const itemSchema = z.array(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
15
|
+
.describe("Trello object id (24 hex chars)."),
|
|
16
|
+
name: z.string(),
|
|
17
|
+
type: z.enum(["checkbox", "date", "list", "number", "text"]),
|
|
18
|
+
options: z
|
|
19
|
+
.array(
|
|
20
|
+
z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
value: z.object({ text: z.string().optional() }).optional(),
|
|
23
|
+
color: z.string().optional(),
|
|
24
|
+
}),
|
|
25
|
+
)
|
|
26
|
+
.nullable()
|
|
27
|
+
.optional(),
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
31
|
+
|
|
32
|
+
const definition = defineTool({
|
|
33
|
+
name: "listCustomFields",
|
|
34
|
+
title: "List Custom Fields",
|
|
35
|
+
description:
|
|
36
|
+
"List custom field definitions on a board. Use before setting custom field values on cards.",
|
|
37
|
+
inputSchema,
|
|
38
|
+
outputSchema,
|
|
39
|
+
annotations: {
|
|
40
|
+
readOnlyHint: true,
|
|
41
|
+
destructiveHint: false,
|
|
42
|
+
idempotentHint: true,
|
|
43
|
+
openWorldHint: true,
|
|
44
|
+
},
|
|
45
|
+
connection: "trello",
|
|
46
|
+
run: async (input, ctx) => {
|
|
47
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/customFields`;
|
|
48
|
+
const res = await ctx.fetch(url, {
|
|
49
|
+
method: "GET",
|
|
50
|
+
});
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
const errBody = await res.text();
|
|
53
|
+
throw new Error(`Trello listCustomFields ${res.status}: ${errBody}`);
|
|
54
|
+
}
|
|
55
|
+
const data = await res.json();
|
|
56
|
+
return { items: data };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export default definition;
|
|
61
|
+
|
|
62
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({ id: z.string().describe("24-char hex board id.") })
|
|
9
|
+
.strict();
|
|
10
|
+
const itemSchema = z.array(
|
|
11
|
+
z.object({
|
|
12
|
+
id: z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
15
|
+
.describe("Trello object id (24 hex chars)."),
|
|
16
|
+
idBoard: z.string(),
|
|
17
|
+
name: z.string().nullable().optional(),
|
|
18
|
+
color: z.string().nullable().optional(),
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
21
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
22
|
+
|
|
23
|
+
const definition = defineTool({
|
|
24
|
+
name: "listLabels",
|
|
25
|
+
title: "List Labels",
|
|
26
|
+
description: "List labels defined on a board.",
|
|
27
|
+
inputSchema,
|
|
28
|
+
outputSchema,
|
|
29
|
+
annotations: {
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
idempotentHint: true,
|
|
33
|
+
openWorldHint: true,
|
|
34
|
+
},
|
|
35
|
+
connection: "trello",
|
|
36
|
+
run: async (input, ctx) => {
|
|
37
|
+
const url = `https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/labels`;
|
|
38
|
+
const res = await ctx.fetch(url, {
|
|
39
|
+
method: "GET",
|
|
40
|
+
});
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
const errBody = await res.text();
|
|
43
|
+
throw new Error(`Trello listLabels ${res.status}: ${errBody}`);
|
|
44
|
+
}
|
|
45
|
+
const data = await res.json();
|
|
46
|
+
return { items: data };
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default definition;
|
|
51
|
+
|
|
52
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
id: z.string().describe("24-char hex board id."),
|
|
10
|
+
filter: z.enum(["all", "closed", "none", "open"]).default("open"),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
13
|
+
const itemSchema = z.array(
|
|
14
|
+
z.object({
|
|
15
|
+
id: z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
18
|
+
.describe("Trello object id (24 hex chars)."),
|
|
19
|
+
name: z.string(),
|
|
20
|
+
closed: z.boolean().nullable().optional(),
|
|
21
|
+
idBoard: z.string(),
|
|
22
|
+
pos: z.number().nullable().optional(),
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
25
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
26
|
+
|
|
27
|
+
const definition = defineTool({
|
|
28
|
+
name: "listLists",
|
|
29
|
+
title: "List Lists",
|
|
30
|
+
description: "List all lists on a board. Use findList to match by name.",
|
|
31
|
+
inputSchema,
|
|
32
|
+
outputSchema,
|
|
33
|
+
annotations: {
|
|
34
|
+
readOnlyHint: true,
|
|
35
|
+
destructiveHint: false,
|
|
36
|
+
idempotentHint: true,
|
|
37
|
+
openWorldHint: true,
|
|
38
|
+
},
|
|
39
|
+
connection: "trello",
|
|
40
|
+
run: async (input, ctx) => {
|
|
41
|
+
const url = new URL(
|
|
42
|
+
`https://api.trello.com/1/boards/${encodeURIComponent(input.id)}/lists`,
|
|
43
|
+
);
|
|
44
|
+
if (input.filter !== undefined) {
|
|
45
|
+
url.searchParams.set("filter", String(input.filter));
|
|
46
|
+
}
|
|
47
|
+
const res = await ctx.fetch(url.toString(), {
|
|
48
|
+
method: "GET",
|
|
49
|
+
});
|
|
50
|
+
if (!res.ok) {
|
|
51
|
+
const errBody = await res.text();
|
|
52
|
+
throw new Error(`Trello listLists ${res.status}: ${errBody}`);
|
|
53
|
+
}
|
|
54
|
+
const data = await res.json();
|
|
55
|
+
return { items: data };
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export default definition;
|
|
60
|
+
|
|
61
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineTool, handleIfScriptMain } from "@zapier/connectors-sdk";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { connectionResolvers } from "../connections.ts";
|
|
6
|
+
|
|
7
|
+
const inputSchema = z.object({}).strict();
|
|
8
|
+
const itemSchema = z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
id: z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(new RegExp("^[0-9a-fA-F]{24}$"))
|
|
13
|
+
.describe("Trello object id (24 hex chars)."),
|
|
14
|
+
name: z.string(),
|
|
15
|
+
displayName: z.string(),
|
|
16
|
+
url: z.string().nullable().optional(),
|
|
17
|
+
}),
|
|
18
|
+
);
|
|
19
|
+
const outputSchema = z.object({ items: itemSchema });
|
|
20
|
+
|
|
21
|
+
const definition = defineTool({
|
|
22
|
+
name: "listOrganizations",
|
|
23
|
+
title: "List Organizations",
|
|
24
|
+
description: "List workspaces the authenticated member belongs to.",
|
|
25
|
+
inputSchema,
|
|
26
|
+
outputSchema,
|
|
27
|
+
annotations: {
|
|
28
|
+
readOnlyHint: true,
|
|
29
|
+
destructiveHint: false,
|
|
30
|
+
idempotentHint: true,
|
|
31
|
+
openWorldHint: true,
|
|
32
|
+
},
|
|
33
|
+
connection: "trello",
|
|
34
|
+
run: async (_input, ctx) => {
|
|
35
|
+
const url = `https://api.trello.com/1/members/me/organizations`;
|
|
36
|
+
const res = await ctx.fetch(url, {
|
|
37
|
+
method: "GET",
|
|
38
|
+
});
|
|
39
|
+
if (!res.ok) {
|
|
40
|
+
const errBody = await res.text();
|
|
41
|
+
throw new Error(`Trello listOrganizations ${res.status}: ${errBody}`);
|
|
42
|
+
}
|
|
43
|
+
const data = await res.json();
|
|
44
|
+
return { items: data };
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export default definition;
|
|
49
|
+
|
|
50
|
+
await handleIfScriptMain(import.meta, definition, { connectionResolvers });
|