Crate nadeo_api

source ·
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 NadeoRequests. 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_oauth("my_identifier", "my_secret")
    .user_agent("Testing the API / my.email@gmail.com")
    .build()
    .await?;

To execute a NadeoRequest you need to create one with NadeoRequest::builder. To successfully 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 or AuthType::NadeoLiveServices you need to build the NadeoClient with NadeoClientBuilder::with_normal_auth(). If the endpoint requires AuthType::OAuth you need to build the NadeoClient with NadeoClientBuilder::with_oauth_auth().
  • a URL
  • an HttpMethod

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(HttpMethod::Get)
    .build()?;

To execute the request use:

let res = client.execute(request).await?;

Re-exports§

Modules§