anki_bridge 0.2.0

AnkiBridge is a Rust library that provides a bridge between your Rust code and the Anki application, enabling HTTP communication and seamless data transmission.
docs.rs failed to build anki_bridge-0.2.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: anki_bridge-0.10.2

AnkiBridge

AnkiBridge is a Rust library that serves as a bridge between your Rust code and the Anki application, leveraging the AnkiConnect add-on to establish an HTTP connection. This library enables seamless transmission of data and facilitates interaction with Anki through Rust.

Features

AnkiBridge provides the following features:

  • Establishing a connection with Anki through the AnkiConnect add-on.
  • Sending requests to Anki for various actions.
  • Retrieving data and statistics from Anki.
  • Interacting with cards and decks in Anki.

Installation

To use AnkiBridge in your Rust project, add the following line to your Cargo.toml file:

[dependencies]
anki_bridge = { version = "0.1", features = ["ureq"] }

Additionally, ensure that you have the Anki application installed on your system and that the AnkiConnect add-on is installed within Anki.

Please note that Anki must be opened and running on your computer for AnkiBridge to establish a connection successfully.

Usage

To establish a connection and perform actions with Anki, you can utilize the functions and structs provided by the AnkiBridge library in your Rust code. Here's a basic example:

use anki_bridge::deck_actions::{GetDeckStatsParams, get_deck_stats};

fn main() {
    // Establish the parameters for retrieving deck statistics
    let params = GetDeckStatsParams {
        decks: vec!["Deck1".to_string(), "Deck2".to_string()],
    };

    // Retrieve deck statistics from Anki
    match get_deck_stats(params) {
        Ok(deck_stats) => {
            for (deck_name, stats) in deck_stats {
                println!("Deck: {}", deck_name);
                println!("Total Cards: {}", stats.total_in_deck);
                println!("New Cards: {}", stats.new_count);
                println!("Learning Cards: {}", stats.learn_count);
                println!("Review Cards: {}", stats.review_count);
                println!("---");
            }
        }
        Err(err) => {
            println!("Error: {}", err);
        }
    }
}

Todo

AnkiBridge is an ongoing project with planned future developments. Here are the upcoming items on the to-do list:

  • Card Actions (implementation)
  • Card Actions (tests)
  • Deck Actions (implementation)
  • Deck Actions (tests)
  • Graphical Actions
  • Media Actions
  • Miscellaneous Actions
  • Model Actions
  • Note Actions
  • Statistic Actions
  • ureq synchronous HTTP client
  • reqwest asynchronous HTTP client
  • Tests

Contributions to AnkiBridge are welcome. Feel free to contribute by opening issues or submitting pull requests on the GitLab repository.

License

AnkiBridge is distributed under the MIT License. For more information, see the LICENSE file.

Contact

For any questions or inquiries, please contact the project maintainer at daniel@kerkmann.dev.