webflow-api 1.0.0 → 1.0.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/README.md +6 -6
- package/dist/Webflow.js +7 -1
- package/index.d.ts +3 -2
- package/package.json +1 -1
- package/src/Webflow.js +8 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ const webflow = new Webflow({ token: "[ACCESS TOKEN]" });
|
|
|
29
29
|
|
|
30
30
|
// fully loaded
|
|
31
31
|
const webflow = new Webflow({
|
|
32
|
-
token: "[ACCESS TOKEN]"
|
|
32
|
+
token: "[ACCESS TOKEN]",
|
|
33
33
|
version: "1.0.0",
|
|
34
34
|
mode: "cors",
|
|
35
35
|
headers: {
|
|
@@ -131,8 +131,8 @@ const auth = await webflow.accessToken({
|
|
|
131
131
|
// you now have the user's access token to make API requests with
|
|
132
132
|
const userWF = new Webflow({ token: auth.access_token });
|
|
133
133
|
|
|
134
|
-
// pull information for the
|
|
135
|
-
const
|
|
134
|
+
// pull information for the user
|
|
135
|
+
const authenticatedUser = await userWF.authenticatedUser();
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
### Revoke Token
|
|
@@ -233,10 +233,10 @@ const webhook = await site.createWebhook({
|
|
|
233
233
|
|
|
234
234
|
```
|
|
235
235
|
|
|
236
|
-
###
|
|
236
|
+
### Authenticated User
|
|
237
237
|
```javascript
|
|
238
|
-
// pull information for the
|
|
239
|
-
const
|
|
238
|
+
// pull information for the authenticated user
|
|
239
|
+
const authenticatedUser = await webflow.authenticatedUser();
|
|
240
240
|
```
|
|
241
241
|
|
|
242
242
|
|
package/dist/Webflow.js
CHANGED
|
@@ -25,6 +25,12 @@ class Webflow {
|
|
|
25
25
|
this.client = new _WebflowClient.WebflowClient(options);
|
|
26
26
|
this.responseWrapper = new _ResponseWrapper.default(this);
|
|
27
27
|
}
|
|
28
|
+
set token(value) {
|
|
29
|
+
this.client.token = value;
|
|
30
|
+
}
|
|
31
|
+
get token() {
|
|
32
|
+
return this.client.token;
|
|
33
|
+
}
|
|
28
34
|
get(path, query = {}) {
|
|
29
35
|
return this.client.get(path, query);
|
|
30
36
|
}
|
|
@@ -45,7 +51,7 @@ class Webflow {
|
|
|
45
51
|
info() {
|
|
46
52
|
return this.get("/info");
|
|
47
53
|
}
|
|
48
|
-
|
|
54
|
+
authenticatedUser() {
|
|
49
55
|
return this.get("/user");
|
|
50
56
|
}
|
|
51
57
|
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare class Webflow {
|
|
2
2
|
constructor(options: Webflow.Options);
|
|
3
|
+
token: string;
|
|
3
4
|
|
|
4
5
|
get<Result extends any>(
|
|
5
6
|
path: string,
|
|
@@ -27,7 +28,7 @@ declare class Webflow {
|
|
|
27
28
|
|
|
28
29
|
// meta
|
|
29
30
|
info(): Promise<Webflow.ApiModel.Info>;
|
|
30
|
-
|
|
31
|
+
authenticatedUser(): Promise<Webflow.ApiModel.AuthenticatedUser>;
|
|
31
32
|
|
|
32
33
|
// oauth
|
|
33
34
|
authorizeUrl(params: {
|
|
@@ -208,7 +209,7 @@ declare namespace Webflow {
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
namespace ApiModel {
|
|
211
|
-
interface
|
|
212
|
+
interface AuthenticatedUser {
|
|
212
213
|
user: {
|
|
213
214
|
_id: string;
|
|
214
215
|
email: string;
|
package/package.json
CHANGED
package/src/Webflow.js
CHANGED
|
@@ -13,6 +13,13 @@ export class Webflow {
|
|
|
13
13
|
this.responseWrapper = new ResponseWrapper(this);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
set token(value) {
|
|
17
|
+
this.client.token = value;
|
|
18
|
+
}
|
|
19
|
+
get token() {
|
|
20
|
+
return this.client.token;
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
get(path, query = {}) {
|
|
17
24
|
return this.client.get(path, query);
|
|
18
25
|
}
|
|
@@ -38,7 +45,7 @@ export class Webflow {
|
|
|
38
45
|
return this.get("/info");
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
|
|
48
|
+
authenticatedUser() {
|
|
42
49
|
return this.get("/user");
|
|
43
50
|
}
|
|
44
51
|
|