webflow-api 1.1.2 → 1.2.1
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 +41 -17
- package/dist/api/collection.d.ts +86 -25
- 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/api/user.d.ts +143 -0
- package/dist/api/user.js +119 -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} +66 -54
- package/dist/{webflow.js → core/webflow.js} +114 -65
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +12 -8
- package/src/api/collection.ts +103 -36
- package/src/api/index.ts +7 -7
- package/src/api/item.ts +217 -176
- package/src/api/meta.ts +19 -18
- package/src/api/oauth.ts +71 -74
- package/src/api/site.ts +161 -55
- package/src/api/user.ts +192 -0
- package/src/api/webhook.ts +103 -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} +153 -125
- package/src/index.ts +1 -1
- package/yarn.lock +4 -9
- package/dist/api/membership.d.ts +0 -114
- package/dist/api/membership.js +0 -96
- package/dist/core/client.d.ts +0 -27
- package/dist/core/client.js +0 -60
- 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.d.ts +0 -105
- package/dist/wrapper/membership.js +0 -123
- package/dist/wrapper/response.d.ts +0 -16
- package/dist/wrapper/response.js +0 -17
- package/dist/wrapper/site.d.ts +0 -168
- package/dist/wrapper/site.js +0 -191
- package/dist/wrapper/webhook.d.ts +0 -78
- package/dist/wrapper/webhook.js +0 -82
- package/src/api/membership.ts +0 -155
- package/src/core/client.ts +0 -82
- 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 -163
- package/src/wrapper/response.ts +0 -25
- package/src/wrapper/site.ts +0 -228
- package/src/wrapper/webhook.ts +0 -116
package/README.md
CHANGED
|
@@ -9,18 +9,20 @@ $ npm install webflow-api
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
using yarn
|
|
12
|
+
|
|
12
13
|
```
|
|
13
14
|
$ yarn add webflow-api
|
|
14
15
|
```
|
|
15
16
|
|
|
16
17
|
## Usage
|
|
18
|
+
|
|
17
19
|
The constructor takes in a few optional parameters to initialize the API client
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
- `token` - the access token to use
|
|
22
|
+
- `headers` - additional headers to add to the request
|
|
23
|
+
- `version` - the version of the API you wish to use
|
|
22
24
|
|
|
23
|
-
```
|
|
25
|
+
```javascript
|
|
24
26
|
const Webflow = require("webflow-api");
|
|
25
27
|
|
|
26
28
|
// initialize the client with the access token
|
|
@@ -31,12 +33,15 @@ const webflow = new Webflow({
|
|
|
31
33
|
token: "[ACCESS TOKEN]",
|
|
32
34
|
version: "1.0.0",
|
|
33
35
|
headers: {
|
|
34
|
-
"User-Agent": "My Webflow App / 1.0"
|
|
35
|
-
}
|
|
36
|
+
"User-Agent": "My Webflow App / 1.0",
|
|
37
|
+
},
|
|
36
38
|
});
|
|
37
39
|
```
|
|
40
|
+
|
|
38
41
|
## Basic Usage
|
|
42
|
+
|
|
39
43
|
### Chaining Calls
|
|
44
|
+
|
|
40
45
|
You can retrieve child resources by chaining calls on the parent object.
|
|
41
46
|
|
|
42
47
|
```javascript
|
|
@@ -54,6 +59,7 @@ const item = await collection.items({ itemId: "[ITEM ID]" });
|
|
|
54
59
|
```
|
|
55
60
|
|
|
56
61
|
### Pagination
|
|
62
|
+
|
|
57
63
|
To paginate results, pass in the `limit` and `offset` options.
|
|
58
64
|
|
|
59
65
|
```javascript
|
|
@@ -65,6 +71,7 @@ const page2 = await collection.items({ limit: 20, offset: 20 });
|
|
|
65
71
|
```
|
|
66
72
|
|
|
67
73
|
### Rate Limit
|
|
74
|
+
|
|
68
75
|
Check rate limit status on each call by checking the `_meta` property.
|
|
69
76
|
|
|
70
77
|
```javascript
|
|
@@ -74,7 +81,9 @@ const site = await webflow.site({ siteId: "[SITE ID]" });
|
|
|
74
81
|
// check rate limit
|
|
75
82
|
const { rateLimit } = site._meta; // { limit: 60, remaining: 56 }
|
|
76
83
|
```
|
|
84
|
+
|
|
77
85
|
### Update Token
|
|
86
|
+
|
|
78
87
|
If you need to update the access token, you can set the `token` property at any time.
|
|
79
88
|
|
|
80
89
|
```javascript
|
|
@@ -87,7 +96,9 @@ webflow.token = "[ACCESS TOKEN]";
|
|
|
87
96
|
// remove the token
|
|
88
97
|
webflow.clearToken();
|
|
89
98
|
```
|
|
99
|
+
|
|
90
100
|
### Calling APIs Directly
|
|
101
|
+
|
|
91
102
|
All Webflow API endpoints can be called directly using the `get`, `post`, `put`, and `delete` methods.
|
|
92
103
|
|
|
93
104
|
```javascript
|
|
@@ -96,14 +107,16 @@ const sites = await webflow.get("/sites");
|
|
|
96
107
|
|
|
97
108
|
// post to an endpoint directly
|
|
98
109
|
const result = await webflow.post("/sites/[SITE ID]/publish", {
|
|
99
|
-
domains: ["hello-webflow.com"]
|
|
110
|
+
domains: ["hello-webflow.com"],
|
|
100
111
|
});
|
|
101
112
|
```
|
|
102
113
|
|
|
103
114
|
## OAuth
|
|
115
|
+
|
|
104
116
|
To implement OAuth, you'll need a Webflow App registered and a webserver running, that is publicly facing.
|
|
105
117
|
|
|
106
118
|
### Authorize
|
|
119
|
+
|
|
107
120
|
The first step in OAuth is to generate an authorization url to redirect the user to.
|
|
108
121
|
|
|
109
122
|
```javascript
|
|
@@ -111,7 +124,7 @@ The first step in OAuth is to generate an authorization url to redirect the user
|
|
|
111
124
|
const url = webflow.authorizeUrl({
|
|
112
125
|
client_id: "[CLIENT ID]",
|
|
113
126
|
state: "1234567890", // optional
|
|
114
|
-
redirect_uri: "https://my.server.com/oauth/callback" // optional
|
|
127
|
+
redirect_uri: "https://my.server.com/oauth/callback", // optional
|
|
115
128
|
});
|
|
116
129
|
|
|
117
130
|
// redirect user from your server route
|
|
@@ -119,6 +132,7 @@ res.redirect(url);
|
|
|
119
132
|
```
|
|
120
133
|
|
|
121
134
|
### Access Token
|
|
135
|
+
|
|
122
136
|
Once a user has authorized their Webflow resource(s), Webflow will redirect back to your server with a `code`. Use this to get an access token.
|
|
123
137
|
|
|
124
138
|
```javascript
|
|
@@ -126,7 +140,7 @@ const auth = await webflow.accessToken({
|
|
|
126
140
|
client_id,
|
|
127
141
|
client_secret,
|
|
128
142
|
code,
|
|
129
|
-
redirect_uri // optional - required if used in the authorize step
|
|
143
|
+
redirect_uri, // optional - required if used in the authorize step
|
|
130
144
|
});
|
|
131
145
|
|
|
132
146
|
// you now have the user's access token to make API requests with
|
|
@@ -137,21 +151,24 @@ const authenticatedUser = await userWF.authenticatedUser();
|
|
|
137
151
|
```
|
|
138
152
|
|
|
139
153
|
### Revoke Token
|
|
154
|
+
|
|
140
155
|
If the user decides to disconnect from your server, you should call revoke token to remove the authorization.
|
|
141
156
|
|
|
142
157
|
```javascript
|
|
143
158
|
const result = await webflow.revokeToken({
|
|
144
159
|
client_id,
|
|
145
160
|
client_secret,
|
|
146
|
-
access_token
|
|
161
|
+
access_token,
|
|
147
162
|
});
|
|
148
163
|
|
|
149
164
|
// ensure it went through
|
|
150
|
-
result.didRevoke === true
|
|
165
|
+
result.didRevoke === true;
|
|
151
166
|
```
|
|
152
167
|
|
|
153
168
|
## Examples
|
|
169
|
+
|
|
154
170
|
### Sites
|
|
171
|
+
|
|
155
172
|
Get all sites available or lookup by site id.
|
|
156
173
|
|
|
157
174
|
```javascript
|
|
@@ -163,7 +180,9 @@ const site = await webflow.sites({ siteId: "[SITE ID]" });
|
|
|
163
180
|
```
|
|
164
181
|
|
|
165
182
|
### Collections
|
|
183
|
+
|
|
166
184
|
Get all collections available for a site or lookup by collection id.
|
|
185
|
+
|
|
167
186
|
```javascript
|
|
168
187
|
// Get a site's collection from the site
|
|
169
188
|
const collections = await site.collections();
|
|
@@ -176,7 +195,9 @@ const collection = await webflow.collection({ collectionId: "[COLLECTION ID]" })
|
|
|
176
195
|
```
|
|
177
196
|
|
|
178
197
|
### Collection Items
|
|
198
|
+
|
|
179
199
|
Get all collection items available for a collection or lookup by item id.
|
|
200
|
+
|
|
180
201
|
```javascript
|
|
181
202
|
// Get the items from a collection
|
|
182
203
|
const items = await collection.items();
|
|
@@ -187,7 +208,9 @@ const items = await collection.items({ limit: 10, offset: 2 });
|
|
|
187
208
|
// Get a single item
|
|
188
209
|
const item = await webflow.item({ collectionId: "[COLLECTION ID]", itemId: "[ITEM ID]" });
|
|
189
210
|
```
|
|
211
|
+
|
|
190
212
|
### Update an Item
|
|
213
|
+
|
|
191
214
|
```javascript
|
|
192
215
|
// Set the fields to update
|
|
193
216
|
const fields = {
|
|
@@ -206,19 +229,20 @@ const updatedItem = await webflow.updateItem({
|
|
|
206
229
|
```
|
|
207
230
|
|
|
208
231
|
### Memberships
|
|
232
|
+
|
|
209
233
|
```javascript
|
|
210
234
|
// Get a site's users from the site
|
|
211
235
|
const users = await site.users();
|
|
212
236
|
|
|
213
237
|
// Get a site's users with a site id
|
|
214
238
|
const users = await webflow.users({
|
|
215
|
-
siteId: "[SITE ID]"
|
|
239
|
+
siteId: "[SITE ID]",
|
|
216
240
|
});
|
|
217
241
|
|
|
218
242
|
// Get a single user
|
|
219
243
|
const user = await site.user({
|
|
220
244
|
siteId: "[SITE ID]",
|
|
221
|
-
userId: "[USER ID]"
|
|
245
|
+
userId: "[USER ID]",
|
|
222
246
|
});
|
|
223
247
|
|
|
224
248
|
// Get a site's access groups
|
|
@@ -226,11 +250,12 @@ const accessGroups = await site.accessGroups();
|
|
|
226
250
|
|
|
227
251
|
// Get a site's access groups with a site id
|
|
228
252
|
const accessGroups = await webflow.accessGroups({
|
|
229
|
-
siteId: "[SITE ID]"
|
|
253
|
+
siteId: "[SITE ID]",
|
|
230
254
|
});
|
|
231
255
|
```
|
|
232
256
|
|
|
233
257
|
### Webhooks
|
|
258
|
+
|
|
234
259
|
```javascript
|
|
235
260
|
// get webhooks for a site
|
|
236
261
|
const webhooks = await site.webhooks();
|
|
@@ -238,18 +263,17 @@ const webhooks = await site.webhooks();
|
|
|
238
263
|
// create a webhook
|
|
239
264
|
const webhook = await site.createWebhook({
|
|
240
265
|
triggerType: "form_submission",
|
|
241
|
-
url: "https://webhook.site"
|
|
266
|
+
url: "https://webhook.site",
|
|
242
267
|
});
|
|
243
|
-
|
|
244
268
|
```
|
|
245
269
|
|
|
246
270
|
### Authenticated User
|
|
271
|
+
|
|
247
272
|
```javascript
|
|
248
273
|
// pull information for the authenticated user
|
|
249
274
|
const authenticatedUser = await webflow.authenticatedUser();
|
|
250
275
|
```
|
|
251
276
|
|
|
252
|
-
|
|
253
277
|
## Contributing
|
|
254
278
|
|
|
255
279
|
Contributions are welcome - feel free to open an issue or pull request.
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import { WebflowRecord } from "../core";
|
|
3
|
+
import { Item } from ".";
|
|
2
4
|
/**************************************************************
|
|
3
5
|
* Types
|
|
4
6
|
**************************************************************/
|
|
@@ -10,7 +12,7 @@ export declare type CollectionField = {
|
|
|
10
12
|
name: string;
|
|
11
13
|
required: boolean;
|
|
12
14
|
editable: boolean;
|
|
13
|
-
validations?:
|
|
15
|
+
validations?: Record<string, string | number | boolean | object>;
|
|
14
16
|
};
|
|
15
17
|
/**************************************************************
|
|
16
18
|
* Interfaces
|
|
@@ -25,27 +27,86 @@ export interface ICollection {
|
|
|
25
27
|
fields: CollectionField[];
|
|
26
28
|
}
|
|
27
29
|
/**************************************************************
|
|
28
|
-
*
|
|
30
|
+
* Class
|
|
29
31
|
**************************************************************/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
export declare class Collection extends WebflowRecord<ICollection> implements ICollection {
|
|
33
|
+
fields: CollectionField[];
|
|
34
|
+
singularName: string;
|
|
35
|
+
lastUpdated: string;
|
|
36
|
+
createdOn: string;
|
|
37
|
+
_id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
slug: string;
|
|
40
|
+
/**************************************************************
|
|
41
|
+
* Static Methods
|
|
42
|
+
**************************************************************/
|
|
43
|
+
/**
|
|
44
|
+
* Get a list of Collections
|
|
45
|
+
* @param params The params for the request
|
|
46
|
+
* @param params.siteId The site ID
|
|
47
|
+
* @param client The Axios client instance
|
|
48
|
+
* @returns A list of Collections
|
|
49
|
+
*/
|
|
50
|
+
static list({ siteId }: {
|
|
51
|
+
siteId: string;
|
|
52
|
+
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<ICollection[], any>>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a single Collection
|
|
55
|
+
* @param params The params for the request
|
|
56
|
+
* @param params.collectionId The collection ID
|
|
57
|
+
* @param client The Axios client instance
|
|
58
|
+
* @returns A single Collection
|
|
59
|
+
*/
|
|
60
|
+
static getOne({ collectionId }: {
|
|
61
|
+
collectionId: string;
|
|
62
|
+
}, client: AxiosInstance): Promise<import("axios").AxiosResponse<ICollection, any>>;
|
|
63
|
+
/**************************************************************
|
|
64
|
+
* Instance Methods
|
|
65
|
+
**************************************************************/
|
|
66
|
+
/**
|
|
67
|
+
* Get a single Item
|
|
68
|
+
* @param params The params for the request
|
|
69
|
+
* @param params.itemId The Item ID
|
|
70
|
+
* @returns A single Item
|
|
71
|
+
*/
|
|
72
|
+
item({ itemId }: {
|
|
73
|
+
itemId: string;
|
|
74
|
+
}): Promise<Item>;
|
|
75
|
+
/**
|
|
76
|
+
* Get a list of Items
|
|
77
|
+
* @param params The params for the request
|
|
78
|
+
* @param params.limit The number of items to return (optional)
|
|
79
|
+
* @param params.offset The number of items to skip (optional)
|
|
80
|
+
* @returns A list of Items
|
|
81
|
+
*/
|
|
82
|
+
items({ limit, offset }?: {
|
|
83
|
+
limit?: number;
|
|
84
|
+
offset?: number;
|
|
85
|
+
}): Promise<Item[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Remove a single Item
|
|
88
|
+
* @param params The params for the request
|
|
89
|
+
* @param params.itemId The Item ID
|
|
90
|
+
* @returns The result from the removal
|
|
91
|
+
*/
|
|
92
|
+
removeItem({ itemId }: {
|
|
93
|
+
itemId: string;
|
|
94
|
+
}): Promise<import("./item").IItemDelete>;
|
|
95
|
+
/**
|
|
96
|
+
* Create a new Item
|
|
97
|
+
* @param fields The Item fields to create
|
|
98
|
+
* @returns The created Item
|
|
99
|
+
*/
|
|
100
|
+
createItem(fields: object): Promise<Item>;
|
|
101
|
+
/**
|
|
102
|
+
* Update a single Item
|
|
103
|
+
* @param params The params for the request
|
|
104
|
+
* @param params.itemId The Item ID
|
|
105
|
+
* @param params.fields The fields to update
|
|
106
|
+
* @returns The updated Item
|
|
107
|
+
*/
|
|
108
|
+
updateItem({ itemId, fields }: {
|
|
109
|
+
itemId: string;
|
|
110
|
+
fields: object;
|
|
111
|
+
}): Promise<Item>;
|
|
112
|
+
}
|
package/dist/api/collection.js
CHANGED
|
@@ -1,35 +1,94 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Collection = void 0;
|
|
4
4
|
const core_1 = require("../core");
|
|
5
|
+
const _1 = require(".");
|
|
5
6
|
/**************************************************************
|
|
6
|
-
*
|
|
7
|
+
* Class
|
|
7
8
|
**************************************************************/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
class Collection extends core_1.WebflowRecord {
|
|
10
|
+
/**************************************************************
|
|
11
|
+
* Static Methods
|
|
12
|
+
**************************************************************/
|
|
13
|
+
/**
|
|
14
|
+
* Get a list of Collections
|
|
15
|
+
* @param params The params for the request
|
|
16
|
+
* @param params.siteId The site ID
|
|
17
|
+
* @param client The Axios client instance
|
|
18
|
+
* @returns A list of Collections
|
|
19
|
+
*/
|
|
20
|
+
static list({ siteId }, client) {
|
|
21
|
+
(0, core_1.requireArgs)({ siteId });
|
|
22
|
+
const path = `/sites/${siteId}/collections`;
|
|
23
|
+
return client.get(path);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get a single Collection
|
|
27
|
+
* @param params The params for the request
|
|
28
|
+
* @param params.collectionId The collection ID
|
|
29
|
+
* @param client The Axios client instance
|
|
30
|
+
* @returns A single Collection
|
|
31
|
+
*/
|
|
32
|
+
static getOne({ collectionId }, client) {
|
|
33
|
+
(0, core_1.requireArgs)({ collectionId });
|
|
34
|
+
const path = `/collections/${collectionId}`;
|
|
35
|
+
return client.get(path);
|
|
36
|
+
}
|
|
37
|
+
/**************************************************************
|
|
38
|
+
* Instance Methods
|
|
39
|
+
**************************************************************/
|
|
40
|
+
/**
|
|
41
|
+
* Get a single Item
|
|
42
|
+
* @param params The params for the request
|
|
43
|
+
* @param params.itemId The Item ID
|
|
44
|
+
* @returns A single Item
|
|
45
|
+
*/
|
|
46
|
+
async item({ itemId }) {
|
|
47
|
+
const res = await _1.Item.getOne({ itemId, collectionId: this._id }, this.client);
|
|
48
|
+
const [item] = res.data.items.map((data) => new _1.Item(this.client, { ...res, data }));
|
|
49
|
+
return item;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get a list of Items
|
|
53
|
+
* @param params The params for the request
|
|
54
|
+
* @param params.limit The number of items to return (optional)
|
|
55
|
+
* @param params.offset The number of items to skip (optional)
|
|
56
|
+
* @returns A list of Items
|
|
57
|
+
*/
|
|
58
|
+
async items({ limit, offset } = {}) {
|
|
59
|
+
const res = await _1.Item.list({ collectionId: this._id, limit, offset }, this.client);
|
|
60
|
+
return res.data.items.map((data) => new _1.Item(this.client, { ...res, data }));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Remove a single Item
|
|
64
|
+
* @param params The params for the request
|
|
65
|
+
* @param params.itemId The Item ID
|
|
66
|
+
* @returns The result from the removal
|
|
67
|
+
*/
|
|
68
|
+
async removeItem({ itemId }) {
|
|
69
|
+
const res = await _1.Item.remove({ itemId, collectionId: this._id }, this.client);
|
|
70
|
+
return res.data;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a new Item
|
|
74
|
+
* @param fields The Item fields to create
|
|
75
|
+
* @returns The created Item
|
|
76
|
+
*/
|
|
77
|
+
async createItem(fields) {
|
|
78
|
+
const res = await _1.Item.create({ collectionId: this._id, fields }, this.client);
|
|
79
|
+
return new _1.Item(this.client, res);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Update a single Item
|
|
83
|
+
* @param params The params for the request
|
|
84
|
+
* @param params.itemId The Item ID
|
|
85
|
+
* @param params.fields The fields to update
|
|
86
|
+
* @returns The updated Item
|
|
87
|
+
*/
|
|
88
|
+
async updateItem({ itemId, fields }) {
|
|
89
|
+
const params = { itemId, collectionId: this._id, fields };
|
|
90
|
+
const res = await _1.Item.update(params, this.client);
|
|
91
|
+
return new _1.Item(this.client, res);
|
|
92
|
+
}
|
|
20
93
|
}
|
|
21
|
-
exports.
|
|
22
|
-
/**
|
|
23
|
-
* Get a single Collection
|
|
24
|
-
* @param client The Webflow client
|
|
25
|
-
* @param params The params for the request
|
|
26
|
-
* @param params.collectionId The collection ID
|
|
27
|
-
* @param params.params The query string parameters (optional)
|
|
28
|
-
* @returns A single Collection
|
|
29
|
-
*/
|
|
30
|
-
function getOne(client, { collectionId }, params) {
|
|
31
|
-
(0, core_1.requireArgs)({ collectionId });
|
|
32
|
-
const path = `/collections/${collectionId}`;
|
|
33
|
-
return client.get(path, { params });
|
|
34
|
-
}
|
|
35
|
-
exports.getOne = getOne;
|
|
94
|
+
exports.Collection = Collection;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export *
|
|
2
|
-
export *
|
|
3
|
-
export *
|
|
4
|
-
export *
|
|
5
|
-
export *
|
|
6
|
-
export *
|
|
7
|
-
export *
|
|
1
|
+
export * from "./collection";
|
|
2
|
+
export * from "./user";
|
|
3
|
+
export * from "./webhook";
|
|
4
|
+
export * from "./item";
|
|
5
|
+
export * from "./site";
|
|
6
|
+
export * from "./oauth";
|
|
7
|
+
export * from "./meta";
|
package/dist/api/index.js
CHANGED
|
@@ -10,24 +10,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
15
|
};
|
|
25
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.Meta = __importStar(require("./meta"));
|
|
17
|
+
__exportStar(require("./collection"), exports);
|
|
18
|
+
__exportStar(require("./user"), exports);
|
|
19
|
+
__exportStar(require("./webhook"), exports);
|
|
20
|
+
__exportStar(require("./item"), exports);
|
|
21
|
+
__exportStar(require("./site"), exports);
|
|
22
|
+
__exportStar(require("./oauth"), exports);
|
|
23
|
+
__exportStar(require("./meta"), exports);
|