pub struct NadeoClient { /* private fields */ }
Expand description
This client can execute NadeoRequest
s and handles authentication.
§Examples
Creating a client.
let mut client = NadeoClient::builder()
.with_normal_auth("email", "password") // optional (but at least 1 of the 3 is required)
.with_server_auth("username", "password") // optional
.with_oauth("identifier", "secret") // optional
.user_agent("Testing the API / mustermann.max@gmail.com") // required
.build()
.await?;
Implementations§
Source§impl NadeoClient
impl NadeoClient
pub fn builder() -> NadeoClientBuilder
Sourcepub async fn execute(&mut self, request: NadeoRequest) -> Result<Response>
pub async fn execute(&mut self, request: NadeoRequest) -> Result<Response>
Executes a NadeoRequest
on the given NadeoClient
. For more information about the API endpoints look here.
§Errors
Returns an Error
if the required credentials for authorizing the request were not supplied when building the client or when there is an Error while executing the request.
§Examples
Gets the clubtag of a player given the accountID.
// create client
let mut client = NadeoClient::builder()
.with_normal_auth("email", "password")
.user_agent("Testing the API / mustermann.max@gmail.com")
.build()
.await?;
// build request
let request = NadeoRequest::builder()
.url("https://prod.trackmania.core.nadeo.online/accounts/clubTags/?accountIdList=29e75531-1a9d-4880-98da-e2acfe17c578")
.auth_type(AuthType::NadeoServices)
.method(Method::GET)
.build()?;
// execute request
let response = client.execute(request).await?;
Trait Implementations§
Source§impl Clone for NadeoClient
impl Clone for NadeoClient
Source§fn clone(&self) -> NadeoClient
fn clone(&self) -> NadeoClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for NadeoClient
impl !RefUnwindSafe for NadeoClient
impl Send for NadeoClient
impl Sync for NadeoClient
impl Unpin for NadeoClient
impl !UnwindSafe for NadeoClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more