Struct rosu_v2::OsuBuilder
source · [−]pub struct OsuBuilder { /* private fields */ }
Expand description
Builder struct for an Osu
client.
client_id
as well as client_secret
must be specified before building.
For more info, check out https://osu.ppy.sh/docs/index.html#client-credentials-grant
Implementations
sourceimpl OsuBuilder
impl OsuBuilder
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OsuBuilder
sourcepub async fn build(self) -> OsuResult<Osu>
pub async fn build(self) -> OsuResult<Osu>
Build an Osu
client.
To build the client, the client id and secret are being used to acquire a token from the API which expires after a certain time. The client will from then on update the token regularly on its own.
Errors
Returns an error if
- client id was not set
- client secret was not set
- API did not provide a token for the given client id and client secret
sourcepub fn client_id(self, client_id: u64) -> Self
pub fn client_id(self, client_id: u64) -> Self
Set the client id of the application.
For more info, check out https://osu.ppy.sh/docs/index.html#client-credentials-grant
sourcepub fn client_secret(self, client_secret: impl Into<String>) -> Self
pub fn client_secret(self, client_secret: impl Into<String>) -> Self
Set the client secret of the application.
For more info, check out https://osu.ppy.sh/docs/index.html#client-credentials-grant
After acquiring the authorization code from a user through OAuth, use this method to provide the given code, and specified redirect uri.
For more info, check out https://osu.ppy.sh/docs/index.html#authorization-code-grant
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for OsuBuilder
impl Send for OsuBuilder
impl Sync for OsuBuilder
impl Unpin for OsuBuilder
impl UnwindSafe for OsuBuilder
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