minecraft-wrapper
v1.1.1
Published
A javascript wrapper to work with the mcapi.de API.
Downloads
6
Readme
MinecraftWrapper
A javascript wrapper library to work with mcapi.de Web API.
Browser Support
This library relies on Fetch API. And this API is supported in the following browsers.
| | | | | --- | --- | --- | --- | --- | 39+ ✔ | 42+ ✔ | 29+ ✔ | 10.1+ ✔ | Nope ✘ |
Dependencies
This library depends on fetch to make requests to the mcapi.de Web API. For environments that don't support fetch, you'll need to provide a polyfill to browser or polyfill to Node.
Installation
$ npm install minecraft-wrapper --save
How to use
ES6
// to import a specific method
import MinecraftWrapper from 'minecraft-wrapper';
const minecraft = new MinecraftWrapper();
// using method
minecraft.user.getUser('Notch');
CommonJS
const MinecraftWrapper = require('minecraft-wrapper').default;
const minecraft = new MinecraftWrapper();
UMD in Browser
<!-- to import non-minified version -->
<script src="minecraft-wrapper.umd.js"></script>
<!-- to import minified version -->
<script src="minecraft-wrapper.umd.min.js"></script>
After that the library will be available to the Global as MinecraftWrapper
. Follow an example:
const minecraft = new MinecraftWrapper();
const user = minecraft.user.getUser('Notch');
Methods
Follow the methods that the library provides.
user.getUser(query)
Search for informations about User with provided query
Arguments
| Argument | Type | Example |
|----------|---------|-------------------|
| query
| string | Notch |
Example
minecraft.user.getUser('Notch')
.then(data => {
// do what you want with the data
})
user.getReputation(query)
Search for informations about User Reputation with provided query
Arguments
| Argument | Type | Example |
|----------|---------|-------------------|
| query
| string | Notch |
Example
minecraft.user.getReputation('Notch')
.then(data => {
// do what you want with the data
})
server.getServer(ip)
Search for informations about Server with provided ip
Arguments
| Argument | Type | Otions |
|----------|---------|-------------------|
|ip
| string | 'Any search ip'|
Example
minecraft.server.getServer('play.hivemc.eu')
.then(data => {
// do what you want with the data
})
server.getPing(ip)
Search for informations about Server Ping with provided ip
Arguments
| Argument | Type | Otions |
|----------|---------|-------------------|
| ip
| string | 'Any search ip'|
Example
minecraft.server.getPing('play.hivemc.eu')
.then(data => {
// do what you want with the data
})
server.getQuery(ip)
Search for informations about Server with provided ip
Arguments
| Argument | Type | Otions |
|----------|---------|-------------------|
| ip
| string | 'Any search ip'|
Example
minecraft.server.getQuery('play.hivemc.eu')
.then(data => {
// do what you want with the data
})
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
| | |:---------------------:| | Ramon Rodrigues |
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details