webflow-api 0.6.0 → 0.7.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/dist/ResponseWrapper.js +81 -45
- package/dist/Webflow.js +97 -143
- package/dist/WebflowError.js +34 -15
- package/dist/index.js +3 -3
- package/dist/utils.js +12 -7
- package/index.d.ts +17 -1
- package/package.json +13 -17
- package/src/Webflow.js +3 -3
- package/src/index.js +2 -2
- package/yarn.lock +3741 -3580
package/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare class Webflow {
|
|
|
79
79
|
collectionId: string;
|
|
80
80
|
},
|
|
81
81
|
query?: Webflow.WebflowQueryArg
|
|
82
|
-
): Promise<Webflow.WebflowApiModel.
|
|
82
|
+
): Promise<Webflow.WebflowApiModel.ItemsResponse>;
|
|
83
83
|
|
|
84
84
|
item(
|
|
85
85
|
data: {
|
|
@@ -297,6 +297,22 @@ declare namespace Webflow {
|
|
|
297
297
|
remove: OmitFirstArgOfFunction<Webflow["removeItem"]>;
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
interface ResponseMeta {
|
|
301
|
+
rateLimit: {
|
|
302
|
+
limit: number;
|
|
303
|
+
remaining: number;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
interface ItemsResponse {
|
|
308
|
+
items: CollectionItem[];
|
|
309
|
+
count: number;
|
|
310
|
+
limit: number;
|
|
311
|
+
offset: number;
|
|
312
|
+
total: number;
|
|
313
|
+
_meta: ResponseMeta;
|
|
314
|
+
}
|
|
315
|
+
|
|
300
316
|
type WebhookTriggerType =
|
|
301
317
|
| "form_submission"
|
|
302
318
|
| "site_publish"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webflow-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "SDK for the Webflow CMS API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -27,29 +27,25 @@
|
|
|
27
27
|
"watch:test": "npm run test -- --watch"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"babel
|
|
32
|
-
"babel-
|
|
33
|
-
"babel
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"eslint": "^3.10.1",
|
|
39
|
-
"eslint-config-airbnb-base": "^10.0.1",
|
|
40
|
-
"eslint-plugin-import": "^2.2.0",
|
|
30
|
+
"@babel/cli": "^7.17.6",
|
|
31
|
+
"@babel/core": "^7.17.8",
|
|
32
|
+
"@babel/preset-env": "^7.16.11",
|
|
33
|
+
"@babel/register": "^7.17.7",
|
|
34
|
+
"ava": "^4.1.0",
|
|
35
|
+
"eslint": "^8.12.0",
|
|
36
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
37
|
+
"eslint-plugin-import": "^2.25.2",
|
|
41
38
|
"nock": "^13.0.7",
|
|
42
|
-
"nyc": "^
|
|
39
|
+
"nyc": "^15.1.0"
|
|
43
40
|
},
|
|
44
41
|
"dependencies": {
|
|
45
|
-
"es6-error": "^4.0.0",
|
|
46
42
|
"isomorphic-fetch": "^3.0.0",
|
|
43
|
+
"es6-error": "^4.0.0",
|
|
47
44
|
"qs": "^6.3.0"
|
|
48
45
|
},
|
|
49
46
|
"ava": {
|
|
50
47
|
"require": [
|
|
51
|
-
"babel
|
|
52
|
-
]
|
|
53
|
-
"babel": "inherit"
|
|
48
|
+
"@babel/register"
|
|
49
|
+
]
|
|
54
50
|
}
|
|
55
51
|
}
|
package/src/Webflow.js
CHANGED
|
@@ -91,7 +91,7 @@ export default class Webflow {
|
|
|
91
91
|
// Generic HTTP request handlers
|
|
92
92
|
|
|
93
93
|
get(path, query = {}) {
|
|
94
|
-
return this.authenticatedFetch('GET', path,
|
|
94
|
+
return this.authenticatedFetch('GET', path, null, query);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
post(path, data, query = {}) {
|
|
@@ -107,7 +107,7 @@ export default class Webflow {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
delete(path, query = {}) {
|
|
110
|
-
return this.authenticatedFetch('DELETE', path, query);
|
|
110
|
+
return this.authenticatedFetch('DELETE', path, null, query);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// Meta
|
|
@@ -179,7 +179,7 @@ export default class Webflow {
|
|
|
179
179
|
|
|
180
180
|
item({ collectionId, itemId }, query = {}) {
|
|
181
181
|
if (!collectionId) return Promise.reject(buildRequiredArgError('collectionId'));
|
|
182
|
-
if (!itemId) return Promise.reject(buildRequiredArgError('
|
|
182
|
+
if (!itemId) return Promise.reject(buildRequiredArgError('itemId'));
|
|
183
183
|
|
|
184
184
|
return this.get(`/collections/${collectionId}/items/${itemId}`, query).then(
|
|
185
185
|
res => this.responseWrapper.item(res.items[0], collectionId),
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
module.exports = require(
|
|
2
|
-
module.exports.WebflowError = require(
|
|
1
|
+
module.exports = require("./Webflow").default;
|
|
2
|
+
module.exports.WebflowError = require("./WebflowError").default;
|