habitica_rust_client 0.1.0

Unnoficial Habitica Api Rust Client
docs.rs failed to build habitica_rust_client-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: habitica_rust_client-0.1.8

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);
}