Expand description
This crate provides an interface for working with the Nadeo API. It handles (re)authentication automatically.
§Getting started
At first, you need to create a NadeoClient
to execute NadeoRequest
s.
You will need to provide credentials for at least one authentication method and a UserAgent
.
let mut client = NadeoClient::builder()
.with_normal_auth("ubisoft_account_email", "ubisoft_account_password")
.with_server_auth("my_username", "my_password")
.with_oauth("my_identifier", "my_secret")
.user_agent("Testing the API / my.email@gmail.com")
.build()
.await?;
Use NadeoRequest::builder
to create a NadeoRequestBuilder
.
To create a NadeoRequest
you will need to supply:
- an
AuthType
:- The depends on the API endpoint you want to make a request to.
If the endpoint requires
AuthType::NadeoServices
orAuthType::NadeoLiveServices
you need to build theNadeoClient
withNadeoClientBuilder::with_normal_auth()
. If the endpoint requiresAuthType::OAuth
you need to build theNadeoClient
withNadeoClientBuilder::with_oauth()
.
- The depends on the API endpoint you want to make a request to.
If the endpoint requires
- an
URL
- a
Method
For more information about the API endpoints look here.
let mut client = NadeoClient::builder()
.with_normal_auth("ubisoft_account_email", "ubisoft_account_password")
.with_oauth("my_identifier", "my_secret")
.user_agent("Testing the API / my.email@gmail.com")
.build()
.await?;
let request = NadeoRequest::builder()
.auth_type(AuthType::NadeoServices)
.url("some_url")
.method(Method::GET)
.build()?;
To execute the request use:
let res = client.execute(request).await?;
Re-exports§
pub use error::Error;
pub use error::Result;
pub use client::NadeoClient;
pub use request::NadeoRequest;