@zapier/zapier-sdk 0.11.2 → 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 +12 -0
- package/README.md +285 -82
- package/dist/index.cjs +69 -28
- package/dist/index.d.mts +20 -8
- package/dist/index.mjs +69 -28
- 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/listAuthentications/schemas.d.ts +1 -1
- package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
- package/dist/plugins/listAuthentications/schemas.js +4 -1
- 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/listAuthentications/schemas.ts +6 -1
- 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
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c2f88bc: Fix usage examples, add rough apps proxy examples
|
|
8
|
+
|
|
9
|
+
## 0.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 21d8487: Improved get started README and added more documentation to the add plugin
|
|
14
|
+
|
|
3
15
|
## 0.11.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
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)
|
|
@@ -29,29 +31,85 @@
|
|
|
29
31
|
|
|
30
32
|
```bash
|
|
31
33
|
npm install @zapier/zapier-sdk
|
|
34
|
+
npm install -D @types/node typescript
|
|
35
|
+
npx tsc --init
|
|
32
36
|
```
|
|
33
37
|
|
|
34
38
|
## Quick Start
|
|
35
39
|
|
|
40
|
+
```bash
|
|
41
|
+
# Authenticates through your browser, automatically handling token management
|
|
42
|
+
npx zapier-sdk login
|
|
43
|
+
|
|
44
|
+
# Generate TypeScript types for the request/response signatures of apps.
|
|
45
|
+
# By default, the types will be generated inside of your `src` folder, if you have one, or the root folder.
|
|
46
|
+
# To use these types, ensure they are added to your `tsconfig.json` file.
|
|
47
|
+
|
|
48
|
+
# Single app
|
|
49
|
+
npx zapier-sdk add slack --types-output ./types/slack.ts
|
|
50
|
+
|
|
51
|
+
# Multiple apps
|
|
52
|
+
npx zapier-sdk add slack github trello
|
|
53
|
+
```
|
|
54
|
+
|
|
36
55
|
```typescript
|
|
37
56
|
import { createZapierSdk } from "@zapier/zapier-sdk";
|
|
38
57
|
|
|
39
|
-
|
|
40
|
-
|
|
58
|
+
// ######## Initialize Zapier SDK ########
|
|
59
|
+
// Running `zapier-sdk login` authenticates through your browser, automatically handling token management
|
|
60
|
+
const zapier = createZapierSdk();
|
|
61
|
+
|
|
62
|
+
// Option 2: Manually provide a token
|
|
63
|
+
// const zapier = createZapierSdk({
|
|
64
|
+
// token: "your_zapier_token_here", // or use ZAPIER_TOKEN env var
|
|
65
|
+
// });
|
|
66
|
+
|
|
67
|
+
// ######## Access Apps ########
|
|
68
|
+
const apps = await zapier.listApps();
|
|
69
|
+
const singleApp = await zapier.getApp({ appKey: "SlackCLIAPI" });
|
|
70
|
+
|
|
71
|
+
// ######## Authentication Usage ########
|
|
72
|
+
const myAuths = await zapier.listAuthentications({
|
|
73
|
+
appKey: "SlackCLIAPI",
|
|
74
|
+
owner: "me",
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// ######## Find Actions ########
|
|
78
|
+
// Option 1: List actions
|
|
79
|
+
const actions = await zapier.listActions({ appKey: "SlackCLIAPI" });
|
|
80
|
+
const singleAction = await zapier.getAction({
|
|
81
|
+
appKey: "SlackCLIAPI",
|
|
82
|
+
actionType: actions.data[0].action_type,
|
|
83
|
+
actionKey: actions.data[0].key,
|
|
41
84
|
});
|
|
42
85
|
|
|
43
|
-
//
|
|
44
|
-
|
|
86
|
+
// Option 2: Access actions via the `apps` proxy
|
|
87
|
+
// If you've generated TS types for an app using `zapier-sdk add`, you can access the app's actions like this:
|
|
88
|
+
|
|
89
|
+
// await zapier.apps.slack.read.channles({});
|
|
90
|
+
// await zapier.apps.slack.write.send_message({})
|
|
91
|
+
|
|
92
|
+
// ######## Run Actions ########
|
|
93
|
+
// Option 1:
|
|
94
|
+
const allChannels = await zapier.runAction({
|
|
95
|
+
appKey: "SlackCLIAPI",
|
|
96
|
+
actionType: "read",
|
|
97
|
+
actionKey: "channels",
|
|
98
|
+
authenticationId: myAuths.data[0].id,
|
|
99
|
+
});
|
|
45
100
|
|
|
46
|
-
//
|
|
47
|
-
const
|
|
101
|
+
// Option 2:
|
|
102
|
+
const allChannelsResult = await zapier.apps.slack.read.channels({
|
|
103
|
+
authenticationId: myAuths.data[0].id,
|
|
104
|
+
});
|
|
48
105
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
106
|
+
console.log({
|
|
107
|
+
apps: apps.data[0],
|
|
108
|
+
singleApp,
|
|
109
|
+
actions: actions.data[0],
|
|
110
|
+
singleAction,
|
|
111
|
+
allChannels: allChannels.data[0],
|
|
112
|
+
allChannelsResult,
|
|
55
113
|
});
|
|
56
114
|
```
|
|
57
115
|
|
|
@@ -65,16 +123,16 @@ Get current user's profile information
|
|
|
65
123
|
|
|
66
124
|
**Parameters:**
|
|
67
125
|
|
|
68
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
69
|
-
| --------- | -------- | -------- | ------- | --------------- |
|
|
70
|
-
| `options` | `
|
|
126
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
127
|
+
| --------- | -------- | -------- | ------- | --------------- | ----------- |
|
|
128
|
+
| `options` | `object` | ❌ | — | — | |
|
|
71
129
|
|
|
72
130
|
**Returns:** `Promise<ProfileItem>`
|
|
73
131
|
|
|
74
132
|
**Example:**
|
|
75
133
|
|
|
76
134
|
```typescript
|
|
77
|
-
const
|
|
135
|
+
const { data: profile } = await sdk.getProfile();
|
|
78
136
|
```
|
|
79
137
|
|
|
80
138
|
### Actions
|
|
@@ -87,7 +145,7 @@ Get detailed information about a specific action
|
|
|
87
145
|
|
|
88
146
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
89
147
|
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
90
|
-
| `options` | `
|
|
148
|
+
| `options` | `object` | ✅ | — | — | |
|
|
91
149
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
92
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 |
|
|
93
151
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -97,8 +155,7 @@ Get detailed information about a specific action
|
|
|
97
155
|
**Example:**
|
|
98
156
|
|
|
99
157
|
```typescript
|
|
100
|
-
const
|
|
101
|
-
options: "example-value",
|
|
158
|
+
const { data: action } = await sdk.getAction({
|
|
102
159
|
appKey: "example-key",
|
|
103
160
|
actionType: "read",
|
|
104
161
|
actionKey: "example-key",
|
|
@@ -113,7 +170,7 @@ List all actions for a specific app
|
|
|
113
170
|
|
|
114
171
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
115
172
|
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
116
|
-
| `options` | `
|
|
173
|
+
| `options` | `object` | ✅ | — | — | |
|
|
117
174
|
| ↳ `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
118
175
|
| ↳ `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
119
176
|
| ↳ `pageSize` | `number` | ❌ | — | — | Number of actions per page |
|
|
@@ -124,10 +181,26 @@ List all actions for a specific app
|
|
|
124
181
|
**Example:**
|
|
125
182
|
|
|
126
183
|
```typescript
|
|
127
|
-
|
|
128
|
-
|
|
184
|
+
// Get first page and a cursor for the second page
|
|
185
|
+
const { data: actions, nextCursor } = await sdk.listActions({
|
|
129
186
|
appKey: "example-key",
|
|
130
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
|
+
}
|
|
131
204
|
```
|
|
132
205
|
|
|
133
206
|
#### `listInputFieldChoices`
|
|
@@ -136,31 +209,55 @@ Get the available choices for a dynamic dropdown input field
|
|
|
136
209
|
|
|
137
210
|
**Parameters:**
|
|
138
211
|
|
|
139
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
140
|
-
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- |
|
|
141
|
-
| `options` | `
|
|
142
|
-
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI')
|
|
143
|
-
| ↳ `actionType` | `string` | ✅ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Action type that matches the action's defined type
|
|
144
|
-
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute
|
|
145
|
-
| ↳ `inputFieldKey` | `string` | ✅ | — | — | Input field key to get choices for.
|
|
146
|
-
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action
|
|
147
|
-
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect available choices
|
|
148
|
-
| ↳ `page` | `number` | ❌ | — | — | Page number for paginated results
|
|
149
|
-
| ↳ `pageSize` | `number` | ❌ | — | — | Number of choices per page
|
|
150
|
-
| ↳ `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 |
|
|
151
224
|
|
|
152
225
|
**Returns:** `Promise<PaginatedResult<InputFieldChoiceItem>>`
|
|
153
226
|
|
|
154
227
|
**Example:**
|
|
155
228
|
|
|
156
229
|
```typescript
|
|
157
|
-
|
|
158
|
-
|
|
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({
|
|
159
242
|
appKey: "example-key",
|
|
160
243
|
actionType: "read",
|
|
161
244
|
actionKey: "example-key",
|
|
162
245
|
inputFieldKey: "example-key",
|
|
163
|
-
})
|
|
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
|
+
}
|
|
164
261
|
```
|
|
165
262
|
|
|
166
263
|
#### `listInputFields`
|
|
@@ -171,7 +268,7 @@ Get the input fields required for a specific action
|
|
|
171
268
|
|
|
172
269
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
173
270
|
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
174
|
-
| `options` | `
|
|
271
|
+
| `options` | `object` | ✅ | — | — | |
|
|
175
272
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
176
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 |
|
|
177
274
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -185,12 +282,32 @@ Get the input fields required for a specific action
|
|
|
185
282
|
**Example:**
|
|
186
283
|
|
|
187
284
|
```typescript
|
|
188
|
-
|
|
189
|
-
|
|
285
|
+
// Get first page and a cursor for the second page
|
|
286
|
+
const { data: rootFieldItems, nextCursor } = await sdk.listInputFields({
|
|
190
287
|
appKey: "example-key",
|
|
191
288
|
actionType: "read",
|
|
192
289
|
actionKey: "example-key",
|
|
193
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
|
+
}
|
|
194
311
|
```
|
|
195
312
|
|
|
196
313
|
#### `runAction`
|
|
@@ -201,7 +318,7 @@ Execute an action with the given inputs
|
|
|
201
318
|
|
|
202
319
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
203
320
|
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
204
|
-
| `options` | `
|
|
321
|
+
| `options` | `object` | ✅ | — | — | |
|
|
205
322
|
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
206
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 |
|
|
207
324
|
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
@@ -215,16 +332,91 @@ Execute an action with the given inputs
|
|
|
215
332
|
**Example:**
|
|
216
333
|
|
|
217
334
|
```typescript
|
|
218
|
-
|
|
219
|
-
|
|
335
|
+
// Get first page and a cursor for the second page
|
|
336
|
+
const { data: actionResults, nextCursor } = await sdk.runAction({
|
|
220
337
|
appKey: "example-key",
|
|
221
338
|
actionType: "read",
|
|
222
339
|
actionKey: "example-key",
|
|
223
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
|
+
}
|
|
224
361
|
```
|
|
225
362
|
|
|
226
363
|
### Apps
|
|
227
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
|
+
|
|
228
420
|
#### `getApp`
|
|
229
421
|
|
|
230
422
|
Get detailed information about a specific app
|
|
@@ -233,7 +425,7 @@ Get detailed information about a specific app
|
|
|
233
425
|
|
|
234
426
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
235
427
|
| ---------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
236
|
-
| `options` | `
|
|
428
|
+
| `options` | `object` | ✅ | — | — | |
|
|
237
429
|
| ↳ `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
238
430
|
|
|
239
431
|
**Returns:** `Promise<AppItem>`
|
|
@@ -241,8 +433,7 @@ Get detailed information about a specific app
|
|
|
241
433
|
**Example:**
|
|
242
434
|
|
|
243
435
|
```typescript
|
|
244
|
-
const
|
|
245
|
-
options: "example-value",
|
|
436
|
+
const { data: app } = await sdk.getApp({
|
|
246
437
|
appKey: "example-key",
|
|
247
438
|
});
|
|
248
439
|
```
|
|
@@ -255,7 +446,7 @@ List all available apps with optional filtering
|
|
|
255
446
|
|
|
256
447
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
257
448
|
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
258
|
-
| `options` | `
|
|
449
|
+
| `options` | `object` | ✅ | — | — | |
|
|
259
450
|
| ↳ `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
260
451
|
| ↳ `search` | `string` | ❌ | — | — | Search for apps by name |
|
|
261
452
|
| ↳ `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
@@ -266,9 +457,18 @@ List all available apps with optional filtering
|
|
|
266
457
|
**Example:**
|
|
267
458
|
|
|
268
459
|
```typescript
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
+
}
|
|
272
472
|
```
|
|
273
473
|
|
|
274
474
|
### Authentications
|
|
@@ -281,7 +481,7 @@ Find the first authentication matching the criteria
|
|
|
281
481
|
|
|
282
482
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
283
483
|
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
284
|
-
| `options` | `
|
|
484
|
+
| `options` | `object` | ✅ | — | — | |
|
|
285
485
|
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
286
486
|
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
287
487
|
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
@@ -293,9 +493,7 @@ Find the first authentication matching the criteria
|
|
|
293
493
|
**Example:**
|
|
294
494
|
|
|
295
495
|
```typescript
|
|
296
|
-
const
|
|
297
|
-
options: "example-value",
|
|
298
|
-
});
|
|
496
|
+
const { data: authentication } = await sdk.findFirstAuthentication();
|
|
299
497
|
```
|
|
300
498
|
|
|
301
499
|
#### `findUniqueAuthentication`
|
|
@@ -306,7 +504,7 @@ Find a unique authentication matching the criteria
|
|
|
306
504
|
|
|
307
505
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
308
506
|
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
309
|
-
| `options` | `
|
|
507
|
+
| `options` | `object` | ✅ | — | — | |
|
|
310
508
|
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
311
509
|
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
312
510
|
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
@@ -318,9 +516,7 @@ Find a unique authentication matching the criteria
|
|
|
318
516
|
**Example:**
|
|
319
517
|
|
|
320
518
|
```typescript
|
|
321
|
-
const
|
|
322
|
-
options: "example-value",
|
|
323
|
-
});
|
|
519
|
+
const { data: authentication } = await sdk.findUniqueAuthentication();
|
|
324
520
|
```
|
|
325
521
|
|
|
326
522
|
#### `getAuthentication`
|
|
@@ -329,18 +525,17 @@ Get a specific authentication by ID
|
|
|
329
525
|
|
|
330
526
|
**Parameters:**
|
|
331
527
|
|
|
332
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
333
|
-
| -------------------- | -------- | -------- | ------- | --------------- |
|
|
334
|
-
| `options` | `
|
|
335
|
-
| ↳ `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 |
|
|
336
532
|
|
|
337
533
|
**Returns:** `Promise<AuthenticationItem>`
|
|
338
534
|
|
|
339
535
|
**Example:**
|
|
340
536
|
|
|
341
537
|
```typescript
|
|
342
|
-
const
|
|
343
|
-
options: "example-value",
|
|
538
|
+
const { data: authentication } = await sdk.getAuthentication({
|
|
344
539
|
authenticationId: 12345,
|
|
345
540
|
});
|
|
346
541
|
```
|
|
@@ -351,26 +546,35 @@ List available authentications with optional filtering
|
|
|
351
546
|
|
|
352
547
|
**Parameters:**
|
|
353
548
|
|
|
354
|
-
| Name | Type | Required | Default | Possible Values | Description
|
|
355
|
-
| --------------------- | -------- | -------- | ------- | --------------- |
|
|
356
|
-
| `options` | `
|
|
357
|
-
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI')
|
|
358
|
-
| ↳ `authenticationIds` | `array` | ❌ | — | — | List of authentication IDs to filter by
|
|
359
|
-
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title
|
|
360
|
-
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match
|
|
361
|
-
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID
|
|
362
|
-
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner
|
|
363
|
-
| ↳ `pageSize` | `number` | ❌ | — | — | Number of authentications per page
|
|
364
|
-
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages
|
|
549
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
550
|
+
| --------------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------ |
|
|
551
|
+
| `options` | `object` | ✅ | — | — | |
|
|
552
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI') |
|
|
553
|
+
| ↳ `authenticationIds` | `array` | ❌ | — | — | List of authentication IDs to filter by |
|
|
554
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
555
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
556
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
557
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own authentications or a specific user ID |
|
|
558
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of authentications per page |
|
|
559
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
365
560
|
|
|
366
561
|
**Returns:** `Promise<PaginatedResult<AuthenticationItem>>`
|
|
367
562
|
|
|
368
563
|
**Example:**
|
|
369
564
|
|
|
370
565
|
```typescript
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
+
}
|
|
374
578
|
```
|
|
375
579
|
|
|
376
580
|
### HTTP Requests
|
|
@@ -384,7 +588,7 @@ Execute fetch
|
|
|
384
588
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
385
589
|
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
386
590
|
| `url` | `string` | ✅ | — | — | The URL to fetch |
|
|
387
|
-
| `init` | `
|
|
591
|
+
| `init` | `object` | ❌ | — | — | Fetch options including authentication |
|
|
388
592
|
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | |
|
|
389
593
|
| ↳ `headers` | `object` | ❌ | — | — | |
|
|
390
594
|
| ↳ `body` | `string` | ❌ | — | — | |
|
|
@@ -397,7 +601,7 @@ Execute fetch
|
|
|
397
601
|
**Example:**
|
|
398
602
|
|
|
399
603
|
```typescript
|
|
400
|
-
const result = await sdk.fetch("https://example.com");
|
|
604
|
+
const result = await sdk.fetch("https://example.com", { key: "value" });
|
|
401
605
|
```
|
|
402
606
|
|
|
403
607
|
#### `request`
|
|
@@ -408,7 +612,7 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
408
612
|
|
|
409
613
|
| Name | Type | Required | Default | Possible Values | Description |
|
|
410
614
|
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
411
|
-
| `options` | `
|
|
615
|
+
| `options` | `object` | ✅ | — | — | |
|
|
412
616
|
| ↳ `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
|
|
413
617
|
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
|
|
414
618
|
| ↳ `body` | `string` | ❌ | — | — | Request body as a string |
|
|
@@ -424,7 +628,6 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
424
628
|
|
|
425
629
|
```typescript
|
|
426
630
|
const result = await sdk.request({
|
|
427
|
-
options: "example-value",
|
|
428
631
|
url: "https://example.com",
|
|
429
632
|
});
|
|
430
633
|
```
|