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