@zapier/zapier-sdk 0.12.0 → 0.12.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/CHANGELOG.md +6 -0
- package/README.md +207 -60
- package/dist/index.cjs +66 -27
- package/dist/index.d.mts +19 -7
- package/dist/index.mjs +66 -27
- package/dist/plugins/apps/index.d.ts +2 -2
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +21 -0
- package/dist/plugins/apps/schemas.d.ts +43 -0
- package/dist/plugins/apps/schemas.d.ts.map +1 -0
- package/dist/plugins/apps/schemas.js +13 -0
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +12 -1
- package/dist/types/sdk.d.ts +1 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/apps/index.ts +28 -7
- package/src/plugins/apps/{types.ts → schemas.ts} +20 -8
- package/src/plugins/registry/index.ts +12 -1
- package/src/types/sdk.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/plugins/apps/types.d.ts +0 -30
- package/dist/plugins/apps/types.d.ts.map +0 -1
- package/dist/plugins/apps/types.js +0 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
- [`listInputFields`](#listinputfields)
|
|
15
15
|
- [`runAction`](#runaction)
|
|
16
16
|
- [Apps](#apps)
|
|
17
|
+
- [`apps.{appKey}`](#appsappkey)
|
|
18
|
+
- [`apps.{appKey}.{actionType}.{actionKey}`](#appsappkeyactiontypeactionkey)
|
|
17
19
|
- [`getApp`](#getapp)
|
|
18
20
|
- [`listApps`](#listapps)
|
|
19
21
|
- [Authentications](#authentications)
|
|
@@ -121,16 +123,16 @@ Get current user's profile information
|
|
|
121
123
|
|
|
122
124
|
**Parameters:**
|
|
123
125
|
|
|
124
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
125
|
-
| --------- | -------- | -------- | ------- | --------------- |
|
|
126
|
-
| `options` | `
|
|
126
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
127
|
+
| --------- | -------- | -------- | ------- | --------------- | ----------- |
|
|
128
|
+
| `options` | `object` | ❌ | — | — | |
|
|
127
129
|
|
|
128
130
|
**Returns:** `Promise<ProfileItem>`
|
|
129
131
|
|
|
130
132
|
**Example:**
|
|
131
133
|
|
|
132
134
|
```typescript
|
|
133
|
-
const
|
|
135
|
+
const { data: profile } = await sdk.getProfile();
|
|
134
136
|
```
|
|
135
137
|
|
|
136
138
|
### Actions
|
|
@@ -143,7 +145,7 @@ Get detailed information about a specific action
|
|
|
143
145
|
|
|
144
146
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
145
147
|
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
146
|
-
| `options` | `
|
|
148
|
+
| `options` | `object` | ✅ | — | — | |
|
|
147
149
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
148
150
|
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
149
151
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -153,8 +155,7 @@ Get detailed information about a specific action
|
|
|
153
155
|
**Example:**
|
|
154
156
|
|
|
155
157
|
```typescript
|
|
156
|
-
const
|
|
157
|
-
options: "example-value",
|
|
158
|
+
const { data: action } = await sdk.getAction({
|
|
158
159
|
appKey: "example-key",
|
|
159
160
|
actionType: "read",
|
|
160
161
|
actionKey: "example-key",
|
|
@@ -169,7 +170,7 @@ List all actions for a specific app
|
|
|
169
170
|
|
|
170
171
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
171
172
|
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
172
|
-
| `options` | `
|
|
173
|
+
| `options` | `object` | ✅ | — | — | |
|
|
173
174
|
| ↳ `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
174
175
|
| ↳ `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
175
176
|
| ↳ `pageSize` | `number` | ❌ | — | — | Number of actions per page |
|
|
@@ -180,10 +181,26 @@ List all actions for a specific app
|
|
|
180
181
|
**Example:**
|
|
181
182
|
|
|
182
183
|
```typescript
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
// Get first page and a cursor for the second page
|
|
185
|
+
const { data: actions, nextCursor } = await sdk.listActions({
|
|
185
186
|
appKey: "example-key",
|
|
186
187
|
});
|
|
188
|
+
|
|
189
|
+
// Or iterate over all pages
|
|
190
|
+
for await (const page of sdk.listActions({
|
|
191
|
+
appKey: "example-key",
|
|
192
|
+
})) {
|
|
193
|
+
// Do something with each page
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Or iterate over individual items across all pages
|
|
197
|
+
for await (const action of sdk
|
|
198
|
+
.listActions({
|
|
199
|
+
appKey: "example-key",
|
|
200
|
+
})
|
|
201
|
+
.items()) {
|
|
202
|
+
// Do something with each action
|
|
203
|
+
}
|
|
187
204
|
```
|
|
188
205
|
|
|
189
206
|
#### `listInputFieldChoices`
|
|
@@ -192,31 +209,55 @@ Get the available choices for a dynamic dropdown input field
|
|
|
192
209
|
|
|
193
210
|
**Parameters:**
|
|
194
211
|
|
|
195
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
196
|
-
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- |
|
|
197
|
-
| `options` | `
|
|
198
|
-
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
199
|
-
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type
|
|
200
|
-
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute
|
|
201
|
-
| ↳ `inputFieldKey` | `string` | ✅ | — | — | Input field key to get choices for.
|
|
202
|
-
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action
|
|
203
|
-
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect available choices
|
|
204
|
-
| ↳ `page` | `number` | ❌ | — | — | Page number for paginated results
|
|
205
|
-
| ↳ `pageSize` | `number` | ❌ | — | — | Number of choices per page
|
|
206
|
-
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages
|
|
212
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
213
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
214
|
+
| `options` | `object` | ✅ | — | — | |
|
|
215
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
216
|
+
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
217
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
218
|
+
| ↳ `inputFieldKey` | `string` | ✅ | — | — | Input field key to get choices for. |
|
|
219
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
220
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect available choices |
|
|
221
|
+
| ↳ `page` | `number` | ❌ | — | — | Page number for paginated results |
|
|
222
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of choices per page |
|
|
223
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
207
224
|
|
|
208
225
|
**Returns:** `Promise<PaginatedResult<InputFieldChoiceItem>>`
|
|
209
226
|
|
|
210
227
|
**Example:**
|
|
211
228
|
|
|
212
229
|
```typescript
|
|
213
|
-
|
|
214
|
-
|
|
230
|
+
// Get first page and a cursor for the second page
|
|
231
|
+
const { data: inputFieldChoices, nextCursor } = await sdk.listInputFieldChoices(
|
|
232
|
+
{
|
|
233
|
+
appKey: "example-key",
|
|
234
|
+
actionType: "read",
|
|
235
|
+
actionKey: "example-key",
|
|
236
|
+
inputFieldKey: "example-key",
|
|
237
|
+
},
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
// Or iterate over all pages
|
|
241
|
+
for await (const page of sdk.listInputFieldChoices({
|
|
215
242
|
appKey: "example-key",
|
|
216
243
|
actionType: "read",
|
|
217
244
|
actionKey: "example-key",
|
|
218
245
|
inputFieldKey: "example-key",
|
|
219
|
-
})
|
|
246
|
+
})) {
|
|
247
|
+
// Do something with each page
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Or iterate over individual items across all pages
|
|
251
|
+
for await (const inputFieldChoice of sdk
|
|
252
|
+
.listInputFieldChoices({
|
|
253
|
+
appKey: "example-key",
|
|
254
|
+
actionType: "read",
|
|
255
|
+
actionKey: "example-key",
|
|
256
|
+
inputFieldKey: "example-key",
|
|
257
|
+
})
|
|
258
|
+
.items()) {
|
|
259
|
+
// Do something with each inputFieldChoice
|
|
260
|
+
}
|
|
220
261
|
```
|
|
221
262
|
|
|
222
263
|
#### `listInputFields`
|
|
@@ -227,7 +268,7 @@ Get the input fields required for a specific action
|
|
|
227
268
|
|
|
228
269
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
229
270
|
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
230
|
-
| `options` | `
|
|
271
|
+
| `options` | `object` | ✅ | — | — | |
|
|
231
272
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
232
273
|
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
233
274
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -241,12 +282,32 @@ Get the input fields required for a specific action
|
|
|
241
282
|
**Example:**
|
|
242
283
|
|
|
243
284
|
```typescript
|
|
244
|
-
|
|
245
|
-
|
|
285
|
+
// Get first page and a cursor for the second page
|
|
286
|
+
const { data: rootFieldItems, nextCursor } = await sdk.listInputFields({
|
|
246
287
|
appKey: "example-key",
|
|
247
288
|
actionType: "read",
|
|
248
289
|
actionKey: "example-key",
|
|
249
290
|
});
|
|
291
|
+
|
|
292
|
+
// Or iterate over all pages
|
|
293
|
+
for await (const page of sdk.listInputFields({
|
|
294
|
+
appKey: "example-key",
|
|
295
|
+
actionType: "read",
|
|
296
|
+
actionKey: "example-key",
|
|
297
|
+
})) {
|
|
298
|
+
// Do something with each page
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Or iterate over individual items across all pages
|
|
302
|
+
for await (const rootFieldItem of sdk
|
|
303
|
+
.listInputFields({
|
|
304
|
+
appKey: "example-key",
|
|
305
|
+
actionType: "read",
|
|
306
|
+
actionKey: "example-key",
|
|
307
|
+
})
|
|
308
|
+
.items()) {
|
|
309
|
+
// Do something with each rootFieldItem
|
|
310
|
+
}
|
|
250
311
|
```
|
|
251
312
|
|
|
252
313
|
#### `runAction`
|
|
@@ -257,7 +318,7 @@ Execute an action with the given inputs
|
|
|
257
318
|
|
|
258
319
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
259
320
|
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
260
|
-
| `options` | `
|
|
321
|
+
| `options` | `object` | ✅ | — | — | |
|
|
261
322
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
262
323
|
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type |
|
|
263
324
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -271,16 +332,91 @@ Execute an action with the given inputs
|
|
|
271
332
|
**Example:**
|
|
272
333
|
|
|
273
334
|
```typescript
|
|
274
|
-
|
|
275
|
-
|
|
335
|
+
// Get first page and a cursor for the second page
|
|
336
|
+
const { data: actionResults, nextCursor } = await sdk.runAction({
|
|
276
337
|
appKey: "example-key",
|
|
277
338
|
actionType: "read",
|
|
278
339
|
actionKey: "example-key",
|
|
279
340
|
});
|
|
341
|
+
|
|
342
|
+
// Or iterate over all pages
|
|
343
|
+
for await (const page of sdk.runAction({
|
|
344
|
+
appKey: "example-key",
|
|
345
|
+
actionType: "read",
|
|
346
|
+
actionKey: "example-key",
|
|
347
|
+
})) {
|
|
348
|
+
// Do something with each page
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Or iterate over individual items across all pages
|
|
352
|
+
for await (const actionResult of sdk
|
|
353
|
+
.runAction({
|
|
354
|
+
appKey: "example-key",
|
|
355
|
+
actionType: "read",
|
|
356
|
+
actionKey: "example-key",
|
|
357
|
+
})
|
|
358
|
+
.items()) {
|
|
359
|
+
// Do something with each actionResult
|
|
360
|
+
}
|
|
280
361
|
```
|
|
281
362
|
|
|
282
363
|
### Apps
|
|
283
364
|
|
|
365
|
+
#### `apps.{appKey}`
|
|
366
|
+
|
|
367
|
+
Bind an authentication ID to an app
|
|
368
|
+
|
|
369
|
+
**Parameters:**
|
|
370
|
+
|
|
371
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
372
|
+
| -------------------- | -------- | -------- | ------- | --------------- | ----------- |
|
|
373
|
+
| `options` | `object` | ✅ | — | — | |
|
|
374
|
+
| ↳ `authenticationId` | `number` | ✅ | — | — | |
|
|
375
|
+
|
|
376
|
+
**Returns:** `Promise<AppProxy>`
|
|
377
|
+
|
|
378
|
+
**Example:**
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
const result = await sdk.apps.appKey({
|
|
382
|
+
authenticationId: 12345,
|
|
383
|
+
});
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
#### `apps.{appKey}.{actionType}.{actionKey}`
|
|
387
|
+
|
|
388
|
+
Execute an action with the given inputs for the bound app, as an alternative to runAction
|
|
389
|
+
|
|
390
|
+
**Parameters:**
|
|
391
|
+
|
|
392
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
393
|
+
| -------------------- | -------- | -------- | ------- | --------------- | ----------- |
|
|
394
|
+
| `options` | `object` | ✅ | — | — | |
|
|
395
|
+
| ↳ `inputs` | `object` | ❌ | — | — | |
|
|
396
|
+
| ↳ `authenticationId` | `number` | ❌ | — | — | |
|
|
397
|
+
|
|
398
|
+
**Returns:** `Promise<PaginatedResult<ActionResultItem>>`
|
|
399
|
+
|
|
400
|
+
**Example:**
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
// Get first page and a cursor for the second page
|
|
404
|
+
const { data: actionResults, nextCursor } =
|
|
405
|
+
await sdk.apps.appKey.actionType.actionKey();
|
|
406
|
+
|
|
407
|
+
// Or iterate over all pages
|
|
408
|
+
for await (const page of sdk.apps.appKey.actionType.actionKey()) {
|
|
409
|
+
// Do something with each page
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Or iterate over individual items across all pages
|
|
413
|
+
for await (const actionResult of sdk.apps.appKey.actionType
|
|
414
|
+
.actionKey()
|
|
415
|
+
.items()) {
|
|
416
|
+
// Do something with each actionResult
|
|
417
|
+
}
|
|
418
|
+
```
|
|
419
|
+
|
|
284
420
|
#### `getApp`
|
|
285
421
|
|
|
286
422
|
Get detailed information about a specific app
|
|
@@ -289,7 +425,7 @@ Get detailed information about a specific app
|
|
|
289
425
|
|
|
290
426
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
291
427
|
| ---------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
292
|
-
| `options` | `
|
|
428
|
+
| `options` | `object` | ✅ | — | — | |
|
|
293
429
|
| ↳ `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
294
430
|
|
|
295
431
|
**Returns:** `Promise<AppItem>`
|
|
@@ -297,8 +433,7 @@ Get detailed information about a specific app
|
|
|
297
433
|
**Example:**
|
|
298
434
|
|
|
299
435
|
```typescript
|
|
300
|
-
const
|
|
301
|
-
options: "example-value",
|
|
436
|
+
const { data: app } = await sdk.getApp({
|
|
302
437
|
appKey: "example-key",
|
|
303
438
|
});
|
|
304
439
|
```
|
|
@@ -311,7 +446,7 @@ List all available apps with optional filtering
|
|
|
311
446
|
|
|
312
447
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
313
448
|
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
314
|
-
| `options` | `
|
|
449
|
+
| `options` | `object` | ✅ | — | — | |
|
|
315
450
|
| ↳ `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
316
451
|
| ↳ `search` | `string` | ❌ | — | — | Search for apps by name |
|
|
317
452
|
| ↳ `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
@@ -322,9 +457,18 @@ List all available apps with optional filtering
|
|
|
322
457
|
**Example:**
|
|
323
458
|
|
|
324
459
|
```typescript
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
460
|
+
// Get first page and a cursor for the second page
|
|
461
|
+
const { data: apps, nextCursor } = await sdk.listApps();
|
|
462
|
+
|
|
463
|
+
// Or iterate over all pages
|
|
464
|
+
for await (const page of sdk.listApps()) {
|
|
465
|
+
// Do something with each page
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Or iterate over individual items across all pages
|
|
469
|
+
for await (const app of sdk.listApps().items()) {
|
|
470
|
+
// Do something with each app
|
|
471
|
+
}
|
|
328
472
|
```
|
|
329
473
|
|
|
330
474
|
### Authentications
|
|
@@ -337,7 +481,7 @@ Find the first authentication matching the criteria
|
|
|
337
481
|
|
|
338
482
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
339
483
|
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
340
|
-
| `options` | `
|
|
484
|
+
| `options` | `object` | ✅ | — | — | |
|
|
341
485
|
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
342
486
|
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
343
487
|
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
@@ -349,9 +493,7 @@ Find the first authentication matching the criteria
|
|
|
349
493
|
**Example:**
|
|
350
494
|
|
|
351
495
|
```typescript
|
|
352
|
-
const
|
|
353
|
-
options: "example-value",
|
|
354
|
-
});
|
|
496
|
+
const { data: authentication } = await sdk.findFirstAuthentication();
|
|
355
497
|
```
|
|
356
498
|
|
|
357
499
|
#### `findUniqueAuthentication`
|
|
@@ -362,7 +504,7 @@ Find a unique authentication matching the criteria
|
|
|
362
504
|
|
|
363
505
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
364
506
|
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
365
|
-
| `options` | `
|
|
507
|
+
| `options` | `object` | ✅ | — | — | |
|
|
366
508
|
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
367
509
|
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
368
510
|
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
@@ -374,9 +516,7 @@ Find a unique authentication matching the criteria
|
|
|
374
516
|
**Example:**
|
|
375
517
|
|
|
376
518
|
```typescript
|
|
377
|
-
const
|
|
378
|
-
options: "example-value",
|
|
379
|
-
});
|
|
519
|
+
const { data: authentication } = await sdk.findUniqueAuthentication();
|
|
380
520
|
```
|
|
381
521
|
|
|
382
522
|
#### `getAuthentication`
|
|
@@ -385,18 +525,17 @@ Get a specific authentication by ID
|
|
|
385
525
|
|
|
386
526
|
**Parameters:**
|
|
387
527
|
|
|
388
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
389
|
-
| -------------------- | -------- | -------- | ------- | --------------- |
|
|
390
|
-
| `options` | `
|
|
391
|
-
| ↳ `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve
|
|
528
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
529
|
+
| -------------------- | -------- | -------- | ------- | --------------- | ----------------------------- |
|
|
530
|
+
| `options` | `object` | ✅ | — | — | |
|
|
531
|
+
| ↳ `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve |
|
|
392
532
|
|
|
393
533
|
**Returns:** `Promise<AuthenticationItem>`
|
|
394
534
|
|
|
395
535
|
**Example:**
|
|
396
536
|
|
|
397
537
|
```typescript
|
|
398
|
-
const
|
|
399
|
-
options: "example-value",
|
|
538
|
+
const { data: authentication } = await sdk.getAuthentication({
|
|
400
539
|
authenticationId: 12345,
|
|
401
540
|
});
|
|
402
541
|
```
|
|
@@ -409,7 +548,7 @@ List available authentications with optional filtering
|
|
|
409
548
|
|
|
410
549
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
411
550
|
| --------------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------ |
|
|
412
|
-
| `options` | `
|
|
551
|
+
| `options` | `object` | ✅ | — | — | |
|
|
413
552
|
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI') |
|
|
414
553
|
| ↳ `authenticationIds` | `array` | ❌ | — | — | List of authentication IDs to filter by |
|
|
415
554
|
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
@@ -424,9 +563,18 @@ List available authentications with optional filtering
|
|
|
424
563
|
**Example:**
|
|
425
564
|
|
|
426
565
|
```typescript
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
566
|
+
// Get first page and a cursor for the second page
|
|
567
|
+
const { data: authentications, nextCursor } = await sdk.listAuthentications();
|
|
568
|
+
|
|
569
|
+
// Or iterate over all pages
|
|
570
|
+
for await (const page of sdk.listAuthentications()) {
|
|
571
|
+
// Do something with each page
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// Or iterate over individual items across all pages
|
|
575
|
+
for await (const authentication of sdk.listAuthentications().items()) {
|
|
576
|
+
// Do something with each authentication
|
|
577
|
+
}
|
|
430
578
|
```
|
|
431
579
|
|
|
432
580
|
### HTTP Requests
|
|
@@ -440,7 +588,7 @@ Execute fetch
|
|
|
440
588
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
441
589
|
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
442
590
|
| `url` | `string` | ✅ | — | — | The URL to fetch |
|
|
443
|
-
| `init` | `
|
|
591
|
+
| `init` | `object` | ❌ | — | — | Fetch options including authentication |
|
|
444
592
|
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | |
|
|
445
593
|
| ↳ `headers` | `object` | ❌ | — | — | |
|
|
446
594
|
| ↳ `body` | `string` | ❌ | — | — | |
|
|
@@ -453,7 +601,7 @@ Execute fetch
|
|
|
453
601
|
**Example:**
|
|
454
602
|
|
|
455
603
|
```typescript
|
|
456
|
-
const result = await sdk.fetch("https://example.com");
|
|
604
|
+
const result = await sdk.fetch("https://example.com", { key: "value" });
|
|
457
605
|
```
|
|
458
606
|
|
|
459
607
|
#### `request`
|
|
@@ -464,7 +612,7 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
464
612
|
|
|
465
613
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
466
614
|
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
467
|
-
| `options` | `
|
|
615
|
+
| `options` | `object` | ✅ | — | — | |
|
|
468
616
|
| ↳ `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
|
|
469
617
|
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
|
|
470
618
|
| ↳ `body` | `string` | ❌ | — | — | Request body as a string |
|
|
@@ -480,7 +628,6 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
480
628
|
|
|
481
629
|
```typescript
|
|
482
630
|
const result = await sdk.request({
|
|
483
|
-
options: "example-value",
|
|
484
631
|
url: "https://example.com",
|
|
485
632
|
});
|
|
486
633
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -192,6 +192,40 @@ HTTP Status: ${error.statusCode}`;
|
|
|
192
192
|
}
|
|
193
193
|
return message;
|
|
194
194
|
}
|
|
195
|
+
var ActionExecutionInputSchema = zod.z.object({
|
|
196
|
+
inputs: zod.z.record(zod.z.unknown()).optional(),
|
|
197
|
+
authenticationId: zod.z.number().optional()
|
|
198
|
+
}).describe(
|
|
199
|
+
"Execute an action with the given inputs for the bound app, as an alternative to runAction"
|
|
200
|
+
);
|
|
201
|
+
var AppFactoryInputSchema = zod.z.object({
|
|
202
|
+
authenticationId: zod.z.number()
|
|
203
|
+
}).describe("Bind an authentication ID to an app");
|
|
204
|
+
function getStringProperty(obj, key) {
|
|
205
|
+
if (typeof obj === "object" && obj !== null && key in obj) {
|
|
206
|
+
const value = obj[key];
|
|
207
|
+
return typeof value === "string" ? value : void 0;
|
|
208
|
+
}
|
|
209
|
+
return void 0;
|
|
210
|
+
}
|
|
211
|
+
function formatActionResult(item) {
|
|
212
|
+
const obj = typeof item === "object" && item !== null ? item : {};
|
|
213
|
+
const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
|
|
214
|
+
return {
|
|
215
|
+
title,
|
|
216
|
+
id: getStringProperty(obj, "id"),
|
|
217
|
+
key: getStringProperty(obj, "key"),
|
|
218
|
+
description: getStringProperty(obj, "description"),
|
|
219
|
+
data: item,
|
|
220
|
+
// Let formatJsonOutput handle the JSON rendering
|
|
221
|
+
details: []
|
|
222
|
+
// Not used when data is provided
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
var ActionResultItemSchema = withFormatter(
|
|
226
|
+
zod.z.unknown().describe("Action execution result"),
|
|
227
|
+
{ format: formatActionResult }
|
|
228
|
+
);
|
|
195
229
|
|
|
196
230
|
// src/plugins/apps/index.ts
|
|
197
231
|
function createActionFunction(appKey, actionType, actionKey, options, pinnedAuthId) {
|
|
@@ -295,7 +329,26 @@ function createAppsProxy(options) {
|
|
|
295
329
|
}
|
|
296
330
|
var appsPlugin = ({ sdk }) => {
|
|
297
331
|
return {
|
|
298
|
-
apps: createAppsProxy({ sdk })
|
|
332
|
+
apps: createAppsProxy({ sdk }),
|
|
333
|
+
context: {
|
|
334
|
+
meta: {
|
|
335
|
+
"apps.{appKey}": {
|
|
336
|
+
categories: ["app"],
|
|
337
|
+
packages: ["sdk"],
|
|
338
|
+
type: "function",
|
|
339
|
+
inputSchema: AppFactoryInputSchema,
|
|
340
|
+
returnType: "AppProxy"
|
|
341
|
+
},
|
|
342
|
+
"apps.{appKey}.{actionType}.{actionKey}": {
|
|
343
|
+
categories: ["app"],
|
|
344
|
+
packages: ["sdk"],
|
|
345
|
+
type: "list",
|
|
346
|
+
inputSchema: ActionExecutionInputSchema,
|
|
347
|
+
itemType: "ActionResult",
|
|
348
|
+
outputSchema: ActionResultItemSchema
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
299
352
|
};
|
|
300
353
|
};
|
|
301
354
|
var FetchUrlSchema = zod.z.union([zod.z.string(), zod.z.instanceof(URL)]).describe("The URL to fetch");
|
|
@@ -2261,31 +2314,6 @@ var RunActionSchema = zod.z.object({
|
|
|
2261
2314
|
pageSize: zod.z.number().min(1).optional().describe("Number of results per page"),
|
|
2262
2315
|
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages")
|
|
2263
2316
|
}).describe("Execute an action with the given inputs");
|
|
2264
|
-
function getStringProperty(obj, key) {
|
|
2265
|
-
if (typeof obj === "object" && obj !== null && key in obj) {
|
|
2266
|
-
const value = obj[key];
|
|
2267
|
-
return typeof value === "string" ? value : void 0;
|
|
2268
|
-
}
|
|
2269
|
-
return void 0;
|
|
2270
|
-
}
|
|
2271
|
-
function formatActionResult(item) {
|
|
2272
|
-
const obj = typeof item === "object" && item !== null ? item : {};
|
|
2273
|
-
const title = getStringProperty(obj, "title") || getStringProperty(obj, "name") || getStringProperty(obj, "label") || getStringProperty(obj, "subject") || "Action Result";
|
|
2274
|
-
return {
|
|
2275
|
-
title,
|
|
2276
|
-
id: getStringProperty(obj, "id"),
|
|
2277
|
-
key: getStringProperty(obj, "key"),
|
|
2278
|
-
description: getStringProperty(obj, "description"),
|
|
2279
|
-
data: item,
|
|
2280
|
-
// Let formatJsonOutput handle the JSON rendering
|
|
2281
|
-
details: []
|
|
2282
|
-
// Not used when data is provided
|
|
2283
|
-
};
|
|
2284
|
-
}
|
|
2285
|
-
var ActionResultItemSchema = withFormatter(
|
|
2286
|
-
zod.z.unknown().describe("Action execution result"),
|
|
2287
|
-
{ format: formatActionResult }
|
|
2288
|
-
);
|
|
2289
2317
|
|
|
2290
2318
|
// src/plugins/runAction/index.ts
|
|
2291
2319
|
async function executeAction(actionOptions) {
|
|
@@ -3517,7 +3545,18 @@ var registryPlugin = ({ sdk, context }) => {
|
|
|
3517
3545
|
title: "Other"
|
|
3518
3546
|
}
|
|
3519
3547
|
};
|
|
3520
|
-
const functions = metaKeys.filter((key) =>
|
|
3548
|
+
const functions = metaKeys.filter((key) => {
|
|
3549
|
+
const property = sdk[key];
|
|
3550
|
+
if (typeof property === "function") {
|
|
3551
|
+
return true;
|
|
3552
|
+
}
|
|
3553
|
+
const [rootKey] = key.split(".");
|
|
3554
|
+
const rootProperty = sdk[rootKey];
|
|
3555
|
+
if (typeof rootProperty === "object" && rootProperty !== null) {
|
|
3556
|
+
return true;
|
|
3557
|
+
}
|
|
3558
|
+
return false;
|
|
3559
|
+
}).map((key) => {
|
|
3521
3560
|
const meta = context.meta[key];
|
|
3522
3561
|
return {
|
|
3523
3562
|
name: key,
|
package/dist/index.d.mts
CHANGED
|
@@ -1613,13 +1613,25 @@ declare const getProfilePlugin: Plugin<{}, // no SDK dependencies
|
|
|
1613
1613
|
}, // requires api in context
|
|
1614
1614
|
GetProfilePluginProvides>;
|
|
1615
1615
|
|
|
1616
|
-
|
|
1617
|
-
inputs
|
|
1618
|
-
authenticationId
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1616
|
+
declare const ActionExecutionInputSchema: z.ZodObject<{
|
|
1617
|
+
inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1618
|
+
authenticationId: z.ZodOptional<z.ZodNumber>;
|
|
1619
|
+
}, "strip", z.ZodTypeAny, {
|
|
1620
|
+
authenticationId?: number | undefined;
|
|
1621
|
+
inputs?: Record<string, unknown> | undefined;
|
|
1622
|
+
}, {
|
|
1623
|
+
authenticationId?: number | undefined;
|
|
1624
|
+
inputs?: Record<string, unknown> | undefined;
|
|
1625
|
+
}>;
|
|
1626
|
+
type ActionExecutionOptions = z.infer<typeof ActionExecutionInputSchema>;
|
|
1627
|
+
declare const AppFactoryInputSchema: z.ZodObject<{
|
|
1628
|
+
authenticationId: z.ZodNumber;
|
|
1629
|
+
}, "strip", z.ZodTypeAny, {
|
|
1621
1630
|
authenticationId: number;
|
|
1622
|
-
}
|
|
1631
|
+
}, {
|
|
1632
|
+
authenticationId: number;
|
|
1633
|
+
}>;
|
|
1634
|
+
type AppFactoryInput = z.infer<typeof AppFactoryInputSchema>;
|
|
1623
1635
|
interface BaseActionTypeProxy {
|
|
1624
1636
|
[action: string]: (options?: ActionExecutionOptions) => unknown;
|
|
1625
1637
|
}
|
|
@@ -1635,7 +1647,7 @@ interface AppProxy {
|
|
|
1635
1647
|
[type: string]: ActionTypeProxy;
|
|
1636
1648
|
}
|
|
1637
1649
|
interface AppFactory {
|
|
1638
|
-
(options:
|
|
1650
|
+
(options: AppFactoryInput): AppProxy;
|
|
1639
1651
|
}
|
|
1640
1652
|
type AppProxyWithFactory = AppFactory & AppProxy;
|
|
1641
1653
|
interface ActionProxy {
|