Skip to content

Commit 42852eb

Browse files
author
John Agan
authored
V1.0.1 (#65)
* fixed setting tokens via property * fixed setting tokens via property * bumped version to 1.0.1
1 parent 3b1ad3c commit 42852eb

File tree

5 files changed

+24
-1
lines changed

5 files changed

+24
-1
lines changed

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/
2+
test/

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
declare class Webflow {
22
constructor(options: Webflow.Options);
3+
token: string;
34

45
get<Result extends any>(
56
path: string,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webflow-api",
33
"description": "Webflow's official Node.js SDK for Data APIs",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"types": "index.d.ts",
66
"main": "dist/index.js",
77
"contributors": [

src/Webflow.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export class Webflow {
1313
this.responseWrapper = new ResponseWrapper(this);
1414
}
1515

16+
set token(value) {
17+
this.client.token = value;
18+
}
19+
get token() {
20+
return this.client.token;
21+
}
22+
1623
get(path, query = {}) {
1724
return this.client.get(path, query);
1825
}

test/Common.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,17 @@ describe("Common", () => {
5151
expect(result._meta.rateLimit.limit).toBe(100);
5252
expect(result._meta.rateLimit.remaining).toBe(99);
5353
});
54+
55+
it("should allow the token to be set via the token property", async () => {
56+
const scope = api
57+
.matchHeader("Authorization", /Bearer new-token/)
58+
.get("/info")
59+
.reply(200, {});
60+
61+
webflow.token = "new-token";
62+
const result = await webflow.info();
63+
scope.done();
64+
65+
expect(result).toBeDefined();
66+
});
5467
});

0 commit comments

Comments
 (0)