night-api
Version:
Ce paquet Npm fourni une interface pour intéragir avec [Night-API](https://night-api.com)
35 lines • 1.55 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const functions_1 = __importDefault(require("../../functions"));
const constants_1 = require("../constants");
class Games {
token;
constructor(token) {
this.token = token;
this.functions = new functions_1.default(this.token);
}
;
async getServer(serverType, ip) {
return new Promise(async (resolve, reject) => {
if (!ip)
throw new Error('The IP is required for Games servers');
if (typeof ip !== 'string')
throw new Error('The IP must be a valid IP address for Games servers. The parameter must be a string');
return this.functions.get(constants_1.Endpoints.Games._ + serverType + `/${ip}`).then(resolve).catch(reject);
});
}
;
async minecraft(ip) { return new Promise((resolve, reject) => this.getServer(constants_1.Endpoints.Games.Minecraft, ip).then(resolve).catch(reject)); }
;
async garrysmod(ip) { return new Promise((resolve, reject) => this.getServer(constants_1.Endpoints.Games.GarrysMod, ip).then(resolve).catch(reject)); }
;
async fivem(ip) { return new Promise((resolve, reject) => this.getServer(constants_1.Endpoints.Games.FiveM, ip).then(resolve).catch(reject)); }
;
}
;
;
exports.default = Games;
//# sourceMappingURL=Games.js.map