webflow-api 1.1.2 → 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.
Files changed (70) hide show
  1. package/dist/api/collection.d.ts +85 -24
  2. package/dist/api/collection.js +88 -29
  3. package/dist/api/index.d.ts +7 -7
  4. package/dist/api/index.js +9 -19
  5. package/dist/api/item.d.ts +141 -107
  6. package/dist/api/item.js +145 -125
  7. package/dist/api/meta.d.ts +16 -14
  8. package/dist/api/meta.js +20 -19
  9. package/dist/api/oauth.d.ts +38 -36
  10. package/dist/api/oauth.js +59 -59
  11. package/dist/api/site.d.ts +118 -43
  12. package/dist/api/site.js +131 -53
  13. package/dist/{wrapper/membership.d.ts → api/user.d.ts} +59 -47
  14. package/dist/api/user.js +103 -0
  15. package/dist/api/webhook.d.ts +77 -55
  16. package/dist/api/webhook.js +74 -61
  17. package/dist/core/error.d.ts +2 -0
  18. package/dist/core/error.js +8 -1
  19. package/dist/core/index.d.ts +2 -2
  20. package/dist/core/index.js +2 -2
  21. package/dist/core/response.d.ts +32 -0
  22. package/dist/core/response.js +26 -0
  23. package/dist/{webflow.d.ts → core/webflow.d.ts} +56 -59
  24. package/dist/{webflow.js → core/webflow.js} +101 -68
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +2 -2
  27. package/package.json +2 -4
  28. package/src/api/collection.ts +102 -35
  29. package/src/api/index.ts +7 -7
  30. package/src/api/item.ts +207 -176
  31. package/src/api/meta.ts +19 -18
  32. package/src/api/oauth.ts +62 -74
  33. package/src/api/site.ts +158 -55
  34. package/src/api/user.ts +152 -0
  35. package/src/api/webhook.ts +97 -80
  36. package/src/core/error.ts +8 -0
  37. package/src/core/index.ts +2 -2
  38. package/src/core/response.ts +50 -0
  39. package/src/{webflow.ts → core/webflow.ts} +131 -145
  40. package/src/index.ts +1 -1
  41. package/yarn.lock +0 -5
  42. package/dist/api/membership.d.ts +0 -114
  43. package/dist/api/membership.js +0 -96
  44. package/dist/core/client.d.ts +0 -27
  45. package/dist/core/client.js +0 -60
  46. package/dist/core/options.d.ts +0 -8
  47. package/dist/core/options.js +0 -5
  48. package/dist/wrapper/collection.d.ts +0 -85
  49. package/dist/wrapper/collection.js +0 -94
  50. package/dist/wrapper/index.d.ts +0 -6
  51. package/dist/wrapper/index.js +0 -22
  52. package/dist/wrapper/item.d.ts +0 -140
  53. package/dist/wrapper/item.js +0 -153
  54. package/dist/wrapper/membership.js +0 -123
  55. package/dist/wrapper/response.d.ts +0 -16
  56. package/dist/wrapper/response.js +0 -17
  57. package/dist/wrapper/site.d.ts +0 -168
  58. package/dist/wrapper/site.js +0 -191
  59. package/dist/wrapper/webhook.d.ts +0 -78
  60. package/dist/wrapper/webhook.js +0 -82
  61. package/src/api/membership.ts +0 -155
  62. package/src/core/client.ts +0 -82
  63. package/src/core/options.ts +0 -9
  64. package/src/wrapper/collection.ts +0 -115
  65. package/src/wrapper/index.ts +0 -6
  66. package/src/wrapper/item.ts +0 -218
  67. package/src/wrapper/membership.ts +0 -163
  68. package/src/wrapper/response.ts +0 -25
  69. package/src/wrapper/site.ts +0 -228
  70. package/src/wrapper/webhook.ts +0 -116
@@ -1,32 +1,68 @@
1
- import { QueryString, Options, Client, PaginationFilter } from "./core";
2
- import { Meta, OAuth, Webhook } from "./api";
1
+ import axios, { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { PaginationFilter } from "../core";
3
3
  import {
4
- MembershipWrapper,
5
- CollectionWrapper,
6
- WebhookWrapper,
7
- SiteWrapper,
8
- ItemWrapper,
9
- ResponseWrapper,
10
- } from "./wrapper";
4
+ Collection,
5
+ IAccessTokenParams,
6
+ IAuthorizeUrlParams,
7
+ IRevokeTokenParams,
8
+ User,
9
+ Meta,
10
+ OAuth,
11
+ Site,
12
+ Webhook,
13
+ WebhookFilter,
14
+ Item,
15
+ } from "../api";
16
+
17
+ export const DEFAULT_HOST = "webflow.com";
18
+ export const USER_AGENT = "Webflow Javascript SDK / 1.0";
19
+
20
+ export interface Options {
21
+ host?: string;
22
+ token?: string;
23
+ version?: string;
24
+ headers?: Record<string, string>;
25
+ }
11
26
 
12
27
  /**************************************************************
13
28
  * Class
14
29
  **************************************************************/
15
30
  export class Webflow {
16
- client: Client;
17
-
31
+ private client: AxiosInstance;
18
32
  constructor(public options: Options = {}) {
19
- this.client = new Client(options);
33
+ this.client = axios.create(this.config);
20
34
  }
21
35
 
22
36
  // Set the Authentication token
23
37
  set token(value: string) {
24
- this.client.token = value;
38
+ this.options.token = value;
25
39
  }
26
40
 
27
41
  // clear the Authorization header
28
42
  clearToken() {
29
- this.client.clearToken();
43
+ delete this.options.token;
44
+ }
45
+
46
+ // The Axios configuration
47
+ get config() {
48
+ const { host = DEFAULT_HOST, token, version, headers } = this.options;
49
+
50
+ const config: AxiosRequestConfig = {
51
+ baseURL: `https://api.${host}/`,
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ "User-Agent": USER_AGENT,
55
+ ...headers,
56
+ },
57
+ };
58
+
59
+ // Add the version to the headers if passed in
60
+ if (version) config.headers["Accept-Version"] = version;
61
+
62
+ // Add the Authorization header if a token is set
63
+ if (token) config.headers.Authorization = `Bearer ${token}`;
64
+
65
+ return config;
30
66
  }
31
67
 
32
68
  /**************************************************************
@@ -39,7 +75,7 @@ export class Webflow {
39
75
  * @param params The query parameters (optional)
40
76
  * @returns The response from the Webflow API
41
77
  */
