UNPKG

osu-api-extended

Version:

Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools

30 lines (29 loc) 1.59 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.matches_list = void 0; const handleErrors_1 = require("../../utility/handleErrors"); const request_1 = require("../../utility/request"); const matches_list = (params, addons) => __awaiter(void 0, void 0, void 0, function* () { const data = yield (0, request_1.request)(`https://osu.ppy.sh/api/v2/matches`, { method: 'GET', params: { limit: params === null || params === void 0 ? void 0 : params.limit, sort: params === null || params === void 0 ? void 0 : params.sort, 'cursor[match_id]': params === null || params === void 0 ? void 0 : params.after_id, }, addons, }); if (data.error) return (0, handleErrors_1.handleErrors)(new Error(data.error)); return data; }); exports.matches_list = matches_list;