pub struct Osu { /* private fields */ }
Expand description
The main osu client. Cheap to clone.
Implementations
sourceimpl 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<'_>ⓘNotable traits for GetBeatmap<'_>impl Future for GetBeatmap<'_> type Output = OsuResult<Beatmap>;
pub fn beatmap(&self) -> GetBeatmap<'_>ⓘNotable traits for GetBeatmap<'_>impl Future for GetBeatmap<'_> type Output = OsuResult<Beatmap>;
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<'_>ⓘNotable traits for GetBeatmaps<'_>impl Future for GetBeatmaps<'_> type Output = OsuResult<Vec<BeatmapCompact>>;
where
I: IntoIterator<Item = u32>,
pub fn beatmaps<I>(&self, map_ids: I) -> GetBeatmaps<'_>ⓘNotable traits for GetBeatmaps<'_>impl Future for GetBeatmaps<'_> type Output = OsuResult<Vec<BeatmapCompact>>;
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<'_>ⓘNotable traits for GetBeatmapScores<'_>impl Future for GetBeatmapScores<'_> type Output = OsuResult<Vec<Score>>;
pub fn beatmap_scores(&self, map_id: u32) -> GetBeatmapScores<'_>ⓘNotable traits for GetBeatmapScores<'_>impl Future for GetBeatmapScores<'_> type Output = OsuResult<Vec<Score>>;
Get a vec of Score
.
The contained scores will have the following options filled:
map
, pp
(if ranked or approved), and user
.
The scores’ contained UserCompact
will have the country
and cover
options filled.
sourcepub fn beatmap_user_score(
&self,
map_id: u32,
user_id: impl Into<UserId>
) -> GetBeatmapUserScore<'_>ⓘNotable traits for GetBeatmapUserScore<'_>impl Future for GetBeatmapUserScore<'_> type Output = OsuResult<BeatmapUserScore>;
pub fn beatmap_user_score(
&self,
map_id: u32,
user_id: impl Into<UserId>
) -> GetBeatmapUserScore<'_>ⓘNotable traits for GetBeatmapUserScore<'_>impl Future for GetBeatmapUserScore<'_> type Output = OsuResult<BeatmapUserScore>;
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<'_>ⓘNotable traits for GetBeatmapUserScores<'_>impl Future for GetBeatmapUserScores<'_> type Output = OsuResult<Vec<Score>>;
pub fn beatmap_user_scores(
&self,
map_id: u32,
user_id: impl Into<UserId>
) -> GetBeatmapUserScores<'_>ⓘNotable traits for GetBeatmapUserScores<'_>impl Future for GetBeatmapUserScores<'_> type Output = OsuResult<Vec<Score>>;
Get a vec of Score
.
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<'_>ⓘNotable traits for GetBeatmapset<'_>impl Future for GetBeatmapset<'_> type Output = OsuResult<Beatmapset>;
pub fn beatmapset(&self, mapset_id: u32) -> GetBeatmapset<'_>ⓘNotable traits for GetBeatmapset<'_>impl Future for GetBeatmapset<'_> type Output = OsuResult<Beatmapset>;
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_events(&self) -> GetBeatmapsetEvents<'_>ⓘNotable traits for GetBeatmapsetEvents<'_>impl Future for GetBeatmapsetEvents<'_> type Output = OsuResult<BeatmapsetEvents>;
pub fn beatmapset_events(&self) -> GetBeatmapsetEvents<'_>ⓘNotable traits for GetBeatmapsetEvents<'_>impl Future for GetBeatmapsetEvents<'_> type Output = OsuResult<BeatmapsetEvents>;
Get a BeatmapsetEvents
struct containing the most recent mapset events.
sourcepub fn beatmapset_search(&self) -> GetBeatmapsetSearch<'_>ⓘNotable traits for GetBeatmapsetSearch<'_>impl Future for GetBeatmapsetSearch<'_> type Output = OsuResult<BeatmapsetSearchResult>;
pub fn beatmapset_search(&self) -> GetBeatmapsetSearch<'_>ⓘNotable traits for GetBeatmapsetSearch<'_>impl Future for GetBeatmapsetSearch<'_> type Output = OsuResult<BeatmapsetSearchResult>;
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<'_>ⓘNotable traits for GetComments<'_>impl Future for GetComments<'_> type Output = OsuResult<CommentBundle>;
pub fn comments(&self) -> GetComments<'_>ⓘNotable traits for GetComments<'_>impl Future for GetComments<'_> type Output = OsuResult<CommentBundle>;
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<'_>ⓘNotable traits for GetChartRankings<'_>impl Future for GetChartRankings<'_> type Output = OsuResult<ChartRankings>;
pub fn chart_rankings(&self, mode: GameMode) -> GetChartRankings<'_>ⓘNotable traits for GetChartRankings<'_>impl Future for GetChartRankings<'_> type Output = OsuResult<ChartRankings>;
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<'_>ⓘNotable traits for GetCountryRankings<'_>impl Future for GetCountryRankings<'_> type Output = OsuResult<CountryRankings>;
pub fn country_rankings(&self, mode: GameMode) -> GetCountryRankings<'_>ⓘNotable traits for GetCountryRankings<'_>impl Future for GetCountryRankings<'_> type Output = OsuResult<CountryRankings>;
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<'_>ⓘNotable traits for GetForumPosts<'_>impl Future for GetForumPosts<'_> type Output = OsuResult<ForumPosts>;
pub fn forum_posts(&self, topic_id: u64) -> GetForumPosts<'_>ⓘNotable traits for GetForumPosts<'_>impl Future for GetForumPosts<'_> type Output = OsuResult<ForumPosts>;
Get a ForumPosts
struct for a forum topic
sourcepub fn kudosu(&self, user_id: impl Into<UserId>) -> GetUserKudosu<'_>ⓘNotable traits for GetUserKudosu<'_>impl Future for GetUserKudosu<'_> type Output = OsuResult<Vec<KudosuHistory>>;
pub fn kudosu(&self, user_id: impl Into<UserId>) -> GetUserKudosu<'_>ⓘNotable traits for GetUserKudosu<'_>impl Future for GetUserKudosu<'_> type Output = OsuResult<Vec<KudosuHistory>>;
Get the kudosu history of a user in form of a vec of
KudosuHistory
.
sourcepub fn news(&self) -> GetNews<'_>ⓘNotable traits for GetNews<'_>impl Future for GetNews<'_> type Output = OsuResult<News>;
pub fn news(&self) -> GetNews<'_>ⓘNotable traits for GetNews<'_>impl Future for GetNews<'_> type Output = OsuResult<News>;
Get News
.
sourcepub fn osu_match(&self, match_id: u32) -> GetMatch<'_>ⓘNotable traits for GetMatch<'_>impl Future for GetMatch<'_> type Output = OsuResult<OsuMatch>;
pub fn osu_match(&self, match_id: u32) -> GetMatch<'_>ⓘNotable traits for GetMatch<'_>impl Future for GetMatch<'_> type Output = OsuResult<OsuMatch>;
Get an OsuMatch
.
sourcepub fn osu_matches(&self) -> GetMatches<'_>ⓘNotable traits for GetMatches<'_>impl Future for GetMatches<'_> type Output = OsuResult<MatchList>;
pub fn osu_matches(&self) -> GetMatches<'_>ⓘNotable traits for GetMatches<'_>impl Future for GetMatches<'_> type Output = OsuResult<MatchList>;
Get a MatchList
containing all
currently open multiplayer lobbies.
sourcepub fn own_data(&self) -> GetOwnData<'_>ⓘNotable traits for GetOwnData<'_>impl Future for GetOwnData<'_> type Output = OsuResult<User>;
pub fn own_data(&self) -> GetOwnData<'_>ⓘNotable traits for GetOwnData<'_>impl Future for GetOwnData<'_> type Output = OsuResult<User>;
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<'_>ⓘNotable traits for GetPerformanceRankings<'_>impl Future for GetPerformanceRankings<'_> type Output = OsuResult<Rankings>;
pub fn performance_rankings(&self, mode: GameMode) -> GetPerformanceRankings<'_>ⓘNotable traits for GetPerformanceRankings<'_>impl Future for GetPerformanceRankings<'_> type Output = OsuResult<Rankings>;
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<'_>ⓘNotable traits for GetRecentEvents<'_>impl Future for GetRecentEvents<'_> type Output = OsuResult<Vec<RecentEvent>>;
pub fn recent_events(&self, user_id: impl Into<UserId>) -> GetRecentEvents<'_>ⓘNotable traits for GetRecentEvents<'_>impl Future for GetRecentEvents<'_> type Output = OsuResult<Vec<RecentEvent>>;
Get the recent activity of a user in form of a vec of
RecentEvent
s.
sourcepub fn score(&self, score_id: u64, mode: GameMode) -> GetScore<'_>ⓘNotable traits for GetScore<'_>impl Future for GetScore<'_> type Output = OsuResult<Score>;
pub fn score(&self, score_id: u64, mode: GameMode) -> GetScore<'_>ⓘNotable traits for GetScore<'_>impl Future for GetScore<'_> type Output = OsuResult<Score>;
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<'_>ⓘNotable traits for GetScoreRankings<'_>impl Future for GetScoreRankings<'_> type Output = OsuResult<Rankings>;
pub fn score_rankings(&self, mode: GameMode) -> GetScoreRankings<'_>ⓘNotable traits for GetScoreRankings<'_>impl Future for GetScoreRankings<'_> type Output = OsuResult<Rankings>;
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<'_>ⓘNotable traits for GetSeasonalBackgrounds<'_>impl Future for GetSeasonalBackgrounds<'_> type Output = OsuResult<SeasonalBackgrounds>;
pub fn seasonal_backgrounds(&self) -> GetSeasonalBackgrounds<'_>ⓘNotable traits for GetSeasonalBackgrounds<'_>impl Future for GetSeasonalBackgrounds<'_> type Output = OsuResult<SeasonalBackgrounds>;
Get SeasonalBackgrounds
.
sourcepub fn spotlights(&self) -> GetSpotlights<'_>ⓘNotable traits for GetSpotlights<'_>impl Future for GetSpotlights<'_> type Output = OsuResult<Vec<Spotlight>>;
pub fn spotlights(&self) -> GetSpotlights<'_>ⓘNotable traits for GetSpotlights<'_>impl Future for GetSpotlights<'_> type Output = OsuResult<Vec<Spotlight>>;
Get the vec of Spotlight
.
sourcepub fn user(&self, user_id: impl Into<UserId>) -> GetUser<'_>ⓘNotable traits for GetUser<'_>impl Future for GetUser<'_> type Output = OsuResult<User>;
pub fn user(&self, user_id: impl Into<UserId>) -> GetUser<'_>ⓘNotable traits for GetUser<'_>impl Future for GetUser<'_> type Output = OsuResult<User>;
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<'_>ⓘNotable traits for GetUserBeatmapsets<'_>impl Future for GetUserBeatmapsets<'_> type Output = OsuResult<Vec<Beatmapset>>;
pub fn user_beatmapsets(
&self,
user_id: impl Into<UserId>
) -> GetUserBeatmapsets<'_>ⓘNotable traits for GetUserBeatmapsets<'_>impl Future for GetUserBeatmapsets<'_> type Output = OsuResult<Vec<Beatmapset>>;
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<'_>ⓘNotable traits for GetUserMostPlayed<'_>impl Future for GetUserMostPlayed<'_> type Output = OsuResult<Vec<MostPlayedMap>>;
pub fn user_most_played(
&self,
user_id: impl Into<UserId>
) -> GetUserMostPlayed<'_>ⓘNotable traits for GetUserMostPlayed<'_>impl Future for GetUserMostPlayed<'_> type Output = OsuResult<Vec<MostPlayedMap>>;
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<'_>ⓘNotable traits for GetUserScores<'_>impl Future for GetUserScores<'_> type Output = OsuResult<Vec<Score>>;
pub fn user_scores(&self, user_id: impl Into<UserId>) -> GetUserScores<'_>ⓘNotable traits for GetUserScores<'_>impl Future for GetUserScores<'_> type Output = OsuResult<Vec<Score>>;
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.
sourcepub fn users(&self, user_ids: &[u32]) -> GetUsers<'_>ⓘNotable traits for GetUsers<'_>impl Future for GetUsers<'_> type Output = OsuResult<Vec<UserCompact>>;
👎 Deprecated: The API currently doesn’t allow this endpoint for public use
pub fn users(&self, user_ids: &[u32]) -> GetUsers<'_>ⓘNotable traits for GetUsers<'_>impl Future for GetUsers<'_> type Output = OsuResult<Vec<UserCompact>>;
The API currently doesn’t allow this endpoint for public use
Get a vec of UserCompact
.
sourcepub fn wiki(&self, locale: impl Into<String>) -> GetWikiPage<'_>ⓘNotable traits for GetWikiPage<'_>impl Future for GetWikiPage<'_> type Output = OsuResult<WikiPage>;
pub fn wiki(&self, locale: impl Into<String>) -> GetWikiPage<'_>ⓘNotable traits for GetWikiPage<'_>impl Future for GetWikiPage<'_> type Output = OsuResult<WikiPage>;
Get a WikiPage
or image data.
locale
adjusts the language, e.g. en
for english, de
for german, …
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Osu
impl Send for Osu
impl Sync for Osu
impl Unpin for Osu
impl !UnwindSafe for Osu
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more