-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ArcticZeroo
authored
Feb 3, 2017
1 parent
72a549e
commit f520caf
Showing
1 changed file
with
17 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,239 +1,25 @@ | ||
#Mineplex API Wrapper | ||
This is a wrapper for the Mineplex API, whose documentation can be found [Here](https://github.com/Mineplex-LLC/MineplexAPI). | ||
Wrapper for the module `mineplex-api` (which is also a wrapper). Weird. | ||
|
||
##Documentation | ||
|
||
Callback documentation outlines the contents of the `result` object if `success = true`. | ||
|
||
###Class `MineplexAPIWrapper` | ||
|
||
####Constructor | ||
`new MineplexAPIWrapper(apiKey)` | ||
`apiKey` - Your Mineplex API key. | ||
|
||
####Properties | ||
|
||
**api** | ||
This property holds the `MineplexAPI class` from the `mineplex-api` module. You can use this property to make requests using the MineplexAPIWrapper without having to deal with the objects they return. | ||
|
||
####Methods | ||
|
||
#####Server Methods | ||
######**getServerStatus** | ||
*Gets current status of the server* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|a new ServerStatus class containing the current server status.|ServerStatus| | ||
|
||
######**getServerTotal** | ||
*Gets current total player count on the server.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|The current amount of online players.|integer| | ||
|
||
|
||
######**getServerGroups** | ||
*Gets a list of all currently active server groups* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An array containing the name of each currently active servergroup.|Array\<String>| | ||
|
||
--- | ||
#####Player Methods | ||
|
||
######**getPlayerInfo** | ||
*Gets all available information about a player* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|player|true|The name or UUID of the player to look up|string| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|A Player class containing information about the player|Player| | ||
|
||
######**getPlayerStats** | ||
*Gets the stats of a player.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|player|true|The name or UUID of the player to look up|string| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|A PlayerStatus class containing stats for the player|PlayerStatus| | ||
|
||
######**getPlayerFriends** | ||
*Gets the friends of a player.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|player|true|The name or UUID of the player to look up|string| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|A PlayerFriends class containing friends for the player|PlayerFriends| | ||
|
||
######**getPlayerStatus** | ||
*Gets the status of a player.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|player|true|The name or UUID of the player to look up|string| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|A PlayerStatus class containing status for the player|PlayerStatus| | ||
|
||
--- | ||
#####Amplifier Methods | ||
|
||
######**getAmplifierGroups** | ||
*Gets a list of all available amplifier groups.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An array of names of available ampllifier groups.|Array\<String>| | ||
|
||
######**getAmplifiers** | ||
*Gets all amplifiers in all groups.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An AmplifierGroups class containing all amplifier groups.|AmplifierGroups| | ||
|
||
######**getAmplifiersForGroup** | ||
*Gets all amplifiers for a specific group.* | ||
|
||
Parameters | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|group|true|Name of the group to get Amplifiers for|string| | ||
|callback|true|Callback with parameters (success, result). If success is `false`, result is some sort of error. If success is `true`, result may be another object|function| | ||
|
||
Callback | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An AmplifierGroup class containing amplifiers for the specific group.|AmplifierGroup| | ||
|
||
###Class `ServerStatus` | ||
|
||
####Constructor | ||
`new ServerStatus(data)` | ||
`data` - A JSON object containing (at minimum) | ||
```javascript | ||
{ | ||
total: int, | ||
groups: object | ||
} | ||
``` | ||
var config = require('./config'); | ||
var MineplexAPI = require('mineplex-api-wrapper'); | ||
var api = new MineplexAPI(config.token); | ||
api.getPlayerInfo('Artix', (err, res)=>{ | ||
if(err) return console.log('Could not get player info for Artix: ' + err); | ||
console.log(JSON.stringify(res)); | ||
}); | ||
``` | ||
|
||
####Properties | ||
|
||
#####Private Properties | ||
|
||
######**_total** | ||
This property holds the total count. | ||
|
||
######**_groups** | ||
This property holds the groups object. | ||
|
||
####Methods | ||
|
||
#####**getTotal** | ||
*Gets total from status* | ||
|
||
Returns | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An integer representing the total count.|integer| | ||
|
||
#####**getGroups** | ||
*Gets stats for all groups* | ||
|
||
Returns | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An object which contains all groups' data. Data format is `{"group":player_count}` |Object| | ||
|
||
#####**getGroup** | ||
*Gets count for a certain group* | ||
#Installation | ||
|
||
Parameters | ||
`$npm install mineplex-api-wrapper` | ||
|
||
|Name|Required|Description|Schema| | ||
|---|---|---|---| | ||
|group|true|Name of the group to get count for|string| | ||
#"Features" | ||
|
||
Returns | ||
* Prettified methods for `mineplex-api` so your code makes slightly more sense | ||
* Rank name conversion, rank permission checking | ||
* Minecraft chat JSON to colored output (with `chalk`) | ||
|
||
|Description|Schema| | ||
|---|---| | ||
|An integer representing the current player count in that group. May be undefined if the group does not exist.|integer| |