pub struct Osu { /* private fields */ }
Expand description
The main osu client. Cheap to clone.
Implementations§
source§impl Osu
impl Osu
sourcepub async fn new(
client_id: u64,
client_secret: impl Into<String>
) -> OsuResult<Self>
pub async fn new( client_id: u64, client_secret: impl Into<String> ) -> OsuResult<Self>
Create a new default Osu
client.
Errors if the API did not provide a token for the given client id and client secret.
sourcepub fn builder() -> OsuBuilder
pub fn builder() -> OsuBuilder
Fine-tune building an Osu
client.
sourcepub fn beatmap(&self) -> GetBeatmap<'_> ⓘ
pub fn beatmap(&self) -> GetBeatmap<'_> ⓘ
Get a Beatmap
.
Filled options will be: deleted_at
(if deleted), fail_times
,
mapset
and max_combo
(if available for mode).
The contained Beatmapset
will
have these options filled: legacy_thread_url
, ratings
,
ranked_date
(if not unranked) and submitted_date
(if submitted).
sourcepub fn beatmaps<I>(&self, map_ids: I) -> GetBeatmaps<'_> ⓘwhere
I: IntoIterator<Item = u32>,
pub fn beatmaps<I>(&self, map_ids: I) -> GetBeatmaps<'_> ⓘwhere I: IntoIterator<Item = u32>,
Get a vec of at most 50 BeatmapCompact
s.
The contained maps will have these options filled: mapset
,
fail_times
, and max_combo
(if available for mode).
sourcepub fn beatmap_scores(&self, map_id: u32) -> GetBeatmapScores<'_> ⓘ
pub fn beatmap_scores(&self, map_id: u32) -> GetBeatmapScores<'_> ⓘ
Get a vec of Score
.
The contained scores will have the following options filled:
pp
(if ranked or approved), and user
.
The scores’ contained UserCompact
will have the country
and cover
options filled.
sourcepub fn beatmap_difficulty_attributes(
&self,
map_id: u32
) -> GetBeatmapDifficultyAttributes<'_> ⓘ
pub fn beatmap_difficulty_attributes( &self, map_id: u32 ) -> GetBeatmapDifficultyAttributes<'_> ⓘ
Get the BeatmapDifficultyAttributes
for a map.
sourcepub fn beatmap_user_score(
&self,
map_id: u32,
user_id: impl Into<UserId>
) -> GetBeatmapUserScore<'_> ⓘ
pub fn beatmap_user_score( &self, map_id: u32, user_id: impl Into<UserId> ) -> GetBeatmapUserScore<'_> ⓘ
Get a BeatmapUserScore
.
The contained Score
will have the
map
and user
options filled.
sourcepub fn beatmap_user_scores(
&self,
map_id: u32,
user_id: impl Into<UserId>
) -> GetBeatmapUserScores<'_> ⓘ
pub fn beatmap_user_scores( &self, map_id: u32, user_id: impl Into<UserId> ) -> GetBeatmapUserScores<'_> ⓘ
Get the top score for each mod combination a user has on a
map in form of a vec of Score
s.
The contained scores won’t have any Options filled except
for pp
in case of a ranked map.
sourcepub fn beatmapset(&self, mapset_id: u32) -> GetBeatmapset<'_> ⓘ
pub fn beatmapset(&self, mapset_id: u32) -> GetBeatmapset<'_> ⓘ
Get a Beatmapset
.
Filled options will be: artist_unicode
, converts
, description
,
genre
, language
, legacy_thread_url
, maps
, ratings
,
ranked_date
(if not unranked), recent_favourites
,
submitted_date
(if submitted), and title_unicode
.
The contained Beatmap
s
will contain Some
in fail_times
, max_combo
(if available for mode), and deleted_at
(if deleted).
sourcepub fn beatmapset_from_map_id(&self, map_id: u32) -> GetBeatmapsetFromMapId<'_> ⓘ
pub fn beatmapset_from_map_id(&self, map_id: u32) -> GetBeatmapsetFromMapId<'_> ⓘ
Get a Beatmapset
from a map ID.
Filled options will be: artist_unicode
, converts
, description
,
genre
, language
, legacy_thread_url
, maps
, ratings
,
ranked_date
(if not unranked), recent_favourites
,
submitted_date
(if submitted), and title_unicode
.
The contained Beatmap
s
will contain Some
in fail_times
, max_combo
(if available for mode), and deleted_at
(if deleted).
sourcepub fn beatmapset_events(&self) -> GetBeatmapsetEvents<'_> ⓘ
pub fn beatmapset_events(&self) -> GetBeatmapsetEvents<'_> ⓘ
Get a BeatmapsetEvents
struct containing the most recent mapset events.
sourcepub fn beatmapset_search(&self) -> GetBeatmapsetSearch<'_> ⓘ
pub fn beatmapset_search(&self) -> GetBeatmapsetSearch<'_> ⓘ
Get a BeatmapsetSearchResult
struct containing the first page of maps that fit the search query.
The default search parameters are:
- mode: any
- status: has leaderboard (ranked, loved, approved, and qualified)
- genre: any
- language: any
- extra: contains neither video nor storyboard
- nsfw: allowed
- sort: by relevance, descending
The contained Beatmapset
s will have the
following options filled: artist_unicode
, legacy_thread_url
, maps
,
ranked_date
and submitted_date
if available, and title_unicode
.
The search query allows the following options to be specified: ar
, artist
,
bpm
, created
, creator
, cs
, dr
(hp drain rate), keys
, length
,
ranked
, stars
, and status
.
Example
// Search for mapsets from Sotarks that have a map with no more than AR 9.
let query = "creator=sotarks ar<9";
// Loved mapsets from Camellia including at least one map above 8 stars
let query = "status=loved artist=camellia stars>8";
sourcepub fn comments(&self) -> GetComments<'_> ⓘ
pub fn comments(&self) -> GetComments<'_> ⓘ
Get a list of comments and their replies up to two levels deep
in form of a CommentBundle
.
sourcepub fn chart_rankings(&self, mode: GameMode) -> GetChartRankings<'_> ⓘ
pub fn chart_rankings(&self, mode: GameMode) -> GetChartRankings<'_> ⓘ
Get a ChartRankings
struct
containing a Spotlight
, its
Beatmapset
s, and participating
UserCompact
.
The mapset will have their maps
option filled.
The user statistics contain specific, spotlight related data.
All fields depends only on scores on maps of the spotlight.
The statistics vector is ordered by ranked_score
.
The user
option is filled.
sourcepub fn country_rankings(&self, mode: GameMode) -> GetCountryRankings<'_> ⓘ
pub fn country_rankings(&self, mode: GameMode) -> GetCountryRankings<'_> ⓘ
Get a CountryRankings
struct
containing a vec of CountryRanking
s
which will be sorted by the country’s total pp.
sourcepub fn forum_posts(&self, topic_id: u64) -> GetForumPosts<'_> ⓘ
pub fn forum_posts(&self, topic_id: u64) -> GetForumPosts<'_> ⓘ
Get a ForumPosts
struct for a forum topic
sourcepub fn kudosu(&self, user_id: impl Into<UserId>) -> GetUserKudosu<'_> ⓘ
pub fn kudosu(&self, user_id: impl Into<UserId>) -> GetUserKudosu<'_> ⓘ
Get the kudosu history of a user in form of a vec of
KudosuHistory
.
sourcepub fn osu_matches(&self) -> GetMatches<'_> ⓘ
pub fn osu_matches(&self) -> GetMatches<'_> ⓘ
Get a MatchList
containing all
currently open multiplayer lobbies.
sourcepub fn own_data(&self) -> GetOwnData<'_> ⓘ
pub fn own_data(&self) -> GetOwnData<'_> ⓘ
Get the User
of the authenticated user.
Note that the client has to be initialized with the identify
scope
through the OAuth process in order for this endpoint to not return an error.
sourcepub fn performance_rankings(&self, mode: GameMode) -> GetPerformanceRankings<'_> ⓘ
pub fn performance_rankings(&self, mode: GameMode) -> GetPerformanceRankings<'_> ⓘ
Get a Rankings
struct whose
UserCompact
s are sorted
by their pp, i.e. the current pp leaderboard.
sourcepub fn recent_events(&self, user_id: impl Into<UserId>) -> GetRecentEvents<'_> ⓘ
pub fn recent_events(&self, user_id: impl Into<UserId>) -> GetRecentEvents<'_> ⓘ
Get the recent activity of a user in form of a vec of
RecentEvent
s.
sourcepub fn replay_raw(&self, mode: GameMode, score_id: u64) -> GetReplayRaw<'_> ⓘ
pub fn replay_raw(&self, mode: GameMode, score_id: u64) -> GetReplayRaw<'_> ⓘ
Get the bytes of a replay of a score in form of a Vec<u8>
.
Note that the client has to be initialized through the OAuth process in order for this endpoint to not return an error.
sourcepub fn score(&self, score_id: u64, mode: GameMode) -> GetScore<'_> ⓘ
pub fn score(&self, score_id: u64, mode: GameMode) -> GetScore<'_> ⓘ
Get a Score
struct.
The contained score will have the following options filled:
map
(will contain checksum
and max_combo
), mapset
(will contain artist_unicode
and title_unicode
), pp
(if ranked), rank_global
(if on leaderboard map) and user
(will contain last_visited
, country
, cover
and groups
)
sourcepub fn score_rankings(&self, mode: GameMode) -> GetScoreRankings<'_> ⓘ
pub fn score_rankings(&self, mode: GameMode) -> GetScoreRankings<'_> ⓘ
Get a Rankings
struct whose
UserCompact
s are sorted
by their ranked score, i.e. the current ranked score leaderboard.
sourcepub fn seasonal_backgrounds(&self) -> GetSeasonalBackgrounds<'_> ⓘ
pub fn seasonal_backgrounds(&self) -> GetSeasonalBackgrounds<'_> ⓘ
Get SeasonalBackgrounds
.
sourcepub fn spotlights(&self) -> GetSpotlights<'_> ⓘ
pub fn spotlights(&self) -> GetSpotlights<'_> ⓘ
Get the vec of Spotlight
.
sourcepub fn user(&self, user_id: impl Into<UserId>) -> GetUser<'_> ⓘ
pub fn user(&self, user_id: impl Into<UserId>) -> GetUser<'_> ⓘ
Get a User
.
The following options will be filled if the user specified them:
discord
, interests
, location
, occupation
, playstyle
,
profile_color
, skype
, title
, title_url
, website
The only is_*
options that will be filled are is_active
, is_bot
,
is_deleted
, is_online
, and is_supporter
, the others won’t be.
All other options will be filled.
sourcepub fn user_beatmapsets(
&self,
user_id: impl Into<UserId>
) -> GetUserBeatmapsets<'_> ⓘ
pub fn user_beatmapsets( &self, user_id: impl Into<UserId> ) -> GetUserBeatmapsets<'_> ⓘ
Get a vec of Beatmapset
s a user made.
Filled options will be: artist_unicode
, legacy_thread_url
, maps
, title_unicode
.
All options of the contained Beatmap
s will be None
.
sourcepub fn user_most_played(
&self,
user_id: impl Into<UserId>
) -> GetUserMostPlayed<'_> ⓘ
pub fn user_most_played( &self, user_id: impl Into<UserId> ) -> GetUserMostPlayed<'_> ⓘ
Get a vec of a user’s MostPlayedMap
s.
All options of the contained BeatmapCompact
and
BeatmapsetCompact
will be None
.
Limit
The API provides at most 100 results, defaults to 5.
sourcepub fn user_scores(&self, user_id: impl Into<UserId>) -> GetUserScores<'_> ⓘ
pub fn user_scores(&self, user_id: impl Into<UserId>) -> GetUserScores<'_> ⓘ
Get either top, global firsts, pinned, or recent scores of a user,
i.e. a vec of Score
.
If no score type is specified by either
best
,
firsts
,
pinned
,
or recent
, it defaults to best
.
The resulting scores will have these options filled: map
, mapset
, pp
, user
Additionally, the best
score type will provide the weight
option.
All options of the contained Beatmap
,
BeatmapsetCompact
, and
UserCompact
will be None
.
Note
- The API provides at most 100 results per requests and defaults to 5.
- For the
recent
score type, failed score are excluded by default. Useinclude_fails
to include them. - For the
firsts
score type,pp
will only beSome
if the map is not loved.