24fire-api 1.0.1
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/package.json +24 -0
- package/src/index.js +98 -0
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "24fire-api",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Nutze die fireapi in Nodejs, sicher und schnell",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/FlosTechnikwelt/24fire-api.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/FlosTechnikwelt/24fire-api.git",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"24fire",
|
|
13
|
+
"24fireAPI",
|
|
14
|
+
"api",
|
|
15
|
+
"Hosting",
|
|
16
|
+
"wrapper",
|
|
17
|
+
"flostechnikwelt"
|
|
18
|
+
],
|
|
19
|
+
"author": "FlosTechnikwelt",
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"axios": "^1.6.4"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
//███████╗██╗██████╗ ███████╗ █████╗ ██████╗ ██╗
|
|
2
|
+
//██╔════╝██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██║
|
|
3
|
+
//█████╗ ██║██████╔╝█████╗ ███████║██████╔╝██║
|
|
4
|
+
//██╔══╝ ██║██╔══██╗██╔══╝ ██╔══██║██╔═══╝ ██║
|
|
5
|
+
//██║ ██║██║ ██║███████╗██║ ██║██║ ██║
|
|
6
|
+
//╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
|
|
7
|
+
//24fireAPI für NodeJS
|
|
8
|
+
//Stand: 06.01.2024
|
|
9
|
+
//Made by FlosTechnikwlt
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
const axios = require('axios');
|
|
13
|
+
const fireapiError = "[24fire Client]: "
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class fireAPI {
|
|
17
|
+
constructor(apiKey) {
|
|
18
|
+
this.apiKey = apiKey;
|
|
19
|
+
if(!apiKey) { return fireapiError + "No API-Key was given"}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
vm() {
|
|
24
|
+
const apiKey = this.apiKey;
|
|
25
|
+
|
|
26
|
+
async function getVMconfig() {
|
|
27
|
+
const response = await axios.get("https://api.24fire.de/kvm/config", {
|
|
28
|
+
headers: {
|
|
29
|
+
//'Authorization': `Bearer ${apiKey}`,
|
|
30
|
+
'X-FIRE-APIKEY': apiKey,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
return response.data;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async function getVMstatus() {
|
|
38
|
+
const response = await axios.get("https://api.24fire.de/kvm/status", {
|
|
39
|
+
headers: {
|
|
40
|
+
//'Authorization': `Bearer ${apiKey}`,
|
|
41
|
+
'X-FIRE-APIKEY': apiKey,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return response.data;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
async function startVM() {
|
|
51
|
+
const response = await axios.post(`https://api.24fire.de/kvm/status/start`, {
|
|
52
|
+
headers: {
|
|
53
|
+
//'Authorization': `Bearer ${apiKey}`,
|
|
54
|
+
'X-FIRE-APIKEY': apiKey,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
return response.data;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
async function stopVM() {
|
|
64
|
+
const response = await axios.post(`https://api.24fire.de/kvm/status/stop`, {
|
|
65
|
+
headers: {
|
|
66
|
+
//'Authorization': `Bearer ${apiKey}`,
|
|
67
|
+
'X-FIRE-APIKEY': apiKey,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
async function restartVM() {
|
|
77
|
+
const response = await axios.post(`https://api.24fire.de/kvm/status/restart`, {
|
|
78
|
+
headers: {
|
|
79
|
+
//'Authorization': `Bearer ${apiKey}`,
|
|
80
|
+
'X-FIRE-APIKEY': apiKey,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
return response.data;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
getVMconfig,
|
|
89
|
+
getVMstatus,
|
|
90
|
+
startVM,
|
|
91
|
+
stopVM,
|
|
92
|
+
restartVM,
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
module.exports = fireAPI;
|