Skip to content

Commit

Permalink
Merge branch '2.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHawkinss committed Oct 22, 2020
2 parents 53bf9cc + 6588c93 commit 9b1d5c5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 7 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,34 @@

A Node.js wrapper for the Multicraft API.

To view examples of use, check out the `examples.js` file.

### Updating
### Example use

`npm i multicraft-api-node`

```
const MulticraftAPI = require('multicraft-api-node');
const api = new MulticraftAPI({
url: "https://localhost/api.php",
user: "username",
key: "apiKey"
});
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' } }
// }
```
To view more examples of use, check out the `examples.js` file.

### Manual Updating

The `methods.json` file automatically generates the functions. To update this file:

Expand Down
4 changes: 2 additions & 2 deletions examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const MulticraftAPI = require('multicraft-api-node');

const api = new MulticraftAPI({
url: "https://localhost/api.php",
user: "admin",
key: "5kd9HaPid@mWqK"
user: "username",
key: "apiKey"
});

async function examples() {
Expand Down
21 changes: 20 additions & 1 deletion methods.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@
{
"name": "value",
"type": "array"
},
{
"name": "details",
"default": "0"
}
],
"listServersByConnection": [
Expand Down Expand Up @@ -386,6 +390,9 @@
"server_id",
"daemon_id"
],
"getMoveStatus": [
"server_id"
],
"listServerPorts": [
"id"
],
Expand Down Expand Up @@ -429,14 +436,26 @@
],
"getStatistics": [
{
"name": "daemon_id",
"name": "id",
"default": 0
},
{
"name": "include_suspended",
"default": 0
}
],
"runScript": [
"daemon_id",
"script",
{
"name": "args",
"default": ""
}
],
"getScript": [
"daemon_id",
"scriptId"
],
"listSettings": [],
"getSetting": [
"key"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "multicraft-api-node",
"version": "2.3.0",
"description": "API Version 2.3.0",
"version": "2.4.0",
"description": "API Version 2.4.0",
"main": "index.js",
"homepage": "https://github.com/Shockbyte/multicraft-api-node",
"repository": {
Expand Down

0 comments on commit 9b1d5c5

Please sign in to comment.