Skip to content

Commit

Permalink
V1.0.1 (#65)
Browse files Browse the repository at this point in the history
* fixed setting tokens via property

* fixed setting tokens via property

* bumped version to 1.0.1
  • Loading branch information
John Agan authored Nov 1, 2022
1 parent 3b1ad3c commit 42852eb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/
test/
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare class Webflow {
constructor(options: Webflow.Options);
token: string;

get<Result extends any>(
path: string,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webflow-api",
"description": "Webflow's official Node.js SDK for Data APIs",
"version": "1.0.0",
"version": "1.0.1",
"types": "index.d.ts",
"main": "dist/index.js",
"contributors": [
Expand Down
7 changes: 7 additions & 0 deletions src/Webflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export class Webflow {
this.responseWrapper = new ResponseWrapper(this);
}

set token(value) {
this.client.token = value;
}
get token() {
return this.client.token;
}

get(path, query = {}) {
return this.client.get(path, query);
}
Expand Down
13 changes: 13 additions & 0 deletions test/Common.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,17 @@ describe("Common", () => {
expect(result._meta.rateLimit.limit).toBe(100);
expect(result._meta.rateLimit.remaining).toBe(99);
});

it("should allow the token to be set via the token property", async () => {
const scope = api
.matchHeader("Authorization", /Bearer new-token/)
.get("/info")
.reply(200, {});

webflow.token = "new-token";
const result = await webflow.info();
scope.done();

expect(result).toBeDefined();
});
});

0 comments on commit 42852eb

Please sign in to comment.