Crates.io | habitica_rust_client |
lib.rs | habitica_rust_client |
version | 0.1.8 |
source | src |
created_at | 2018-05-11 11:45:51.177165 |
updated_at | 2021-11-09 14:32:33.450264 |
description | Unnoficial Habitica Api Rust Client |
homepage | |
repository | |
max_upload_size | |
id | 64844 |
size | 75,437 |
This is a unnoficial Habitica V3 Api Client for Rust.
Feel free to use, open an issue or a PR.
Method: client.get_all_tasks()
Reference: Task - Get a user's tasks
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()
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);
}