@squadbase/vite-server 0.1.2 → 0.1.3-dev.1
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/cli/index.js +13609 -3797
- package/dist/connectors/airtable-oauth.js +12 -4
- package/dist/connectors/amplitude.js +335 -32
- package/dist/connectors/asana.d.ts +5 -0
- package/dist/connectors/asana.js +661 -0
- package/dist/connectors/attio.js +304 -36
- package/dist/connectors/customerio.d.ts +5 -0
- package/dist/connectors/customerio.js +633 -0
- package/dist/connectors/gmail-oauth.d.ts +5 -0
- package/dist/connectors/gmail-oauth.js +639 -0
- package/dist/connectors/google-ads-oauth.js +14 -8
- package/dist/connectors/google-ads.d.ts +5 -0
- package/dist/connectors/google-ads.js +784 -0
- package/dist/connectors/google-analytics-oauth.js +16 -8
- package/dist/connectors/google-sheets-oauth.js +12 -4
- package/dist/connectors/google-sheets.d.ts +5 -0
- package/dist/connectors/google-sheets.js +598 -0
- package/dist/connectors/hubspot-oauth.js +12 -4
- package/dist/connectors/hubspot.d.ts +5 -0
- package/dist/connectors/hubspot.js +550 -0
- package/dist/connectors/intercom-oauth.d.ts +5 -0
- package/dist/connectors/intercom-oauth.js +510 -0
- package/dist/connectors/intercom.d.ts +5 -0
- package/dist/connectors/intercom.js +627 -0
- package/dist/connectors/jira-api-key.d.ts +5 -0
- package/dist/connectors/jira-api-key.js +523 -0
- package/dist/connectors/kintone-api-token.js +16 -20
- package/dist/connectors/linkedin-ads-oauth.d.ts +5 -0
- package/dist/connectors/linkedin-ads-oauth.js +774 -0
- package/dist/connectors/linkedin-ads.d.ts +5 -0
- package/dist/connectors/linkedin-ads.js +782 -0
- package/dist/connectors/mailchimp-oauth.d.ts +5 -0
- package/dist/connectors/mailchimp-oauth.js +539 -0
- package/dist/connectors/mailchimp.d.ts +5 -0
- package/dist/connectors/mailchimp.js +646 -0
- package/dist/connectors/shopify-oauth.js +12 -4
- package/dist/connectors/shopify.js +500 -80
- package/dist/connectors/stripe-oauth.js +12 -4
- package/dist/connectors/zendesk-oauth.d.ts +5 -0
- package/dist/connectors/zendesk-oauth.js +505 -0
- package/dist/connectors/zendesk.d.ts +5 -0
- package/dist/connectors/zendesk.js +631 -0
- package/dist/index.js +13594 -3782
- package/dist/main.js +13596 -3784
- package/dist/vite-plugin.js +13596 -3784
- package/package.json +46 -2
package/dist/connectors/attio.js
CHANGED
|
@@ -56,6 +56,7 @@ var parameters = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
// ../connectors/src/connectors/attio/sdk/index.ts
|
|
59
|
+
var BASE_URL = "https://api.attio.com/v2";
|
|
59
60
|
function createClient(params) {
|
|
60
61
|
const apiKey = params[parameters.apiKey.slug];
|
|
61
62
|
if (!apiKey) {
|
|
@@ -63,9 +64,131 @@ function createClient(params) {
|
|
|
63
64
|
`attio: missing required parameter: ${parameters.apiKey.slug}`
|
|
64
65
|
);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
function authHeaders(extra) {
|
|
68
|
+
const headers = new Headers(extra);
|
|
69
|
+
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
70
|
+
headers.set("Content-Type", "application/json");
|
|
71
|
+
return headers;
|
|
72
|
+
}
|
|
73
|
+
async function assertOk(res, label) {
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const body = await res.text().catch(() => "(unreadable body)");
|
|
76
|
+
throw new Error(
|
|
77
|
+
`attio ${label}: ${res.status} ${res.statusText} \u2014 ${body}`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
request(path2, init) {
|
|
83
|
+
const url = `${BASE_URL}${path2}`;
|
|
84
|
+
const headers = new Headers(init?.headers);
|
|
85
|
+
headers.set("Authorization", `Bearer ${apiKey}`);
|
|
86
|
+
headers.set("Content-Type", "application/json");
|
|
87
|
+
return fetch(url, { ...init, headers });
|
|
88
|
+
},
|
|
89
|
+
async listObjects() {
|
|
90
|
+
const res = await fetch(`${BASE_URL}/objects`, {
|
|
91
|
+
method: "GET",
|
|
92
|
+
headers: authHeaders()
|
|
93
|
+
});
|
|
94
|
+
await assertOk(res, "listObjects");
|
|
95
|
+
return await res.json();
|
|
96
|
+
},
|
|
97
|
+
async listAttributes(object) {
|
|
98
|
+
const res = await fetch(
|
|
99
|
+
`${BASE_URL}/objects/${encodeURIComponent(object)}/attributes`,
|
|
100
|
+
{ method: "GET", headers: authHeaders() }
|
|
101
|
+
);
|
|
102
|
+
await assertOk(res, "listAttributes");
|
|
103
|
+
return await res.json();
|
|
104
|
+
},
|
|
105
|
+
async queryRecords(object, options) {
|
|
106
|
+
const body = {};
|
|
107
|
+
if (options?.filter) body.filter = options.filter;
|
|
108
|
+
if (options?.sorts) body.sorts = options.sorts;
|
|
109
|
+
if (options?.limit) body.limit = options.limit;
|
|
110
|
+
if (options?.offset) body.offset = options.offset;
|
|
111
|
+
const res = await fetch(
|
|
112
|
+
`${BASE_URL}/objects/${encodeURIComponent(object)}/records/query`,
|
|
113
|
+
{
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: authHeaders(),
|
|
116
|
+
body: JSON.stringify(body)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
await assertOk(res, "queryRecords");
|
|
120
|
+
return await res.json();
|
|
121
|
+
},
|
|
122
|
+
async getRecord(object, recordId) {
|
|
123
|
+
const res = await fetch(
|
|
124
|
+
`${BASE_URL}/objects/${encodeURIComponent(object)}/records/${encodeURIComponent(recordId)}`,
|
|
125
|
+
{ method: "GET", headers: authHeaders() }
|
|
126
|
+
);
|
|
127
|
+
await assertOk(res, "getRecord");
|
|
128
|
+
return await res.json();
|
|
129
|
+
},
|
|
130
|
+
async queryListEntries(listId, options) {
|
|
131
|
+
const body = {};
|
|
132
|
+
if (options?.filter) body.filter = options.filter;
|
|
133
|
+
if (options?.sorts) body.sorts = options.sorts;
|
|
134
|
+
if (options?.limit) body.limit = options.limit;
|
|
135
|
+
if (options?.offset) body.offset = options.offset;
|
|
136
|
+
const res = await fetch(
|
|
137
|
+
`${BASE_URL}/lists/${encodeURIComponent(listId)}/entries/query`,
|
|
138
|
+
{
|
|
139
|
+
method: "POST",
|
|
140
|
+
headers: authHeaders(),
|
|
141
|
+
body: JSON.stringify(body)
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
await assertOk(res, "queryListEntries");
|
|
145
|
+
return await res.json();
|
|
146
|
+
}
|
|
147
|
+
};
|
|
67
148
|
}
|
|
68
149
|
|
|
150
|
+
// ../connectors/src/connector-onboarding.ts
|
|
151
|
+
var ConnectorOnboarding = class {
|
|
152
|
+
/** Phase 1: Connection setup instructions (optional — some connectors don't need this) */
|
|
153
|
+
connectionSetupInstructions;
|
|
154
|
+
/** Phase 2: Data overview instructions */
|
|
155
|
+
dataOverviewInstructions;
|
|
156
|
+
constructor(config) {
|
|
157
|
+
this.connectionSetupInstructions = config.connectionSetupInstructions;
|
|
158
|
+
this.dataOverviewInstructions = config.dataOverviewInstructions;
|
|
159
|
+
}
|
|
160
|
+
getConnectionSetupPrompt(language) {
|
|
161
|
+
return this.connectionSetupInstructions?.[language] ?? null;
|
|
162
|
+
}
|
|
163
|
+
getDataOverviewInstructions(language) {
|
|
164
|
+
return this.dataOverviewInstructions[language];
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// ../connectors/src/connector-tool.ts
|
|
169
|
+
var ConnectorTool = class {
|
|
170
|
+
name;
|
|
171
|
+
description;
|
|
172
|
+
inputSchema;
|
|
173
|
+
outputSchema;
|
|
174
|
+
_execute;
|
|
175
|
+
constructor(config) {
|
|
176
|
+
this.name = config.name;
|
|
177
|
+
this.description = config.description;
|
|
178
|
+
this.inputSchema = config.inputSchema;
|
|
179
|
+
this.outputSchema = config.outputSchema;
|
|
180
|
+
this._execute = config.execute;
|
|
181
|
+
}
|
|
182
|
+
createTool(connections, config) {
|
|
183
|
+
return {
|
|
184
|
+
description: this.description,
|
|
185
|
+
inputSchema: this.inputSchema,
|
|
186
|
+
outputSchema: this.outputSchema,
|
|
187
|
+
execute: (input) => this._execute(input, connections, config)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
69
192
|
// ../connectors/src/connector-plugin.ts
|
|
70
193
|
var ConnectorPlugin = class _ConnectorPlugin {
|
|
71
194
|
slug;
|
|
@@ -124,8 +247,100 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
124
247
|
}
|
|
125
248
|
};
|
|
126
249
|
|
|
250
|
+
// ../connectors/src/connectors/attio/setup.ts
|
|
251
|
+
var attioOnboarding = new ConnectorOnboarding({
|
|
252
|
+
dataOverviewInstructions: {
|
|
253
|
+
en: `1. Call attio_request with GET /objects to list all available objects (people, companies, deals, etc.)
|
|
254
|
+
2. Call attio_request with GET /objects/people/attributes to explore the people object attributes
|
|
255
|
+
3. Call attio_request with POST /objects/people/records/query with { "limit": 5 } to sample people records
|
|
256
|
+
4. Explore other objects (companies, deals) as needed`,
|
|
257
|
+
ja: `1. attio_request \u3067 GET /objects \u3092\u547C\u3073\u51FA\u3057\u3001\u5229\u7528\u53EF\u80FD\u306A\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u4E00\u89A7\u3092\u53D6\u5F97\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
258
|
+
2. attio_request \u3067 GET /objects/people/attributes \u3092\u547C\u3073\u51FA\u3057\u3001people\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u3092\u78BA\u8A8D
|
|
259
|
+
3. attio_request \u3067 POST /objects/people/records/query \u3092 { "limit": 5 } \u3067\u547C\u3073\u51FA\u3057\u3001people\u30EC\u30B3\u30FC\u30C9\u3092\u30B5\u30F3\u30D7\u30EA\u30F3\u30B0
|
|
260
|
+
4. \u5FC5\u8981\u306B\u5FDC\u3058\u3066\u4ED6\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\uFF08companies\u3001deals\uFF09\u3092\u63A2\u7D22`
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// ../connectors/src/connectors/attio/tools/request.ts
|
|
265
|
+
import { z } from "zod";
|
|
266
|
+
var BASE_URL2 = "https://api.attio.com/v2";
|
|
267
|
+
var REQUEST_TIMEOUT_MS = 6e4;
|
|
268
|
+
var inputSchema = z.object({
|
|
269
|
+
toolUseIntent: z.string().optional().describe(
|
|
270
|
+
"Brief description of what you intend to accomplish with this tool call"
|
|
271
|
+
),
|
|
272
|
+
connectionId: z.string().describe("ID of the Attio connection to use"),
|
|
273
|
+
method: z.enum(["GET", "POST", "PATCH", "DELETE"]).describe(
|
|
274
|
+
"HTTP method. GET for reading resources, POST for creating or querying records, PATCH for updating, DELETE for removing."
|
|
275
|
+
),
|
|
276
|
+
path: z.string().describe(
|
|
277
|
+
"API path (e.g., '/objects', '/objects/people/records/query', '/objects/companies/records/{record_id}')"
|
|
278
|
+
),
|
|
279
|
+
body: z.record(z.string(), z.unknown()).optional().describe("Request body (JSON) for POST/PATCH requests")
|
|
280
|
+
});
|
|
281
|
+
var outputSchema = z.discriminatedUnion("success", [
|
|
282
|
+
z.object({
|
|
283
|
+
success: z.literal(true),
|
|
284
|
+
status: z.number(),
|
|
285
|
+
data: z.record(z.string(), z.unknown())
|
|
286
|
+
}),
|
|
287
|
+
z.object({
|
|
288
|
+
success: z.literal(false),
|
|
289
|
+
error: z.string()
|
|
290
|
+
})
|
|
291
|
+
]);
|
|
292
|
+
var requestTool = new ConnectorTool({
|
|
293
|
+
name: "request",
|
|
294
|
+
description: `Send authenticated requests to the Attio REST API.
|
|
295
|
+
Authentication is handled automatically using the API Key (Bearer token).
|
|
296
|
+
Use this tool for all Attio API interactions: querying records (people, companies, deals), listing objects and attributes, managing list entries, and working with notes.
|
|
297
|
+
Note that querying records uses POST (not GET) with a request body for filters.`,
|
|
298
|
+
inputSchema,
|
|
299
|
+
outputSchema,
|
|
300
|
+
async execute({ connectionId, method, path: path2, body }, connections) {
|
|
301
|
+
const connection2 = connections.find((c) => c.id === connectionId);
|
|
302
|
+
if (!connection2) {
|
|
303
|
+
return {
|
|
304
|
+
success: false,
|
|
305
|
+
error: `Connection ${connectionId} not found`
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
console.log(
|
|
309
|
+
`[connector-request] attio/${connection2.name}: ${method} ${path2}`
|
|
310
|
+
);
|
|
311
|
+
try {
|
|
312
|
+
const apiKey = parameters.apiKey.getValue(connection2);
|
|
313
|
+
const url = `${BASE_URL2}${path2}`;
|
|
314
|
+
const controller = new AbortController();
|
|
315
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
316
|
+
try {
|
|
317
|
+
const response = await fetch(url, {
|
|
318
|
+
method,
|
|
319
|
+
headers: {
|
|
320
|
+
Authorization: `Bearer ${apiKey}`,
|
|
321
|
+
"Content-Type": "application/json"
|
|
322
|
+
},
|
|
323
|
+
body: body ? JSON.stringify(body) : void 0,
|
|
324
|
+
signal: controller.signal
|
|
325
|
+
});
|
|
326
|
+
const data = await response.json();
|
|
327
|
+
if (!response.ok) {
|
|
328
|
+
const errorMessage = typeof data?.message === "string" ? data.message : typeof data?.error === "string" ? data.error : `HTTP ${response.status} ${response.statusText}`;
|
|
329
|
+
return { success: false, error: errorMessage };
|
|
330
|
+
}
|
|
331
|
+
return { success: true, status: response.status, data };
|
|
332
|
+
} finally {
|
|
333
|
+
clearTimeout(timeout);
|
|
334
|
+
}
|
|
335
|
+
} catch (err) {
|
|
336
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
337
|
+
return { success: false, error: msg };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
127
342
|
// ../connectors/src/connectors/attio/index.ts
|
|
128
|
-
var tools = {};
|
|
343
|
+
var tools = { request: requestTool };
|
|
129
344
|
var attioConnector = new ConnectorPlugin({
|
|
130
345
|
slug: "attio",
|
|
131
346
|
authType: null,
|
|
@@ -134,69 +349,122 @@ var attioConnector = new ConnectorPlugin({
|
|
|
134
349
|
iconUrl: "https://images.ctfassets.net/9ncizv60xc5y/2qqx99vvXJojUM3tSrSWPX/1e7c35e13da6b365b8b475c1effe568f/attio.svg",
|
|
135
350
|
parameters,
|
|
136
351
|
releaseFlag: { dev1: true, dev2: false, prod: false },
|
|
352
|
+
onboarding: attioOnboarding,
|
|
137
353
|
systemPrompt: {
|
|
138
|
-
en: `###
|
|
139
|
-
|
|
354
|
+
en: `### Tools
|
|
355
|
+
|
|
356
|
+
- \`attio_request\`: The only way to call the Attio REST API. Use it to query records (people, companies, deals), list objects and attributes, manage list entries, and work with notes. Authentication (Bearer token) is configured automatically. Note that querying records uses POST (not GET) with a request body containing filters.
|
|
357
|
+
|
|
358
|
+
### Business Logic
|
|
359
|
+
|
|
360
|
+
The business logic type for this connector is "typescript". Use the connector SDK in your handler. Do NOT read credentials from environment variables.
|
|
361
|
+
|
|
362
|
+
SDK methods (client created via \`connection(connectionId)\`):
|
|
363
|
+
- \`client.request(path, init?)\` \u2014 low-level authenticated fetch
|
|
364
|
+
- \`client.listObjects()\` \u2014 list all objects (people, companies, deals, etc.)
|
|
365
|
+
- \`client.listAttributes(object)\` \u2014 list attributes for an object
|
|
366
|
+
- \`client.queryRecords(object, options?)\` \u2014 query records with filter/sort/pagination
|
|
367
|
+
- \`client.getRecord(object, recordId)\` \u2014 fetch a single record
|
|
368
|
+
- \`client.queryListEntries(listId, options?)\` \u2014 query list entries with filter/sort/pagination
|
|
140
369
|
|
|
141
370
|
\`\`\`ts
|
|
371
|
+
import type { Context } from "hono";
|
|
142
372
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
143
373
|
|
|
144
|
-
const
|
|
374
|
+
const attio = connection("<connectionId>");
|
|
145
375
|
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
|
|
376
|
+
export default async function handler(c: Context) {
|
|
377
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
378
|
+
object?: string;
|
|
379
|
+
limit?: number;
|
|
380
|
+
}>();
|
|
381
|
+
|
|
382
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
383
|
+
|
|
384
|
+
return c.json({ records: data });
|
|
385
|
+
}
|
|
156
386
|
\`\`\`
|
|
157
387
|
|
|
158
|
-
###
|
|
388
|
+
### Attio REST API Reference
|
|
389
|
+
|
|
390
|
+
- Base URL: \`https://api.attio.com/v2\`
|
|
391
|
+
- Authentication: Bearer token (handled automatically)
|
|
392
|
+
- Querying records uses POST with JSON body (not GET with query params)
|
|
393
|
+
|
|
394
|
+
#### Common Endpoints
|
|
395
|
+
- GET \`/objects\` \u2014 List all objects
|
|
396
|
+
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
159
397
|
- POST \`/objects/{object}/records/query\` \u2014 Query records (people, companies, deals, etc.)
|
|
160
398
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 Get a record
|
|
161
399
|
- POST \`/objects/{object}/records\` \u2014 Create a record
|
|
162
400
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 Update a record
|
|
163
401
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 Delete a record
|
|
164
|
-
- GET \`/objects\` \u2014 List all objects
|
|
165
|
-
- GET \`/objects/{object}/attributes\` \u2014 List attributes of an object
|
|
166
402
|
- POST \`/lists/{list_id}/entries/query\` \u2014 Query list entries
|
|
167
403
|
- POST \`/notes\` \u2014 Create a note
|
|
168
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
169
|
-
|
|
170
|
-
|
|
404
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 Get notes for a record
|
|
405
|
+
|
|
406
|
+
#### Query Body (for POST /objects/{object}/records/query)
|
|
407
|
+
- \`filter\` \u2014 Filter conditions
|
|
408
|
+
- \`sorts\` \u2014 Array of sort specifications
|
|
409
|
+
- \`limit\` \u2014 Max records per page (default 25)
|
|
410
|
+
- \`offset\` \u2014 Pagination offset`,
|
|
411
|
+
ja: `### \u30C4\u30FC\u30EB
|
|
412
|
+
|
|
413
|
+
- \`attio_request\`: Attio REST API\u3092\u547C\u3073\u51FA\u3059\u552F\u4E00\u306E\u624B\u6BB5\u3067\u3059\u3002\u30EC\u30B3\u30FC\u30C9\uFF08people\u3001companies\u3001deals\uFF09\u306E\u30AF\u30A8\u30EA\u3001\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3084\u5C5E\u6027\u306E\u4E00\u89A7\u8868\u793A\u3001\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u306E\u7BA1\u7406\u3001\u30CE\u30FC\u30C8\u306E\u64CD\u4F5C\u306B\u4F7F\u7528\u3057\u307E\u3059\u3002\u8A8D\u8A3C\uFF08Bearer\u30C8\u30FC\u30AF\u30F3\uFF09\u306F\u81EA\u52D5\u7684\u306B\u8A2D\u5B9A\u3055\u308C\u307E\u3059\u3002\u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u306B\u306FGET\u3067\u306F\u306A\u304FPOST\u3092\u30D5\u30A3\u30EB\u30BF\u4ED8\u304D\u306E\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3\u3067\u4F7F\u7528\u3059\u308B\u70B9\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
414
|
+
|
|
415
|
+
### Business Logic
|
|
416
|
+
|
|
417
|
+
\u3053\u306E\u30B3\u30CD\u30AF\u30BF\u306E\u30D3\u30B8\u30CD\u30B9\u30ED\u30B8\u30C3\u30AF\u30BF\u30A4\u30D7\u306F "typescript" \u3067\u3059\u3002\u30CF\u30F3\u30C9\u30E9\u5185\u3067\u306F\u30B3\u30CD\u30AF\u30BFSDK\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u74B0\u5883\u5909\u6570\u304B\u3089\u8A8D\u8A3C\u60C5\u5831\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002
|
|
418
|
+
|
|
419
|
+
SDK\u30E1\u30BD\u30C3\u30C9 (\`connection(connectionId)\` \u3067\u4F5C\u6210\u3057\u305F\u30AF\u30E9\u30A4\u30A2\u30F3\u30C8):
|
|
420
|
+
- \`client.request(path, init?)\` \u2014 \u4F4E\u30EC\u30D9\u30EB\u306E\u8A8D\u8A3C\u4ED8\u304Dfetch
|
|
421
|
+
- \`client.listObjects()\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
422
|
+
- \`client.listAttributes(object)\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
423
|
+
- \`client.queryRecords(object, options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF/\u30BD\u30FC\u30C8/\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u30EC\u30B3\u30FC\u30C9\u3092\u30AF\u30A8\u30EA
|
|
424
|
+
- \`client.getRecord(object, recordId)\` \u2014 \u5358\u4E00\u30EC\u30B3\u30FC\u30C9\u3092\u53D6\u5F97
|
|
425
|
+
- \`client.queryListEntries(listId, options?)\` \u2014 \u30D5\u30A3\u30EB\u30BF/\u30BD\u30FC\u30C8/\u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u4ED8\u304D\u3067\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u3092\u30AF\u30A8\u30EA
|
|
171
426
|
|
|
172
427
|
\`\`\`ts
|
|
428
|
+
import type { Context } from "hono";
|
|
173
429
|
import { connection } from "@squadbase/vite-server/connectors/attio";
|
|
174
430
|
|
|
175
|
-
const
|
|
431
|
+
const attio = connection("<connectionId>");
|
|
176
432
|
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
|
|
433
|
+
export default async function handler(c: Context) {
|
|
434
|
+
const { object = "people", limit = 25 } = await c.req.json<{
|
|
435
|
+
object?: string;
|
|
436
|
+
limit?: number;
|
|
437
|
+
}>();
|
|
438
|
+
|
|
439
|
+
const { data } = await attio.queryRecords(object, { limit });
|
|
440
|
+
|
|
441
|
+
return c.json({ records: data });
|
|
442
|
+
}
|
|
187
443
|
\`\`\`
|
|
188
444
|
|
|
189
|
-
### \
|
|
445
|
+
### Attio REST API \u30EA\u30D5\u30A1\u30EC\u30F3\u30B9
|
|
446
|
+
|
|
447
|
+
- \u30D9\u30FC\u30B9URL: \`https://api.attio.com/v2\`
|
|
448
|
+
- \u8A8D\u8A3C: Bearer\u30C8\u30FC\u30AF\u30F3\uFF08\u81EA\u52D5\u8A2D\u5B9A\uFF09
|
|
449
|
+
- \u30EC\u30B3\u30FC\u30C9\u306E\u30AF\u30A8\u30EA\u306B\u306FGET\u30AF\u30A8\u30EA\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u306F\u306A\u304FPOST\u3067JSON\u30DC\u30C7\u30A3\u3092\u4F7F\u7528\u3057\u307E\u3059
|
|
450
|
+
|
|
451
|
+
#### \u4E3B\u8981\u30A8\u30F3\u30C9\u30DD\u30A4\u30F3\u30C8
|
|
452
|
+
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
453
|
+
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
190
454
|
- POST \`/objects/{object}/records/query\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u691C\u7D22\uFF08people\u3001companies\u3001deals\u306A\u3069\uFF09
|
|
191
455
|
- GET \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u53D6\u5F97
|
|
192
456
|
- POST \`/objects/{object}/records\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u4F5C\u6210
|
|
193
457
|
- PATCH \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u66F4\u65B0
|
|
194
458
|
- DELETE \`/objects/{object}/records/{record_id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u524A\u9664
|
|
195
|
-
- GET \`/objects\` \u2014 \u5168\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u4E00\u89A7
|
|
196
|
-
- GET \`/objects/{object}/attributes\` \u2014 \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C5E\u6027\u4E00\u89A7
|
|
197
459
|
- POST \`/lists/{list_id}/entries/query\` \u2014 \u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u306E\u691C\u7D22
|
|
198
460
|
- POST \`/notes\` \u2014 \u30CE\u30FC\u30C8\u306E\u4F5C\u6210
|
|
199
|
-
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
461
|
+
- GET \`/notes?parent_object={object}&parent_record_id={id}\` \u2014 \u30EC\u30B3\u30FC\u30C9\u306E\u30CE\u30FC\u30C8\u3092\u53D6\u5F97
|
|
462
|
+
|
|
463
|
+
#### \u30AF\u30A8\u30EA\u30DC\u30C7\u30A3 (POST /objects/{object}/records/query)
|
|
464
|
+
- \`filter\` \u2014 \u30D5\u30A3\u30EB\u30BF\u6761\u4EF6
|
|
465
|
+
- \`sorts\` \u2014 \u30BD\u30FC\u30C8\u6307\u5B9A\u306E\u914D\u5217
|
|
466
|
+
- \`limit\` \u2014 \u30DA\u30FC\u30B8\u3042\u305F\u308A\u306E\u6700\u5927\u30EC\u30B3\u30FC\u30C9\u6570\uFF08\u30C7\u30D5\u30A9\u30EB\u30C825\uFF09
|
|
467
|
+
- \`offset\` \u2014 \u30DA\u30FC\u30B8\u30CD\u30FC\u30B7\u30E7\u30F3\u30AA\u30D5\u30BB\u30C3\u30C8`
|
|
200
468
|
},
|
|
201
469
|
tools
|
|
202
470
|
});
|