@zapier/zapier-sdk 0.11.0 → 0.11.2
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 +149 -95
- package/dist/index.cjs +69 -25
- package/dist/index.d.mts +35 -2
- package/dist/index.mjs +69 -25
- 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/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/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.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 407245e: Add packages to meta so we can document `fetch` for SDK but not CLI/MCP.
|
|
8
|
+
|
|
9
|
+
## 0.11.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0002fe9: Updated doc generation
|
|
14
|
+
|
|
3
15
|
## 0.11.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
-
<!-- Generated API Reference -->
|
|
4
|
-
|
|
5
3
|
## Table of Contents
|
|
6
4
|
|
|
7
5
|
- [Installation](#installation)
|
|
@@ -24,6 +22,7 @@
|
|
|
24
22
|
- [`getAuthentication`](#getauthentication)
|
|
25
23
|
- [`listAuthentications`](#listauthentications)
|
|
26
24
|
- [HTTP Requests](#http-requests)
|
|
25
|
+
- [`fetch`](#fetch)
|
|
27
26
|
- [`request`](#request)
|
|
28
27
|
|
|
29
28
|
## Installation
|
|
@@ -64,7 +63,11 @@ const result = await sdk.runAction({
|
|
|
64
63
|
|
|
65
64
|
Get current user's profile information
|
|
66
65
|
|
|
67
|
-
**Parameters:**
|
|
66
|
+
**Parameters:**
|
|
67
|
+
|
|
68
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
69
|
+
| --------- | -------- | -------- | ------- | --------------- | -------------------------------------- |
|
|
70
|
+
| `options` | `string` | ❌ | — | — | Get current user's profile information |
|
|
68
71
|
|
|
69
72
|
**Returns:** `Promise<ProfileItem>`
|
|
70
73
|
|
|
@@ -82,11 +85,12 @@ Get detailed information about a specific action
|
|
|
82
85
|
|
|
83
86
|
**Parameters:**
|
|
84
87
|
|
|
85
|
-
| Name
|
|
86
|
-
|
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
88
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
89
|
+
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
90
|
+
| `options` | `string` | ✅ | — | — | Get detailed information about a specific action |
|
|
91
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
92
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
90
94
|
|
|
91
95
|
**Returns:** `Promise<ActionItem>`
|
|
92
96
|
|
|
@@ -94,6 +98,7 @@ Get detailed information about a specific action
|
|
|
94
98
|
|
|
95
99
|
```typescript
|
|
96
100
|
const result = await sdk.getAction({
|
|
101
|
+
options: "example-value",
|
|
97
102
|
appKey: "example-key",
|
|
98
103
|
actionType: "read",
|
|
99
104
|
actionKey: "example-key",
|
|
@@ -106,12 +111,13 @@ List all actions for a specific app
|
|
|
106
111
|
|
|
107
112
|
**Parameters:**
|
|
108
113
|
|
|
109
|
-
| Name
|
|
110
|
-
|
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
114
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
115
|
+
| -------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
116
|
+
| `options` | `string` | ✅ | — | — | List all actions for a specific app |
|
|
117
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key of actions to list (e.g., 'SlackCLIAPI') |
|
|
118
|
+
| ↳ `actionType` | `string` | ❌ | — | `read`, `read_bulk`, `write`, `run`, `search`, `search_or_write`, `search_and_write`, `filter` | Filter actions by type |
|
|
119
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of actions per page |
|
|
120
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
115
121
|
|
|
116
122
|
**Returns:** `Promise<PaginatedResult<ActionItem>>`
|
|
117
123
|
|
|
@@ -119,6 +125,7 @@ List all actions for a specific app
|
|
|
119
125
|
|
|
120
126
|
```typescript
|
|
121
127
|
const result = await sdk.listActions({
|
|
128
|
+
options: "example-value",
|
|
122
129
|
appKey: "example-key",
|
|
123
130
|
});
|
|
124
131
|
```
|
|
@@ -129,17 +136,18 @@ Get the available choices for a dynamic dropdown input field
|
|
|
129
136
|
|
|
130
137
|
**Parameters:**
|
|
131
138
|
|
|
132
|
-
| Name
|
|
133
|
-
|
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
139
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
140
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
141
|
+
| `options` | `string` | ✅ | — | — | Get the available choices for a dynamic dropdown input field |
|
|
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 |
|
|
143
151
|
|
|
144
152
|
**Returns:** `Promise<PaginatedResult<InputFieldChoiceItem>>`
|
|
145
153
|
|
|
@@ -147,6 +155,7 @@ Get the available choices for a dynamic dropdown input field
|
|
|
147
155
|
|
|
148
156
|
```typescript
|
|
149
157
|
const result = await sdk.listInputFieldChoices({
|
|
158
|
+
options: "example-value",
|
|
150
159
|
appKey: "example-key",
|
|
151
160
|
actionType: "read",
|
|
152
161
|
actionKey: "example-key",
|
|
@@ -160,15 +169,16 @@ Get the input fields required for a specific action
|
|
|
160
169
|
|
|
161
170
|
**Parameters:**
|
|
162
171
|
|
|
163
|
-
| Name
|
|
164
|
-
|
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
173
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
174
|
+
| `options` | `string` | ✅ | — | — | Get the input fields required for a specific action |
|
|
175
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
176
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
178
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
179
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Current input values that may affect available fields |
|
|
180
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of input fields per page |
|
|
181
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
172
182
|
|
|
173
183
|
**Returns:** `Promise<PaginatedResult<RootFieldItemItem>>`
|
|
174
184
|
|
|
@@ -176,6 +186,7 @@ Get the input fields required for a specific action
|
|
|
176
186
|
|
|
177
187
|
```typescript
|
|
178
188
|
const result = await sdk.listInputFields({
|
|
189
|
+
options: "example-value",
|
|
179
190
|
appKey: "example-key",
|
|
180
191
|
actionType: "read",
|
|
181
192
|
actionKey: "example-key",
|
|
@@ -188,15 +199,16 @@ Execute an action with the given inputs
|
|
|
188
199
|
|
|
189
200
|
**Parameters:**
|
|
190
201
|
|
|
191
|
-
| Name
|
|
192
|
-
|
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
| `
|
|
202
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
203
|
+
| -------------------- | -------- | -------- | ------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
204
|
+
| `options` | `string` | ✅ | — | — | Execute an action with the given inputs |
|
|
205
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key (e.g., 'SlackCLIAPI') |
|
|
206
|
+
| ↳ `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
|
+
| ↳ `actionKey` | `string` | ✅ | — | — | Action key to execute |
|
|
208
|
+
| ↳ `authenticationId` | `string` | ❌ | — | — | Authentication ID to use for this action |
|
|
209
|
+
| ↳ `inputs` | `object` | ❌ | — | — | Input parameters for the action |
|
|
210
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of results per page |
|
|
211
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
200
212
|
|
|
201
213
|
**Returns:** `Promise<PaginatedResult<ActionResultItem>>`
|
|
202
214
|
|
|
@@ -204,6 +216,7 @@ Execute an action with the given inputs
|
|
|
204
216
|
|
|
205
217
|
```typescript
|
|
206
218
|
const result = await sdk.runAction({
|
|
219
|
+
options: "example-value",
|
|
207
220
|
appKey: "example-key",
|
|
208
221
|
actionType: "read",
|
|
209
222
|
actionKey: "example-key",
|
|
@@ -218,9 +231,10 @@ Get detailed information about a specific app
|
|
|
218
231
|
|
|
219
232
|
**Parameters:**
|
|
220
233
|
|
|
221
|
-
| Name
|
|
222
|
-
|
|
|
223
|
-
| `
|
|
234
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
235
|
+
| ---------- | -------- | -------- | ------- | --------------- | --------------------------------------------- |
|
|
236
|
+
| `options` | `string` | ✅ | — | — | Get detailed information about a specific app |
|
|
237
|
+
| ↳ `appKey` | `string` | ✅ | — | — | App key of app to fetch (e.g., 'SlackCLIAPI') |
|
|
224
238
|
|
|
225
239
|
**Returns:** `Promise<AppItem>`
|
|
226
240
|
|
|
@@ -228,6 +242,7 @@ Get detailed information about a specific app
|
|
|
228
242
|
|
|
229
243
|
```typescript
|
|
230
244
|
const result = await sdk.getApp({
|
|
245
|
+
options: "example-value",
|
|
231
246
|
appKey: "example-key",
|
|
232
247
|
});
|
|
233
248
|
```
|
|
@@ -238,19 +253,22 @@ List all available apps with optional filtering
|
|
|
238
253
|
|
|
239
254
|
**Parameters:**
|
|
240
255
|
|
|
241
|
-
| Name
|
|
242
|
-
|
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
246
|
-
| `
|
|
256
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
257
|
+
| ------------ | -------- | -------- | ------- | --------------- | ------------------------------------------------------------------- |
|
|
258
|
+
| `options` | `string` | ✅ | — | — | List all available apps with optional filtering |
|
|
259
|
+
| ↳ `appKeys` | `array` | ❌ | — | — | Filter apps by app keys (e.g., 'SlackCLIAPI' or slug like 'github') |
|
|
260
|
+
| ↳ `search` | `string` | ❌ | — | — | Search for apps by name |
|
|
261
|
+
| ↳ `pageSize` | `number` | ❌ | — | — | Number of apps per page |
|
|
262
|
+
| ↳ `maxItems` | `number` | ❌ | — | — | Maximum total items to return across all pages |
|
|
247
263
|
|
|
248
264
|
**Returns:** `Promise<PaginatedResult<AppItem>>`
|
|
249
265
|
|
|
250
266
|
**Example:**
|
|
251
267
|
|
|
252
268
|
```typescript
|
|
253
|
-
const result = await sdk.listApps(
|
|
269
|
+
const result = await sdk.listApps({
|
|
270
|
+
options: "example-value",
|
|
271
|
+
});
|
|
254
272
|
```
|
|
255
273
|
|
|
256
274
|
### Authentications
|
|
@@ -261,20 +279,23 @@ Find the first authentication matching the criteria
|
|
|
261
279
|
|
|
262
280
|
**Parameters:**
|
|
263
281
|
|
|
264
|
-
| Name
|
|
265
|
-
|
|
|
266
|
-
| `
|
|
267
|
-
| `
|
|
268
|
-
| `
|
|
269
|
-
| `
|
|
270
|
-
| `
|
|
282
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
283
|
+
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
284
|
+
| `options` | `string` | ✅ | — | — | Find the first authentication matching the criteria |
|
|
285
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
286
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
287
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
288
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
289
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
271
290
|
|
|
272
291
|
**Returns:** `Promise<AuthenticationItem>`
|
|
273
292
|
|
|
274
293
|
**Example:**
|
|
275
294
|
|
|
276
295
|
```typescript
|
|
277
|
-
const result = await sdk.findFirstAuthentication(
|
|
296
|
+
const result = await sdk.findFirstAuthentication({
|
|
297
|
+
options: "example-value",
|
|
298
|
+
});
|
|
278
299
|
```
|
|
279
300
|
|
|
280
301
|
#### `findUniqueAuthentication`
|
|
@@ -283,20 +304,23 @@ Find a unique authentication matching the criteria
|
|
|
283
304
|
|
|
284
305
|
**Parameters:**
|
|
285
306
|
|
|
286
|
-
| Name
|
|
287
|
-
|
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
307
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
308
|
+
| ------------- | -------- | -------- | ------- | --------------- | ------------------------------------------------------- |
|
|
309
|
+
| `options` | `string` | ✅ | — | — | Find a unique authentication matching the criteria |
|
|
310
|
+
| ↳ `appKey` | `string` | ❌ | — | — | App key of authentication to find (e.g., 'SlackCLIAPI') |
|
|
311
|
+
| ↳ `search` | `string` | ❌ | — | — | Search term to filter authentications by title |
|
|
312
|
+
| ↳ `title` | `string` | ❌ | — | — | Filter authentications by exact title match |
|
|
313
|
+
| ↳ `accountId` | `string` | ❌ | — | — | Filter by account ID |
|
|
314
|
+
| ↳ `owner` | `string` | ❌ | — | — | Filter by owner |
|
|
293
315
|
|
|
294
316
|
**Returns:** `Promise<AuthenticationItem>`
|
|
295
317
|
|
|
296
318
|
**Example:**
|
|
297
319
|
|
|
298
320
|
```typescript
|
|
299
|
-
const result = await sdk.findUniqueAuthentication(
|
|
321
|
+
const result = await sdk.findUniqueAuthentication({
|
|
322
|
+
options: "example-value",
|
|
323
|
+
});
|
|
300
324
|
```
|
|
301
325
|
|
|
302
326
|
#### `getAuthentication`
|
|
@@ -305,9 +329,10 @@ Get a specific authentication by ID
|
|
|
305
329
|
|
|
306
330
|
**Parameters:**
|
|
307
331
|
|
|
308
|
-
| Name
|
|
309
|
-
|
|
|
310
|
-
| `
|
|
332
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
333
|
+
| -------------------- | -------- | -------- | ------- | --------------- | ----------------------------------- |
|
|
334
|
+
| `options` | `string` | ✅ | — | — | Get a specific authentication by ID |
|
|
335
|
+
| ↳ `authenticationId` | `number` | ✅ | — | — | Authentication ID to retrieve |
|
|
311
336
|
|
|
312
337
|
**Returns:** `Promise<AuthenticationItem>`
|
|
313
338
|
|
|
@@ -315,6 +340,7 @@ Get a specific authentication by ID
|
|
|
315
340
|
|
|
316
341
|
```typescript
|
|
317
342
|
const result = await sdk.getAuthentication({
|
|
343
|
+
options: "example-value",
|
|
318
344
|
authenticationId: 12345,
|
|
319
345
|
});
|
|
320
346
|
```
|
|
@@ -325,43 +351,72 @@ List available authentications with optional filtering
|
|
|
325
351
|
|
|
326
352
|
**Parameters:**
|
|
327
353
|
|
|
328
|
-
| Name
|
|
329
|
-
|
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
| `
|
|
337
|
-
| `
|
|
354
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
355
|
+
| --------------------- | -------- | -------- | ------- | --------------- | -------------------------------------------------------- |
|
|
356
|
+
| `options` | `string` | ✅ | — | — | List available authentications with optional filtering |
|
|
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 |
|
|
338
365
|
|
|
339
366
|
**Returns:** `Promise<PaginatedResult<AuthenticationItem>>`
|
|
340
367
|
|
|
341
368
|
**Example:**
|
|
342
369
|
|
|
343
370
|
```typescript
|
|
344
|
-
const result = await sdk.listAuthentications(
|
|
371
|
+
const result = await sdk.listAuthentications({
|
|
372
|
+
options: "example-value",
|
|
373
|
+
});
|
|
345
374
|
```
|
|
346
375
|
|
|
347
376
|
### HTTP Requests
|
|
348
377
|
|
|
378
|
+
#### `fetch`
|
|
379
|
+
|
|
380
|
+
Execute fetch
|
|
381
|
+
|
|
382
|
+
**Parameters:**
|
|
383
|
+
|
|
384
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
385
|
+
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
386
|
+
| `url` | `string` | ✅ | — | — | The URL to fetch |
|
|
387
|
+
| `init` | `string` | ❌ | — | — | Fetch options including authentication |
|
|
388
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | |
|
|
389
|
+
| ↳ `headers` | `object` | ❌ | — | — | |
|
|
390
|
+
| ↳ `body` | `string` | ❌ | — | — | |
|
|
391
|
+
| ↳ `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
|
|
392
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
393
|
+
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
394
|
+
|
|
395
|
+
**Returns:** `Promise<Response>`
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
const result = await sdk.fetch("https://example.com");
|
|
401
|
+
```
|
|
402
|
+
|
|
349
403
|
#### `request`
|
|
350
404
|
|
|
351
405
|
Make authenticated HTTP requests through Zapier's Relay service
|
|
352
406
|
|
|
353
407
|
**Parameters:**
|
|
354
408
|
|
|
355
|
-
| Name
|
|
356
|
-
|
|
|
357
|
-
| `
|
|
358
|
-
| `
|
|
359
|
-
| `
|
|
360
|
-
| `
|
|
361
|
-
| `
|
|
362
|
-
| `
|
|
363
|
-
| `
|
|
364
|
-
| `
|
|
409
|
+
| Name | Type | Required | Default | Possible Values | Description |
|
|
410
|
+
| -------------------------- | -------- | -------- | ------- | ---------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
411
|
+
| `options` | `string` | ✅ | — | — | Make authenticated HTTP requests through Zapier's Relay service |
|
|
412
|
+
| ↳ `url` | `string` | ✅ | — | — | The URL to request (will be proxied through Relay) |
|
|
413
|
+
| ↳ `method` | `string` | ❌ | — | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, `HEAD`, `OPTIONS` | HTTP method |
|
|
414
|
+
| ↳ `body` | `string` | ❌ | — | — | Request body as a string |
|
|
415
|
+
| ↳ `authenticationId` | `number` | ❌ | — | — | Zapier authentication ID to use for the request |
|
|
416
|
+
| ↳ `callbackUrl` | `string` | ❌ | — | — | URL to send async response to (makes request async) |
|
|
417
|
+
| ↳ `authenticationTemplate` | `string` | ❌ | — | — | Optional JSON string authentication template to bypass Notary lookup |
|
|
418
|
+
| ↳ `headers` | `string` | ❌ | — | — | Request headers |
|
|
419
|
+
| ↳ `relayBaseUrl` | `string` | ❌ | — | — | Base URL for Relay service |
|
|
365
420
|
|
|
366
421
|
**Returns:** `Promise<Response>`
|
|
367
422
|
|
|
@@ -369,8 +424,7 @@ Make authenticated HTTP requests through Zapier's Relay service
|
|
|
369
424
|
|
|
370
425
|
```typescript
|
|
371
426
|
const result = await sdk.request({
|
|
427
|
+
options: "example-value",
|
|
372
428
|
url: "https://example.com",
|
|
373
429
|
});
|
|
374
430
|
```
|
|
375
|
-
|
|
376
|
-
<!-- End Generated API Reference -->
|
package/dist/index.cjs
CHANGED
|
@@ -298,6 +298,21 @@ var appsPlugin = ({ sdk }) => {
|
|
|
298
298
|
apps: createAppsProxy({ sdk })
|
|
299
299
|
};
|
|
300
300
|
};
|
|
301
|
+
var FetchUrlSchema = zod.z.union([zod.z.string(), zod.z.instanceof(URL)]).describe("The URL to fetch");
|
|
302
|
+
var FetchInitSchema = zod.z.object({
|
|
303
|
+
method: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional(),
|
|
304
|
+
headers: zod.z.record(zod.z.string()).optional(),
|
|
305
|
+
body: zod.z.union([
|
|
306
|
+
zod.z.string(),
|
|
307
|
+
zod.z.instanceof(FormData),
|
|
308
|
+
zod.z.instanceof(URLSearchParams)
|
|
309
|
+
]).optional(),
|
|
310
|
+
authenticationId: zod.z.number().optional().describe("Zapier authentication ID to use for the request"),
|
|
311
|
+
callbackUrl: zod.z.string().optional().describe("URL to send async response to (makes request async)"),
|
|
312
|
+
authenticationTemplate: zod.z.string().optional().describe(
|
|
313
|
+
"Optional JSON string authentication template to bypass Notary lookup"
|
|
314
|
+
)
|
|
315
|
+
}).optional().describe("Fetch options including authentication");
|
|
301
316
|
|
|
302
317
|
// src/plugins/fetch/index.ts
|
|
303
318
|
var fetchPlugin = ({ sdk }) => {
|
|
@@ -318,6 +333,19 @@ var fetchPlugin = ({ sdk }) => {
|
|
|
318
333
|
callbackUrl,
|
|
319
334
|
authenticationTemplate
|
|
320
335
|
});
|
|
336
|
+
},
|
|
337
|
+
context: {
|
|
338
|
+
meta: {
|
|
339
|
+
fetch: {
|
|
340
|
+
packages: ["sdk"],
|
|
341
|
+
categories: ["http"],
|
|
342
|
+
returnType: "Response",
|
|
343
|
+
inputParameters: [
|
|
344
|
+
{ name: "url", schema: FetchUrlSchema },
|
|
345
|
+
{ name: "init", schema: FetchInitSchema }
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
}
|
|
321
349
|
}
|
|
322
350
|
};
|
|
323
351
|
};
|
|
@@ -3495,37 +3523,53 @@ var registryPlugin = ({ sdk, context }) => {
|
|
|
3495
3523
|
itemType: meta.itemType,
|
|
3496
3524
|
returnType: meta.returnType,
|
|
3497
3525
|
inputSchema: meta.inputSchema,
|
|
3526
|
+
inputParameters: meta.inputParameters,
|
|
3498
3527
|
outputSchema: meta.outputSchema,
|
|
3499
3528
|
categories: meta.categories || [],
|
|
3500
|
-
resolvers: meta.resolvers
|
|
3529
|
+
resolvers: meta.resolvers,
|
|
3530
|
+
packages: meta.packages
|
|
3501
3531
|
};
|
|
3502
3532
|
}).sort((a, b) => a.name.localeCompare(b.name));
|
|
3503
3533
|
const knownCategories = Object.keys(categoryDefinitions);
|
|
3504
|
-
const
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
const
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
const
|
|
3512
|
-
(f) =>
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3534
|
+
const registryCache = /* @__PURE__ */ new Map();
|
|
3535
|
+
function getRegistry(options) {
|
|
3536
|
+
const packageFilter = options?.package;
|
|
3537
|
+
const cacheKey = packageFilter || "__all__";
|
|
3538
|
+
if (registryCache.has(cacheKey)) {
|
|
3539
|
+
return registryCache.get(cacheKey);
|
|
3540
|
+
}
|
|
3541
|
+
const filteredFunctions = packageFilter ? functions.filter(
|
|
3542
|
+
(f) => (
|
|
3543
|
+
// Include if packages is undefined (belongs to all packages) or includes the specified package
|
|
3544
|
+
!f.packages || f.packages.includes(packageFilter)
|
|
3545
|
+
)
|
|
3546
|
+
) : functions;
|
|
3547
|
+
const filteredCategories = knownCategories.sort((a, b) => {
|
|
3548
|
+
if (a === "other") return 1;
|
|
3549
|
+
if (b === "other") return -1;
|
|
3550
|
+
const titleA = categoryDefinitions[a].title;
|
|
3551
|
+
const titleB = categoryDefinitions[b].title;
|
|
3552
|
+
return titleA.localeCompare(titleB);
|
|
3553
|
+
}).map((categoryKey) => {
|
|
3554
|
+
const categoryFunctions = filteredFunctions.filter(
|
|
3555
|
+
(f) => f.categories.includes(categoryKey) || // If the category is "other" and the function is not in any other category, include it
|
|
3556
|
+
categoryKey === "other" && !f.categories.some((c) => knownCategories.includes(c))
|
|
3557
|
+
).map((f) => f.name).sort();
|
|
3558
|
+
const definition = categoryDefinitions[categoryKey];
|
|
3559
|
+
const title = definition.title;
|
|
3560
|
+
return {
|
|
3561
|
+
key: categoryKey,
|
|
3562
|
+
title,
|
|
3563
|
+
titlePlural: definition.titlePlural ?? `${title}s`,
|
|
3564
|
+
functions: categoryFunctions
|
|
3565
|
+
};
|
|
3566
|
+
}).filter((category) => category.functions.length > 0);
|
|
3567
|
+
const result = {
|
|
3568
|
+
functions: filteredFunctions,
|
|
3569
|
+
categories: filteredCategories
|
|
3528
3570
|
};
|
|
3571
|
+
registryCache.set(cacheKey, result);
|
|
3572
|
+
return result;
|
|
3529
3573
|
}
|
|
3530
3574
|
return {
|
|
3531
3575
|
getRegistry
|