[][src]Struct sage_auth::validate::ValidateBuilder

pub struct ValidateBuilder<'a> { /* fields omitted */ }

ValidateBuilder is used to generate a validate request

It can check if an access_token is usable for authentication with a Minecraft server.

For more details, see [https://wiki.vg/Authentication]. For example:

let resp = ValidateBuilder::new()
    .access_token("ACCESS_TOKEN")
    .client_token(Uuid::new_v4())
    .request()
    .await?;

Methods

impl<'a> ValidateBuilder<'a>[src]

pub fn new() -> ValidateBuilder<'a>[src]

pub fn client_token(&mut self, client_token: Uuid) -> &mut ValidateBuilder<'a>[src]

Client token, the same as when you request access_token.

pub fn access_token(
    &mut self,
    access_token: &'a str
) -> &mut ValidateBuilder<'a>
[src]

access_token to invalidate.

pub fn server<T: IntoUrl>(
    &mut self,
    server: T
) -> Result<&mut ValidateBuilder<'a>>
[src]

Set base url, default is https://authserver.mojang.com.

pub fn endpoint(&mut self, endpoint: &'a str) -> &mut ValidateBuilder<'a>[src]

set endpoint, default is /authenticate.

pub async fn request<'_>(&'_ mut self) -> Result<()>[src]

Make a request with the given parameters. If success, it will return Ok(()).

Trait Implementations

impl<'_> Default for ValidateBuilder<'_>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for ValidateBuilder<'a>

impl<'a> Send for ValidateBuilder<'a>

impl<'a> Sync for ValidateBuilder<'a>

impl<'a> Unpin for ValidateBuilder<'a>

impl<'a> UnwindSafe for ValidateBuilder<'a>

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<T> From<T> for T[src]

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

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,