[][src]Struct rosu::backend::requests::UserRequest

pub struct UserRequest<'s> { /* fields omitted */ }

Request struct to retrieve users. An instance must contain either a user id or a username

Methods

impl<'s> UserRequest<'s>[src]

pub fn with_user_id(id: u32) -> Self[src]

Construct a UserRequest via user id

pub fn with_username(name: &str) -> Self[src]

Construct a UserRequest via username

pub fn mode(self, mode: GameMode) -> Self[src]

Specify a game mode for the request

pub fn event_days(self, amount: u32) -> Self[src]

Specify event days for the request.

From osu!api repo: Max number of days between now and last event date. Range of 1-31. Optional, default value is 1

pub async fn queue<'_>(self, osu: &'_ Osu) -> OsuResult<Vec<User>>[src]

Asynchronously send the user request and await the parsed Vec<User>.

Example

use rosu::{
    backend::{Osu, requests::UserRequest},
    models::User,
};

let osu = Osu::new("osu_api_key");
let request: UserRequest = UserRequest::with_username("Badewanne3");
let users: Vec<User> = request.queue(&osu).await?;
// ...

pub async fn queue_single<'_>(self, osu: &'_ Osu) -> OsuResult<Option<User>>[src]

Asynchronously send the user request and await the parsed User.

If the API's response contains more than one user, the method will return the last one.

If the API response contains no users, the method will return None.

Example

use rosu::{
    backend::{Osu, requests::UserRequest},
    models::User,
};

let osu = Osu::new("osu_api_key");
let request: UserRequest = UserRequest::with_username("Badewanne3");
let user: Option<User> = request.queue_single(&osu).await?;
// ...

Trait Implementations

impl<'s> Clone for UserRequest<'s>[src]

impl<'s> Eq for UserRequest<'s>[src]

impl<'s> PartialEq<UserRequest<'s>> for UserRequest<'s>[src]

impl<'s> StructuralEq for UserRequest<'s>[src]

impl<'s> StructuralPartialEq for UserRequest<'s>[src]

Auto Trait Implementations

impl<'s> RefUnwindSafe for UserRequest<'s>

impl<'s> Send for UserRequest<'s>

impl<'s> Sync for UserRequest<'s>

impl<'s> Unpin for UserRequest<'s>

impl<'s> UnwindSafe for UserRequest<'s>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.