webflow-api 1.1.1 → 1.2.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/README.md +12 -1
- package/dist/api/collection.d.ts +85 -24
- package/dist/api/collection.js +88 -29
- package/dist/api/index.d.ts +7 -7
- package/dist/api/index.js +9 -19
- package/dist/api/item.d.ts +141 -107
- package/dist/api/item.js +145 -125
- package/dist/api/meta.d.ts +16 -14
- package/dist/api/meta.js +20 -19
- package/dist/api/oauth.d.ts +38 -36
- package/dist/api/oauth.js +59 -59
- package/dist/api/site.d.ts +118 -43
- package/dist/api/site.js +131 -53
- package/dist/{wrapper/membership.d.ts → api/user.d.ts} +59 -33
- package/dist/api/user.js +103 -0
- package/dist/api/webhook.d.ts +77 -55
- package/dist/api/webhook.js +74 -61
- package/dist/core/error.d.ts +2 -0
- package/dist/core/error.js +8 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/response.d.ts +32 -0
- package/dist/core/response.js +26 -0
- package/dist/{webflow.d.ts → core/webflow.d.ts} +57 -52
- package/dist/{webflow.js → core/webflow.js} +102 -61
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -4
- package/src/api/collection.ts +102 -35
- package/src/api/index.ts +7 -7
- package/src/api/item.ts +207 -176
- package/src/api/meta.ts +19 -18
- package/src/api/oauth.ts +62 -74
- package/src/api/site.ts +158 -55
- package/src/api/user.ts +152 -0
- package/src/api/webhook.ts +97 -80
- package/src/core/error.ts +8 -0
- package/src/core/index.ts +2 -2
- package/src/core/response.ts +50 -0
- package/src/{webflow.ts → core/webflow.ts} +132 -137
- package/src/index.ts +1 -1
- package/yarn.lock +0 -5
- package/dist/api/membership.d.ts +0 -91
- package/dist/api/membership.js +0 -80
- package/dist/core/client.d.ts +0 -40
- package/dist/core/client.js +0 -49
- package/dist/core/options.d.ts +0 -8
- package/dist/core/options.js +0 -5
- package/dist/wrapper/collection.d.ts +0 -85
- package/dist/wrapper/collection.js +0 -94
- package/dist/wrapper/index.d.ts +0 -6
- package/dist/wrapper/index.js +0 -22
- package/dist/wrapper/item.d.ts +0 -140
- package/dist/wrapper/item.js +0 -153
- package/dist/wrapper/membership.js +0 -106
- package/dist/wrapper/response.d.ts +0 -16
- package/dist/wrapper/response.js +0 -17
- package/dist/wrapper/site.d.ts +0 -119
- package/dist/wrapper/site.js +0 -136
- package/dist/wrapper/webhook.d.ts +0 -78
- package/dist/wrapper/webhook.js +0 -82
- package/src/api/membership.ts +0 -125
- package/src/core/client.ts +0 -76
- package/src/core/options.ts +0 -9
- package/src/wrapper/collection.ts +0 -115
- package/src/wrapper/index.ts +0 -6
- package/src/wrapper/item.ts +0 -218
- package/src/wrapper/membership.ts +0 -138
- package/src/wrapper/response.ts +0 -25
- package/src/wrapper/site.ts +0 -164
- package/src/wrapper/webhook.ts +0 -116
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { AxiosRequestConfig } from "axios";
|
|
2
|
+
import { PaginationFilter } from "../core";
|
|
3
|
+
import { Collection, IAccessTokenParams, IAuthorizeUrlParams, IRevokeTokenParams, User, Site, Webhook, WebhookFilter, Item } from "../api";
|
|
4
|
+
export declare const DEFAULT_HOST = "webflow.com";
|
|
5
|
+
export declare const USER_AGENT = "Webflow Javascript SDK / 1.0";
|
|
6
|
+
export interface Options {
|
|
7
|
+
host?: string;
|
|
8
|
+
token?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
}
|
|
4
12
|
/**************************************************************
|
|
5
13
|
* Class
|
|
6
14
|
**************************************************************/
|
|
7
15
|
export declare class Webflow {
|
|
8
16
|
options: Options;
|
|
9
|
-
client
|
|
17
|
+
private client;
|
|
10
18
|
constructor(options?: Options);
|
|
11
19
|
set token(value: string);
|
|
12
20
|
clearToken(): void;
|
|
21
|
+
get config(): AxiosRequestConfig<any>;
|
|
13
22
|
/**************************************************************
|
|
14
23
|
* HTTP Methods
|
|
15
24
|
**************************************************************/
|
|
@@ -19,14 +28,14 @@ export declare class Webflow {
|
|
|
19
28
|
* @param params The query parameters (optional)
|
|
20
29
|
* @returns The response from the Webflow API
|
|
21
30
|
*/
|
|
22
|
-
get(path: string, params?:
|
|
31
|
+
get(path: string, params?: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
23
32
|
/**
|
|
24
33
|
* Send a DELETE request to the Webflow API
|
|
25
34
|
* @param path The path to the endpoint
|
|
26
35
|
* @param params The query parameters (optional)
|
|
27
36
|
* @returns The response from the Webflow API
|
|
28
37
|
*/
|
|
29
|
-
delete(path: string, params?:
|
|
38
|
+
delete(path: string, params?: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
30
39
|
/**
|
|
31
40
|
* Send a POST request to create a new Collection
|
|
32
41
|
* @param path The path to the endpoint
|
|
@@ -34,7 +43,7 @@ export declare class Webflow {
|
|
|
34
43
|
* @param params The query parameters (optional)
|
|
35
44
|
* @returns The response from the Webflow API
|
|
36
45
|
*/
|
|
37
|
-
post(path: string, data: any, params?:
|
|
46
|
+
post(path: string, data: any, params?: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
38
47
|
/**
|
|
39
48
|
* Send a PUT request to create a new Collection
|
|
40
49
|
* @param path The path to the endpoint
|
|
@@ -42,7 +51,7 @@ export declare class Webflow {
|
|
|
42
51
|
* @param params The query parameters (optional)
|
|
43
52
|
* @returns The response from the Webflow API
|
|
44
53
|
*/
|
|
45
|
-
put(path: string, data: any, params?:
|
|
54
|
+
put(path: string, data: any, params?: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
46
55
|
/**
|
|
47
56
|
* Send a PATCH request to create a new Collection
|
|
48
57
|
* @param path The path to the endpoint
|
|
@@ -50,7 +59,7 @@ export declare class Webflow {
|
|
|
50
59
|
* @param params The query parameters (optional)
|
|
51
60
|
* @returns The response from the Webflow API
|
|
52
61
|
*/
|
|
53
|
-
patch(path: string, data: any, params?:
|
|
62
|
+
patch(path: string, data: any, params?: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
|
|
54
63
|
/**************************************************************
|
|
55
64
|
* OAuth Endpoints
|
|
56
65
|
**************************************************************/
|
|
@@ -64,7 +73,7 @@ export declare class Webflow {
|
|
|
64
73
|
* @param params.response_type The response_type parameter (default: "code")
|
|
65
74
|
* @returns The url to redirect to
|
|
66
75
|
*/
|
|
67
|
-
authorizeUrl(params:
|
|
76
|
+
authorizeUrl(params: IAuthorizeUrlParams): string;
|
|
68
77
|
/**
|
|
69
78
|
* Create an OAuth Access Token
|
|
70
79
|
* @param params The OAuth information
|
|
@@ -75,7 +84,7 @@ export declare class Webflow {
|
|
|
75
84
|
* @param params.grant_type The grant_type parameter (default: "authorization_code")
|
|
76
85
|
* @returns The access token
|
|
77
86
|
*/
|
|
78
|
-
accessToken(params:
|
|
87
|
+
accessToken(params: IAccessTokenParams): Promise<import("../api").IAccessToken>;
|
|
79
88
|
/**
|
|
80
89
|
* Revoke an OAuth Access Token
|
|
81
90
|
* @param params The access token information
|
|
@@ -84,7 +93,7 @@ export declare class Webflow {
|
|
|
84
93
|
* @param params.client_secret The client_secret parameter
|
|
85
94
|
* @returns The result of the revoked token
|
|
86
95
|
*/
|
|
87
|
-
revokeToken(params:
|
|
96
|
+
revokeToken(params: IRevokeTokenParams): Promise<import("../api").IRevokeToken>;
|
|
88
97
|
/**************************************************************
|
|
89
98
|
* Meta Endpoints
|
|
90
99
|
**************************************************************/
|
|
@@ -92,21 +101,20 @@ export declare class Webflow {
|
|
|
92
101
|
* Get the current authorization information
|
|
93
102
|
* @returns The authorization information
|
|
94
103
|
*/
|
|
95
|
-
info(): Promise<import("
|
|
104
|
+
info(): Promise<import("../api").IAuthentiationInfo>;
|
|
96
105
|
/**
|
|
97
106
|
* Get the current authenticated user
|
|
98
107
|
* @returns The current authenticated user
|
|
99
108
|
*/
|
|
100
|
-
authenticatedUser(): Promise<import("
|
|
109
|
+
authenticatedUser(): Promise<import("../api").IAuthenticatedUser>;
|
|
101
110
|
/**************************************************************
|
|
102
111
|
* Site Endpoints
|
|
103
112
|
**************************************************************/
|
|
104
113
|
/**
|
|
105
114
|
* Get a list of Sites available
|
|
106
|
-
* @param query The query parameters (optional)
|
|
107
115
|
* @returns A list of Sites
|
|
108
116
|
*/
|
|
109
|
-
sites(
|
|
117
|
+
sites(): Promise<Site[]>;
|
|
110
118
|
/**
|
|
111
119
|
* Get a single Site
|
|
112
120
|
* @param params The Site information
|
|
@@ -115,7 +123,7 @@ export declare class Webflow {
|
|
|
115
123
|
*/
|
|
116
124
|
site({ siteId }: {
|
|
117
125
|
siteId: string;
|
|
118
|
-
}): Promise<
|
|
126
|
+
}): Promise<Site>;
|
|
119
127
|
/**
|
|
120
128
|
* Publish a Site
|
|
121
129
|
* @param params The Site information
|
|
@@ -127,7 +135,7 @@ export declare class Webflow {
|
|
|
127
135
|
siteId: string;
|
|
128
136
|
} & {
|
|
129
137
|
domains: string[];
|
|
130
|
-
}): Promise<import("
|
|
138
|
+
}): Promise<import("../api").IPublishSite>;
|
|
131
139
|
/**
|
|
132
140
|
* Get a list of Domains for a Site
|
|
133
141
|
* @param params The Site information
|
|
@@ -136,7 +144,7 @@ export declare class Webflow {
|
|
|
136
144
|
*/
|
|
137
145
|
domains({ siteId }: {
|
|
138
146
|
siteId: string;
|
|
139
|
-
}): Promise<import("
|
|
147
|
+
}): Promise<import("../api").IDomain[]>;
|
|
140
148
|
/**************************************************************
|
|
141
149
|
* Collection Endpoints
|
|
142
150
|
**************************************************************/
|
|
@@ -144,12 +152,11 @@ export declare class Webflow {
|
|
|
144
152
|
* Get a list of Collections
|
|
145
153
|
* @param params The Site information
|
|
146
154
|
* @param params.siteId The Site ID
|
|
147
|
-
* @param query The query parameters (optional)
|
|
148
155
|
* @returns A list of Collections
|
|
149
156
|
*/
|
|
150
157
|
collections({ siteId }: {
|
|
151
158
|
siteId: string;
|
|
152
|
-
}
|
|
159
|
+
}): Promise<Collection[]>;
|
|
153
160
|
/**
|
|
154
161
|
* Get a single Collection
|
|
155
162
|
* @param params The Collection information
|
|
@@ -158,7 +165,7 @@ export declare class Webflow {
|
|
|
158
165
|
*/
|
|
159
166
|
collection({ collectionId }: {
|
|
160
167
|
collectionId: string;
|
|
161
|
-
}): Promise<
|
|
168
|
+
}): Promise<Collection>;
|
|
162
169
|
/**************************************************************
|
|
163
170
|
* Item Endpoints
|
|
164
171
|
**************************************************************/
|
|
@@ -166,12 +173,13 @@ export declare class Webflow {
|
|
|
166
173
|
* Get a list of Collection Items
|
|
167
174
|
* @param params The Collection information
|
|
168
175
|
* @param params.collectionId The Collection ID
|
|
169
|
-
* @param
|
|
176
|
+
* @param params.limit The number of items to return
|
|
177
|
+
* @param params.offset The number of items to skip
|
|
170
178
|
* @returns A list of Items
|
|
171
179
|
*/
|
|
172
|
-
items({ collectionId }: {
|
|
180
|
+
items({ collectionId, limit, offset }: {
|
|
173
181
|
collectionId: string;
|
|
174
|
-
}
|
|
182
|
+
} & PaginationFilter): Promise<Item[]>;
|
|
175
183
|
/**
|
|
176
184
|
* Get a single Collection Item
|
|
177
185
|
* @param params The Item information
|
|
@@ -179,20 +187,20 @@ export declare class Webflow {
|
|
|
179
187
|
* @param params.itemId The Item ID
|
|
180
188
|
* @returns A single Collection Item
|
|
181
189
|
*/
|
|
182
|
-
item({ itemId, collectionId
|
|
190
|
+
item({ itemId, collectionId }: {
|
|
183
191
|
itemId: string;
|
|
184
192
|
collectionId: string;
|
|
185
|
-
}): Promise<
|
|
193
|
+
}): Promise<Item>;
|
|
186
194
|
/**
|
|
187
195
|
* Create a new Collection Item
|
|
188
196
|
* @param params The Item information
|
|
189
197
|
* @param params.collectionId The Collection ID
|
|
190
198
|
* @returns The created Collection Item
|
|
191
199
|
*/
|
|
192
|
-
createItem({ collectionId, fields
|
|
200
|
+
createItem({ collectionId, fields }: {
|
|
193
201
|
collectionId: string;
|
|
194
202
|
fields: any;
|
|
195
|
-
}): Promise<
|
|
203
|
+
}): Promise<Item>;
|
|
196
204
|
/**
|
|
197
205
|
* Update a Collection Item
|
|
198
206
|
* @param params The Item information
|
|
@@ -204,19 +212,18 @@ export declare class Webflow {
|
|
|
204
212
|
updateItem({ collectionId, itemId, ...fields }: {
|
|
205
213
|
itemId: string;
|
|
206
214
|
collectionId: string;
|
|
207
|
-
}): Promise<
|
|
215
|
+
}): Promise<Item>;
|
|
208
216
|
/**
|
|
209
217
|
* Patch a Collection Item
|
|
210
218
|
* @param params The Item information
|
|
211
219
|
* @param params.collectionId The Collection ID
|
|
212
220
|
* @param params.itemId The Item ID
|
|
213
|
-
* @param query The query parameters (optional)
|
|
214
221
|
* @returns The patched Collection Item
|
|
215
222
|
*/
|
|
216
223
|
patchItem({ collectionId, itemId, ...fields }: {
|
|
217
224
|
collectionId: string;
|
|
218
225
|
itemId: string;
|
|
219
|
-
}
|
|
226
|
+
}): Promise<Item>;
|
|
220
227
|
/**
|
|
221
228
|
* Delete a Collection Item
|
|
222
229
|
* @param params The Item information
|
|
@@ -224,38 +231,36 @@ export declare class Webflow {
|
|
|
224
231
|
* @param params.itemId The Item ID
|
|
225
232
|
* @returns The deleted Collection Item result
|
|
226
233
|
*/
|
|
227
|
-
removeItem({ collectionId, itemId
|
|
234
|
+
removeItem({ collectionId, itemId }: {
|
|
228
235
|
itemId: string;
|
|
229
236
|
collectionId: string;
|
|
230
|
-
}): Promise<import("
|
|
237
|
+
}): Promise<import("../api").IItemDelete>;
|
|
231
238
|
/**
|
|
232
239
|
* Upublish a Collection Item
|
|
233
240
|
* @param params The Item information
|
|
234
241
|
* @param params.collectionId The Collection ID
|
|
235
242
|
* @param params.itemId The Item ID
|
|
236
|
-
* @param
|
|
237
|
-
* @param query.live Update the live version
|
|
243
|
+
* @param params.live Update the live version
|
|
238
244
|
* @returns The unpublished Collection Item result
|
|
239
245
|
*/
|
|
240
|
-
deleteItems({ collectionId, itemIds, live
|
|
246
|
+
deleteItems({ collectionId, itemIds, live }: {
|
|
241
247
|
collectionId: string;
|
|
242
248
|
itemIds: string[];
|
|
243
249
|
live?: boolean;
|
|
244
|
-
}): Promise<import("
|
|
250
|
+
}): Promise<import("../api").IDeletedItems>;
|
|
245
251
|
/**
|
|
246
252
|
* Publish a Collection Item
|
|
247
253
|
* @param params The Item information
|
|
248
254
|
* @param params.collectionId The Collection ID
|
|
249
255
|
* @param params.itemId The Item ID
|
|
250
|
-
* @param
|
|
251
|
-
* @param query.live Update the live version
|
|
256
|
+
* @param params.live Update the live version
|
|
252
257
|
* @returns The Published Collection Item result
|
|
253
258
|
*/
|
|
254
|
-
publishItems({ collectionId, itemIds, live
|
|
259
|
+
publishItems({ collectionId, itemIds, live }: {
|
|
255
260
|
collectionId: string;
|
|
256
261
|
itemIds: string[];
|
|
257
262
|
live?: boolean;
|
|
258
|
-
}): Promise<import("
|
|
263
|
+
}): Promise<import("../api").IPublishItems>;
|
|
259
264
|
/**************************************************************
|
|
260
265
|
* Membership Endpoints
|
|
261
266
|
**************************************************************/
|
|
@@ -268,7 +273,7 @@ export declare class Webflow {
|
|
|
268
273
|
*/
|
|
269
274
|
users({ siteId }: {
|
|
270
275
|
siteId: string;
|
|
271
|
-
}, pageParams?: PaginationFilter): Promise<
|
|
276
|
+
}, pageParams?: PaginationFilter): Promise<User[]>;
|
|
272
277
|
/**
|
|
273
278
|
* Get a single User account
|
|
274
279
|
* @param param The Site and User information
|
|
@@ -279,7 +284,7 @@ export declare class Webflow {
|
|
|
279
284
|
user({ siteId, userId }: {
|
|
280
285
|
siteId: string;
|
|
281
286
|
userId: string;
|
|
282
|
-
}): Promise<
|
|
287
|
+
}): Promise<User>;
|
|
283
288
|
/**
|
|
284
289
|
* Update a User account
|
|
285
290
|
* @param params The Site and User information
|
|
@@ -291,7 +296,7 @@ export declare class Webflow {
|
|
|
291
296
|
siteId: string;
|
|
292
297
|
userId: string;
|
|
293
298
|
data: any;
|
|
294
|
-
}): Promise<
|
|
299
|
+
}): Promise<User>;
|
|
295
300
|
/**
|
|
296
301
|
* Invite a User to a Site
|
|
297
302
|
* @param params The Site and User information
|
|
@@ -302,7 +307,7 @@ export declare class Webflow {
|
|
|
302
307
|
inviteUser({ siteId, email }: {
|
|
303
308
|
siteId: string;
|
|
304
309
|
email: string;
|
|
305
|
-
}): Promise<
|
|
310
|
+
}): Promise<User>;
|
|
306
311
|
/**
|
|
307
312
|
* Remove a user from a Site
|
|
308
313
|
* @param params The Site and User information
|
|
@@ -313,7 +318,7 @@ export declare class Webflow {
|
|
|
313
318
|
removeUser({ siteId, userId }: {
|
|
314
319
|
siteId: string;
|
|
315
320
|
userId: string;
|
|
316
|
-
}): Promise<import("
|
|
321
|
+
}): Promise<import("../api").IUserDelete>;
|
|
317
322
|
/**************************************************************
|
|
318
323
|
* Webhook Endpoints
|
|
319
324
|
**************************************************************/
|
|
@@ -325,7 +330,7 @@ export declare class Webflow {
|
|
|
325
330
|
*/
|
|
326
331
|
webhooks({ siteId }: {
|
|
327
332
|
siteId: string;
|
|
328
|
-
}
|
|
333
|
+
}): Promise<Webhook[]>;
|
|
329
334
|
/**
|
|
330
335
|
* Get a single Webhook
|
|
331
336
|
* @param params The Webhook and Site information
|
|
@@ -336,7 +341,7 @@ export declare class Webflow {
|
|
|
336
341
|
webhook({ siteId, webhookId }: {
|
|
337
342
|
siteId: string;
|
|
338
343
|
webhookId: string;
|
|
339
|
-
}): Promise<
|
|
344
|
+
}): Promise<Webhook>;
|
|
340
345
|
/**
|
|
341
346
|
* Remove a Webhook
|
|
342
347
|
* @param params The Webhook and Site information
|
|
@@ -347,7 +352,7 @@ export declare class Webflow {
|
|
|
347
352
|
removeWebhook({ siteId, webhookId }: {
|
|
348
353
|
siteId: string;
|
|
349
354
|
webhookId: string;
|
|
350
|
-
}): Promise<import("
|
|
355
|
+
}): Promise<import("../api").IRemoveResult>;
|
|
351
356
|
/**
|
|
352
357
|
* Create a Webhook
|
|
353
358
|
* @param params The params to create a webhooks
|
|
@@ -361,6 +366,6 @@ export declare class Webflow {
|
|
|
361
366
|
url: string;
|
|
362
367
|
siteId: string;
|
|
363
368
|
triggerType: string;
|
|
364
|
-
filter?:
|
|
365
|
-
}): Promise<
|
|
369
|
+
filter?: WebhookFilter;
|
|
370
|
+
}): Promise<Webhook>;
|
|
366
371
|
}
|