osu-api-extended
Version:
Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools
50 lines (49 loc) • 2.52 kB
JavaScript
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.beatmaps_actions = void 0;
const handleErrors_1 = require("../../utility/handleErrors");
const beatmaps_actions = (params, addons) => __awaiter(void 0, void 0, void 0, function* () {
if (params.type == 'favourite' || params.type == 'tag') {
return (0, handleErrors_1.handleErrors)(new Error(`currently osu! api does not support this action`));
}
;
// if (params.id == null) {
// if (params.type == 'favourite') return handleErrors(new Error(`Specify beatmapset id`)) as Response<T['type']>;
// return handleErrors(new Error(`Specify beatmap id`)) as Response<T['type']>;
// };
// const object: any = {};
// let url = 'https://osu.ppy.sh/api/v2';
// let method = 'POST';
// switch (params.type) {
// case 'favourite': {
// url += `/beatmapsets/${params.id}/favourites`;
// object['action'] = params.status == true ? 'favourite' : 'unfavourite';
// break;
// };
// case 'tag': {
// if (params.name == null || params.name == '') return handleErrors(new Error(`Specify tag name`)) as Response<T['type']>;
// url += `/beatmaps/${params.id}/tags/${params.name}`;
// method = params.status == true ? 'PUT' : 'DELETE';
// break;
// }
// default:
// return handleErrors(new Error(`Unsupported type: ${(params as any).type}`)) as Response<T['type']>;
// };
// const data = await request(url, {
// method: method,
// params: object,
// addons,
// });
// if (data.error) return handleErrors(new Error(data.error)) as Response<T['type']>;
// return data as Response<T['type']>;
});
exports.beatmaps_actions = beatmaps_actions;
;