hcloud-sdk 0.0.12 → 0.0.15
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/lib/base.d.ts +5 -0
- package/lib/hcloud.d.ts +4 -2
- package/lib/hcloud.js +10 -3
- package/{src/lib → lib}/interfaces/Auditor.d.ts +0 -0
- package/{src/lib → lib}/interfaces/Auditor.js +0 -0
- package/{src/lib → lib}/interfaces/Global.d.ts +0 -0
- package/{src/lib → lib}/interfaces/Global.js +0 -0
- package/{src/lib → lib}/interfaces/IDP.d.ts +0 -0
- package/lib/{dto → interfaces}/IDP.js +0 -0
- package/{src/lib → lib}/service/Auditor.d.ts +0 -0
- package/{src/lib → lib}/service/Auditor.js +0 -0
- package/lib/service/IDP.d.ts +7 -1
- package/lib/service/IDP.js +11 -1
- package/package.json +2 -3
- package/lib/dto/IDP.d.ts +0 -13
- package/src/index.d.ts +0 -2
- package/src/index.js +0 -4
- package/src/lib/base.d.ts +0 -12
- package/src/lib/base.js +0 -8
- package/src/lib/hcloud.d.ts +0 -11
- package/src/lib/hcloud.js +0 -27
- package/src/lib/interfaces/IDP.js +0 -2
- package/src/lib/service/High5.d.ts +0 -4
- package/src/lib/service/High5.js +0 -9
- package/src/lib/service/IDP.d.ts +0 -39
- package/src/lib/service/IDP.js +0 -84
package/lib/base.d.ts
CHANGED
package/lib/hcloud.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import base, { Options } from "./base";
|
|
2
2
|
import IDPService from "./service/IDP";
|
|
3
|
+
import AuditorService from "./service/Auditor";
|
|
3
4
|
import High5Service from "./service/High5";
|
|
4
5
|
export default class hcloud extends base {
|
|
5
|
-
|
|
6
|
+
Auditor: AuditorService;
|
|
6
7
|
High5: High5Service;
|
|
8
|
+
IDP: IDPService;
|
|
7
9
|
constructor(opts: Options);
|
|
8
|
-
setAuthToken(token: string):
|
|
10
|
+
setAuthToken(token: string): hcloud;
|
|
9
11
|
}
|
package/lib/hcloud.js
CHANGED
|
@@ -2,19 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const base_1 = require("./base");
|
|
4
4
|
const IDP_1 = require("./service/IDP");
|
|
5
|
+
const Auditor_1 = require("./service/Auditor");
|
|
5
6
|
const High5_1 = require("./service/High5");
|
|
6
7
|
const axios_1 = require("axios");
|
|
8
|
+
const package_json_1 = require("../package.json");
|
|
7
9
|
// tslint:disable-next-line
|
|
8
10
|
class hcloud extends base_1.default {
|
|
9
11
|
constructor(opts) {
|
|
10
12
|
super(opts);
|
|
11
|
-
this.
|
|
13
|
+
this.Auditor = new Auditor_1.default(this.opts);
|
|
12
14
|
this.High5 = new High5_1.default(this.opts);
|
|
15
|
+
this.IDP = new IDP_1.default(this.opts);
|
|
16
|
+
axios_1.default.defaults.headers.common = {
|
|
17
|
+
"User-Agent": "hcloud-sdk-js/v" + package_json_1.version,
|
|
18
|
+
};
|
|
13
19
|
}
|
|
14
20
|
setAuthToken(token) {
|
|
15
|
-
axios_1.default.defaults.headers.common = {
|
|
21
|
+
axios_1.default.defaults.headers.common = Object.assign(axios_1.default.defaults.headers.common, {
|
|
16
22
|
Authorization: token,
|
|
17
|
-
};
|
|
23
|
+
});
|
|
24
|
+
return this;
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
exports.default = hcloud;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/service/IDP.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import base from "../base";
|
|
2
|
-
import { Token, User } from "../
|
|
2
|
+
import { Token, User } from "../interfaces/IDP";
|
|
3
|
+
import { Version } from "../interfaces/Global";
|
|
3
4
|
export default class IDP extends base {
|
|
5
|
+
/**
|
|
6
|
+
* Version requests the endpoint version
|
|
7
|
+
* @returns Version object
|
|
8
|
+
*/
|
|
9
|
+
version: () => Promise<Version>;
|
|
4
10
|
/**
|
|
5
11
|
* Authorize validates a token
|
|
6
12
|
* @param token
|
package/lib/service/IDP.js
CHANGED
|
@@ -14,13 +14,23 @@ const axios_1 = require("axios");
|
|
|
14
14
|
class IDP extends base_1.default {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* Version requests the endpoint version
|
|
19
|
+
* @returns Version object
|
|
20
|
+
*/
|
|
21
|
+
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const resp = yield axios_1.default.get(this.getEndpoint("/v1/version"), {}).catch((err) => {
|
|
23
|
+
throw err;
|
|
24
|
+
});
|
|
25
|
+
return resp.data;
|
|
26
|
+
});
|
|
17
27
|
/**
|
|
18
28
|
* Authorize validates a token
|
|
19
29
|
* @param token
|
|
20
30
|
* @returns User object
|
|
21
31
|
*/
|
|
22
32
|
this.authorize = () => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const resp = yield axios_1.default.
|
|
33
|
+
const resp = yield axios_1.default.get(this.getEndpoint("/v1/authorize"), {}).catch((err) => {
|
|
24
34
|
throw err;
|
|
25
35
|
});
|
|
26
36
|
return resp.data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hcloud-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "hcloud platform sdk",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -46,6 +46,5 @@
|
|
|
46
46
|
"doc:dev": "vuepress dev _docs/src",
|
|
47
47
|
"doc:export": "vuepress export _docs/src",
|
|
48
48
|
"build": "tsc"
|
|
49
|
-
}
|
|
50
|
-
"readme": "# hcloud-sdk\n[](https://opensource.org/licenses/MIT)\n[](https://www.npmjs.com/package/hcloud-sdk)\n"
|
|
49
|
+
}
|
|
51
50
|
}
|
package/lib/dto/IDP.d.ts
DELETED
package/src/index.d.ts
DELETED
package/src/index.js
DELETED
package/src/lib/base.d.ts
DELETED
package/src/lib/base.js
DELETED
package/src/lib/hcloud.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import base, { Options } from "./base";
|
|
2
|
-
import IDPService from "./service/IDP";
|
|
3
|
-
import AuditorService from "./service/Auditor";
|
|
4
|
-
import High5Service from "./service/High5";
|
|
5
|
-
export default class hcloud extends base {
|
|
6
|
-
Auditor: AuditorService;
|
|
7
|
-
High5: High5Service;
|
|
8
|
-
IDP: IDPService;
|
|
9
|
-
constructor(opts: Options);
|
|
10
|
-
setAuthToken(token: string): hcloud;
|
|
11
|
-
}
|
package/src/lib/hcloud.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const base_1 = require("./base");
|
|
4
|
-
const IDP_1 = require("./service/IDP");
|
|
5
|
-
const Auditor_1 = require("./service/Auditor");
|
|
6
|
-
const High5_1 = require("./service/High5");
|
|
7
|
-
const axios_1 = require("axios");
|
|
8
|
-
const package_json_1 = require("../../package.json");
|
|
9
|
-
// tslint:disable-next-line
|
|
10
|
-
class hcloud extends base_1.default {
|
|
11
|
-
constructor(opts) {
|
|
12
|
-
super(opts);
|
|
13
|
-
this.Auditor = new Auditor_1.default(this.opts);
|
|
14
|
-
this.High5 = new High5_1.default(this.opts);
|
|
15
|
-
this.IDP = new IDP_1.default(this.opts);
|
|
16
|
-
axios_1.default.defaults.headers.common = {
|
|
17
|
-
"User-Agent": "hcloud-sdk-js/v" + package_json_1.version,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
setAuthToken(token) {
|
|
21
|
-
axios_1.default.defaults.headers.common = Object.assign(axios_1.default.defaults.headers.common, {
|
|
22
|
-
Authorization: token,
|
|
23
|
-
});
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.default = hcloud;
|
package/src/lib/service/High5.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const base_1 = require("../base");
|
|
4
|
-
class High5 extends base_1.default {
|
|
5
|
-
getEndpoint(endpoint) {
|
|
6
|
-
return `${this.opts.api}/api/high5${endpoint}`;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.default = High5;
|
package/src/lib/service/IDP.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import base from "../base";
|
|
2
|
-
import { Token, User } from "../interfaces/IDP";
|
|
3
|
-
import { Version } from "../interfaces/Global";
|
|
4
|
-
export default class IDP extends base {
|
|
5
|
-
/**
|
|
6
|
-
* Version requests the endpoint version
|
|
7
|
-
* @returns Version object
|
|
8
|
-
*/
|
|
9
|
-
version: () => Promise<Version>;
|
|
10
|
-
/**
|
|
11
|
-
* Authorize validates a token
|
|
12
|
-
* @param token
|
|
13
|
-
* @returns User object
|
|
14
|
-
*/
|
|
15
|
-
authorize: () => Promise<User>;
|
|
16
|
-
/**
|
|
17
|
-
* Register against the identity provider
|
|
18
|
-
* @param name
|
|
19
|
-
* @param email
|
|
20
|
-
* @param password
|
|
21
|
-
* @returns Bearer Token
|
|
22
|
-
*/
|
|
23
|
-
register: (name: string, email: string, password: string) => Promise<User>;
|
|
24
|
-
/**
|
|
25
|
-
* Authenticate against the identity provider with a given email and password.
|
|
26
|
-
* @param email
|
|
27
|
-
* @param password
|
|
28
|
-
* @returns Bearer Token
|
|
29
|
-
*/
|
|
30
|
-
authenticate: (email: string, password: string) => Promise<Token>;
|
|
31
|
-
/**
|
|
32
|
-
* authenticateReturnUser against the identity provider with a given email and password.
|
|
33
|
-
* @param email
|
|
34
|
-
* @param password
|
|
35
|
-
* @returns User object
|
|
36
|
-
*/
|
|
37
|
-
authenticateReturnUser: (email: string, password: string) => Promise<User>;
|
|
38
|
-
private getEndpoint;
|
|
39
|
-
}
|
package/src/lib/service/IDP.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const base_1 = require("../base");
|
|
13
|
-
const axios_1 = require("axios");
|
|
14
|
-
class IDP extends base_1.default {
|
|
15
|
-
constructor() {
|
|
16
|
-
super(...arguments);
|
|
17
|
-
/**
|
|
18
|
-
* Version requests the endpoint version
|
|
19
|
-
* @returns Version object
|
|
20
|
-
*/
|
|
21
|
-
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const resp = yield axios_1.default.get(this.getEndpoint("/v1/version"), {}).catch((err) => {
|
|
23
|
-
throw err;
|
|
24
|
-
});
|
|
25
|
-
return resp.data;
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Authorize validates a token
|
|
29
|
-
* @param token
|
|
30
|
-
* @returns User object
|
|
31
|
-
*/
|
|
32
|
-
this.authorize = () => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const resp = yield axios_1.default.get(this.getEndpoint("/v1/authorize"), {}).catch((err) => {
|
|
34
|
-
throw err;
|
|
35
|
-
});
|
|
36
|
-
return resp.data;
|
|
37
|
-
});
|
|
38
|
-
/**
|
|
39
|
-
* Register against the identity provider
|
|
40
|
-
* @param name
|
|
41
|
-
* @param email
|
|
42
|
-
* @param password
|
|
43
|
-
* @returns Bearer Token
|
|
44
|
-
*/
|
|
45
|
-
this.register = (name, email, password) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const resp = yield axios_1.default
|
|
47
|
-
.post(this.getEndpoint("/v1/registration"), { name: name, email: email, password: password })
|
|
48
|
-
.catch((err) => {
|
|
49
|
-
throw err;
|
|
50
|
-
});
|
|
51
|
-
return resp.data;
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Authenticate against the identity provider with a given email and password.
|
|
55
|
-
* @param email
|
|
56
|
-
* @param password
|
|
57
|
-
* @returns Bearer Token
|
|
58
|
-
*/
|
|
59
|
-
this.authenticate = (email, password) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
const resp = yield axios_1.default.post(this.getEndpoint("/v1/authenticate"), { email: email, password: password }).catch((err) => {
|
|
61
|
-
throw err;
|
|
62
|
-
});
|
|
63
|
-
// tslint-disable: no-string-literal
|
|
64
|
-
const token = { token: resp.headers.authorization };
|
|
65
|
-
return token;
|
|
66
|
-
});
|
|
67
|
-
/**
|
|
68
|
-
* authenticateReturnUser against the identity provider with a given email and password.
|
|
69
|
-
* @param email
|
|
70
|
-
* @param password
|
|
71
|
-
* @returns User object
|
|
72
|
-
*/
|
|
73
|
-
this.authenticateReturnUser = (email, password) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const resp = yield axios_1.default.post(this.getEndpoint("/v1/authenticate"), { email: email, password: password }).catch((err) => {
|
|
75
|
-
throw err;
|
|
76
|
-
});
|
|
77
|
-
return resp.data;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
getEndpoint(endpoint) {
|
|
81
|
-
return `${this.opts.api}/api/account${endpoint}`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.default = IDP;
|