#api-bindings #nadeo #trackmania #nadeo-api-client

nadeo-api

An interface for working with the Nadeo API

7 releases

0.3.0 Feb 4, 2025
0.2.4 Oct 3, 2024
0.2.3 May 30, 2024
0.1.0 May 2, 2024

#729 in Web programming

Download history 3/week @ 2024-12-07 2/week @ 2024-12-21 105/week @ 2025-02-01 32/week @ 2025-02-08

137 downloads per month

Apache-2.0

42KB
742 lines

Crates.io Version Crates.io License docs.rs

nadeo-api

This library handles all the authentication for working with the Nadeo API.

Installation

Via command line:

cargo add nadeo-api

Via Cargo.toml:

nadeo-api = "0.3.0"

Getting started

Creating a client:

use nadeo_api::NadeoClient;

let mut client = NadeoClient::builder()
    .with_normal_auth("my_email", "my_password")
    .with_server_auth("my_username", "my_other_password")
    .with_oauth("my_identifier", "my_secret")
    .user_agent("My cool Application / my.email@domain.com")
    .build()
    .await?;

Creating a request:

use nadeo_api::NadeoRequest;
use nadeo_api::auth::AuthType;
use nadeo_api::request::Method;

let request = NadeoRequest::builder()
    .url("api_endpoint_url")
    .auth_type(AuthType::NadeoServices)
    .method(Method::GET)
    .body("some text/json") // optional
    .build()?;

Executing a request:

let mut client = /* snap */;
let request = /* snap */;

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

License

This project is licensed under Apache License, Version 2.0.

Dependencies

~8–19MB
~257K SLoC