runline 0.2.1 → 0.2.2
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/dist/plugins/actionNetwork/src/index.js +118 -25
- package/dist/plugins/activeCampaign/src/index.js +184 -38
- package/dist/plugins/adalo/src/index.js +40 -8
- package/dist/plugins/affinity/src/index.js +100 -20
- package/dist/plugins/agileCrm/src/index.js +115 -27
- package/dist/plugins/airtable/src/index.js +94 -19
- package/dist/plugins/airtop/src/index.js +266 -62
- package/dist/plugins/apiTemplateIo/src/index.js +25 -5
- package/dist/plugins/asana/src/index.js +195 -41
- package/dist/plugins/autopilot/src/index.js +39 -8
- package/dist/plugins/bambooHr/src/index.js +109 -22
- package/dist/plugins/bannerbear/src/index.js +36 -8
- package/dist/plugins/baserow/src/index.js +35 -7
- package/dist/plugins/beeminder/src/index.js +198 -40
- package/dist/plugins/bitly/src/index.js +46 -10
- package/dist/plugins/bitwarden/src/index.js +167 -36
- package/dist/plugins/box/src/index.js +172 -37
- package/dist/plugins/brandfetch/src/index.js +5 -1
- package/dist/plugins/brevo/src/index.js +136 -29
- package/dist/plugins/bubble/src/index.js +76 -17
- package/dist/plugins/chargebee/src/index.js +35 -7
- package/dist/plugins/circleci/src/index.js +50 -10
- package/dist/plugins/ciscoWebex/src/index.js +131 -27
- package/dist/plugins/clearbit/src/index.js +76 -17
- package/dist/plugins/clickup/src/index.js +500 -107
- package/dist/plugins/clockify/src/index.js +229 -47
- package/dist/plugins/cloudflare/src/index.js +28 -6
- package/dist/plugins/cockpit/src/index.js +54 -12
- package/dist/plugins/coda/src/index.js +81 -19
- package/dist/plugins/coingecko/src/index.js +157 -33
- package/dist/plugins/contentful/src/index.js +85 -17
- package/dist/plugins/convertkit/src/index.js +74 -18
- package/dist/plugins/copper/src/index.js +59 -11
- package/dist/plugins/cortex/src/index.js +55 -13
- package/dist/plugins/currents/src/index.js +310 -71
- package/dist/plugins/customerIo/src/index.js +112 -23
- package/dist/plugins/databricks/src/index.js +549 -115
- package/dist/plugins/deepl/src/index.js +26 -6
- package/dist/plugins/demio/src/index.js +56 -11
- package/dist/plugins/dhl/src/index.js +16 -3
- package/dist/plugins/discord/src/index.js +141 -31
- package/dist/plugins/discourse/src/index.js +136 -31
- package/dist/plugins/disqus/src/index.js +96 -20
- package/dist/plugins/docker/src/index.js +20 -4
- package/dist/plugins/drift/src/index.js +19 -5
- package/dist/plugins/dropbox/src/index.js +139 -30
- package/dist/plugins/dropcontact/src/index.js +21 -4
- package/dist/plugins/egoi/src/index.js +61 -15
- package/dist/plugins/elasticsearch/src/index.js +59 -13
- package/dist/plugins/emelia/src/index.js +95 -19
- package/dist/plugins/erpnext/src/index.js +74 -15
- package/dist/plugins/facebookGraph/src/index.js +52 -11
- package/dist/plugins/freshdesk/src/index.js +220 -48
- package/dist/plugins/freshservice/src/index.js +39 -9
- package/dist/plugins/freshworksCrm/src/index.js +58 -12
- package/dist/plugins/getresponse/src/index.js +87 -18
- package/dist/plugins/ghost/src/index.js +114 -26
- package/dist/plugins/github/src/index.js +483 -109
- package/dist/plugins/gitlab/src/index.js +193 -45
- package/dist/plugins/gong/src/index.js +68 -14
- package/dist/plugins/gotify/src/index.js +43 -9
- package/dist/plugins/gotowebinar/src/index.js +233 -47
- package/dist/plugins/grafana/src/index.js +92 -21
- package/dist/plugins/graphql/src/index.js +38 -8
- package/dist/plugins/grist/src/index.js +52 -10
- package/dist/plugins/hackernews/src/index.js +32 -6
- package/dist/plugins/halopsa/src/index.js +131 -26
- package/dist/plugins/harvest/src/index.js +182 -42
- package/dist/plugins/helpscout/src/index.js +153 -31
- package/dist/plugins/highlevel/src/index.js +291 -58
- package/dist/plugins/homeAssistant/src/index.js +124 -26
- package/dist/plugins/hubspot/src/index.js +163 -29
- package/dist/plugins/humanticAi/src/index.js +54 -5
- package/dist/plugins/hunter/src/index.js +21 -4
- package/dist/plugins/intercom/src/index.js +95 -20
- package/dist/plugins/iterable/src/index.js +96 -20
- package/dist/plugins/jenkins/src/index.js +75 -17
- package/dist/plugins/jira/src/index.js +193 -43
- package/dist/plugins/keap/src/index.js +222 -56
- package/dist/plugins/kobotoolbox/src/index.js +113 -25
- package/dist/plugins/lemlist/src/index.js +79 -18
- package/dist/plugins/linear/src/index.js +86 -19
- package/dist/plugins/lingvanex/src/index.js +38 -8
- package/dist/plugins/linkedin/src/index.js +37 -8
- package/dist/plugins/lonescale/src/index.js +41 -9
- package/dist/plugins/magento/src/index.js +98 -27
- package/dist/plugins/mailcheck/src/index.js +11 -2
- package/dist/plugins/mailchimp/src/index.js +193 -42
- package/dist/plugins/mailerlite/src/index.js +61 -12
- package/dist/plugins/mailgun/src/index.js +39 -7
- package/dist/plugins/mailjet/src/index.js +141 -30
- package/dist/plugins/mandrill/src/index.js +67 -14
- package/dist/plugins/marketstack/src/index.js +56 -10
- package/dist/plugins/matrix/src/index.js +97 -20
- package/dist/plugins/mattermost/src/index.js +124 -26
- package/dist/plugins/mautic/src/index.js +129 -26
- package/dist/plugins/medium/src/index.js +64 -13
- package/dist/plugins/messagebird/src/index.js +80 -15
- package/dist/plugins/metabase/src/index.js +57 -12
- package/dist/plugins/misp/src/index.js +135 -33
- package/dist/plugins/mocean/src/index.js +33 -7
- package/dist/plugins/monday/src/index.js +97 -23
- package/dist/plugins/monicaCrm/src/index.js +112 -23
- package/dist/plugins/msg91/src/index.js +11 -2
- package/dist/plugins/nasa/src/index.js +108 -21
- package/dist/plugins/netlify/src/index.js +28 -6
- package/dist/plugins/netscalerAdc/src/index.js +144 -29
- package/dist/plugins/nextcloud/src/index.js +103 -20
- package/dist/plugins/nocodb/src/index.js +57 -11
- package/dist/plugins/notion/src/index.js +148 -37
- package/dist/plugins/npm/src/index.js +59 -12
- package/dist/plugins/odoo/src/index.js +102 -20
- package/dist/plugins/okta/src/index.js +50 -10
- package/dist/plugins/oneSimpleApi/src/index.js +84 -17
- package/dist/plugins/onfleet/src/index.js +139 -32
- package/dist/plugins/openThesaurus/src/index.js +46 -9
- package/dist/plugins/openweathermap/src/index.js +31 -6
- package/dist/plugins/oura/src/index.js +36 -7
- package/dist/plugins/paddle/src/index.js +80 -17
- package/dist/plugins/pagerduty/src/index.js +53 -12
- package/dist/plugins/paypal/src/index.js +51 -11
- package/dist/plugins/peekalink/src/index.js +12 -3
- package/dist/plugins/phantombuster/src/index.js +39 -8
- package/dist/plugins/philipsHue/src/index.js +64 -13
- package/dist/plugins/pipedrive/src/index.js +167 -45
- package/dist/plugins/plivo/src/index.js +43 -8
- package/dist/plugins/postbin/src/index.js +9 -2
- package/dist/plugins/posthog/src/index.js +50 -13
- package/dist/plugins/profitwell/src/index.js +24 -5
- package/dist/plugins/pushbullet/src/index.js +45 -9
- package/dist/plugins/pushcut/src/index.js +31 -6
- package/dist/plugins/pushover/src/index.js +51 -10
- package/dist/plugins/quickbase/src/index.js +66 -13
- package/dist/plugins/quickbooks/src/index.js +86 -19
- package/dist/plugins/quickchart/src/index.js +35 -7
- package/dist/plugins/raindrop/src/index.js +54 -13
- package/dist/plugins/reddit/src/index.js +73 -18
- package/dist/plugins/rocketchat/src/index.js +47 -9
- package/dist/plugins/rundeck/src/index.js +26 -5
- package/dist/plugins/salesforce/src/index.js +161 -31
- package/dist/plugins/salesmate/src/index.js +75 -16
- package/dist/plugins/securityScorecard/src/index.js +73 -15
- package/dist/plugins/segment/src/index.js +21 -4
- package/dist/plugins/sendgrid/src/index.js +102 -24
- package/dist/plugins/sendy/src/index.js +54 -11
- package/dist/plugins/sentry/src/index.js +174 -34
- package/dist/plugins/servicenow/src/index.js +120 -27
- package/dist/plugins/shopify/src/index.js +53 -12
- package/dist/plugins/signl4/src/index.js +16 -3
- package/dist/plugins/slack/src/index.js +407 -105
- package/dist/plugins/sms77/src/index.js +26 -5
- package/dist/plugins/splunk/src/index.js +186 -45
- package/dist/plugins/spotify/src/index.js +265 -66
- package/dist/plugins/stackby/src/index.js +18 -6
- package/dist/plugins/storyblok/src/index.js +57 -11
- package/dist/plugins/strapi/src/index.js +63 -12
- package/dist/plugins/strava/src/index.js +58 -13
- package/dist/plugins/stripe/src/index.js +143 -30
- package/dist/plugins/supabase/src/index.js +49 -10
- package/dist/plugins/syncromsp/src/index.js +245 -67
- package/dist/plugins/tapfiliate/src/index.js +57 -14
- package/dist/plugins/telegram/src/index.js +202 -39
- package/dist/plugins/thehive/src/index.js +271 -66
- package/dist/plugins/thehiveProject/src/index.js +457 -89
- package/dist/plugins/todoist/src/index.js +326 -77
- package/dist/plugins/travisci/src/index.js +35 -8
- package/dist/plugins/trello/src/index.js +204 -46
- package/dist/plugins/twake/src/index.js +10 -2
- package/dist/plugins/twilio/src/index.js +56 -11
- package/dist/plugins/twist/src/index.js +241 -48
- package/dist/plugins/twitter/src/index.js +128 -30
- package/dist/plugins/unleashedSoftware/src/index.js +30 -6
- package/dist/plugins/uplead/src/index.js +9 -2
- package/dist/plugins/uproc/src/index.js +31 -6
- package/dist/plugins/uptimerobot/src/index.js +119 -25
- package/dist/plugins/urlscanio/src/index.js +25 -6
- package/dist/plugins/vero/src/index.js +68 -13
- package/dist/plugins/vonage/src/index.js +32 -6
- package/dist/plugins/wekan/src/index.js +297 -52
- package/dist/plugins/woocommerce/src/index.js +57 -12
- package/dist/plugins/wordpress/src/index.js +94 -18
- package/dist/plugins/xero/src/index.js +79 -13
- package/dist/plugins/yourls/src/index.js +33 -6
- package/dist/plugins/zammad/src/index.js +139 -36
- package/dist/plugins/zendesk/src/index.js +201 -48
- package/dist/plugins/zoho/src/index.js +88 -21
- package/dist/plugins/zoom/src/index.js +41 -7
- package/dist/plugins/zulip/src/index.js +101 -20
- package/package.json +1 -1
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
url: c.url.replace(/\/$/, ""),
|
|
5
|
+
token: c.token,
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
async function api(conn, method, endpoint, body) {
|
|
6
|
-
const init = {
|
|
9
|
+
const init = {
|
|
10
|
+
method,
|
|
11
|
+
headers: {
|
|
12
|
+
Authorization: `Bearer ${conn.token}`,
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Accept: "application/json",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
7
17
|
if (body && Object.keys(body).length > 0)
|
|
8
18
|
init.body = JSON.stringify(body);
|
|
9
19
|
const res = await fetch(`${conn.url}/api/${endpoint}`, init);
|
|
@@ -16,76 +26,311 @@ export default function wekan(rl) {
|
|
|
16
26
|
rl.setName("wekan");
|
|
17
27
|
rl.setVersion("0.1.0");
|
|
18
28
|
rl.setConnectionSchema({
|
|
19
|
-
url: {
|
|
20
|
-
|
|
29
|
+
url: {
|
|
30
|
+
type: "string",
|
|
31
|
+
required: true,
|
|
32
|
+
description: "Wekan server URL",
|
|
33
|
+
env: "WEKAN_URL",
|
|
34
|
+
},
|
|
35
|
+
token: {
|
|
36
|
+
type: "string",
|
|
37
|
+
required: true,
|
|
38
|
+
description: "Wekan API token",
|
|
39
|
+
env: "WEKAN_TOKEN",
|
|
40
|
+
},
|
|
21
41
|
});
|
|
22
42
|
// ── Board ───────────────────────────────────────────
|
|
23
|
-
rl.registerAction("board.create", {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
rl.registerAction("board.create", {
|
|
44
|
+
description: "Create a board",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
title: { type: "string", required: true },
|
|
47
|
+
owner: { type: "string", required: true },
|
|
48
|
+
},
|
|
49
|
+
async execute(input, ctx) {
|
|
50
|
+
return api(getConn(ctx), "POST", "boards", input);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
rl.registerAction("board.get", {
|
|
54
|
+
description: "Get a board",
|
|
55
|
+
inputSchema: { boardId: { type: "string", required: true } },
|
|
56
|
+
async execute(input, ctx) {
|
|
57
|
+
return api(getConn(ctx), "GET", `boards/${input.boardId}`);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
rl.registerAction("board.list", {
|
|
61
|
+
description: "List boards for a user",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
userId: { type: "string", required: true },
|
|
64
|
+
limit: { type: "number", required: false },
|
|
65
|
+
},
|
|
28
66
|
async execute(input, ctx) {
|
|
29
67
|
const p = input;
|
|
30
68
|
const data = (await api(getConn(ctx), "GET", `users/${p.userId}/boards`));
|
|
31
69
|
return p.limit ? data.slice(0, p.limit) : data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
rl.registerAction("board.delete", {
|
|
73
|
+
description: "Delete a board",
|
|
74
|
+
inputSchema: { boardId: { type: "string", required: true } },
|
|
75
|
+
async execute(input, ctx) {
|
|
76
|
+
return api(getConn(ctx), "DELETE", `boards/${input.boardId}`);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
35
79
|
// ── List ────────────────────────────────────────────
|
|
36
|
-
rl.registerAction("list.create", {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
80
|
+
rl.registerAction("list.create", {
|
|
81
|
+
description: "Create a list on a board",
|
|
82
|
+
inputSchema: {
|
|
83
|
+
boardId: { type: "string", required: true },
|
|
84
|
+
title: { type: "string", required: true },
|
|
85
|
+
},
|
|
86
|
+
async execute(input, ctx) {
|
|
87
|
+
const p = input;
|
|
88
|
+
return api(getConn(ctx), "POST", `boards/${p.boardId}/lists`, {
|
|
89
|
+
title: p.title,
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
rl.registerAction("list.get", {
|
|
94
|
+
description: "Get a list",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
boardId: { type: "string", required: true },
|
|
97
|
+
listId: { type: "string", required: true },
|
|
98
|
+
},
|
|
99
|
+
async execute(input, ctx) {
|
|
100
|
+
const p = input;
|
|
101
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/lists/${p.listId}`);
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
rl.registerAction("list.listAll", {
|
|
105
|
+
description: "List all lists on a board",
|
|
106
|
+
inputSchema: {
|
|
107
|
+
boardId: { type: "string", required: true },
|
|
108
|
+
limit: { type: "number", required: false },
|
|
109
|
+
},
|
|
41
110
|
async execute(input, ctx) {
|
|
42
111
|
const p = input;
|
|
43
112
|
const data = (await api(getConn(ctx), "GET", `boards/${p.boardId}/lists`));
|
|
44
113
|
return p.limit ? data.slice(0, p.limit) : data;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
rl.registerAction("list.delete", {
|
|
117
|
+
description: "Delete a list",
|
|
118
|
+
inputSchema: {
|
|
119
|
+
boardId: { type: "string", required: true },
|
|
120
|
+
listId: { type: "string", required: true },
|
|
121
|
+
},
|
|
122
|
+
async execute(input, ctx) {
|
|
123
|
+
const p = input;
|
|
124
|
+
return api(getConn(ctx), "DELETE", `boards/${p.boardId}/lists/${p.listId}`);
|
|
125
|
+
},
|
|
126
|
+
});
|
|
48
127
|
// ── Card ────────────────────────────────────────────
|
|
49
|
-
rl.registerAction("card.create", {
|
|
128
|
+
rl.registerAction("card.create", {
|
|
129
|
+
description: "Create a card",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
boardId: { type: "string", required: true },
|
|
132
|
+
listId: { type: "string", required: true },
|
|
133
|
+
title: { type: "string", required: true },
|
|
134
|
+
swimlaneId: { type: "string", required: true },
|
|
135
|
+
authorId: { type: "string", required: true },
|
|
136
|
+
description: { type: "string", required: false },
|
|
137
|
+
},
|
|
50
138
|
async execute(input, ctx) {
|
|
51
139
|
const { boardId, listId, ...body } = input;
|
|
52
140
|
return api(getConn(ctx), "POST", `boards/${boardId}/lists/${listId}/cards`, body);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
rl.registerAction("card.get", {
|
|
144
|
+
description: "Get a card",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
boardId: { type: "string", required: true },
|
|
147
|
+
listId: { type: "string", required: true },
|
|
148
|
+
cardId: { type: "string", required: true },
|
|
149
|
+
},
|
|
150
|
+
async execute(input, ctx) {
|
|
151
|
+
const p = input;
|
|
152
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/lists/${p.listId}/cards/${p.cardId}`);
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
rl.registerAction("card.list", {
|
|
156
|
+
description: "List cards in a list",
|
|
157
|
+
inputSchema: {
|
|
158
|
+
boardId: { type: "string", required: true },
|
|
159
|
+
listId: { type: "string", required: true },
|
|
160
|
+
limit: { type: "number", required: false },
|
|
161
|
+
},
|
|
57
162
|
async execute(input, ctx) {
|
|
58
163
|
const p = input;
|
|
59
164
|
const data = (await api(getConn(ctx), "GET", `boards/${p.boardId}/lists/${p.listId}/cards`));
|
|
60
165
|
return p.limit ? data.slice(0, p.limit) : data;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
rl.registerAction("card.update", {
|
|
169
|
+
description: "Update a card",
|
|
170
|
+
inputSchema: {
|
|
171
|
+
boardId: { type: "string", required: true },
|
|
172
|
+
listId: { type: "string", required: true },
|
|
173
|
+
cardId: { type: "string", required: true },
|
|
174
|
+
data: { type: "object", required: true },
|
|
175
|
+
},
|
|
176
|
+
async execute(input, ctx) {
|
|
177
|
+
const p = input;
|
|
178
|
+
return api(getConn(ctx), "PUT", `boards/${p.boardId}/lists/${p.listId}/cards/${p.cardId}`, p.data);
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
rl.registerAction("card.delete", {
|
|
182
|
+
description: "Delete a card",
|
|
183
|
+
inputSchema: {
|
|
184
|
+
boardId: { type: "string", required: true },
|
|
185
|
+
listId: { type: "string", required: true },
|
|
186
|
+
cardId: { type: "string", required: true },
|
|
187
|
+
},
|
|
188
|
+
async execute(input, ctx) {
|
|
189
|
+
const p = input;
|
|
190
|
+
return api(getConn(ctx), "DELETE", `boards/${p.boardId}/lists/${p.listId}/cards/${p.cardId}`);
|
|
191
|
+
},
|
|
192
|
+
});
|
|
66
193
|
// ── Card Comment ────────────────────────────────────
|
|
67
|
-
rl.registerAction("cardComment.create", {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
194
|
+
rl.registerAction("cardComment.create", {
|
|
195
|
+
description: "Add a comment to a card",
|
|
196
|
+
inputSchema: {
|
|
197
|
+
boardId: { type: "string", required: true },
|
|
198
|
+
cardId: { type: "string", required: true },
|
|
199
|
+
authorId: { type: "string", required: true },
|
|
200
|
+
comment: { type: "string", required: true },
|
|
201
|
+
},
|
|
202
|
+
async execute(input, ctx) {
|
|
203
|
+
const p = input;
|
|
204
|
+
return api(getConn(ctx), "POST", `boards/${p.boardId}/cards/${p.cardId}/comments`, { authorId: p.authorId, comment: p.comment });
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
rl.registerAction("cardComment.get", {
|
|
208
|
+
description: "Get a comment",
|
|
209
|
+
inputSchema: {
|
|
210
|
+
boardId: { type: "string", required: true },
|
|
211
|
+
cardId: { type: "string", required: true },
|
|
212
|
+
commentId: { type: "string", required: true },
|
|
213
|
+
},
|
|
214
|
+
async execute(input, ctx) {
|
|
215
|
+
const p = input;
|
|
216
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/cards/${p.cardId}/comments/${p.commentId}`);
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
rl.registerAction("cardComment.list", {
|
|
220
|
+
description: "List comments on a card",
|
|
221
|
+
inputSchema: {
|
|
222
|
+
boardId: { type: "string", required: true },
|
|
223
|
+
cardId: { type: "string", required: true },
|
|
224
|
+
},
|
|
225
|
+
async execute(input, ctx) {
|
|
226
|
+
const p = input;
|
|
227
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/cards/${p.cardId}/comments`);
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
rl.registerAction("cardComment.delete", {
|
|
231
|
+
description: "Delete a comment",
|
|
232
|
+
inputSchema: {
|
|
233
|
+
boardId: { type: "string", required: true },
|
|
234
|
+
cardId: { type: "string", required: true },
|
|
235
|
+
commentId: { type: "string", required: true },
|
|
236
|
+
},
|
|
237
|
+
async execute(input, ctx) {
|
|
238
|
+
const p = input;
|
|
239
|
+
return api(getConn(ctx), "DELETE", `boards/${p.boardId}/cards/${p.cardId}/comments/${p.commentId}`);
|
|
240
|
+
},
|
|
241
|
+
});
|
|
75
242
|
// ── Checklist ───────────────────────────────────────
|
|
76
|
-
rl.registerAction("checklist.create", {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
243
|
+
rl.registerAction("checklist.create", {
|
|
244
|
+
description: "Create a checklist on a card",
|
|
245
|
+
inputSchema: {
|
|
246
|
+
boardId: { type: "string", required: true },
|
|
247
|
+
cardId: { type: "string", required: true },
|
|
248
|
+
title: { type: "string", required: true },
|
|
249
|
+
items: {
|
|
250
|
+
type: "object",
|
|
251
|
+
required: false,
|
|
252
|
+
description: "Array of item titles",
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
async execute(input, ctx) {
|
|
256
|
+
const p = input;
|
|
257
|
+
return api(getConn(ctx), "POST", `boards/${p.boardId}/cards/${p.cardId}/checklists`, { title: p.title, items: p.items });
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
rl.registerAction("checklist.get", {
|
|
261
|
+
description: "Get a checklist",
|
|
262
|
+
inputSchema: {
|
|
263
|
+
boardId: { type: "string", required: true },
|
|
264
|
+
cardId: { type: "string", required: true },
|
|
265
|
+
checklistId: { type: "string", required: true },
|
|
266
|
+
},
|
|
267
|
+
async execute(input, ctx) {
|
|
268
|
+
const p = input;
|
|
269
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/cards/${p.cardId}/checklists/${p.checklistId}`);
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
rl.registerAction("checklist.list", {
|
|
273
|
+
description: "List checklists on a card",
|
|
274
|
+
inputSchema: {
|
|
275
|
+
boardId: { type: "string", required: true },
|
|
276
|
+
cardId: { type: "string", required: true },
|
|
277
|
+
},
|
|
278
|
+
async execute(input, ctx) {
|
|
279
|
+
const p = input;
|
|
280
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/cards/${p.cardId}/checklists`);
|
|
281
|
+
},
|
|
282
|
+
});
|
|
283
|
+
rl.registerAction("checklist.delete", {
|
|
284
|
+
description: "Delete a checklist",
|
|
285
|
+
inputSchema: {
|
|
286
|
+
boardId: { type: "string", required: true },
|
|
287
|
+
cardId: { type: "string", required: true },
|
|
288
|
+
checklistId: { type: "string", required: true },
|
|
289
|
+
},
|
|
290
|
+
async execute(input, ctx) {
|
|
291
|
+
const p = input;
|
|
292
|
+
return api(getConn(ctx), "DELETE", `boards/${p.boardId}/cards/${p.cardId}/checklists/${p.checklistId}`);
|
|
293
|
+
},
|
|
294
|
+
});
|
|
84
295
|
// ── Checklist Item ──────────────────────────────────
|
|
85
|
-
rl.registerAction("checklistItem.get", {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
296
|
+
rl.registerAction("checklistItem.get", {
|
|
297
|
+
description: "Get a checklist item",
|
|
298
|
+
inputSchema: {
|
|
299
|
+
boardId: { type: "string", required: true },
|
|
300
|
+
cardId: { type: "string", required: true },
|
|
301
|
+
checklistId: { type: "string", required: true },
|
|
302
|
+
itemId: { type: "string", required: true },
|
|
303
|
+
},
|
|
304
|
+
async execute(input, ctx) {
|
|
305
|
+
const p = input;
|
|
306
|
+
return api(getConn(ctx), "GET", `boards/${p.boardId}/cards/${p.cardId}/checklists/${p.checklistId}/items/${p.itemId}`);
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
rl.registerAction("checklistItem.update", {
|
|
310
|
+
description: "Update a checklist item",
|
|
311
|
+
inputSchema: {
|
|
312
|
+
boardId: { type: "string", required: true },
|
|
313
|
+
cardId: { type: "string", required: true },
|
|
314
|
+
checklistId: { type: "string", required: true },
|
|
315
|
+
itemId: { type: "string", required: true },
|
|
316
|
+
data: { type: "object", required: true },
|
|
317
|
+
},
|
|
318
|
+
async execute(input, ctx) {
|
|
319
|
+
const p = input;
|
|
320
|
+
return api(getConn(ctx), "PUT", `boards/${p.boardId}/cards/${p.cardId}/checklists/${p.checklistId}/items/${p.itemId}`, p.data);
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
rl.registerAction("checklistItem.delete", {
|
|
324
|
+
description: "Delete a checklist item",
|
|
325
|
+
inputSchema: {
|
|
326
|
+
boardId: { type: "string", required: true },
|
|
327
|
+
cardId: { type: "string", required: true },
|
|
328
|
+
checklistId: { type: "string", required: true },
|
|
329
|
+
itemId: { type: "string", required: true },
|
|
330
|
+
},
|
|
331
|
+
async execute(input, ctx) {
|
|
332
|
+
const p = input;
|
|
333
|
+
return api(getConn(ctx), "DELETE", `boards/${p.boardId}/cards/${p.cardId}/checklists/${p.checklistId}/items/${p.itemId}`);
|
|
334
|
+
},
|
|
335
|
+
});
|
|
91
336
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
url: c.url.replace(/\/$/, ""),
|
|
5
|
+
consumerKey: c.consumerKey,
|
|
6
|
+
consumerSecret: c.consumerSecret,
|
|
7
|
+
};
|
|
4
8
|
}
|
|
5
9
|
async function apiRequest(conn, method, endpoint, body, qs) {
|
|
6
10
|
const url = new URL(`${conn.url}/wp-json/wc/v3${endpoint}`);
|
|
@@ -12,7 +16,10 @@ async function apiRequest(conn, method, endpoint, body, qs) {
|
|
|
12
16
|
}
|
|
13
17
|
const init = {
|
|
14
18
|
method,
|
|
15
|
-
headers: {
|
|
19
|
+
headers: {
|
|
20
|
+
Authorization: `Basic ${btoa(`${conn.consumerKey}:${conn.consumerSecret}`)}`,
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
},
|
|
16
23
|
};
|
|
17
24
|
if (body && Object.keys(body).length > 0)
|
|
18
25
|
init.body = JSON.stringify(body);
|
|
@@ -25,16 +32,24 @@ function registerCrud(rl, resource, plural, conn, createSchema) {
|
|
|
25
32
|
rl.registerAction(`${resource}.create`, {
|
|
26
33
|
description: `Create a ${resource}`,
|
|
27
34
|
inputSchema: createSchema,
|
|
28
|
-
async execute(input, ctx) {
|
|
35
|
+
async execute(input, ctx) {
|
|
36
|
+
return apiRequest(conn(ctx), "POST", `/${plural}`, input);
|
|
37
|
+
},
|
|
29
38
|
});
|
|
30
39
|
rl.registerAction(`${resource}.get`, {
|
|
31
40
|
description: `Get a ${resource} by ID`,
|
|
32
41
|
inputSchema: { id: { type: "string", required: true } },
|
|
33
|
-
async execute(input, ctx) {
|
|
42
|
+
async execute(input, ctx) {
|
|
43
|
+
return apiRequest(conn(ctx), "GET", `/${plural}/${input.id}`);
|
|
44
|
+
},
|
|
34
45
|
});
|
|
35
46
|
rl.registerAction(`${resource}.list`, {
|
|
36
47
|
description: `List ${plural}`,
|
|
37
|
-
inputSchema: {
|
|
48
|
+
inputSchema: {
|
|
49
|
+
limit: { type: "number", required: false },
|
|
50
|
+
search: { type: "string", required: false },
|
|
51
|
+
status: { type: "string", required: false },
|
|
52
|
+
},
|
|
38
53
|
async execute(input, ctx) {
|
|
39
54
|
const p = (input ?? {});
|
|
40
55
|
const qs = {};
|
|
@@ -49,7 +64,10 @@ function registerCrud(rl, resource, plural, conn, createSchema) {
|
|
|
49
64
|
});
|
|
50
65
|
rl.registerAction(`${resource}.update`, {
|
|
51
66
|
description: `Update a ${resource}`,
|
|
52
|
-
inputSchema: {
|
|
67
|
+
inputSchema: {
|
|
68
|
+
id: { type: "string", required: true },
|
|
69
|
+
data: { type: "object", required: true },
|
|
70
|
+
},
|
|
53
71
|
async execute(input, ctx) {
|
|
54
72
|
const p = input;
|
|
55
73
|
return apiRequest(conn(ctx), "PUT", `/${plural}/${p.id}`, p.data);
|
|
@@ -67,21 +85,48 @@ export default function woocommerce(rl) {
|
|
|
67
85
|
rl.setName("woocommerce");
|
|
68
86
|
rl.setVersion("0.1.0");
|
|
69
87
|
rl.setConnectionSchema({
|
|
70
|
-
url: {
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
url: {
|
|
89
|
+
type: "string",
|
|
90
|
+
required: true,
|
|
91
|
+
description: "WooCommerce store URL",
|
|
92
|
+
env: "WOOCOMMERCE_URL",
|
|
93
|
+
},
|
|
94
|
+
consumerKey: {
|
|
95
|
+
type: "string",
|
|
96
|
+
required: true,
|
|
97
|
+
description: "WooCommerce consumer key",
|
|
98
|
+
env: "WOOCOMMERCE_CONSUMER_KEY",
|
|
99
|
+
},
|
|
100
|
+
consumerSecret: {
|
|
101
|
+
type: "string",
|
|
102
|
+
required: true,
|
|
103
|
+
description: "WooCommerce consumer secret",
|
|
104
|
+
env: "WOOCOMMERCE_CONSUMER_SECRET",
|
|
105
|
+
},
|
|
73
106
|
});
|
|
74
107
|
registerCrud(rl, "product", "products", getConn, {
|
|
75
108
|
name: { type: "string", required: true },
|
|
76
|
-
type: {
|
|
109
|
+
type: {
|
|
110
|
+
type: "string",
|
|
111
|
+
required: false,
|
|
112
|
+
description: "simple, grouped, external, variable",
|
|
113
|
+
},
|
|
77
114
|
regular_price: { type: "string", required: false },
|
|
78
115
|
description: { type: "string", required: false },
|
|
79
116
|
sku: { type: "string", required: false },
|
|
80
117
|
});
|
|
81
118
|
registerCrud(rl, "order", "orders", getConn, {
|
|
82
|
-
status: {
|
|
119
|
+
status: {
|
|
120
|
+
type: "string",
|
|
121
|
+
required: false,
|
|
122
|
+
description: "pending, processing, on-hold, completed, cancelled, refunded, failed",
|
|
123
|
+
},
|
|
83
124
|
customer_id: { type: "number", required: false },
|
|
84
|
-
line_items: {
|
|
125
|
+
line_items: {
|
|
126
|
+
type: "object",
|
|
127
|
+
required: false,
|
|
128
|
+
description: "Array of { product_id, quantity }",
|
|
129
|
+
},
|
|
85
130
|
payment_method: { type: "string", required: false },
|
|
86
131
|
});
|
|
87
132
|
registerCrud(rl, "customer", "customers", getConn, {
|