9 releases
0.1.8 | Nov 9, 2021 |
---|---|
0.1.7 | Nov 8, 2021 |
0.1.5 | Aug 11, 2018 |
0.1.3 | May 25, 2018 |
#917 in Authentication
34 downloads per month
Used in 2 crates
21KB
480 lines
Habitica Api Rust Client
This is a unnoficial Habitica V3 Api Client for Rust.
Feel free to use, open an issue or a PR.
Supported Operations
List user tasks
Method: client.get_all_tasks()
Reference: Task - Get a user's tasks
Usage
In order to use the api, you will need an active account on Habitica, with that, get the user_id
and api_token
from the Api Configurations Page.
With the user_id
and api_token
create a new instance of ApiCredentials
with the following command:
ApiCredentials::new(user_id, api_token)
Having created the credentials, you can create the HabiticaClient
:
HabiticaClient::new(api_credentials)
And then use it to call the supported api methods:
habitica_client.get_all_tasks()
Examples
extern crate habitica_rust_client;
use habitica_rust_client::task::api_credentials::ApiCredentials;
use habitica_rust_client::task::habitica_client::HabiticaClient;
pub fn main() {
let user_id: String = "you_user_id".to_string();
let api_token: String = "you_api_token".to_string();
let api_credentials = ApiCredentials::new(user_id, api_token);
let habitica_client = HabiticaClient::new(api_credentials);
let tasks = habitica_client.get_all_tasks();
print("{:?}", tasks);
}
Dependencies
~4–16MB
~215K SLoC