habitica_rust_client

Crates.iohabitica_rust_client
lib.rshabitica_rust_client
version0.1.8
sourcesrc
created_at2018-05-11 11:45:51.177165
updated_at2021-11-09 14:32:33.450264
descriptionUnnoficial Habitica Api Rust Client
homepage
repository
max_upload_size
id64844
size75,437
Dawson Freitas Israel (dawsonfi)

documentation

README

Build Status Current Crates.io Version Docs.rs Code Coverage

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

Commit count: 0

cargo fmt