1.3.2 • Published 2 years ago

minehut-apis v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

npm install minehut-apis
# or
yarn add minehut-apis
# or
pnpm add minehut-apis

Loading the module

ES Modules (ESM)

import { Client } from "minehut-apis";

CommonJS

const { Client } = require("minehut-apis");

Example usage

Get server by name

import { Client } from "minehut-apis";

const minehut = new Client();

(async () => {
  // Get server by name
  const server = await minehut.server.get("lightskies", true);
  
  console.log(server);
})();

Get server by Id

import { Client } from "minehut-apis";

const minehut = new Client();

(async () => {
  // Get server by Id
  const server = await minehut.server.get("60e57b624cba54007bf05c34", false);

  console.log(server);
})();

Get product by name

import { Client } from "minehut-apis";

const minehut = new Client();

(async () => {
  // Get product by name
  const product = await client.product.get("WorldEdit", true);

  console.log(product);

  // The publisher of the product
  console.log(`Publisher: ${product.publisherName}`);
  // The short description of the product
  console.log(`Short description: ${product.shortDescription}`);
})();

Avoid conflicts

Importing another module with the same name will cause conflicts (eg. discord.js). This can simply be avoided by renaming the import.

import { Client as Minehut } from "minehut-apis";
// Using CommonJS: "const { Client: Minehut } = require("minehut-apis")"
import { Client } from "discord.js";

// minehut-apis client
const minehut = new Minehut();

// discord.js client
const client = new Client();

TypeScript

Types are bundled with minehut-apis, so you do not need to install any additional packages.

Team

Mullp
Mullp
1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago