osu-api-extended
Version:
Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools
1,456 lines (1,455 loc) • 108 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.groups = exports.rooms = exports.session = exports.chat = exports.matches = exports.me = exports.wiki = exports.spotlights = exports.ranking = exports.notifications = exports.news = exports.assets = exports.search = exports.forums = exports.scores = exports.users = exports.comments = exports.changelogs = exports.beatmaps = void 0;
const beatmaps_events_list_1 = require("../api/v2/beatmaps_events_list");
const beatmaps_lookup_1 = require("../api/v2/beatmaps_lookup");
const beatmaps_details_1 = require("../api/v2/beatmaps_details");
const beatmaps_actions_1 = require("../api/v2/beatmaps_actions");
const beatmaps_download_1 = require("../api/v2/beatmaps_download");
const beatmaps_packs_list_1 = require("../api/v2/beatmaps_packs_list");
const beatmaps_packs_details_1 = require("../api/v2/beatmaps_packs_details");
const beatmaps_discussions_list_1 = require("../api/v2/beatmaps_discussions_list");
const beatmaps_discussions_posts_1 = require("../api/v2/beatmaps_discussions_posts");
const beatmaps_discussions_votes_1 = require("../api/v2/beatmaps_discussions_votes");
/**
* ##### Description
* Object containing methods for retrieving beatmaps data.
*/
exports.beatmaps = {
/**
* ##### Description
* Covers API Endpoints regarding beatmap packs.
*
*/
packs: {
/**
* ### `GET` [/v2/beatmaps/packs](https://osu.ppy.sh/docs/index.html#get-beatmap-packs)
* `async` Retrieves a list of all available beatmap packs.
*
*
*
* ## Parameters
* - `params.type` - Type of the beatmap pack.
* - `params.cusor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.packs.list({
* type: 'loved'
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.packs.list_v3) | [Check return types](../types/v2/beatmaps_packs_list.ts)
*/
list: beatmaps_packs_list_1.beatmaps_packs_list,
/**
* ### `GET` [/v2/beatmaps/packs/{pack_tag}](https://osu.ppy.sh/docs/index.html#get-beatmap-pack)
* `async` Retrieves a beatmap pack by given ID.
*
*
*
* ### Parameters
* - `pack_tag` - ID of the beatmap pack to retrieve.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.packs.details('ST265');
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.packs.details_v3) | [Check return types](../types/v2/beatmaps_packs_details.ts)
*/
details: beatmaps_packs_details_1.beatmap_packs_details,
},
/**
* ### `GET` [/v2/beatmaps/lookup](https://osu.ppy.sh/docs/index.html#lookup-beatmap)
* ### `GET` [/v2/beatmapsets/lookup](https://osu.ppy.sh/docs/index.html#get-apiv2beatmapsetslookup)
* ### `POST` [/v2/beatmaps/{beatmap}/attributes](https://osu.ppy.sh/docs/index.html#get-beatmap-attributes)
* ### `GET` [/v2/beatmaps](https://osu.ppy.sh/docs/index.html#get-beatmaps)
* `async` Lookup for a beatmap by given parameters.
*
*
*
* ### Global Parameters
* - `params.type` - Type of lookup.
*
* &
*
* ### Parameters for `params.type:'difficulty'`
* - `params.id` - ID of the difficulty to lookup for.
* - `params.checksum` - Checksum of the difficulty to lookup.
* - `params.filename` - Filename of the difficulty to lookup.
*
*
*
* ### Parameters for `params.type:'set'`
* - `params.id` - ID of the beatmap set to lookup for.
*
*
*
* ### Parameters for `params.type:'attribute'`
* - `params.id` - ID of the beatmap to lookup for.
* - `params.mods` - Mod combination of the beatmap to lookup for.
* - `params.mode` - Mode of the beatmap to lookup for.
*
*
*
* ### Parameters for `params.type:'difficulties'`
* - `params.ids` - IDs of the difficulties to lookup for.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.lookup({
* type: 'attributes',
* id: 3798013,
* });
* // or
* const result = await v2.beatmaps.lookup({
* type: 'difficulties',
* ids: [4233769, 3798013]
* });
* // or
* const result = await v2.beatmaps.lookup({
* type: 'difficulty',
* id: 4233769,
* });
* // or
* const result = await v2.beatmaps.lookup({
* type: 'set',
* id: 2246377,
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.lookup_v3) | [Check return types](../types/v2/beatmaps_lookup.ts)
*/
lookup: beatmaps_lookup_1.beatmaps_lookup,
/**
* ### `GET` [v2/beatmaps/{beatmap}](https://osu.ppy.sh/docs/index.html#get-beatmap)
* ### `GET` [v2/beatmapsets/{beatmapset}](https://osu.ppy.sh/docs/index.html#get-apiv2beatmapsetsbeatmapset)
* `async` Retrieves a beatmap or beatmap set by given ID.
*
*
*
* ##### Parameters
* - `params.type` - 'difficulty' or 'set'.
* - `params.id` - The ID to search for.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.details({
* type: 'set',
* id: 2182218
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.details_v3) | [Check return types](../types/v2/beatmaps_details_set.ts)
*/
details: beatmaps_details_1.beatmaps_details,
/**
* ##### Description
* Covers API Endpoints regarding beatmap set events.
*/
events: {
/**
* ### `GET` [v2/beatmapsets/{beatmapset}/events](https://osu.ppy.sh/docs/index.html#get-apiv2beatmapsetsevents)
* `async` Retrieves a list of beatmap set events.
*
*
*
* ### Parameters
* - `obj.user` - Filter by author of the event.
* - `obj.types` - Filter by type of the event.
* - `obj.min_date` - Filter by minimum date of the event.
* - `obj.max_date` - Filter by maximum date of the event.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.events.list({ types: ['approve'] });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.events.list_v3) | [Check return types](../types/v2/beatmaps_events_list.ts)
*/
list: beatmaps_events_list_1.beatmaps_events_list,
},
/**
* `async` Downloads a beatmap or beatmap set by given ID. (Supports different hosts)
*
*
*
* ### Available hosts
* - For `type:'difficulty'`: osu, osu_direct_mirror, catboy
* - For `type:'set'`: osu, beatconnect, nerinyan, osu_direct_mirror, sayobot, gatari, ripple, catboy
*
*
*
* ### Global Parameters
* - `params.type` - Type of the beatmap.
* - `params.id` - ID of the beatmap or beatmap set.
* - `params.host` - Host of the download source.
* - `params.file_path` - Path to the save location.
* - `params.overwrite` - Whether to overwrite the file if it already exists.
*
*
*
* ### Parameters for `params.type:'set'`
* - `params.no_video?` - Whether to include video in the download.
* - `params.progress_log_fn?` - Callback function to send progress.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* // only for downloading sets from osu host
* await auth.login({
* type: 'lazer',
* login: login,
* password: password,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
*
* const progress_update = (...args) => {
* console.log(args);
* };
* const set_id = 320118;
*
*
* const result = await v2.beatmaps.download({
* type: 'set',
* host: 'gatari',
* id: set_id,
* file_path: `./cache/${set_id}.osz`,
* progress_log_fn: progress_update
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.download_v3)
*/
download: beatmaps_download_1.beatmaps_download,
/**
* ##### Description
* Covers API Endpoints regarding beatmap discussions.
*/
discussions: {
/**
* ### `GET` [/v2/beatmapsets/discussions](https://osu.ppy.sh/docs/index.html#get-beatmapset-discussions)
* `async` Retrieves a list of beatmap set discussions.
*
*
*
* ### Parameters
* - `params.only_unresolved?` - Filter by unresolved discussions.
* - `params.user?` - Filter by author of the discussion.
* - `params.beatmap_id?` - Filter by beatmap ID.
* - `params.beatmapset_id?` - Filter by beatmap set ID.
* - `params.beatmapset_status?` - Filter by beatmap set status.
* - `params.message_type?` - Filter by message type.
* - `params.limit?` - Maximum number of discussions to return.
* - `params.sort?` - Sort order of the discussions.
* - `params.cursor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.discussions.list({ beatmapset_id: 2084849 });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.discussions.list_v3) | [Check return types](../types/v2/beatmaps_discussions_list.ts)
*/
list: beatmaps_discussions_list_1.beatmaps_discussions_list,
/**
* ### `GET` [/v2/beatmapsets/discussions/posts](https://osu.ppy.sh/docs/index.html#beatmapset-discussions)
* `async` Retrieves the posts of a beatmap set discussion.
*
*
*
* ### Parameters
* - `params.discussion_id?` - ID of the beatmap set discussion to retrieve.
* - `params.sort?` - Sort order of the posts.
* - `params.type?` - Filter by type of the post.
* - `params.limit?` - Maximum number of posts to return.
* - `params.user?` - Filter by author of the post.
* - `params.cursor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.discussions.posts();
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.discussions.posts_v3) | [Check return types](../types/v2/beatmaps_discussions_posts.ts)
*/
posts: beatmaps_discussions_posts_1.beatmaps_discussions_posts,
/**
* ### `GET` [/v2/beatmapsets/discussions/votes](https://osu.ppy.sh/docs/index.html#get-beatmapset-discussion-votes)
* `async` Retrieves the votes given to beatmap set discussions.
*
*
*
* ### Parameters
* - `params.discussion_id?` - ID of the beatmap set discussion to retrieve.
* - `params.sort?` - Sort order of the votes.
* - `params.score?` - Filter by score of the vote.
* - `params.user?` - Filter by author of the vote.
* - `params.receiver?` - Filter by receiver of the vote.
* - `params.limit?` - Maximum number of votes to return.
* - `params.cursor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.beatmaps.discussions.votes({ discussion_id: 4533908 });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.discussions.votes_v3) | [Check return types](../types/v2/beatmaps_discussions_votes.ts)
*/
votes: beatmaps_discussions_votes_1.beatmaps_discussions_votes,
},
/**
* Currently broken.
*/
actions: beatmaps_actions_1.beatmaps_actions,
};
const changelogs_list_1 = require("../api/v2/changelogs_list");
const changelogs_details_1 = require("../api/v2/changelogs_details");
/**
* ##### Description
* Covers API Endpoints regarding changelogs.
*/
exports.changelogs = {
/**
* ### `GET` [/v2/changelogs](https://osu.ppy.sh/docs/index.html#get-changelog-listing)
* ### `GET` [/v2/changelogs/{changelog}](https://osu.ppy.sh/docs/index.html#lookup-changelog-build)
* `async` Retrieves a list of all available changelogs.
*
*
*
* ### Global Parameters
* - `params.type` - Fetch type.
* - `params.message_formats` - Return format.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Parameters for `type:'all'`
* - `params.from_build?` - Minimum build version.
* - `params.to_build?` - Maximum build version.
* - `params.stream_name?` - Stream name to return builds from.
* - `params.max_id?` - Maximum build ID.
*
*
*
* ### Parameters for `type:'lookup'`
* - `params.changelog` - Build version, update stream name, or build ID.
* - `params.key` - Unset to query by build version or stream name, or id to query by build ID.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* const result = await v2.changelogs.list({
* type: 'all',
* stream_name: 'web',
* });
* // or
* const result = await v2.changelogs.list({
* type: 'lookup',
* changelog: 'lazer'
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.changelogs.list_v3) | [Check return types](../types/v2/changelogs_list_all.ts)
*/
list: changelogs_list_1.changelogs_list,
/**
* ### `GET` [/v2/changelog/{stream}/{build}](https://osu.ppy.sh/docs/index.html#get-changelog-build)
* `async` Retrieves details of the specified build.
*
*
*
* ### Parameters
* - `params.stream_name` - Update stream name.
* - `params.build_version` - Build version.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* const result = await v2.changelogs.details({
* stream_name: 'web',
* build_version: '2024.930.0'
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.changelogs.details_v3) | [Check return types](../types/v2/changelogs_details.ts)
*/
details: changelogs_details_1.changelogs_details,
};
const comments_list_1 = require("../api/v2/comments_list");
const comments_details_1 = require("../api/v2/comments_details");
const comments_actions_1 = require("../api/v2/comments_actions");
/**
* ##### Description
* Covers API Endpoints regarding comments.
*/
exports.comments = {
/**
* ### `GET` [/v2/comments](https://osu.ppy.sh/api/v2/comments)
* `async` Retrieves a list of all comments by given parameters.
*
*
*
* ### Parameters
* - `params.type?` - Type of the resource to get comments from.
* - `params.id?` - ID of the resource to get comments from.
* - `params.parent_id?` - ID of the parent comment.
* - `params.after_id?` - ID of the comment after which the comments will be returned.
* - `params.cursor?.id`- The ID of the cursor.
* - `params.cursor?.created_at` - The timestamp of the cursor.
* - `params.sort?` - Sort order of the comments.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* const result = await v2.comments.list({
* type: 'news_post',
* id: 1430,
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.list_v3) | [Check return types](../types/v2/comments_list.ts)
*/
list: comments_list_1.comments_list,
/**
* ### `GET` [/v2/comments/{comment}](https://osu.ppy.sh/docs/index.html#get-a-comment)
* `async` Retrieves a comment by given parameters.
*
*
*
* ### Parameters
* - `params.comment_id` - ID of the comment to retrieve.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* const result = await v2.comments.details(3035523);
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.details_v3) | [Check return types](../types/v2/comments_details.ts)
*/
details: comments_details_1.comments_details,
/**
* ### `POST` [/v2/comments](https://osu.ppy.sh/docs/index.html#post-a-new-comment)
* ### `PUT` [/v2/comments/{comment}](https://osu.ppy.sh/docs/index.html#edit-comment)
* ### `PATCH` [/v2/comments/{comment}](https://osu.ppy.sh/docs/index.html#edit-comment)
* ### `DELETE` [/v2/comments/{comment}](https://osu.ppy.sh/docs/index.html#delete-comment)
* ### `POST` [/v2/comments/{comment}/vote](https://osu.ppy.sh/docs/index.html#add-comment-vote)
* ### `DELETE` [/v2/comments/{comment}/vote](https://osu.ppy.sh/docs/index.html#remove-comment-vote)
* `async` Perform comment actions via endpoint.
*
*
*
* ### Global Parameters
* - `params.id?` - ID of the comment to perform the action on.
* - `params.type` - Type of the action to perform.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Parameters for `params.type:'new'`
* - `params.message?` - The message of the comment.
* - `params.parent_id?` - The id of the comment to reply to.
* - `params.commentable_type?` - Resource type the comment thread is attached to.
*
*
*
* ### Parameters for `params.type:'edit'`
* - `params.message?` - The message of the comment.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'lazer',
* login: login,
* password: password,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.comments.actions({
* type: 'new',
*
* commentable_type: 'beatmapset',
* id: 1378401,
* message: 'hello from api'
* });
* // or
* const result = await v2.comments.actions({
* type: 'edit',
*
* id: 3058002,
* message: 'hello from api (edited)'
* });
* // or
* const result = await v2.comments.actions({
* type: 'vote',
* id: 3058002,
* });
* // or
* const result = await v2.comments.actions({
* type: 'unvote',
* id: 3058002,
* });
* // or
* const result = await v2.comments.actions({
* type: 'delete',
* id: 3058002,
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.actions_v3) | [Check return types](../types/v2/comments_actions.ts)
*/
actions: comments_actions_1.comments_actions,
};
const users_list_1 = require("../api/v2/users_list");
const users_lookup_1 = require("../api/v2/users_lookup");
const users_events_1 = require("../api/v2/users_events");
const users_details_1 = require("../api/v2/users_details");
const users_activity_1 = require("../api/v2/users_activity");
const users_beatmaps_1 = require("../api/v2/users_beatmaps");
const users_kudosu_1 = require("../api/v2/users_kudosu");
/**
* ##### Description
* Covers API Endpoints regarding users.
*/
exports.users = {
/**
* ### `GET` [/v2/users](https://osu.ppy.sh/docs/index.html#get-users)
* `async` Retrieves a list of users by given parameters.
*
*
*
* ### Parameters
* - `params.ids` - List of user ids to retrieve.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.list({
* ids: [2, 8928855, 7562902, 10083439],
* include_variants: true
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.list_v3) | [Check return types](../types/v2/users_list.ts)
*/
list: users_list_1.users_list,
/**
* ### `GET` [/v2/users/lookup](https://osu.ppy.sh/docs/index.html#get-apiv2userslookup)
* `async` Retrieves a list of users by their id or name.
*
*
*
* ### Parameters
* - `params.ids` - List of user ids or names to retrieve.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.lookup({
* ids: [2, 8928855, 7562902, 'mrekk', 'whitecat'],
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.lookup_v3) | [Check return types](../types/v2/users_list.ts)
*/
lookup: users_lookup_1.users_lookup,
/**
* ### `GET` [/v2/users/{user}/kudosu](https://osu.ppy.sh/docs/index.html#get-user-kudosu)
* `async` Retrieves the kudosu history of a given user.
*
*
*
* ### Parameters
* - `params.id` - ID of the user to retrieve.
* - `params.limit?` - Maximum number of results to return.
* - `params.offset?` - Result offset for pagination.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.kudosu({ id: 4830261 });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.kudosu_v3) | [Check return types](../types/v2/users_kudosu.ts)
*/
kudosu: users_kudosu_1.users_kudosu,
/**
* ### `GET` [/v2/events](https://osu.ppy.sh/docs/index.html#get-events)
* `async` Retrieves a list of user events by given parameters.
*
*
*
* ### Parameters
* - `params.type?` - Filter by type of event.
* - `params.sort?` - Sort order of the events by id.
* - `params.cursor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.events()
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.events_v3) | [Check return types](../types/v2/users_events.ts)
*/
events: users_events_1.users_events,
/**
* ### `GET` [/v2/users/{user}/{mode?}](https://osu.ppy.sh/docs/index.html#get-user)
* `async` Retrieves a user by given parameters.
*
*
*
* ### Parameters
* - `params.id` - ID or username of the user to retrieve.
* - `params.mode?` - Retrieve data for a specific gamemode.
* - `params.key?` - Type of the `params.id` parameter.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.details({ user: 9893708, mode: 'osu', key: 'id' });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.details_v3) | [Check return types](../types/v2/users_details.ts)
*/
details: users_details_1.users_details,
/**
* ### `GET` [/v2/users/{user}/beatmapsets/{type}](https://osu.ppy.sh/docs/index.html#get-user-beatmaps)
* `async` Retrieves a list of user's beatmaps sets by given parameters.
*
*
*
* ### Parameters
* - `params.type` - Filter by type of beatmap set.
* - `params.id` - ID of the user to retrieve.
* - `params.limit?` - Maximum number of beatmap sets to return.
* - `params.offset?` - Result offset for pagination.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.beatmaps({ type: 'ranked', id: 4378277 });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.beatmaps_v3) | [Check return types](../types/v2/users_beatmaps.ts)
*/
beatmaps: users_beatmaps_1.users_beatmaps,
/**
* ### `GET` [/v2/users/{user}/recent_activity](https://osu.ppy.sh/docs/index.html#get-user-recent-activity)
* `async` Retrieves a list of user's recent activities by given parameters.
*
*
*
* ### Parameters
* - `params.id` - ID of the user to retrieve.
* - `params.limit?` - Maximum number of activities to return.
* - `params.offset?` - Result offset for pagination.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.users.activity({ id: 11367222 });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.activity_v3) | [Check return types](../types/v2/users_activity.ts)
*/
activity: users_activity_1.users_activity,
};
const scores_list_1 = require("../api/v2/scores_list");
const scores_details_1 = require("../api/v2/scores_details");
const scores_download_1 = require("../api/v2/scores_download");
/**
* ##### Description
* Covers API Endpoints regarding scores.
*/
exports.scores = {
/**
* ### `GET` [/v2/beatmaps/{beatmap}/scores](https://osu.ppy.sh/docs/index.html#get-beatmap-scores)
* ### `GET` [/v2/beatmaps/{beatmap}/scores/users/{user}](https://osu.ppy.sh/docs/index.html#get-a-user-beatmap-score)
* ### `GET` [/v2/beatmaps/{beatmap}/scores/users/{user}/all](https://osu.ppy.sh/docs/index.html#get-a-user-beatmap-scores)
* ### `GET` [/v2/beatmaps/{beatmap}/solo-scores](https://osu.ppy.sh/docs/index.html#get-beatmap-scores-non-legacy)
* ### `GET` /v2/scores
* `async` Retrieves a list of scores by given parameters.
*
*
*
* ### Global Parameters
* - `params.mode?` - Retrieve data for a specific gamemode.
* - `params.type` - Type of scores to retrieve.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Parameters for `params.type: 'leaderboard' | 'solo_scores'`
* - `params.leaderboard_type?: Type of leaderboard to retrieve.`
* - `params.beatmap_id` - ID of the beatmap to retrieve data from.
* - `params.mods?` - Retrieve scores for specific mods.
*
*
*
* ### Parameters for `params.type: 'user_beatmap_best'`
* - `params.beatmap_id` - ID of the beatmap.
* - `params.user_id` - ID of the user.
* - `params.mods?` - Retrieve scores for specific mods.
*
*
*
* ### Parameters for `params.type: 'user_beatmap_all'`
* - `params.beatmap_id` - ID of the beatmap.
* - `params.user_id` - ID of the user.
*
*
*
* ### Parameters for `params.type:'user_best' | 'user_firsts' | 'user_recent' | 'user_pinned'`
* - `params.user_id` - ID of the user to retrieve data from.
* - `params.include_fails?` - Include failed scores.
* - `params.limit?` - Maximum number of scores to return.
* - `params.offset?` - Result offset for pagination.
*
*
*
* ### Parameters for `params.type:'latest_ranked'`
* - `params.cursor_string?` - [Cursor string for pagination.](https://osu.ppy.sh/docs/index.html#cursorstring)
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.scores.list({
* type: 'user_beatmap_all',
* // or
* type: 'user_beatmap_best',
* beatmap_id: 1141858,
* user_id: 7562902
* });
* // or
* const result = await v2.scores.list({
* type: 'leaderboard',
* beatmap_id: 1141858
* });
* // or
* const result = await v2.scores.list({
* type: 'user_best',
* // or
* type: 'user_firsts',
* // or
* type: 'user_pinned',
* // or
* type: 'user_recent',
* user_id: 7562902,
* });
* // or
* const result = await v2.scores.list({
* type: 'latest_ranked',
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.scores.list_v3) | [Check return types](../types/v2/scores_list_user_recent.ts)
*
*/
list: scores_list_1.scores_list,
/**
* ### `GET` [/v2/scores/{rulesetOrScore}/{score?}](https://osu.ppy.sh/docs/index.html#get-apiv2scoresrulesetorscorescore)
* `async` Retrieves a score by given parameters.
*
*
*
* ### Parameters
* - `params.id` - ID of the score to retrieve.
* - `params.mode?` - Gamemode of the score.
* - `addons?` - Additional parameters to include in the request.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.scores.details({
* id: 3321956713,
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.scores.details_v3) | [Check return types](../types/v2/scores_details.ts)
*
*/
details: scores_details_1.scores_details,
/**
* ### `GET` [/v2/scores/{rulesetOrScore}/{score}/download](https://osu.ppy.sh/docs/index.html#get-apiv2scoresrulesetorscorescoredownload)
* `async` Downloads a score by given parameters.
*
*
*
* ### Parameters
* - `params.id` - ID of the score to download.
* - `params.mode?` - Gamemode of the score.
* - `params.file_path?` - Where to save the file.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'lazer',
* login: login,
* password: password,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)
* });
*
* const result = await v2.scores.download({
* id: 3427873257,
* file_path: './cache/replay.osr'
* });
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*
*
*
* [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.scores.download_v3) | [Check return types](../types/v2/scores_download.ts)
*/
download: scores_download_1.scores_download,
};
const forums_topics_list_1 = require("../api/v2/forums_topics_list");
const forums_topics_details_1 = require("../api/v2/forums_topics_details");
const forums_topics_actions_1 = require("../api/v2/forums_topics_actions");
const forums_list_1 = require("../api/v2/forums_list");
const forums_details_1 = require("../api/v2/forums_details");
/**
* ##### Description
* Covers API Endpoints regarding forums.
*/
exports.forums = {
/**
* ##### Description
* Covers API Endpoints regarding forum topics.
*/
topics: {
/**
* ### `GET` [/v2//forums/topics](https://osu.ppy.sh/docs/index.html#get-topic-listing)
* `async` Retrieves a list of topics.
*
*
*
* ### Parameters
* - `params.id` - ID of the forum/subforum to retrieve.
*
*
*
* ### Usage Example
* ```js
* const { auth, v2 } = require('osu-api-extended');
*
* async function main() {
* try {
* await auth.login({
* type: 'v2',
* client_id: CLIENT_ID,
* client_secret: CLIENT_SECRET,
* cachedTokenPath: './test.json' // path to the file your auth token will be saved (to prevent osu!api spam)