42
- get(path: string, params?: QueryString) {
78
+ get(path: string, params?: Record<string, any>) {
43
79
  return this.client.get(path, { params });
44
80
  }
45
81
  /**
@@ -48,7 +84,7 @@ export class Webflow {
48
84
  * @param params The query parameters (optional)
49
85
  * @returns The response from the Webflow API
50
86
  */
51
- delete(path: string, params?: QueryString) {
87
+ delete(path: string, params?: Record<string, any>) {
52
88
  return this.client.delete(path, { params });
53
89
  }
54
90
  /**
@@ -58,7 +94,7 @@ export class Webflow {
58
94
  * @param params The query parameters (optional)
59
95
  * @returns The response from the Webflow API
60
96
  */
61
- post(path: string, data: any, params?: QueryString) {
97
+ post(path: string, data: any, params?: Record<string, any>) {
62
98
  return this.client.post(path, data, { params });
63
99
  }
64
100
  /**
@@ -68,7 +104,7 @@ export class Webflow {
68
104
  * @param params The query parameters (optional)
69
105
  * @returns The response from the Webflow API
70
106
  */
71
- put(path: string, data: any, params?: QueryString) {
107
+ put(path: string, data: any, params?: Record<string, any>) {
72
108
  return this.client.put(path, data, { params });
73
109
  }
74
110
  /**
@@ -78,7 +114,7 @@ export class Webflow {
78
114
  * @param params The query parameters (optional)
79
115
  * @returns The response from the Webflow API
80
116
  */
81
- patch(path: string, data: any, params?: QueryString) {
117
+ patch(path: string, data: any, params?: Record<string, any>) {
82
118
  return this.client.patch(path, data, { params });
83
119
  }
84
120
 
@@ -96,8 +132,8 @@ export class Webflow {
96
132
  * @param params.response_type The response_type parameter (default: "code")
97
133
  * @returns The url to redirect to
98
134
  */
99
- authorizeUrl(params: OAuth.IAuthorizeUrlParams) {
100
- return OAuth.authorizeUrl(this.client, params);
135
+ authorizeUrl(params: IAuthorizeUrlParams) {
136
+ return OAuth.authorizeUrl(params, this.client);
101
137
  }
102
138
  /**
103
139
  * Create an OAuth Access Token
@@ -109,9 +145,9 @@ export class Webflow {
109
145
  * @param params.grant_type The grant_type parameter (default: "authorization_code")
110
146
  * @returns The access token
111
147
  */
112
- async accessToken(params: OAuth.IAccessTokenParams) {
113
- const res = await OAuth.accessToken(this.client, params);
114
- return ResponseWrapper<typeof res.data>(res);
148
+ async accessToken(params: IAccessTokenParams) {
149
+ const res = await OAuth.accessToken(params, this.client);
150
+ return res.data;
115
151
  }
116
152
  /**
117
153
  * Revoke an OAuth Access Token
@@ -121,9 +157,9 @@ export class Webflow {
121
157
  * @param params.client_secret The client_secret parameter
122
158
  * @returns The result of the revoked token
123
159
  */
124
- async revokeToken(params: OAuth.IRevokeTokenParams) {
125
- const res = await OAuth.revokeToken(this.client, params);
126
- return ResponseWrapper<typeof res.data>(res);
160
+ async revokeToken(params: IRevokeTokenParams) {
161
+ const res = await OAuth.revokeToken(params, this.client);
162
+ return res.data;
127
163
  }
128
164
 
129
165
  /**************************************************************
@@ -136,7 +172,7 @@ export class Webflow {
136
172
  */
137
173
  async info() {
138
174
  const res = await Meta.info(this.client);
139
- return ResponseWrapper<typeof res.data>(res);
175
+ return res.data;
140
176
  }
141
177
  /**
142
178
  * Get the current authenticated user
@@ -144,7 +180,7 @@ export class Webflow {
144
180
  */
145
181
  async authenticatedUser() {
146
182
  const res = await Meta.user(this.client);
147
- return ResponseWrapper<typeof res.data>(res);
183
+ return res.data;
148
184
  }
149
185
 
150
186
  /**************************************************************
@@ -153,11 +189,11 @@ export class Webflow {
153
189
 
154
190
  /**
155
191
  * Get a list of Sites available
156
- * @param query The query parameters (optional)
157
192
  * @returns A list of Sites
158
193
  */
159
- async sites(query?: QueryString) {
160
- return SiteWrapper.list(this.client, query);
194
+ async sites() {
195
+ const res = await Site.list(this.client);
196
+ return res.data.map((data) => new Site(this.client, { ...res, data }));
161
197
  }
162
198
  /**
163
199
  * Get a single Site
@@ -166,7 +202,8 @@ export class Webflow {
166
202
  * @returns The Site
167
203
  */
168
204
  async site({ siteId }: { siteId: string }) {
169
- return SiteWrapper.getOne(this.client, { siteId });
205
+ const res = await Site.getOne({ siteId }, this.client);
206
+ return new Site(this.client, res);
170
207
  }
171
208
  /**
172
209
  * Publish a Site
@@ -175,8 +212,9 @@ export class Webflow {
175
212
  * @param params.domain The domains to publish
176
213
  * @returns The result of the publish
177
214
  */
178
- publishSite({ siteId, domains }: { siteId: string } & { domains: string[] }) {
179
- return SiteWrapper.publish(this.client, { siteId, domains });
215
+ async publishSite({ siteId, domains }: { siteId: string } & { domains: string[] }) {
216
+ const res = await Site.publish({ siteId, domains }, this.client);
217
+ return res.data;
180
218
  }
181
219
  /**
182
220
  * Get a list of Domains for a Site
@@ -185,7 +223,8 @@ export class Webflow {
185
223
  * @returns A list of Domains
186
224
  */
187
225
  async domains({ siteId }: { siteId: string }) {
188
- return SiteWrapper.domains(this.client, { siteId });
226
+ const res = await Site.domains({ siteId }, this.client);
227
+ return res.data;
189
228
  }
190
229
 
191
230
  /**************************************************************
@@ -196,11 +235,11 @@ export class Webflow {
196
235
  * Get a list of Collections
197
236
  * @param params The Site information
198
237
  * @param params.siteId The Site ID
199
- * @param query The query parameters (optional)
200
238
  * @returns A list of Collections
201
239
  */
202
- async collections({ siteId }: { siteId: string }, query?: QueryString) {
203
- return CollectionWrapper.list(this.client, { siteId }, query);
240
+ async collections({ siteId }: { siteId: string }) {
241
+ const res = await Collection.list({ siteId }, this.client);
242
+ return res.data.map((data) => new Collection(this.client, { ...res, data }));
204
243
  }
205
244
  /**
206
245
  * Get a single Collection
@@ -209,7 +248,8 @@ export class Webflow {
209
248
  * @returns A single Collection
210
249
  */
211
250
  async collection({ collectionId }: { collectionId: string }) {
212
- return CollectionWrapper.getOne(this.client, { collectionId });
251
+ const res = await Collection.getOne({ collectionId }, this.client);
252
+ return new Collection(this.client, res);
213
253
  }
214
254
 
215
255
  /**************************************************************
@@ -220,14 +260,13 @@ export class Webflow {
220
260
  * Get a list of Collection Items
221
261
  * @param params The Collection information
222
262
  * @param params.collectionId The Collection ID
223
- * @param pageParams The pagination parameters (optional)
263
+ * @param params.limit The number of items to return
264
+ * @param params.offset The number of items to skip
224
265
  * @returns A list of Items
225
266
  */
226
- async items(
227
- { collectionId }: { collectionId: string },
228
- pageParams?: PaginationFilter
229
- ) {
230
- return ItemWrapper.list(this.client, { collectionId, ...pageParams });
267
+ async items({ collectionId, limit, offset }: { collectionId: string } & PaginationFilter) {
268
+ const res = await Item.list({ collectionId, limit, offset }, this.client);
269
+ return res.data.items.map((data) => new Item(this.client, { ...res, data }));
231
270
  }
232
271
  /**
233
272
  * Get a single Collection Item
@@ -236,14 +275,10 @@ export class Webflow {
236
275
  * @param params.itemId The Item ID
237
276
  * @returns A single Collection Item
238
277
  */
239
- async item({
240
- itemId,
241
- collectionId,
242
- }: {
243
- itemId: string;
244
- collectionId: string;
245
- }) {
246
- return ItemWrapper.getOne(this.client, { itemId, collectionId });
278
+ async item({ itemId, collectionId }: { itemId: string; collectionId: string }) {
279
+ const res = await Item.getOne({ itemId, collectionId }, this.client);
280
+ const [item] = res.data.items.map((data) => new Item(this.client, { ...res, data }));
281
+ return item;
247
282
  }
248
283
  /**
249
284
  * Create a new Collection Item
@@ -251,51 +286,34 @@ export class Webflow {
251
286
  * @param params.collectionId The Collection ID
252
287
  * @returns The created Collection Item
253
288
  */
254
- async createItem({
255
- collectionId,
256
- fields,
257
- }: {
258
- collectionId: string;
259
- fields: any;
260
- }) {
261
- return ItemWrapper.create(this.client, { collectionId, fields });
289
+ async createItem({ collectionId, fields }: { collectionId: string; fields: any }) {
290
+ const res = await Item.create({ collectionId, fields }, this.client);
291
+ return new Item(this.client, res);
262
292
  }
263
293
  /**
264
294
  * Update a Collection Item
265
295
  * @param params The Item information
266
296
  * @param params.collectionId The Collection ID
267
297
  * @param params.itemId The Item ID
298
+ * @param query The query parameters (optional)
268
299
  * @returns The updated Collection Item
269
300
  */
270
- updateItem({
271
- collectionId,
272
- itemId,
273
- ...fields
274
- }: {
275
- itemId: string;
276
- collectionId: string;
277
- }) {
301
+ async updateItem({ collectionId, itemId, ...fields }: { itemId: string; collectionId: string }) {
278
302
  const _params = { collectionId, itemId, fields };
279
- return ItemWrapper.update(this.client, _params);
303
+ const res = await Item.update(_params, this.client);
304
+ return new Item(this.client, res);
280
305
  }
281
306
  /**
282
307
  * Patch a Collection Item
283
308
  * @param params The Item information
284
309
  * @param params.collectionId The Collection ID
285
310
  * @param params.itemId The Item ID
286
- * @param query The query parameters (optional)
287
311
  * @returns The patched Collection Item
288
312
  */
289
- patchItem(
290
- {
291
- collectionId,
292
- itemId,
293
- ...fields
294
- }: { collectionId: string; itemId: string },
295
- query?: QueryString
296
- ) {
313
+ async patchItem({ collectionId, itemId, ...fields }: { collectionId: string; itemId: string }) {
297
314
  const _params = { collectionId, itemId, fields };
298
- return ItemWrapper.patch(this.client, _params, query);
315
+ const res = await Item.patch(_params, this.client);
316
+ return new Item(this.client, res);
299
317
  }
300
318
  /**
301
319
  * Delete a Collection Item
@@ -304,14 +322,9 @@ export class Webflow {
304
322
  * @param params.itemId The Item ID
305
323
  * @returns The deleted Collection Item result
306
324
  */
307
- removeItem({
308
- collectionId,
309
- itemId,
310
- }: {
311
- itemId: string;
312
- collectionId: string;
313
- }) {
314
- return ItemWrapper.remove(this.client, { collectionId, itemId });
325
+ async removeItem({ collectionId, itemId }: { itemId: string; collectionId: string }) {
326
+ const res = await Item.remove({ collectionId, itemId }, this.client);
327
+ return res.data;
315
328
  }
316
329
  /**
317
330
  * Upublish a Collection Item
@@ -321,17 +334,9 @@ export class Webflow {
321
334
  * @param params.live Update the live version
322
335
  * @returns The unpublished Collection Item result
323
336
  */
324
- deleteItems({
325
- collectionId,
326
- itemIds,
327
- live,
328
- }: {
329
- collectionId: string;
330
- itemIds: string[];
331
- live?: boolean;
332
- }) {
333
- const params = { collectionId, itemIds, live };
334
- return ItemWrapper.unpublish(this.client, params);
337
+ async deleteItems({ collectionId, itemIds, live }: { collectionId: string; itemIds: string[]; live?: boolean }) {
338
+ const res = await Item.unpublish({ collectionId, itemIds, live }, this.client);
339
+ return res.data;
335
340
  }
336
341
  /**
337
342
  * Publish a Collection Item
@@ -341,17 +346,9 @@ export class Webflow {
341
346
  * @param params.live Update the live version
342
347
  * @returns The Published Collection Item result
343
348
  */
344
- publishItems({
345
- collectionId,
346
- itemIds,
347
- live,
348
- }: {
349
- collectionId: string;
350
- itemIds: string[];
351
- live?: boolean;
352
- }) {
353
- const params = { collectionId, itemIds, live };
354
- return ItemWrapper.publish(this.client, params);
349
+ async publishItems({ collectionId, itemIds, live }: { collectionId: string; itemIds: string[]; live?: boolean }) {
350
+ const res = await Item.publish({ collectionId, itemIds, live }, this.client);
351
+ return res.data;
355
352
  }
356
353
 
357
354
  /**************************************************************
@@ -363,12 +360,11 @@ export class Webflow {
363
360
  * @param params The Site information
364
361
  * @param params.siteId The Site ID
365
362
  * @param pageParams The pagination information (optional)
366
- * @param pageParams.limit The number of results to return
367
- * @param pageParams.offset The number of results to skip
368
363
  * @returns A list of User accounts
369
364
  */
370
365
  async users({ siteId }: { siteId: string }, pageParams?: PaginationFilter) {
371
- return MembershipWrapper.list(this.client, { siteId, ...pageParams });
366
+ const res = await User.list({ siteId, ...pageParams }, this.client);
367
+ return res.data.users.map((data) => new User(this.client, { ...res, data }));
372
368
  }
373
369
 
374
370
  /**
@@ -379,7 +375,8 @@ export class Webflow {
379
375
  * @returns The User information
380
376
  */
381
377
  async user({ siteId, userId }: { siteId: string; userId: string }) {
382
- return MembershipWrapper.getOne(this.client, { siteId, userId });
378
+ const res = await User.getOne({ siteId, userId }, this.client);
379
+ return new User(this.client, res, res.data, { siteId });
383
380
  }
384
381
 
385
382
  /**
@@ -389,17 +386,10 @@ export class Webflow {
389
386
  * @param params.userId The User ID
390
387
  * @returns The updated User
391
388
  */
392
- async updateUser({
393
- siteId,
394
- userId,
395
- ...data
396
- }: {
397
- siteId: string;
398
- userId: string;
399
- data: any;
400
- }) {
389
+ async updateUser({ siteId, userId, ...data }: { siteId: string; userId: string; data: any }) {
401
390
  const _params = { siteId, userId, data };
402
- return MembershipWrapper.update(this.client, _params);
391
+ const res = await User.update(_params, this.client);
392
+ return new User(this.client, res, res.data, { siteId });
403
393
  }
404
394
 
405
395
  /**
@@ -410,7 +400,8 @@ export class Webflow {
410
400
  * @returns The created User account
411
401
  */
412
402
  async inviteUser({ siteId, email }: { siteId: string; email: string }) {
413
- return MembershipWrapper.invite(this.client, { siteId, email });
403
+ const res = await User.invite({ siteId, email }, this.client);
404
+ return new User(this.client, res, res.data, { siteId });
414
405
  }
415
406
 
416
407
  /**
@@ -420,18 +411,9 @@ export class Webflow {
420
411
  * @param params.userId The User ID
421
412
  * @returns The result from the remove request
422
413
  */
423
- removeUser({ siteId, userId }: { siteId: string; userId: string }) {
424
- return MembershipWrapper.remove(this.client, { siteId, userId });
425
- }
426
-
427
- /**
428
- * Get a list of Access Groups
429
- * @param params The Site and User information
430
- * @param params.siteId The Site ID
431
- * @returns The result from the remove request
432
- */
433
- accessGroups({ siteId }: { siteId: string }) {
434
- return MembershipWrapper.accessGroups(this.client, { siteId });
414
+ async removeUser({ siteId, userId }: { siteId: string; userId: string }) {
415
+ const res = await User.remove({ siteId, userId }, this.client);
416
+ return res.data;
435
417
  }
436
418
 
437
419
  /**************************************************************
@@ -444,8 +426,9 @@ export class Webflow {
444
426
  * @param params.siteId The Site ID
445
427
  * @returns A list of Webhooks
446
428
  */
447
- async webhooks({ siteId }: { siteId: string }, query?: QueryString) {
448
- return WebhookWrapper.list(this.client, { siteId }, query);
429
+ async webhooks({ siteId }: { siteId: string }) {
430
+ const res = await Webhook.list({ siteId }, this.client);
431
+ return res.data.map((data) => new Webhook(this.client, { ...res, data }));
449
432
  }
450
433
 
451
434
  /**
@@ -456,7 +439,8 @@ export class Webflow {
456
439
  * @returns The Webhook
457
440
  */
458
441
  async webhook({ siteId, webhookId }: { siteId: string; webhookId: string }) {
459
- return WebhookWrapper.getOne(this.client, { siteId, webhookId });
442
+ const res = await Webhook.getOne({ siteId, webhookId }, this.client);
443
+ return new Webhook(this.client, res);
460
444
  }
461
445
 
462
446
  /**
@@ -466,8 +450,9 @@ export class Webflow {
466
450
  * @param params.webhookId The Webhook Id
467
451
  * @returns the result from the remove request
468
452
  */
469
- removeWebhook({ siteId, webhookId }: { siteId: string; webhookId: string }) {
470
- return WebhookWrapper.remove(this.client, { siteId, webhookId });
453
+ async removeWebhook({ siteId, webhookId }: { siteId: string; webhookId: string }) {
454
+ const res = await Webhook.remove({ siteId, webhookId }, this.client);
455
+ return res.data;
471
456
  }
472
457
 
473
458
  /**
@@ -488,9 +473,10 @@ export class Webflow {
488
473
  url: string;
489
474
  siteId: string;
490
475
  triggerType: string;
491
- filter?: Webhook.Filter;
476
+ filter?: WebhookFilter;
492
477
  }) {
493
478
  const _params = { url, siteId, triggerType, filter };
494
- return WebhookWrapper.create(this.client, _params);
479
+ const res = await Webhook.create(_params, this.client);
480
+ return new Webhook(this.client, res);
495
481
  }
496
482
  }
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { Webflow } from "./webflow";
1
+ import { Webflow } from "./core";
2
2
 
3
3
  export = Webflow;
package/yarn.lock CHANGED
@@ -654,11 +654,6 @@
654
654
  dependencies:
655
655
  "@types/node" "*"
656
656
 
657
- "@types/isomorphic-fetch@^0.0.36":
658
- "integrity" "sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw=="
659
- "resolved" "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.36.tgz"
660
- "version" "0.0.36"
661
-
662
657
  "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
663
658
  "integrity" "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g=="
664
659
  "resolved" "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz"
@@ -1,114 +0,0 @@
1
- import { Client, PaginatedData } from "../core";
2
- /**************************************************************
3
- * Interfaces
4
- **************************************************************/
5
- export interface IUser {
6
- emailVerified: boolean;
7
- lastUpdated?: string;
8
- createdOn: string;
9
- _id: string;
10
- data: any;
11
- }
12
- export interface IAccessGroup {
13
- _id: string;
14
- name: string;
15
- shortId: string;
16
- slug: string;
17
- createdOn: string;
18
- }
19
- export interface IUserDelete {
20
- deleted: number;
21
- }
22
- /**************************************************************
23
- * Types
24
- **************************************************************/
25
- export declare type PaginatedUsers = PaginatedData & {
26
- users: IUser[];
27
- };
28
- export declare type PaginatedAccessGroups = PaginatedData & {
29
- accessGroups: IAccessGroup[];
30
- };
31
- export declare type UserIdParam = {
32
- siteId: string;
33
- userId: string;
34
- };
35
- /**************************************************************
36
- * Functions
37
- **************************************************************/
38
- /**
39
- * Get a list of Users
40
- * @param client The Webflow client
41
- * @param params The params for the request
42
- * @param params.siteId The site ID
43
- * @param params.limit The number of items to return (optional)
44
- * @param params.offset The number of items to skip (optional)
45
- * @returns A list of Users
46
- */
47
- export declare function list(client: Client, { siteId, limit, offset }: {
48
- siteId: string;
49
- limit?: number;
50
- offset?: number;
51
- }): Promise<import("axios").AxiosResponse<PaginatedUsers, any>>;
52
- /**
53
- * Get a single User
54
- * @param client The Webflow client
55
- * @param params The params for the request
56
- * @param params.siteId The site ID
57
- * @param params.userId The user ID
58
- * @returns A single User
59
- */
60
- export declare function getOne(client: Client, { siteId, userId }: {
61
- siteId: string;
62
- userId: string;
63
- }): Promise<import("axios").AxiosResponse<IUser, any>>;
64
- /**
65
- * Update a User
66
- * @param client The Webflow client
67
- * @param params The params for the request
68
- * @param params.siteId The site ID
69
- * @param params.userId The user ID
70
- * @param params.data The data to update
71
- * @returns The updated User
72
- */
73
- export declare function update(client: Client, { siteId, userId, ...data }: {
74
- siteId: string;
75
- userId: string;
76
- }): Promise<import("axios").AxiosResponse<IUser, any>>;
77
- /**
78
- * Invite a User to a site
79
- * @param client The Webflow client
80
- * @param params The params for the request
81
- * @param params.siteId The site ID
82
- * @param params.email The email address of the user to invite
83
- * @returns The newly created User
84
- */
85
- export declare function invite(client: Client, { siteId, email }: {
86
- siteId: string;
87
- email: string;
88
- }): Promise<import("axios").AxiosResponse<IUser, any>>;
89
- /**
90
- * Remove a User
91
- * @param client The Webflow client
92
- * @param params The params for the request
93
- * @param params.siteId The site ID
94
- * @param params.userId The user ID
95
- * @returns The result of the remove
96
- */
97
- export declare function remove(client: Client, { siteId, userId }: {
98
- siteId: string;
99
- userId: string;
100
- }): Promise<import("axios").AxiosResponse<IUserDelete, any>>;
101
- /**
102
- * Get a list of Access Groups
103
- * @param client The Webflow client
104
- * @param params The params for the request
105
- * @param params.siteId The Site ID
106
- * @param params.limit The number of items to return (optional)
107
- * @param params.offset The number of items to skip (optional)
108
- * @returns A list of Access Groups
109
- */
110
- export declare function accessGroups(client: Client, { siteId, limit, offset }: {
111
- siteId: string;
112
- limit?: number;
113
- offset?: number;
114
- }): Promise<import("axios").AxiosResponse<PaginatedAccessGroups, any>>;