-
Notifications
You must be signed in to change notification settings - Fork 2
/
examples.js
35 lines (31 loc) · 892 Bytes
/
examples.js
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
// npm install multicraft-api-node
const MulticraftAPI = require('multicraft-api-node');
const api = new MulticraftAPI({
url: "https://localhost/api.php",
user: "username",
key: "apiKey"
});
async function examples() {
try {
const listServers = await api.listServers();
console.log(listServers);
// {
// success: true,
// errors: [],
// data: {
// Servers: { '1': 'test', '2': 'Minecraft Server', '3': 'Minecraft Server' }
// }
// }
} catch (e) {
console.log(e);
}
api.listServersByConnection({ connection_id: '1' })
.then((data) => console.log(data))
.catch((err) => console.error(err));
// {
// success: true,
// errors: [],
// data: { Servers: { '1': 'test', '2': 'Minecraft Server' } }
// }
}
examples()