runline 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/.pi/extensions/runline-context/index.ts +135 -0
- package/.pi/extensions/runline-context/package.json +17 -0
- package/README.md +273 -0
- package/dist/commands/actions.d.ts +3 -0
- package/dist/commands/actions.js +43 -0
- package/dist/commands/connection.d.ts +11 -0
- package/dist/commands/connection.js +56 -0
- package/dist/commands/exec.d.ts +5 -0
- package/dist/commands/exec.js +46 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +26 -0
- package/dist/commands/plugin.d.ts +10 -0
- package/dist/commands/plugin.js +57 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.js +2 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.js +82 -0
- package/dist/config/types.d.ts +9 -0
- package/dist/config/types.js +5 -0
- package/dist/core/engine.d.ts +21 -0
- package/dist/core/engine.js +280 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +127 -0
- package/dist/plugin/api.d.ts +32 -0
- package/dist/plugin/api.js +68 -0
- package/dist/plugin/installer.d.ts +27 -0
- package/dist/plugin/installer.js +181 -0
- package/dist/plugin/loader.d.ts +13 -0
- package/dist/plugin/loader.js +164 -0
- package/dist/plugin/registry.d.ts +18 -0
- package/dist/plugin/registry.js +43 -0
- package/dist/plugin/types.d.ts +40 -0
- package/dist/plugin/types.js +1 -0
- package/dist/plugins/actionNetwork/src/index.js +353 -0
- package/dist/plugins/activeCampaign/src/index.js +711 -0
- package/dist/plugins/adalo/src/index.js +131 -0
- package/dist/plugins/affinity/src/index.js +279 -0
- package/dist/plugins/agileCrm/src/index.js +415 -0
- package/dist/plugins/airtable/src/index.js +280 -0
- package/dist/plugins/airtop/src/index.js +527 -0
- package/dist/plugins/apiTemplateIo/src/index.js +86 -0
- package/dist/plugins/asana/src/index.js +413 -0
- package/dist/plugins/autopilot/src/index.js +203 -0
- package/dist/plugins/bambooHr/src/index.js +252 -0
- package/dist/plugins/bannerbear/src/index.js +100 -0
- package/dist/plugins/baserow/src/index.js +180 -0
- package/dist/plugins/beeminder/src/index.js +298 -0
- package/dist/plugins/bitly/src/index.js +107 -0
- package/dist/plugins/bitwarden/src/index.js +383 -0
- package/dist/plugins/box/src/index.js +300 -0
- package/dist/plugins/brandfetch/src/index.js +80 -0
- package/dist/plugins/brevo/src/index.js +305 -0
- package/dist/plugins/bubble/src/index.js +181 -0
- package/dist/plugins/chargebee/src/index.js +126 -0
- package/dist/plugins/circleci/src/index.js +111 -0
- package/dist/plugins/ciscoWebex/src/index.js +245 -0
- package/dist/plugins/clearbit/src/index.js +103 -0
- package/dist/plugins/clickup/src/index.js +1043 -0
- package/dist/plugins/clockify/src/index.js +443 -0
- package/dist/plugins/cloudflare/src/index.js +93 -0
- package/dist/plugins/cockpit/src/index.js +131 -0
- package/dist/plugins/coda/src/index.js +327 -0
- package/dist/plugins/coingecko/src/index.js +244 -0
- package/dist/plugins/contentful/src/index.js +146 -0
- package/dist/plugins/convertkit/src/index.js +270 -0
- package/dist/plugins/copper/src/index.js +140 -0
- package/dist/plugins/cortex/src/index.js +147 -0
- package/dist/plugins/currents/src/index.js +405 -0
- package/dist/plugins/customerIo/src/index.js +184 -0
- package/dist/plugins/databricks/src/index.js +342 -0
- package/dist/plugins/deepl/src/index.js +87 -0
- package/dist/plugins/demio/src/index.js +111 -0
- package/dist/plugins/dhl/src/index.js +40 -0
- package/dist/plugins/discord/src/index.js +275 -0
- package/dist/plugins/discourse/src/index.js +273 -0
- package/dist/plugins/disqus/src/index.js +145 -0
- package/dist/plugins/docker/src/index.js +76 -0
- package/dist/plugins/drift/src/index.js +89 -0
- package/dist/plugins/dropbox/src/index.js +159 -0
- package/dist/plugins/dropcontact/src/index.js +59 -0
- package/dist/plugins/egoi/src/index.js +151 -0
- package/dist/plugins/elasticsearch/src/index.js +157 -0
- package/dist/plugins/emelia/src/index.js +174 -0
- package/dist/plugins/erpnext/src/index.js +121 -0
- package/dist/plugins/facebookGraph/src/index.js +57 -0
- package/dist/plugins/freshdesk/src/index.js +320 -0
- package/dist/plugins/freshservice/src/index.js +146 -0
- package/dist/plugins/freshworksCrm/src/index.js +149 -0
- package/dist/plugins/getresponse/src/index.js +140 -0
- package/dist/plugins/ghost/src/index.js +192 -0
- package/dist/plugins/github/src/index.js +630 -0
- package/dist/plugins/gitlab/src/index.js +358 -0
- package/dist/plugins/gong/src/index.js +126 -0
- package/dist/plugins/gotify/src/index.js +77 -0
- package/dist/plugins/gotowebinar/src/index.js +316 -0
- package/dist/plugins/grafana/src/index.js +250 -0
- package/dist/plugins/graphql/src/index.js +78 -0
- package/dist/plugins/grist/src/index.js +106 -0
- package/dist/plugins/hackernews/src/index.js +89 -0
- package/dist/plugins/halopsa/src/index.js +79 -0
- package/dist/plugins/harvest/src/index.js +163 -0
- package/dist/plugins/helpscout/src/index.js +176 -0
- package/dist/plugins/highlevel/src/index.js +172 -0
- package/dist/plugins/homeAssistant/src/index.js +148 -0
- package/dist/plugins/hubspot/src/index.js +176 -0
- package/dist/plugins/humanticAi/src/index.js +60 -0
- package/dist/plugins/hunter/src/index.js +59 -0
- package/dist/plugins/intercom/src/index.js +156 -0
- package/dist/plugins/iterable/src/index.js +139 -0
- package/dist/plugins/jenkins/src/index.js +132 -0
- package/dist/plugins/jira/src/index.js +229 -0
- package/dist/plugins/keap/src/index.js +502 -0
- package/dist/plugins/kobotoolbox/src/index.js +281 -0
- package/dist/plugins/lemlist/src/index.js +231 -0
- package/dist/plugins/linear/src/index.js +133 -0
- package/dist/plugins/lingvanex/src/index.js +31 -0
- package/dist/plugins/linkedin/src/index.js +80 -0
- package/dist/plugins/lonescale/src/index.js +119 -0
- package/dist/plugins/magento/src/index.js +300 -0
- package/dist/plugins/mailcheck/src/index.js +27 -0
- package/dist/plugins/mailchimp/src/index.js +321 -0
- package/dist/plugins/mailerlite/src/index.js +123 -0
- package/dist/plugins/mailgun/src/index.js +48 -0
- package/dist/plugins/mailjet/src/index.js +155 -0
- package/dist/plugins/mandrill/src/index.js +145 -0
- package/dist/plugins/marketstack/src/index.js +97 -0
- package/dist/plugins/matrix/src/index.js +194 -0
- package/dist/plugins/mattermost/src/index.js +331 -0
- package/dist/plugins/mautic/src/index.js +311 -0
- package/dist/plugins/medium/src/index.js +77 -0
- package/dist/plugins/messagebird/src/index.js +57 -0
- package/dist/plugins/metabase/src/index.js +130 -0
- package/dist/plugins/misp/src/index.js +476 -0
- package/dist/plugins/mocean/src/index.js +67 -0
- package/dist/plugins/monday/src/index.js +231 -0
- package/dist/plugins/monicaCrm/src/index.js +52 -0
- package/dist/plugins/msg91/src/index.js +31 -0
- package/dist/plugins/nasa/src/index.js +146 -0
- package/dist/plugins/netlify/src/index.js +151 -0
- package/dist/plugins/netscalerAdc/src/index.js +131 -0
- package/dist/plugins/nextcloud/src/index.js +263 -0
- package/dist/plugins/nocodb/src/index.js +130 -0
- package/dist/plugins/notion/src/index.js +112 -0
- package/dist/plugins/npm/src/index.js +104 -0
- package/dist/plugins/odoo/src/index.js +157 -0
- package/dist/plugins/okta/src/index.js +141 -0
- package/dist/plugins/oneSimpleApi/src/index.js +155 -0
- package/dist/plugins/onfleet/src/index.js +254 -0
- package/dist/plugins/openThesaurus/src/index.js +32 -0
- package/dist/plugins/openweathermap/src/index.js +60 -0
- package/dist/plugins/oura/src/index.js +62 -0
- package/dist/plugins/paddle/src/index.js +247 -0
- package/dist/plugins/pagerduty/src/index.js +201 -0
- package/dist/plugins/paypal/src/index.js +106 -0
- package/dist/plugins/peekalink/src/index.js +35 -0
- package/dist/plugins/phantombuster/src/index.js +94 -0
- package/dist/plugins/philipsHue/src/index.js +98 -0
- package/dist/plugins/pipedrive/src/index.js +169 -0
- package/dist/plugins/plivo/src/index.js +66 -0
- package/dist/plugins/postbin/src/index.js +93 -0
- package/dist/plugins/posthog/src/index.js +113 -0
- package/dist/plugins/profitwell/src/index.js +50 -0
- package/dist/plugins/pushbullet/src/index.js +102 -0
- package/dist/plugins/pushcut/src/index.js +39 -0
- package/dist/plugins/pushover/src/index.js +65 -0
- package/dist/plugins/quickbase/src/index.js +153 -0
- package/dist/plugins/quickbooks/src/index.js +73 -0
- package/dist/plugins/quickchart/src/index.js +36 -0
- package/dist/plugins/raindrop/src/index.js +209 -0
- package/dist/plugins/reddit/src/index.js +185 -0
- package/dist/plugins/rocketchat/src/index.js +53 -0
- package/dist/plugins/rundeck/src/index.js +62 -0
- package/dist/plugins/salesforce/src/index.js +94 -0
- package/dist/plugins/salesmate/src/index.js +83 -0
- package/dist/plugins/securityScorecard/src/index.js +200 -0
- package/dist/plugins/segment/src/index.js +125 -0
- package/dist/plugins/sendgrid/src/index.js +187 -0
- package/dist/plugins/sendy/src/index.js +138 -0
- package/dist/plugins/sentry/src/index.js +233 -0
- package/dist/plugins/servicenow/src/index.js +108 -0
- package/dist/plugins/shopify/src/index.js +222 -0
- package/dist/plugins/signl4/src/index.js +61 -0
- package/dist/plugins/slack/src/index.js +236 -0
- package/dist/plugins/sms77/src/index.js +63 -0
- package/dist/plugins/splunk/src/index.js +207 -0
- package/dist/plugins/spotify/src/index.js +188 -0
- package/dist/plugins/stackby/src/index.js +82 -0
- package/dist/plugins/storyblok/src/index.js +141 -0
- package/dist/plugins/strapi/src/index.js +152 -0
- package/dist/plugins/strava/src/index.js +137 -0
- package/dist/plugins/stripe/src/index.js +222 -0
- package/dist/plugins/supabase/src/index.js +121 -0
- package/dist/plugins/syncromsp/src/index.js +255 -0
- package/dist/plugins/tapfiliate/src/index.js +125 -0
- package/dist/plugins/telegram/src/index.js +233 -0
- package/dist/plugins/thehive/src/index.js +142 -0
- package/dist/plugins/thehiveProject/src/index.js +194 -0
- package/dist/plugins/todoist/src/index.js +244 -0
- package/dist/plugins/travisci/src/index.js +71 -0
- package/dist/plugins/trello/src/index.js +341 -0
- package/dist/plugins/twake/src/index.js +40 -0
- package/dist/plugins/twilio/src/index.js +75 -0
- package/dist/plugins/twist/src/index.js +90 -0
- package/dist/plugins/twitter/src/index.js +123 -0
- package/dist/plugins/unleashedSoftware/src/index.js +84 -0
- package/dist/plugins/uplead/src/index.js +59 -0
- package/dist/plugins/uproc/src/index.js +34 -0
- package/dist/plugins/uptimerobot/src/index.js +264 -0
- package/dist/plugins/urlscanio/src/index.js +64 -0
- package/dist/plugins/vero/src/index.js +80 -0
- package/dist/plugins/vonage/src/index.js +42 -0
- package/dist/plugins/wekan/src/index.js +91 -0
- package/dist/plugins/woocommerce/src/index.js +92 -0
- package/dist/plugins/wordpress/src/index.js +121 -0
- package/dist/plugins/xero/src/index.js +136 -0
- package/dist/plugins/yourls/src/index.js +56 -0
- package/dist/plugins/zammad/src/index.js +91 -0
- package/dist/plugins/zendesk/src/index.js +137 -0
- package/dist/plugins/zoho/src/index.js +85 -0
- package/dist/plugins/zoom/src/index.js +122 -0
- package/dist/plugins/zulip/src/index.js +170 -0
- package/dist/sdk.d.ts +38 -0
- package/dist/sdk.js +105 -0
- package/dist/utils/cli.d.ts +13 -0
- package/dist/utils/cli.js +32 -0
- package/dist/utils/output.d.ts +4 -0
- package/dist/utils/output.js +13 -0
- package/package.json +57 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
async function apiRequest(appId, apiKey, method, path, body, qs) {
|
|
2
|
+
const url = new URL(`https://api.adalo.com/v0/apps/${appId}${path}`);
|
|
3
|
+
if (qs) {
|
|
4
|
+
for (const [k, v] of Object.entries(qs)) {
|
|
5
|
+
if (v !== undefined)
|
|
6
|
+
url.searchParams.set(k, String(v));
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const opts = {
|
|
10
|
+
method,
|
|
11
|
+
headers: {
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
Authorization: `Bearer ${apiKey}`,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
if (body && Object.keys(body).length > 0) {
|
|
17
|
+
opts.body = JSON.stringify(body);
|
|
18
|
+
}
|
|
19
|
+
const res = await fetch(url.toString(), opts);
|
|
20
|
+
if (!res.ok) {
|
|
21
|
+
const text = await res.text();
|
|
22
|
+
throw new Error(`Adalo API error ${res.status}: ${text}`);
|
|
23
|
+
}
|
|
24
|
+
if (res.status === 204)
|
|
25
|
+
return { success: true };
|
|
26
|
+
return res.json();
|
|
27
|
+
}
|
|
28
|
+
async function paginate(appId, apiKey, collectionId, limit) {
|
|
29
|
+
const results = [];
|
|
30
|
+
let offset = 0;
|
|
31
|
+
const pageSize = 100;
|
|
32
|
+
while (true) {
|
|
33
|
+
const data = (await apiRequest(appId, apiKey, "GET", `/collections/${collectionId}`, undefined, {
|
|
34
|
+
limit: pageSize,
|
|
35
|
+
offset,
|
|
36
|
+
}));
|
|
37
|
+
const items = data.records ?? [];
|
|
38
|
+
results.push(...items);
|
|
39
|
+
if (limit && results.length >= limit)
|
|
40
|
+
return results.slice(0, limit);
|
|
41
|
+
if (items.length < pageSize)
|
|
42
|
+
break;
|
|
43
|
+
offset += items.length;
|
|
44
|
+
}
|
|
45
|
+
return results;
|
|
46
|
+
}
|
|
47
|
+
function getConn(ctx) {
|
|
48
|
+
return {
|
|
49
|
+
appId: ctx.connection.config.appId,
|
|
50
|
+
apiKey: ctx.connection.config.apiKey,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export default function adalo(rl) {
|
|
54
|
+
rl.setName("adalo");
|
|
55
|
+
rl.setVersion("0.1.0");
|
|
56
|
+
rl.setConnectionSchema({
|
|
57
|
+
appId: {
|
|
58
|
+
type: "string",
|
|
59
|
+
required: true,
|
|
60
|
+
description: "Adalo application ID",
|
|
61
|
+
env: "ADALO_APP_ID",
|
|
62
|
+
},
|
|
63
|
+
apiKey: {
|
|
64
|
+
type: "string",
|
|
65
|
+
required: true,
|
|
66
|
+
description: "Adalo API key",
|
|
67
|
+
env: "ADALO_API_KEY",
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
rl.registerAction("collection.create", {
|
|
71
|
+
description: "Create a row in a collection",
|
|
72
|
+
inputSchema: {
|
|
73
|
+
collectionId: { type: "string", required: true, description: "Collection ID" },
|
|
74
|
+
fields: { type: "object", required: true, description: "Field values as key-value pairs" },
|
|
75
|
+
},
|
|
76
|
+
async execute(input, ctx) {
|
|
77
|
+
const { collectionId, fields } = input;
|
|
78
|
+
const { appId, apiKey } = getConn(ctx);
|
|
79
|
+
return apiRequest(appId, apiKey, "POST", `/collections/${collectionId}`, fields);
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
rl.registerAction("collection.get", {
|
|
83
|
+
description: "Get a row from a collection",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
collectionId: { type: "string", required: true, description: "Collection ID" },
|
|
86
|
+
rowId: { type: "string", required: true, description: "Row ID" },
|
|
87
|
+
},
|
|
88
|
+
async execute(input, ctx) {
|
|
89
|
+
const { collectionId, rowId } = input;
|
|
90
|
+
const { appId, apiKey } = getConn(ctx);
|
|
91
|
+
return apiRequest(appId, apiKey, "GET", `/collections/${collectionId}/${rowId}`);
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
rl.registerAction("collection.list", {
|
|
95
|
+
description: "List rows from a collection",
|
|
96
|
+
inputSchema: {
|
|
97
|
+
collectionId: { type: "string", required: true, description: "Collection ID" },
|
|
98
|
+
limit: { type: "number", required: false, description: "Max results to return" },
|
|
99
|
+
},
|
|
100
|
+
async execute(input, ctx) {
|
|
101
|
+
const { collectionId, limit } = input;
|
|
102
|
+
const { appId, apiKey } = getConn(ctx);
|
|
103
|
+
return paginate(appId, apiKey, collectionId, limit);
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
rl.registerAction("collection.update", {
|
|
107
|
+
description: "Update a row in a collection",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
collectionId: { type: "string", required: true, description: "Collection ID" },
|
|
110
|
+
rowId: { type: "string", required: true, description: "Row ID" },
|
|
111
|
+
fields: { type: "object", required: true, description: "Field values to update" },
|
|
112
|
+
},
|
|
113
|
+
async execute(input, ctx) {
|
|
114
|
+
const { collectionId, rowId, fields } = input;
|
|
115
|
+
const { appId, apiKey } = getConn(ctx);
|
|
116
|
+
return apiRequest(appId, apiKey, "PUT", `/collections/${collectionId}/${rowId}`, fields);
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
rl.registerAction("collection.delete", {
|
|
120
|
+
description: "Delete a row from a collection",
|
|
121
|
+
inputSchema: {
|
|
122
|
+
collectionId: { type: "string", required: true, description: "Collection ID" },
|
|
123
|
+
rowId: { type: "string", required: true, description: "Row ID" },
|
|
124
|
+
},
|
|
125
|
+
async execute(input, ctx) {
|
|
126
|
+
const { collectionId, rowId } = input;
|
|
127
|
+
const { appId, apiKey } = getConn(ctx);
|
|
128
|
+
return apiRequest(appId, apiKey, "DELETE", `/collections/${collectionId}/${rowId}`);
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
const BASE_URL = "https://api.affinity.co";
|
|
2
|
+
async function apiRequest(apiKey, method, path, body, qs) {
|
|
3
|
+
const url = new URL(`${BASE_URL}${path}`);
|
|
4
|
+
if (qs) {
|
|
5
|
+
for (const [k, v] of Object.entries(qs)) {
|
|
6
|
+
if (v !== undefined)
|
|
7
|
+
url.searchParams.set(k, String(v));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const opts = {
|
|
11
|
+
method,
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Authorization: `Basic ${btoa(`:${apiKey}`)}`,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
if (body && Object.keys(body).length > 0) {
|
|
18
|
+
opts.body = JSON.stringify(body);
|
|
19
|
+
}
|
|
20
|
+
const res = await fetch(url.toString(), opts);
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
const text = await res.text();
|
|
23
|
+
throw new Error(`Affinity API error ${res.status}: ${text}`);
|
|
24
|
+
}
|
|
25
|
+
if (res.status === 204)
|
|
26
|
+
return { success: true };
|
|
27
|
+
return res.json();
|
|
28
|
+
}
|
|
29
|
+
async function paginateAll(apiKey, path, dataKey, limit) {
|
|
30
|
+
const results = [];
|
|
31
|
+
let pageToken;
|
|
32
|
+
while (true) {
|
|
33
|
+
const qs = { page_size: 500 };
|
|
34
|
+
if (pageToken)
|
|
35
|
+
qs.page_token = pageToken;
|
|
36
|
+
const data = (await apiRequest(apiKey, "GET", path, undefined, qs));
|
|
37
|
+
const items = data[dataKey] ?? [];
|
|
38
|
+
results.push(...items);
|
|
39
|
+
if (limit && results.length >= limit)
|
|
40
|
+
return results.slice(0, limit);
|
|
41
|
+
pageToken = data.page_token;
|
|
42
|
+
if (!pageToken)
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
return results;
|
|
46
|
+
}
|
|
47
|
+
function getKey(ctx) {
|
|
48
|
+
return ctx.connection.config.apiKey;
|
|
49
|
+
}
|
|
50
|
+
export default function affinity(rl) {
|
|
51
|
+
rl.setName("affinity");
|
|
52
|
+
rl.setVersion("0.1.0");
|
|
53
|
+
rl.setConnectionSchema({
|
|
54
|
+
apiKey: {
|
|
55
|
+
type: "string",
|
|
56
|
+
required: true,
|
|
57
|
+
description: "Affinity API key",
|
|
58
|
+
env: "AFFINITY_API_KEY",
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
// ── List ────────────────────────────────────────────
|
|
62
|
+
rl.registerAction("list.get", {
|
|
63
|
+
description: "Get a specific list",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
listId: { type: "string", required: true, description: "List ID" },
|
|
66
|
+
},
|
|
67
|
+
async execute(input, ctx) {
|
|
68
|
+
const { listId } = input;
|
|
69
|
+
return apiRequest(getKey(ctx), "GET", `/lists/${listId}`);
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
rl.registerAction("list.list", {
|
|
73
|
+
description: "List all lists",
|
|
74
|
+
inputSchema: {
|
|
75
|
+
limit: { type: "number", required: false, description: "Max results to return" },
|
|
76
|
+
},
|
|
77
|
+
async execute(input, ctx) {
|
|
78
|
+
const { limit } = input ?? {};
|
|
79
|
+
const data = (await apiRequest(getKey(ctx), "GET", "/lists"));
|
|
80
|
+
if (limit)
|
|
81
|
+
return data.slice(0, limit);
|
|
82
|
+
return data;
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
// ── List Entry ──────────────────────────────────────
|
|
86
|
+
rl.registerAction("listEntry.create", {
|
|
87
|
+
description: "Create a new list entry",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
listId: { type: "string", required: true, description: "List ID" },
|
|
90
|
+
entityId: { type: "number", required: true, description: "Entity ID to add" },
|
|
91
|
+
},
|
|
92
|
+
async execute(input, ctx) {
|
|
93
|
+
const { listId, entityId, ...rest } = input;
|
|
94
|
+
return apiRequest(getKey(ctx), "POST", `/lists/${listId}/list-entries`, {
|
|
95
|
+
entity_id: entityId,
|
|
96
|
+
...rest,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
rl.registerAction("listEntry.get", {
|
|
101
|
+
description: "Get a specific list entry",
|
|
102
|
+
inputSchema: {
|
|
103
|
+
listId: { type: "string", required: true, description: "List ID" },
|
|
104
|
+
listEntryId: { type: "string", required: true, description: "List Entry ID" },
|
|
105
|
+
},
|
|
106
|
+
async execute(input, ctx) {
|
|
107
|
+
const { listId, listEntryId } = input;
|
|
108
|
+
return apiRequest(getKey(ctx), "GET", `/lists/${listId}/list-entries/${listEntryId}`);
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
rl.registerAction("listEntry.list", {
|
|
112
|
+
description: "List all entries in a list",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
listId: { type: "string", required: true, description: "List ID" },
|
|
115
|
+
limit: { type: "number", required: false, description: "Max results to return" },
|
|
116
|
+
},
|
|
117
|
+
async execute(input, ctx) {
|
|
118
|
+
const { listId, limit } = input;
|
|
119
|
+
return paginateAll(getKey(ctx), `/lists/${listId}/list-entries`, "list_entries", limit);
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
rl.registerAction("listEntry.delete", {
|
|
123
|
+
description: "Delete a list entry",
|
|
124
|
+
inputSchema: {
|
|
125
|
+
listId: { type: "string", required: true, description: "List ID" },
|
|
126
|
+
listEntryId: { type: "string", required: true, description: "List Entry ID" },
|
|
127
|
+
},
|
|
128
|
+
async execute(input, ctx) {
|
|
129
|
+
const { listId, listEntryId } = input;
|
|
130
|
+
return apiRequest(getKey(ctx), "DELETE", `/lists/${listId}/list-entries/${listEntryId}`);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
// ── Person ──────────────────────────────────────────
|
|
134
|
+
rl.registerAction("person.create", {
|
|
135
|
+
description: "Create a new person",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
firstName: { type: "string", required: true, description: "First name" },
|
|
138
|
+
lastName: { type: "string", required: true, description: "Last name" },
|
|
139
|
+
emails: { type: "array", required: true, description: "Array of email addresses" },
|
|
140
|
+
organizationIds: { type: "array", required: false, description: "Array of organization IDs" },
|
|
141
|
+
},
|
|
142
|
+
async execute(input, ctx) {
|
|
143
|
+
const { firstName, lastName, emails, organizationIds } = input;
|
|
144
|
+
const body = {
|
|
145
|
+
first_name: firstName,
|
|
146
|
+
last_name: lastName,
|
|
147
|
+
emails,
|
|
148
|
+
};
|
|
149
|
+
if (organizationIds)
|
|
150
|
+
body.organization_ids = organizationIds;
|
|
151
|
+
return apiRequest(getKey(ctx), "POST", "/persons", body);
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
rl.registerAction("person.get", {
|
|
155
|
+
description: "Get a specific person",
|
|
156
|
+
inputSchema: {
|
|
157
|
+
personId: { type: "string", required: true, description: "Person ID" },
|
|
158
|
+
},
|
|
159
|
+
async execute(input, ctx) {
|
|
160
|
+
const { personId } = input;
|
|
161
|
+
return apiRequest(getKey(ctx), "GET", `/persons/${personId}`);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
rl.registerAction("person.list", {
|
|
165
|
+
description: "Search/list persons",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
term: { type: "string", required: false, description: "Search term" },
|
|
168
|
+
limit: { type: "number", required: false, description: "Max results to return" },
|
|
169
|
+
},
|
|
170
|
+
async execute(input, ctx) {
|
|
171
|
+
const { term, limit } = input ?? {};
|
|
172
|
+
const qs = {};
|
|
173
|
+
if (term)
|
|
174
|
+
qs.term = term;
|
|
175
|
+
return paginateAll(getKey(ctx), "/persons", "persons", limit);
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
rl.registerAction("person.update", {
|
|
179
|
+
description: "Update a person",
|
|
180
|
+
inputSchema: {
|
|
181
|
+
personId: { type: "string", required: true, description: "Person ID" },
|
|
182
|
+
emails: { type: "array", required: true, description: "Array of email addresses" },
|
|
183
|
+
firstName: { type: "string", required: false, description: "First name" },
|
|
184
|
+
lastName: { type: "string", required: false, description: "Last name" },
|
|
185
|
+
organizationIds: { type: "array", required: false, description: "Array of organization IDs" },
|
|
186
|
+
},
|
|
187
|
+
async execute(input, ctx) {
|
|
188
|
+
const { personId, firstName, lastName, emails, organizationIds } = input;
|
|
189
|
+
const body = { emails };
|
|
190
|
+
if (firstName)
|
|
191
|
+
body.first_name = firstName;
|
|
192
|
+
if (lastName)
|
|
193
|
+
body.last_name = lastName;
|
|
194
|
+
if (organizationIds)
|
|
195
|
+
body.organization_ids = organizationIds;
|
|
196
|
+
return apiRequest(getKey(ctx), "PUT", `/persons/${personId}`, body);
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
rl.registerAction("person.delete", {
|
|
200
|
+
description: "Delete a person",
|
|
201
|
+
inputSchema: {
|
|
202
|
+
personId: { type: "string", required: true, description: "Person ID" },
|
|
203
|
+
},
|
|
204
|
+
async execute(input, ctx) {
|
|
205
|
+
const { personId } = input;
|
|
206
|
+
return apiRequest(getKey(ctx), "DELETE", `/persons/${personId}`);
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
// ── Organization ────────────────────────────────────
|
|
210
|
+
rl.registerAction("organization.create", {
|
|
211
|
+
description: "Create a new organization",
|
|
212
|
+
inputSchema: {
|
|
213
|
+
name: { type: "string", required: true, description: "Organization name" },
|
|
214
|
+
domain: { type: "string", required: true, description: "Organization domain" },
|
|
215
|
+
personIds: { type: "array", required: false, description: "Array of person IDs" },
|
|
216
|
+
},
|
|
217
|
+
async execute(input, ctx) {
|
|
218
|
+
const { name, domain, personIds } = input;
|
|
219
|
+
const body = { name, domain };
|
|
220
|
+
if (personIds)
|
|
221
|
+
body.person_ids = personIds;
|
|
222
|
+
return apiRequest(getKey(ctx), "POST", "/organizations", body);
|
|
223
|
+
},
|
|
224
|
+
});
|
|
225
|
+
rl.registerAction("organization.get", {
|
|
226
|
+
description: "Get a specific organization",
|
|
227
|
+
inputSchema: {
|
|
228
|
+
organizationId: { type: "string", required: true, description: "Organization ID" },
|
|
229
|
+
},
|
|
230
|
+
async execute(input, ctx) {
|
|
231
|
+
const { organizationId } = input;
|
|
232
|
+
return apiRequest(getKey(ctx), "GET", `/organizations/${organizationId}`);
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
rl.registerAction("organization.list", {
|
|
236
|
+
description: "Search/list organizations",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
term: { type: "string", required: false, description: "Search term" },
|
|
239
|
+
limit: { type: "number", required: false, description: "Max results to return" },
|
|
240
|
+
},
|
|
241
|
+
async execute(input, ctx) {
|
|
242
|
+
const { term, limit } = input ?? {};
|
|
243
|
+
const qs = {};
|
|
244
|
+
if (term)
|
|
245
|
+
qs.term = term;
|
|
246
|
+
return paginateAll(getKey(ctx), "/organizations", "organizations", limit);
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
rl.registerAction("organization.update", {
|
|
250
|
+
description: "Update an organization",
|
|
251
|
+
inputSchema: {
|
|
252
|
+
organizationId: { type: "string", required: true, description: "Organization ID" },
|
|
253
|
+
name: { type: "string", required: false, description: "Organization name" },
|
|
254
|
+
domain: { type: "string", required: false, description: "Organization domain" },
|
|
255
|
+
personIds: { type: "array", required: false, description: "Array of person IDs" },
|
|
256
|
+
},
|
|
257
|
+
async execute(input, ctx) {
|
|
258
|
+
const { organizationId, name, domain, personIds } = input;
|
|
259
|
+
const body = {};
|
|
260
|
+
if (name)
|
|
261
|
+
body.name = name;
|
|
262
|
+
if (domain)
|
|
263
|
+
body.domain = domain;
|
|
264
|
+
if (personIds)
|
|
265
|
+
body.person_ids = personIds;
|
|
266
|
+
return apiRequest(getKey(ctx), "PUT", `/organizations/${organizationId}`, body);
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
rl.registerAction("organization.delete", {
|
|
270
|
+
description: "Delete an organization",
|
|
271
|
+
inputSchema: {
|
|
272
|
+
organizationId: { type: "string", required: true, description: "Organization ID" },
|
|
273
|
+
},
|
|
274
|
+
async execute(input, ctx) {
|
|
275
|
+
const { organizationId } = input;
|
|
276
|
+
return apiRequest(getKey(ctx), "DELETE", `/organizations/${organizationId}`);
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
}
|