Skip to content

Commit 501aba1

Browse files
committed
Addition of README in package root & bump version
1 parent 059b258 commit 501aba1

File tree

3 files changed

+54
-134
lines changed

3 files changed

+54
-134
lines changed

USAGE.md

-133
This file was deleted.

src/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# MC-Market's Official JS API Wrapper
2+
[![GitHub license](https://img.shields.io/badge/license-MIT-007ec6)](https://github.com/Majored/mcm-js-api-wrapper/blob/main/LICENSE)
3+
[![npm version](https://badge.fury.io/js/mcm-js-api-wrapper.svg)](https://www.npmjs.com/package/mcm-js-api-wrapper)
4+
5+
An official asynchronous JavaScript (Node.js) wrapper for MC-Market's [Ultimate REST API](https://www.mc-market.org/wiki/ultimate-api/).
6+
7+
* Fully asynchronous design compatible with .then() notation or async/await.
8+
* Dynamically stalls requests when a rate limit is hit.
9+
* A comprehensive set of usage examples.
10+
* Heavily commented making contributions painless.
11+
12+
## Installation & Basic Usage
13+
Install via `npm`:
14+
```
15+
npm i mcm-js-api-wrapper
16+
```
17+
18+
Initialise wrapper and fetch information about yourself via Promise's .then() notation:
19+
```JS
20+
const wrapper = require("mcm-js-api-wrapper");
21+
const token = {type: "Private", value: "xXoIjvQ6G8UmUPufZWxN-Kkyd54Js_bY"};
22+
23+
wrapper.init(token).then(init => {
24+
if (init.result === "error") {
25+
console.log(init.error);
26+
process.exit(0);
27+
}
28+
}).then(wrapper.members.self().then(self => {
29+
console.log(self);
30+
}));
31+
```
32+
33+
Initialise wrapper and fetch information about yourself via async/await:
34+
```JS
35+
const wrapper = require("mcm-js-api-wrapper");
36+
const token = {type: "Private", value: "xXoIjvQ6G8UmUPufZWxN-Kkyd54Js_bY"};
37+
...
38+
39+
let init = await wrapper.init(token);
40+
if (init.result === "error") {
41+
console.log(init.error);
42+
process.exit(0);
43+
}
44+
45+
console.log(await wrapper.members.self());
46+
```
47+
48+
A full list of functions and their signatures can be found [here](https://github.com/MC-Market-org/mcm-js-api-wrapper/blob/main/USAGE.md).
49+
50+
## Issues & Support
51+
The [issues tracker](https://github.com/MC-Market-org/mcm-js-api-wrapper/issues) for this repository should only be used to report bugs or issues with this official JS wrapper.
52+
53+
For bugs or issues related to the Ultimate API itself, please open a [support ticket](https://www.mc-market.org/tickets/new) or create a [bug report](https://www.mc-market.org/suggestions/create-thread) on our platform.

src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcm-js-api-wrapper",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "An official asynchronous JavaScript (Node.js) wrapper for MC-Market's Ultimate REST API.",
55
"main": "lib.js",
66
"scripts": {

0 commit comments

Comments
 (0)