hcloud-sdk 0.0.8 → 0.0.9

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 CHANGED
@@ -1 +1,3 @@
1
1
  # hcloud-sdk
2
+ [![MIT License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ [![Latest Release](https://img.shields.io/npm/v/hcloud-sdk.svg)](https://www.npmjs.com/package/hcloud-sdk)
package/lib/hcloud.d.ts CHANGED
@@ -5,4 +5,5 @@ export default class hcloud extends base {
5
5
  IDP: IDPService;
6
6
  High5: High5Service;
7
7
  constructor(opts: Options);
8
+ setAuthToken(token: string): void;
8
9
  }
package/lib/hcloud.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const base_1 = require("./base");
4
4
  const IDP_1 = require("./service/IDP");
5
5
  const High5_1 = require("./service/High5");
6
+ const axios_1 = require("axios");
6
7
  // tslint:disable-next-line
7
8
  class hcloud extends base_1.default {
8
9
  constructor(opts) {
@@ -10,5 +11,10 @@ class hcloud extends base_1.default {
10
11
  this.IDP = new IDP_1.default(this.opts);
11
12
  this.High5 = new High5_1.default(this.opts);
12
13
  }
14
+ setAuthToken(token) {
15
+ axios_1.default.defaults.headers.common = {
16
+ Authorization: token,
17
+ };
18
+ }
13
19
  }
14
20
  exports.default = hcloud;
@@ -6,7 +6,7 @@ export default class IDP extends base {
6
6
  * @param token
7
7
  * @returns User object
8
8
  */
9
- authorize: (token: string) => Promise<User>;
9
+ authorize: () => Promise<User>;
10
10
  /**
11
11
  * Register against the identity provider
12
12
  * @param name
@@ -19,8 +19,8 @@ class IDP extends base_1.default {
19
19
  * @param token
20
20
  * @returns User object
21
21
  */
22
- this.authorize = (token) => __awaiter(this, void 0, void 0, function* () {
23
- const resp = yield axios_1.default.post(this.getEndpoint("/v1/authenticate"), {}, { headers: { Authorization: token } }).catch((err) => {
22
+ this.authorize = () => __awaiter(this, void 0, void 0, function* () {
23
+ const resp = yield axios_1.default.post(this.getEndpoint("/v1/authenticate"), {}, {}).catch((err) => {
24
24
  throw err;
25
25
  });
26
26
  return resp.data;
package/package.json CHANGED
@@ -1,43 +1,50 @@
1
1
  {
2
- "name": "hcloud-sdk",
3
- "version": "0.0.8",
4
- "description": "hcloud platform sdk",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "scripts": {
8
- "test": "mocha -r ts-node/register tests/**/*.test.ts",
9
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.test.ts\"",
10
- "lint": "tslint -p tsconfig.json",
11
- "build": "tsc"
12
- },
13
- "repository": {
14
- "type": "git",
15
- "url": "git+https://github.com/moovit-sp-gmbh/hcloud-sdk-js.git"
16
- },
17
- "keywords": [
18
- "hcloud",
19
- "sdk"
20
- ],
21
- "license": "MIT",
22
- "bugs": {
23
- "url": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js/issues"
24
- },
25
- "author": "moovit-sp-gmbh",
26
- "homepage": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js#readme",
27
- "devDependencies": {
28
- "@types/chai": "^4.3.1",
29
- "@types/mocha": "^9.1.1",
30
- "@types/uuid": "^8.3.4",
31
- "chai": "^4.3.6",
32
- "mocha": "^10.0.0",
33
- "prettier": "^2.6.2",
34
- "ts-node": "^10.8.0",
35
- "tslint": "^6.1.3",
36
- "tslint-config-prettier": "^1.18.0",
37
- "typescript": "^4.7.2",
38
- "uuid": "^8.3.2"
39
- },
40
- "dependencies": {
41
- "axios": "^0.27.2"
42
- }
43
- }
2
+ "name": "hcloud-sdk",
3
+ "version": "0.0.9",
4
+ "description": "hcloud platform sdk",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/moovit-sp-gmbh/hcloud-sdk-js.git"
10
+ },
11
+ "keywords": [
12
+ "hcloud",
13
+ "sdk"
14
+ ],
15
+ "license": "MIT",
16
+ "bugs": {
17
+ "url": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js/issues"
18
+ },
19
+ "author": "moovit-sp-gmbh",
20
+ "homepage": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js#readme",
21
+ "devDependencies": {
22
+ "@types/chai": "^4.3.1",
23
+ "@types/mocha": "^9.1.1",
24
+ "@types/uuid": "^8.3.4",
25
+ "chai": "^4.3.6",
26
+ "mocha": "^10.0.0",
27
+ "prettier": "^2.6.2",
28
+ "ts-node": "^10.8.0",
29
+ "tslint": "^6.1.3",
30
+ "tslint-config-prettier": "^1.18.0",
31
+ "typescript": "^4.7.2",
32
+ "uuid": "^8.3.2"
33
+ },
34
+ "dependencies": {
35
+ "axios": "^0.27.2",
36
+ "dayjs": "^1.11.3",
37
+ "vuepress": "^1.9.7",
38
+ "vuepress-theme-default-prefers-color-scheme": "^2.0.0"
39
+ },
40
+ "scripts": {
41
+ "test": "mocha -r ts-node/register tests/**/*.test.ts",
42
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.test.ts\"",
43
+ "lint": "tslint -p tsconfig.json",
44
+ "doc:build": "vuepress build _docs/src",
45
+ "doc:dev": "vuepress dev _docs/src",
46
+ "doc:export": "vuepress export _docs/src",
47
+ "build": "tsc"
48
+ },
49
+ "readme": "# hcloud-sdk\n[![MIT License](https://img.shields.io/badge/license-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Latest Release](https://img.shields.io/npm/v/hcloud-sdk.svg)](https://www.npmjs.com/package/hcloud-sdk)\n"
50
+ }