24fire-api 1.0.2 → 1.0.3
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 +1 -1
- package/src/index.js +27 -20
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
//24fireAPI für NodeJS
|
|
8
8
|
//Stand: 06.01.2024
|
|
9
9
|
//Made by FlosTechnikwlt
|
|
10
|
+
//Credits: Lars.1309
|
|
10
11
|
|
|
11
12
|
'use strict';
|
|
12
13
|
const axios = require('axios');
|
|
13
14
|
const fireapiError = "[24fire Client]: "
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
class
|
|
17
|
+
class fireAPI {
|
|
17
18
|
constructor(apiKey) {
|
|
18
19
|
this.apiKey = apiKey;
|
|
19
20
|
if(!apiKey) { return fireapiError + "No API-Key was given"}
|
|
@@ -48,12 +49,14 @@ class fireApi {
|
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
async function startVM() {
|
|
51
|
-
const response = await axios.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
const response = await axios.request({
|
|
53
|
+
method: 'post',
|
|
54
|
+
maxBodyLength: Infinity,
|
|
55
|
+
url: 'https://api.24fire.de/kvm/status/start',
|
|
56
|
+
headers: {
|
|
57
|
+
'X-FIRE-APIKEY': apiKey
|
|
58
|
+
}
|
|
59
|
+
})
|
|
57
60
|
return response.data;
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -61,12 +64,14 @@ class fireApi {
|
|
|
61
64
|
|
|
62
65
|
|
|
63
66
|
async function stopVM() {
|
|
64
|
-
const response = await axios.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const response = await axios.request({
|
|
68
|
+
method: 'post',
|
|
69
|
+
maxBodyLength: Infinity,
|
|
70
|
+
url: 'https://api.24fire.de/kvm/status/start',
|
|
71
|
+
headers: {
|
|
72
|
+
'X-FIRE-APIKEY': apiKey
|
|
73
|
+
}
|
|
74
|
+
})
|
|
70
75
|
return response.data;
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -74,12 +79,14 @@ class fireApi {
|
|
|
74
79
|
|
|
75
80
|
|
|
76
81
|
async function restartVM() {
|
|
77
|
-
const response = await axios.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
const response = await axios.request({
|
|
83
|
+
method: 'post',
|
|
84
|
+
maxBodyLength: Infinity,
|
|
85
|
+
url: 'https://api.24fire.de/kvm/status/restart',
|
|
86
|
+
headers: {
|
|
87
|
+
'X-FIRE-APIKEY': apiKey
|
|
88
|
+
}
|
|
89
|
+
})
|
|
83
90
|
return response.data;
|
|
84
91
|
}
|
|
85
92
|
|
|
@@ -95,4 +102,4 @@ class fireApi {
|
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
|
|
98
|
-
module.exports =
|
|
105
|
+
module.exports = fireAPI;
|