Crates.io | nadeo-api |
lib.rs | nadeo-api |
version | 0.2.4 |
source | src |
created_at | 2024-05-02 16:03:43.697215 |
updated_at | 2024-10-03 18:41:26.102611 |
description | An interface for working with the Nadeo API |
homepage | |
repository | https://www.github.com/TgZ39/nadeo-api |
max_upload_size | |
id | 1227865 |
size | 59,173 |
This library handles all the authentication for working with the Nadeo API.
Via command line:
cargo add nadeo-api
Via Cargo.toml
:
nadeo-api = "0.2.4"
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::HttpMethod;
let request = NadeoRequest::builder()
.url("api_endpoint_url")
.auth_type(AuthType::NadeoServices)
.method(HttpMethod::Get)
.body("some text/json") // optional
.build()?;
Executing a request:
let mut client = /* snap */;
let request = /* snap */;
let response = client.execute(request).await?;
This project is licensed under Apache License, Version 2.0.