Skip to content

Commit

Permalink
Document getBeatmapTopNonLegacyScores
Browse files Browse the repository at this point in the history
  • Loading branch information
L-Mario564 committed Apr 2, 2024
1 parent 76638c8 commit acac09e
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/content/changelog.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## Unreleased
## 2.4.0

- Add support for the `/beatmaps/{beatmap}/solo-scores` endpoint via `Client.beatmaps.getBeatmapTopNonLegacyScores`.
- Add `GetBeatmapTopNonLegacyScoresOptions` interface.
- Add `image@2x` property to `UserActiveTournamentBanner` interface.
- Add `image@2x_url` property to `UserBadge` interface.
- Add `count_100`, `count_300`, `count_50`, `count_miss`, `pp_exp` and `global_rank_exp` properties to `UserStatistics` interface.
Expand Down
60 changes: 60 additions & 0 deletions docs/content/current/get-beatmap-top-non-legacy-scores.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Get beatmap top scores (non-legacy)
ref: beatmaps
---

# Get beatmap top scores (non-legacy)

The `beatmaps.getBeatmapTopNonLegacyScores` method on a `Client` instance makes a `GET` request to the `beatmaps/{beatmap}/solo-scores` endpoint and returns an array of user scores on a beatmap.

### Example

```ts
const scores = await api.beatmaps.getBeatmapTopNonLegacyScores(1816113, {
query: {
mode: 'osu'
}
});
```

### Parameters

| Parameter | Type | Optional | Description |
| --------- | -------------------------------------------------------------------------------------------- | -------- | ---------------------------------------- |
| beatmap | number | | ID of the beatmap to get top scores from |
| options | [GetBeatmapTopNonLegacyScoresOptions](/references/get-beatmap-top-non-legacy-scores-options) || |

#### options.query

| Parameter | Type | Optional | Description |
| ----------- | --------------------------------- | -------- | ---------------------------------------- |
| legacy_only | boolean || Set to true to only return legacy scores |
| mode | [GameMode](/references/game-mode) || Gamemode of the scores to return |

### Returns

```ts
Promise<
(Score & {
user: UserCompact & {
country: Country;
cover: Cover;
};
})[]
>;
```

#### Types

- [Score](/references/score)
- [UserCompact](/references/user-compact)
- [Country](/references/country)
- [Cover](/references/cover)

### Possible Exceptions

See the [error handling documentation](/extras/error-handling) for more information.

- `invalid_json_syntax`
- `network_error`
- `unexpected_response`
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: GetBeatmapTopNonLegacyScoresOptions
ref: interface
---

# GetBeatmapTopNonLegacyScoresOptions

```ts
interface GetBeatmapTopNonLegacyScoresOptions {
query?: {
legacy_only?: boolean;
mode?: GameMode;
};
}
```

## Types

- [GameMode](/references/game-mode)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osu-web.js",
"version": "2.3.1",
"version": "2.4.0",
"description": "osu.js is an unofficial Javascript and Typescript SDK for the browser-facing portion of osu! with type safety in mind",
"main": "lib/index.cjs",
"module": "lib/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/classes/Beatmaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
} from '../types';
import type {
GetBeatmapAttributesOptions,
GetBeatmapNonLegacyScoresOptions,
GetBeatmapTopNonLegacyScoresOptions,
GetBeatmapScoresOptions,
GetBeatmapsOptions,
LookupBeatmapOptions
Expand Down Expand Up @@ -133,9 +133,9 @@ export default class Beatmaps<
* @param beatmap ID of the beatmap to get top scores from
* @returns An array of user scores on a beatmap
*/
private async getBeatmapTopNonLegacyScores(
public async getBeatmapTopNonLegacyScores(
beatmap: number,
options?: GetBeatmapNonLegacyScoresOptions
options?: GetBeatmapTopNonLegacyScoresOptions
): Promise<
(Score & {
user: UserCompact & {
Expand Down
2 changes: 1 addition & 1 deletion src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface GetBeatmapScoresOptions {
};
}

export interface GetBeatmapNonLegacyScoresOptions {
export interface GetBeatmapTopNonLegacyScoresOptions {
query?: {
/** Set to true to only return legacy scores */
legacy_only?: boolean;
Expand Down

0 comments on commit acac09e

Please sign in to comment.