-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.ts
83 lines (73 loc) · 1.89 KB
/
keys.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { Service } from "../service.ts";
import { Payload } from "../client.ts";
import { TombaException } from "../exception.ts";
export class Keys extends Service {
/**
* Get your keys.
*
* Returns a list of your keys.
*
* @throws {TombaException}
* @returns {Promise}
*/
async getKeys<T extends unknown>(): Promise<T> {
let path = "/keys/{id}";
let payload: Payload = {};
return await this.client.call("get", path, {
"content-type": "application/json",
}, payload);
}
/**
* Delete key
*
* Delete key
*
* @param {string} id
* @throws {TombaException}
* @returns {Promise}
*/
async deleteKey<T extends unknown>(id: string): Promise<T> {
if (typeof id === "undefined") {
throw new TombaException('Missing required parameter: "id"');
}
let path = "/keys/{id}".replace("{id}", id);
let payload: Payload = {};
return await this.client.call("delete", path, {
"content-type": "application/json",
}, payload);
}
/**
* Create Key
*
* Create a new Key.
*
* @throws {TombaException}
* @returns {Promise}
*/
async createKey<T extends unknown>(): Promise<T> {
let path = "/keys/{id}";
let payload: Payload = {};
return await this.client.call("post", path, {
"content-type": "application/json",
}, payload);
}
/**
* Reset a key
*
* Rest your key.
*
* @param {string} id
* @throws {TombaException}
* @returns {Promise}
*/
async resetKey<T extends unknown>(id: string): Promise<T> {
if (typeof id === "undefined") {
throw new TombaException('Missing required parameter: "id"');
}
let path = "/keys/{id}".replace("{id}", id);
let payload: Payload = {};
return await this.client.call("put", path, {
"content-type": "application/json",
}, payload);
}
}