Struct rosu_v2::Osu

source ·
pub struct Osu { /* private fields */ }
Expand description

The main osu client. Cheap to clone.

Implementations§

source§

impl Osu

source

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.

source

pub fn builder() -> OsuBuilder

Fine-tune building an Osu client.

source

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).

source

pub fn beatmaps<I>(&self, map_ids: I) -> GetBeatmaps<'_> where I: IntoIterator<Item = u32>,

Get a vec of at most 50 BeatmapCompacts.

The contained maps will have these options filled: mapset, fail_times, and max_combo (if available for mode).

source

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.

source

pub fn beatmap_difficulty_attributes( &self, map_id: u32 ) -> GetBeatmapDifficultyAttributes<'_>

Get the BeatmapDifficultyAttributes for a map.

source

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.

source

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 Scores.

The contained scores won’t have any Options filled except for pp in case of a ranked map.

source

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 Beatmaps will contain Some in fail_times, max_combo (if available for mode), and deleted_at (if deleted).

source

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 Beatmaps will contain Some in fail_times, max_combo (if available for mode), and deleted_at (if deleted).

source

pub fn beatmapset_events(&self) -> GetBeatmapsetEvents<'_>

Get a BeatmapsetEvents struct containing the most recent mapset events.

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 Beatmapsets 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";
source

pub fn comments(&self) -> GetComments<'_>

Get a list of comments and their replies up to two levels deep in form of a CommentBundle .

source

pub fn chart_rankings(&self, mode: GameMode) -> GetChartRankings<'_>

Get a ChartRankings struct containing a Spotlight, its Beatmapsets, 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.

source

pub fn country_rankings(&self, mode: GameMode) -> GetCountryRankings<'_>

Get a CountryRankings struct containing a vec of CountryRankings which will be sorted by the country’s total pp.

source

pub fn forum_posts(&self, topic_id: u64) -> GetForumPosts<'_>

Get a ForumPosts struct for a forum topic

source

pub fn kudosu(&self, user_id: impl Into<UserId>) -> GetUserKudosu<'_>

Get the kudosu history of a user in form of a vec of KudosuHistory.

source

pub fn news(&self) -> GetNews<'_>

Get News.

source

pub fn osu_match(&self, match_id: u32) -> GetMatch<'_>

Get an OsuMatch.

source

pub fn osu_matches(&self) -> GetMatches<'_>

Get a MatchList containing all currently open multiplayer lobbies.

source

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.

See OsuBuilder::with_authorization.

source

pub fn performance_rankings(&self, mode: GameMode) -> GetPerformanceRankings<'_>

Get a Rankings struct whose UserCompacts are sorted by their pp, i.e. the current pp leaderboard.

source

pub fn recent_events(&self, user_id: impl Into<UserId>) -> GetRecentEvents<'_>

Get the recent activity of a user in form of a vec of RecentEvents.

source

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.

See OsuBuilder::with_authorization.

source

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)

source

pub fn score_rankings(&self, mode: GameMode) -> GetScoreRankings<'_>

Get a Rankings struct whose UserCompacts are sorted by their ranked score, i.e. the current ranked score leaderboard.

source

pub fn seasonal_backgrounds(&self) -> GetSeasonalBackgrounds<'_>

source

pub fn spotlights(&self) -> GetSpotlights<'_>

Get the vec of Spotlight.

source

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.

source

pub fn user_beatmapsets( &self, user_id: impl Into<UserId> ) -> GetUserBeatmapsets<'_>

Get a vec of Beatmapsets a user made.

Filled options will be: artist_unicode, legacy_thread_url, maps, title_unicode.

All options of the contained Beatmaps will be None.

source

pub fn user_most_played( &self, user_id: impl Into<UserId> ) -> GetUserMostPlayed<'_>

Get a vec of a user’s MostPlayedMaps.

All options of the contained BeatmapCompact and BeatmapsetCompact will be None.

Limit

The API provides at most 100 results, defaults to 5.

source

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. Use include_fails to include them.
  • For the firsts score type, pp will only be Some if the map is not loved.
source

pub fn users(&self, user_ids: &[u32]) -> GetUsers<'_>

👎Deprecated: The API currently doesn’t allow this endpoint for public use

Get a vec of UserCompact.

source

pub fn wiki(&self, locale: impl Into<String>) -> GetWikiPage<'_>

Get a WikiPage or image data.

locale adjusts the language, e.g. en for english, de for german, …

Trait Implementations§

source§

impl Drop for Osu

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more