UNPKG

osu-api-extended

Version:

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

1,364 lines 130 kB
/** * ##### Description * Object containing methods for retrieving beatmaps data. */ export declare const 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. * * &nbsp; * * ## 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [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: (params: { type: import("..").IBeatmapPackType; cursor_string?: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_packs_list").BeatmapsPacksListResponse & import("..").IError>; /** * ### `GET` [/v2/beatmaps/packs/{pack_tag}](https://osu.ppy.sh/docs/index.html#get-beatmap-pack) * `async` Retrieves a beatmap pack by given ID. * * &nbsp; * * ### Parameters * - `pack_tag` - ID of the beatmap pack to retrieve. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [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: (pack_tag: string, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_packs_details").beatmaps_packs_details_response & import("..").IError>; }; /** * ### `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. * * &nbsp; * * ### Global Parameters * - `params.type` - Type of lookup. * * & &nbsp; * * ### 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. * * &nbsp; * * ### Parameters for `params.type:'set'` * - `params.id` - ID of the beatmap set to lookup for. * * &nbsp; * * ### 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. * * &nbsp; * * ### Parameters for `params.type:'difficulties'` * - `params.ids` - IDs of the difficulties to lookup for. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.lookup_v3) | [Check return types](../types/v2/beatmaps_lookup.ts) */ lookup: <T extends { type: "difficulty"; id?: number; checksum?: string; filename?: string; } | { type: "set"; /** * ##### Description * Object containing methods for retrieving beatmaps data. */ id: number; } | { type: "attributes"; id: number; mods?: number; mode?: import("..").Modes_names; } | { type: "difficulties"; ids: number[]; }>(params: T, addons?: import("..").IDefaultParams) => Promise<T["type"] extends infer T_1 ? T_1 extends T["type"] ? T_1 extends "difficulty" ? import("../types/v2/beatmaps_lookup_difficulty").beatmaps_lookup_difficulty_response & import("..").IError : T_1 extends "set" ? import("../types/v2/beatmaps_lookup_set").beatmaps_lookup_set_response & import("..").IError : T_1 extends "attributes" ? import("../types/v2/beatmaps_lookup_attributes").BeatmapsLookupAttributes & import("..").IError : T_1 extends "difficulties" ? import("../types/v2/beatmaps_lookup_difficulties").beatmaps_lookup_difficulties_response[] & import("..").IError : import("..").IError : never : never>; /** * ### `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. * * &nbsp; * * ##### Parameters * - `params.type` - 'difficulty' or 'set'. * - `params.id` - The ID to search for. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.details_v3) | [Check return types](../types/v2/beatmaps_details_set.ts) */ details: <T_2 extends { type: "difficulty"; id: number; } | { type: "set"; id: number; }>(params: T_2, addons?: import("..").IDefaultParams) => Promise<T_2["type"] extends infer T_3 ? T_3 extends T_2["type"] ? T_3 extends "difficulty" ? import("../types/v2/beatmaps_details_difficulty").beatmaps_details_difficulty_response & import("..").IError : T_3 extends "set" ? import("../types/v2/beatmaps_details_set").beatmaps_details_set_response & import("..").IError : import("..").IError : never : never>; /** * ##### 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [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: (obj: { user: string | number; types: import("..").beatmap_events_types[]; min_date: string; max_date: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_events_list").BeatmapsEvents & import("..").IError>; }; /** * `async` Downloads a beatmap or beatmap set by given ID. (Supports different hosts) * * &nbsp; * * ### Available hosts * - For `type:'difficulty'`: osu, osu_direct_mirror, catboy * - For `type:'set'`: osu, beatconnect, nerinyan, osu_direct_mirror, sayobot, gatari, ripple, catboy * * &nbsp; * * ### 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. * * &nbsp; * * ### Parameters for `params.type:'set'` * - `params.no_video?` - Whether to include video in the download. * - `params.progress_log_fn?` - Callback function to send progress. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.beatmaps.download_v3) */ download: <T_4 extends { type: "difficulty"; id: number; host: "osu" | "osu_direct_mirror" | "catboy"; file_path: string; overwrite?: boolean; progress_log_fn?: (host: string, progress: number) => void; } | { type: "set"; id: number; host: "osu" | "osu_direct_mirror" | "catboy" | "beatconnect" | "nerinyan" | "sayobot" | "gatari" | "ripple" | "mino" | "akatsuki"; file_path: string; no_video?: boolean; overwrite?: boolean; progress_log_fn?: (host: string, progress: number) => void; }>(params: T_4, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_download").BeatmapsDownloadResponse>; /** * ##### 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [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: (params: { only_unresolved?: boolean; user?: number; beatmap_id?: number; beatmapset_id?: number; beatmapset_status?: "ranked" | "qualified" | "loved" | "all" | "disqualified" | "never_qualified"; message_types?: ("all" | "suggestion" | "problem" | "mapper_note" | "praise" | "hype" | "review")[]; limit?: number; sort?: "id_desc" | "id_asc"; cursor_string?: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_discussions_list").BeatmapsDiscussionsListResponse & import("..").IError>; /** * ### `GET` [/v2/beatmapsets/discussions/posts](https://osu.ppy.sh/docs/index.html#beatmapset-discussions) * `async` Retrieves the posts of a beatmap set discussion. * * &nbsp; * * ### 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. * * &nbsp; * * ```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(); * ``` * * &nbsp; * * [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: (params: { discussion_id?: number; sort?: "id_desc" | "id_asc"; types?: ("first" | "reply" | "system")[]; user?: number; limit?: number; cursor_string?: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_discussions_posts").BeatmapsDiscussionsPostsResponse & import("..").IError>; /** * ### `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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [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: (params: { discussion_id?: number; sort?: "id_desc" | "id_asc"; score?: "1" | "-1"; user?: number; receiver?: number; limit?: number; cursor_string?: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/beatmaps_discussions_votes").BeatmapsDiscussionsVotesResponse & import("..").IError>; }; /** * Currently broken. */ actions: <T_5 extends { type: "favourite"; id: number; status: boolean; } | { type: "tag"; id: number; name: string; status: boolean; }>(params: T_5, addons?: import("..").IDefaultParams) => Promise<T_5["type"] extends infer T_6 ? T_6 extends T_5["type"] ? T_6 extends "favourite" ? string & import("..").IError : T_6 extends "tag" ? string & import("..").IError : import("..").IError : never : never>; }; /** * ##### Description * Covers API Endpoints regarding changelogs. */ export declare const 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. * * &nbsp; * * ### Global Parameters * - `params.type` - Fetch type. * - `params.message_formats` - Return format. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.changelogs.list_v3) | [Check return types](../types/v2/changelogs_list_all.ts) */ list: <T extends { type: "all"; from_build?: string; to_build?: string; stream_name?: "lazer" | "stable40" | "beta40" | "cuttingedge" | "web"; max_id?: string; message_formats?: ("html" | "markdown")[]; } | { type: "lookup"; message_formats: ("html" | "markdown")[]; changelog: "lazer" | "stable40" | "beta40" | "cuttingedge" | "web"; key: string; }>(params: T, addons?: import("..").IDefaultParams) => Promise<T["type"] extends infer T_1 ? T_1 extends T["type"] ? T_1 extends "all" ? import("../types/v2/changelogs_list_all").ChangelogsListAllResponse & import("..").IError : T_1 extends "lookup" ? import("../types/v2/changelogs_list_lookup").ChangelogsListLookupResponse & import("..").IError : import("..").IError : never : never>; /** * ### `GET` [/v2/changelog/{stream}/{build}](https://osu.ppy.sh/docs/index.html#get-changelog-build) * `async` Retrieves details of the specified build. * * &nbsp; * * ### Parameters * - `params.stream_name` - Update stream name. * - `params.build_version` - Build version. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.changelogs.details_v3) | [Check return types](../types/v2/changelogs_details.ts) */ details: (params: { stream_name: "lazer" | "stable40" | "beta40" | "cuttingedge" | "web"; build_version: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/changelogs_details").changelogsDetailsResponse[] & import("..").IError>; }; /** * ##### Description * Covers API Endpoints regarding comments. */ export declare const comments: { /** * ### `GET` [/v2/comments](https://osu.ppy.sh/api/v2/comments) * `async` Retrieves a list of all comments by given parameters. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.list_v3) | [Check return types](../types/v2/comments_list.ts) */ list: (params: { type?: "news_post" | "beatmapset" | "Build"; id?: string; parent_id?: string; after_id?: string; cursor?: { id: number; created_at: string; }; sort?: "new" | "old" | "top"; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/comments_list").CommentsListResponse & import("..").IError>; /** * ### `GET` [/v2/comments/{comment}](https://osu.ppy.sh/docs/index.html#get-a-comment) * `async` Retrieves a comment by given parameters. * * &nbsp; * * ### Parameters * - `params.comment_id` - ID of the comment to retrieve. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.details_v3) | [Check return types](../types/v2/comments_details.ts) */ details: (comment_id: string, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/comments_details").CommentsDetailsResponse & import("..").IError>; /** * ### `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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### Parameters for `params.type:'edit'` * - `params.message?` - The message of the comment. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.comments.actions_v3) | [Check return types](../types/v2/comments_actions.ts) */ actions: <T extends { type: "new"; commentable_type: "news_post" | "beatmapset"; id: number; parent_id?: string; message: string; } | { type: "edit"; id: number; message: string; } | { type: "delete"; id: number; } | { type: "vote"; id: number; } | { type: "unvote"; id: number; }>(params: T, addons?: import("..").IDefaultParams) => Promise<(T["type"] extends infer T_1 ? T_1 extends T["type"] ? T_1 extends "new" ? import("../types/v2/comments_actions_new").CommentsActionsNewResponse & import("..").IError : T_1 extends "edit" ? import("../types/v2/comments_actions_edit").CommentsActionsEditResponse & import("..").IError : T_1 extends "delete" ? import("../types/v2/comments_actions_delete").CommentsActionsDeleteResponse & import("..").IError : T_1 extends "vote" ? import("../types/v2/comments_actions_vote").CommentsActionsVoteResponse & import("..").IError : T_1 extends "unvote" ? import("../types/v2/comments_actions_unvote").CommentsActionsUnvoteResponse & import("..").IError : import("..").IError : never : never) | { error: string; }>; }; /** * ##### Description * Covers API Endpoints regarding users. */ export declare const users: { /** * ### `GET` [/v2/users](https://osu.ppy.sh/docs/index.html#get-users) * `async` Retrieves a list of users by given parameters. * * &nbsp; * * ### Parameters * - `params.ids` - List of user ids to retrieve. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.list_v3) | [Check return types](../types/v2/users_list.ts) */ list: (params: { ids: number[]; include_variants?: boolean; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_list").UsersLisResponse[] & import("..").IError>; /** * ### `GET` [/v2/users/lookup](https://osu.ppy.sh/docs/index.html#get-apiv2userslookup) * `async` Retrieves a list of users by their id or name. * * &nbsp; * * ### Parameters * - `params.ids` - List of user ids or names to retrieve. * - `addons?` - Additional parameters to include in the request. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.lookup_v3) | [Check return types](../types/v2/users_list.ts) */ lookup: (params: { ids: (string | number)[]; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_lookup").UsersLookupResponse[] & import("..").IError>; /** * ### `GET` [/v2/users/{user}/kudosu](https://osu.ppy.sh/docs/index.html#get-user-kudosu) * `async` Retrieves the kudosu history of a given user. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.kudosu_v3) | [Check return types](../types/v2/users_kudosu.ts) */ kudosu: (params: { id: number; limit?: number; offset?: number; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_kudosu").UsersKudosuResponse[] & import("..").IError>; /** * ### `GET` [/v2/events](https://osu.ppy.sh/docs/index.html#get-events) * `async` Retrieves a list of user events by given parameters. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.events_v3) | [Check return types](../types/v2/users_events.ts) */ events: ({ sort, cursor_string, type }?: { type?: ("rank" | "achievement" | "beatmapsetApprove" | "beatmapsetDelete" | "beatmapsetRevive" | "beatmapsetUpdate" | "beatmapsetUpload" | "rankLost" | "userSupportAgain" | "userSupportFirst" | "userSupportGift" | "usernameChange")[]; sort?: "id_desc" | "id_asc"; cursor_string?: string; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_events").UsersEventsResponse & import("..").IError>; /** * ### `GET` [/v2/users/{user}/{mode?}](https://osu.ppy.sh/docs/index.html#get-user) * `async` Retrieves a user by given parameters. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.details_v3) | [Check return types](../types/v2/users_details.ts) */ details: (params: { user?: string | number; mode?: import("..").Modes_names; key?: "id" | "username" | "@"; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_details").UsersDetailsResponse & import("..").IError>; /** * ### `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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.beatmaps_v3) | [Check return types](../types/v2/users_beatmaps.ts) */ beatmaps: (params: { type: "ranked" | "loved" | "pending" | "graveyard" | "favourite" | "guest" | "most_played" | "nominated"; id: number; limit?: number; offset?: number; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_beatmaps").UsersBeatmapsResponse[] & import("..").IError>; /** * ### `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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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(); * ``` * * &nbsp; * * [See documentation](https://github.com/cyperdark/osu-api-extended/wiki/v2.users.activity_v3) | [Check return types](../types/v2/users_activity.ts) */ activity: (params: { id: number; limit?: number; offset?: number; }, addons?: import("..").IDefaultParams) => Promise<import("../types/v2/users_activity").UsersActivityResponse[] & import("..").IError>; }; /** * ##### Description * Covers API Endpoints regarding scores. */ export declare const 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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. * * &nbsp; * * ### 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 f