@zapier/zapier-sdk 0.11.1 → 0.12.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/CHANGELOG.md +12 -0
- package/README.md +217 -103
- package/dist/index.cjs +72 -26
- package/dist/index.d.mts +36 -3
- package/dist/index.mjs +72 -26
- package/dist/plugins/fetch/index.d.ts +14 -0
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +14 -0
- package/dist/plugins/fetch/schemas.d.ts +25 -0
- package/dist/plugins/fetch/schemas.d.ts.map +1 -0
- package/dist/plugins/fetch/schemas.js +33 -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 +3 -1
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +55 -34
- package/dist/sdk.d.ts +12 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +6 -1
- package/dist/types/sdk.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/plugins/fetch/index.ts +25 -0
- package/src/plugins/fetch/schemas.ts +37 -0
- package/src/plugins/listAuthentications/schemas.ts +6 -1
- package/src/plugins/registry/index.ts +66 -34
- package/src/types/sdk.ts +3 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 21d8487: Improved get started README and added more documentation to the add plugin
|
|
8
|
+
|
|
9
|
+
## 0.11.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 407245e: Add packages to meta so we can document `fetch` for SDK but not CLI/MCP.
|
|
14
|
+
|
|
3
15
|
## 0.11.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -22,35 +22,92 @@
|
|
|
22
22
|
- [`getAuthentication`](#getauthentication)
|
|
23
23
|
- [`listAuthentications`](#listauthentications)
|
|
24
24
|
- [HTTP Requests](#http-requests)
|
|
25
|
+
- [`fetch`](#fetch)
|
|
25
26
|
- [`request`](#request)
|
|
26
27
|
|
|
27
28
|
## Installation
|
|
28
29
|
|
|
29
30
|
```bash
|
|
30
31
|
npm install @zapier/zapier-sdk
|
|
32
|
+
npm install -D @types/node typescript
|
|
33
|
+
npx tsc --init
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
## Quick Start
|
|
34
37
|
|
|
38
|
+
```bash
|
|
39
|
+
# Authenticates through your browser, automatically handling token management
|
|
40
|
+
npx zapier-sdk login
|
|
41
|
+
|
|
42
|
+
# Generate TypeScript types for the request/response signatures of apps.
|
|
43
|
+
# By default, the types will be generated inside of your `src` folder, if you have one, or the root folder.
|
|
44
|
+
# To use these types, ensure they are added to your `tsconfig.json` file.
|
|
45
|
+
|
|
46
|
+
# Single app
|
|
47
|
+
npx zapier-sdk add slack --types-output ./types/slack.ts
|
|
48
|
+
|
|
49
|
+
# Multiple apps
|
|
50
|
+
npx zapier-sdk add slack github trello
|
|
51
|
+
```
|
|
52
|
+
|
|
35
53
|
```typescript
|
|
36
54
|
import { createZapierSdk } from "@zapier/zapier-sdk";
|
|
37
55
|
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
// ######## Initialize Zapier SDK ########
|
|
57
|
+
// Running `zapier-sdk login` authenticates through your browser, automatically handling token management
|
|
58
|
+
const zapier = createZapierSdk();
|
|
59
|
+
|
|
60
|
+
// Option 2: Manually provide a token
|
|
61
|
+
// const zapier = createZapierSdk({
|
|
62
|
+
// token: "your_zapier_token_here", // or use ZAPIER_TOKEN env var
|
|
63
|
+
// });
|
|
64
|
+
|
|
65
|
+
// ######## Access Apps ########
|
|
66
|
+
const apps = await zapier.listApps();
|
|
67
|
+
const singleApp = await zapier.getApp({ appKey: "SlackCLIAPI" });
|
|
68
|
+
|
|
69
|
+
// ######## Authentication Usage ########
|
|
70
|
+
const myAuths = await zapier.listAuthentications({
|
|
71
|
+
appKey: "SlackCLIAPI",
|
|
72
|
+
owner: "me",
|
|
40
73
|
});
|
|
41
74
|
|
|
42
|
-
//
|
|
43
|
-
|
|
75
|
+
// ######## Find Actions ########
|
|
76
|
+
// Option 1: List actions
|
|
77
|
+
const actions = await zapier.listActions({ appKey: "SlackCLIAPI" });
|
|
78
|
+
const singleAction = await zapier.getAction({
|
|
79
|
+
appKey: "SlackCLIAPI",
|
|
80
|
+
actionType: actions.data[0].action_type,
|
|
81
|
+
actionKey: actions.data[0].key,
|
|
82
|
+
});
|
|
44
83
|
|
|
45
|
-
//
|
|
46
|
-
|
|
84
|
+
// Option 2: Access actions via the `apps` proxy
|
|
85
|
+
// If you've generated TS types for an app using `zapier-sdk add`, you can access the app's actions like this:
|
|
47
86
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
87
|
+
// await zapier.apps.slack.read.channles({});
|
|
88
|
+
// await zapier.apps.slack.write.send_message({})
|
|
89
|
+
|
|
90
|
+
// ######## Run Actions ########
|
|
91
|
+
// Option 1:
|
|
92
|
+
const allChannels = await zapier.runAction({
|
|
93
|
+
appKey: "SlackCLIAPI",
|
|
94
|
+
actionType: "read",
|
|
95
|
+
actionKey: "channels",
|
|
96
|
+
authenticationId: myAuths.data[0].id,
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Option 2:
|
|
100
|
+
const allChannelsResult = await zapier.apps.slack.read.channels({
|
|
101
|
+
authenticationId: myAuths.data[0].id,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
console.log({
|
|
105
|
+
apps: apps.data[0],
|
|
106
|
+
singleApp,
|
|
107
|
+
actions: actions.data[0],
|
|
108
|
+
singleAction,
|
|
109
|
+
allChannels: allChannels.data[0],
|
|
110
|
+
allChannelsResult,
|
|
54
111
|
});
|
|
55
112
|
```
|
|
56
113
|
|
|
@@ -62,7 +119,11 @@ const result = await sdk.runAction({
|
|
|
62
119
|
|
|
63
120
|
Get current user's profile information
|
|
64
121
|
|
|
65
|
-
**Parameters:**
|
|
122
|
+
**Parameters:**
|
|
123
|
+
|
|
124
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
125
|
+
| --------- | -------- | -------- | ------- | --------------- | -------------------------------------- |
|
|
126
|
+
| `options` | `string` | ❌ | — | — | Get current user's profile information |
|
|
66
127
|
|
|
67
128
|
**Returns:** `Promise<ProfileItem>`
|
|
68
129
|
|
|
@@ -80,11 +141,12 @@ Get detailed information about a specific action
|
|
|
80
141
|
|
|
81
142
|
**Parameters:**
|
|
82
143
|
|
|
83
|
-
| Name
|
|
84
|
-
|
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
144
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
145
|
+
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
146
|
+
| `options` | `string` | ✅ | — | — | Get detailed information about a specific action |
|
|
147
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
148
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
88
150
|
|
|
89
151
|
**Returns:** `Promise<ActionItem>`
|
|
90
152
|
|
|
@@ -92,6 +154,7 @@ Get detailed information about a specific action
|
|
|
92
154
|
|
|
93
155
|
```typescript
|
|
94
156
|
const result = await sdk.getAction({
|
|
157
|
+
options: "example-value",
|
|
95
158
|
appKey: "example-key",
|
|
96
159
|
actionType: "read",
|
|
97
160
|
actionKey: "example-key",
|
|
@@ -104,12 +167,13 @@ List all actions for a specific app
|
|
|
104
167
|
|
|
105
168
|
**Parameters:**
|
|
106
169
|
|
|
107
|
-
| Name
|
|
108
|
-
|
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
170
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
171
|
+
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
172
|
+
| `options` | `string` | ✅ | — | — | List all actions for a specific app |
|
|
173
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
174
|
+
| ↳ `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
175
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of actions per page |
|
|
176
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
113
177
|
|
|
114
178
|
**Returns:** `Promise<PaginatedResult<ActionItem>>`
|
|
115
179
|
|
|
@@ -117,6 +181,7 @@ List all actions for a specific app
|
|
|
117
181
|
|
|
118
182
|
```typescript
|
|
119
183
|
const result = await sdk.listActions({
|
|
184
|
+
options: "example-value",
|
|
120
185
|
appKey: "example-key",
|
|
121
186
|
});
|
|
122
187
|
```
|
|
@@ -127,17 +192,18 @@ Get the available choices for a dynamic dropdown input field
|
|
|
127
192
|
|
|
128
193
|
**Parameters:**
|
|
129
194
|
|
|
130
|
-
| Name
|
|
131
|
-
|
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
195
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
196
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
197
|
+
| `options` | `string` | ✅ | — | — | Get the available choices for a dynamic dropdown input field |
|
|
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 |
|
|
141
207
|
|
|
142
208
|
**Returns:** `Promise<PaginatedResult<InputFieldChoiceItem>>`
|
|
143
209
|
|
|
@@ -145,6 +211,7 @@ Get the available choices for a dynamic dropdown input field
|
|
|
145
211
|
|
|
146
212
|
```typescript
|
|
147
213
|
const result = await sdk.listInputFieldChoices({
|
|
214
|
+
options: "example-value",
|
|
148
215
|
appKey: "example-key",
|
|
149
216
|
actionType: "read",
|
|
150
217
|
actionKey: "example-key",
|
|
@@ -158,15 +225,16 @@ Get the input fields required for a specific action
|
|
|
158
225
|
|
|
159
226
|
**Parameters:**
|
|
160
227
|
|
|
161
|
-
| Name
|
|
162
|
-
|
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
228
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
229
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
230
|
+
| `options` | `string` | ✅ | — | — | Get the input fields required for a specific action |
|
|
231
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
232
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
234
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
235
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect available fields |
|
|
236
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of input fields per page |
|
|
237
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
170
238
|
|
|
171
239
|
**Returns:** `Promise<PaginatedResult<RootFieldItemItem>>`
|
|
172
240
|
|
|
@@ -174,6 +242,7 @@ Get the input fields required for a specific action
|
|
|
174
242
|
|
|
175
243
|
```typescript
|
|
176
244
|
const result = await sdk.listInputFields({
|
|
245
|
+
options: "example-value",
|
|
177
246
|
appKey: "example-key",
|
|
178
247
|
actionType: "read",
|
|
179
248
|
actionKey: "example-key",
|
|
@@ -186,15 +255,16 @@ Execute an action with the given inputs
|
|
|
186
255
|
|
|
187
256
|
**Parameters:**
|
|
188
257
|
|
|
189
|
-
| Name
|
|
190
|
-
|
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
258
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
259
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
260
|
+
| `options` | `string` | ✅ | — | — | Execute an action with the given inputs |
|
|
261
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
262
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
264
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
265
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Input parameters for the action |
|
|
266
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of results per page |
|
|
267
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
198
268
|
|
|
199
269
|
**Returns:** `Promise<PaginatedResult<ActionResultItem>>`
|
|
200
270
|
|
|
@@ -202,6 +272,7 @@ Execute an action with the given inputs
|
|
|
202
272
|
|
|
203
273
|
```typescript
|
|
204
274
|
const result = await sdk.runAction({
|
|
275
|
+
options: "example-value",
|
|
205
276
|
appKey: "example-key",
|
|
206
277
|
actionType: "read",
|
|
207
278
|
actionKey: "example-key",
|
|
@@ -216,9 +287,10 @@ Get detailed information about a specific app
|
|
|
216
287
|
|
|
217
288
|
**Parameters:**
|
|
218
289
|
|
|
219
|
-
| Name
|
|
220
|
-
|
|
|
221
|
-
| `
|
|
290
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
291
|
+
| ---------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
292
|
+
| `options` | `string` | ✅ | — | — | Get detailed information about a specific app |
|
|
293
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
222
294
|
|
|
223
295
|
**Returns:** `Promise<AppItem>`
|
|
224
296
|
|
|
@@ -226,6 +298,7 @@ Get detailed information about a specific app
|
|
|
226
298
|
|
|
227
299
|
```typescript
|
|
228
300
|
const result = await sdk.getApp({
|
|
301
|
+
options: "example-value",
|
|
229
302
|
appKey: "example-key",
|
|
230
303
|
});
|
|
231
304
|
```
|
|
@@ -236,19 +309,22 @@ List all available apps with optional filtering
|
|
|
236
309
|
|
|
237
310
|
**Parameters:**
|
|
238
311
|
|
|
239
|
-
| Name
|
|
240
|
-
|
|
|
241
|
-
| `
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
312
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
313
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
314
|
+
| `options` | `string` | ✅ | — | — | List all available apps with optional filtering |
|
|
315
|
+
| ↳ `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
316
|
+
| ↳ `search` | `string` | ❌ | — | — | Search for apps by name |
|
|
317
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
318
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
245
319
|
|
|
246
320
|
**Returns:** `Promise<PaginatedResult<AppItem>>`
|
|
247
321
|
|
|
248
322
|
**Example:**
|
|
249
323
|
|
|
250
324
|
```typescript
|
|
251
|
-
const result = await sdk.listApps(
|
|
325
|
+
const result = await sdk.listApps({
|
|
326
|
+
options: "example-value",
|
|
327
|
+
});
|
|
252
328
|
```
|
|
253
329
|
|
|
254
330
|
### Authentications
|
|
@@ -259,20 +335,23 @@ Find the first authentication matching the criteria
|
|
|
259
335
|
|
|
260
336
|
**Parameters:**
|
|
261
337
|
|
|
262
|
-
| Name
|
|
263
|
-
|
|
|
264
|
-
| `
|
|
265
|
-
| `
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
338
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
339
|
+
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
340
|
+
| `options` | `string` | ✅ | — | — | Find the first authentication matching the criteria |
|
|
341
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
342
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
343
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
344
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
345
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
269
346
|
|
|
270
347
|
**Returns:** `Promise<AuthenticationItem>`
|
|
271
348
|
|
|
272
349
|
**Example:**
|
|
273
350
|
|
|
274
351
|
```typescript
|
|
275
|
-
const result = await sdk.findFirstAuthentication(
|
|
352
|
+
const result = await sdk.findFirstAuthentication({
|
|
353
|
+
options: "example-value",
|
|
354
|
+
});
|
|
276
355
|
```
|
|
277
356
|
|
|
278
357
|
#### `findUniqueAuthentication`
|
|
@@ -281,20 +360,23 @@ Find a unique authentication matching the criteria
|
|
|
281
360
|
|
|
282
361
|
**Parameters:**
|
|
283
362
|
|
|
284
|
-
| Name
|
|
285
|
-
|
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
363
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
364
|
+
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
365
|
+
| `options` | `string` | ✅ | — | — | Find a unique authentication matching the criteria |
|
|
366
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
367
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
368
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
369
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
370
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
291
371
|
|
|
292
372
|
**Returns:** `Promise<AuthenticationItem>`
|
|
293
373
|
|
|
294
374
|
**Example:**
|
|
295
375
|
|
|
296
376
|
```typescript
|
|
297
|
-
const result = await sdk.findUniqueAuthentication(
|
|
377
|
+
const result = await sdk.findUniqueAuthentication({
|
|
378
|
+
options: "example-value",
|
|
379
|
+
});
|
|
298
380
|
```
|
|
299
381
|
|
|
300
382
|
#### `getAuthentication`
|
|
@@ -303,9 +385,10 @@ Get a specific authentication by ID
|
|
|
303
385
|
|
|
304
386
|
**Parameters:**
|
|
305
387
|
|
|
306
|
-
| Name
|
|
307
|
-
|
|
|
308
|
-
| `
|
|
388
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
389
|
+
| -------------------- | -------- | -------- | ------- | --------------- | ----------------------------------- |
|
|
390
|
+
| `options` | `string` | ✅ | — | — | Get a specific authentication by ID |
|
|
391
|
+
| ↳ `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve |
|
|
309
392
|
|
|
310
393
|
**Returns:** `Promise<AuthenticationItem>`
|
|
311
394
|
|
|
@@ -313,6 +396,7 @@ Get a specific authentication by ID
|
|
|
313
396
|
|
|
314
397
|
```typescript
|
|
315
398
|
const result = await sdk.getAuthentication({
|
|
399
|
+
options: "example-value",
|
|
316
400
|
authenticationId: 12345,
|
|
317
401
|
});
|
|
318
402
|
```
|
|
@@ -323,43 +407,72 @@ List available authentications with optional filtering
|
|
|
323
407
|
|
|
324
408
|
**Parameters:**
|
|
325
409
|
|
|
326
|
-
| Name
|
|
327
|
-
|
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
410
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
411
|
+
| --------------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------------ |
|
|
412
|
+
| `options` | `string` | ✅ | — | — | List available authentications with optional filtering |
|
|
413
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentications to list (e.g., 'SlackCLIAPI') |
|
|
414
|
+
| ↳ `authenticationIds` | `array` | ❌ | — | — | List of authentication IDs to filter by |
|
|
415
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
416
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
417
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
418
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner, 'me' for your own authentications or a specific user ID |
|
|
419
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of authentications per page |
|
|
420
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
336
421
|
|
|
337
422
|
**Returns:** `Promise<PaginatedResult<AuthenticationItem>>`
|
|
338
423
|
|
|
339
424
|
**Example:**
|
|
340
425
|
|
|
341
426
|
```typescript
|
|
342
|
-
const result = await sdk.listAuthentications(
|
|
427
|
+
const result = await sdk.listAuthentications({
|
|
428
|
+
options: "example-value",
|
|
429
|
+
});
|
|
343
430
|
```
|
|
344
431
|
|
|
345
432
|
### HTTP Requests
|
|
346
433
|
|
|
434
|
+
#### `fetch`
|
|
435
|
+
|
|
436
|
+
Execute fetch
|
|
437
|
+
|
|
438
|
+
**Parameters:**
|
|
439
|
+
|
|
440
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
441
|
+
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
442
|
+
| `url` | `string` | ✅ | — | — | The URL to fetch |
|
|
443
|
+
| `init` | `string` | ❌ | — | — | Fetch options including authentication |
|
|
444
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | |
|
|
445
|
+
| ↳ `headers` | `object` | ❌ | — | — | |
|
|
446
|
+
| ↳ `body` | `string` | ❌ | — | — | |
|
|
447
|
+
| ↳ `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
|
|
448
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
449
|
+
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
450
|
+
|
|
451
|
+
**Returns:** `Promise<Response>`
|
|
452
|
+
|
|
453
|
+
**Example:**
|
|
454
|
+
|
|
455
|
+
```typescript
|
|
456
|
+
const result = await sdk.fetch("https://example.com");
|
|
457
|
+
```
|
|
458
|
+
|
|
347
459
|
#### `request`
|
|
348
460
|
|
|
349
461
|
Make authenticated HTTP requests through Zapier's Relay service
|
|
350
462
|
|
|
351
463
|
**Parameters:**
|
|
352
464
|
|
|
353
|
-
| Name
|
|
354
|
-
|
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `
|
|
358
|
-
| `
|
|
359
|
-
| `
|
|
360
|
-
| `
|
|
361
|
-
| `
|
|
362
|
-
| `
|
|
465
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
466
|
+
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
467
|
+
| `options` | `string` | ✅ | — | — | Make authenticated HTTP requests through Zapier's Relay service |
|
|
468
|
+
| ↳ `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
|
|
469
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
|
|
470
|
+
| ↳ `body` | `string` | ❌ | — | — | Request body as a string |
|
|
471
|
+
| ↳ `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
|
|
472
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
473
|
+
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
474
|
+
| ↳ `headers` | `string` | ❌ | — | — | Request headers |
|
|
475
|
+
| ↳ `relayBaseUrl` | `string` | ❌ | — | — | Base URL for Relay service |
|
|
363
476
|
|
|
364
477
|
**Returns:** `Promise<Response>`
|
|
365
478
|
|
|
@@ -367,6 +480,7 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
367
480
|
|
|
368
481
|
```typescript
|
|
369
482
|
const result = await sdk.request({
|
|
483
|
+
options: "example-value",
|
|
370
484
|
url: "https://example.com",
|
|
371
485
|
});
|
|
372
486
|
```
|