anki_bridge 0.10.2

AnkiBridge is a Rust library that provides a bridge between your Rust code and the Anki application, enabling HTTP communication and seamless data transmission.
Documentation
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 VaiTon <eyadlorenzo.issa@studio.unibo.it>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

/// Adds a new note to a deck.
///
/// Creates a note using the given deck and model, with the provided field values and tags.
/// Returns the identifier of the created note created on success, and `null` on failure.
///
/// Anki-Connect can download audio, video, and picture files and embed them in newly created notes.
/// The corresponding `audio`, `video`, and `picture` note members are optional and can be omitted.
/// If you choose to include any of them, they should contain a single object or an array of objects with the mandatory `filename` field and one of `data`, `path` or `url`.
/// Refer to the documentation of [store_media_file] for an explanation of these fields.
///
/// The `skip_hash` field can be optionally provided to skip the inclusion of files with an MD5 hash that matches the provided value.
/// This is useful for avoiding the saving of error pages and stub files.
///
/// The `fields` member is a list of fields that should play audio or video or show a picture when the card is displayed in Anki.
///
/// The `allow_duplicate` member inside the `options` group can be set to true to enable adding duplicate cards.
/// Normally duplicate cards cannot be added and trigger exception.
///
/// The `duplicate_scope` member inside `options` can be used to specify the scope for which duplicates are checked.
/// A value of "`deck`" will only check for duplicates in the target deck; any other value will check the entire collection.
///
/// The `duplicate_scope_options` object can be used to specify some additional settings:
/// - `duplicate_scope_options.deck_name` will specify which deck to use for checking duplicates in. If undefined or `null`, the target deck will be used.
/// - `duplicate_scope_options.check_children` will change whether duplicate cards are checked in child decks. The default value is `false`.
/// - `duplicate_scope_options.check_all_models` specifies whether duplicate checks are performed across all note types. The default value is `false`.
///
/// [store_media_file]: crate::media_actions::store_media_file
pub mod add_note;

/// Adds multiple new notes to a deck.
///
/// Creates multiple notes using the given deck and model, with the provided field values and tags.
/// Returns an array of identifiers of the created notes.
/// In the event of any errors, all errors are gathered and returned.
///
/// Please see the documentation for [add_note] for an explanation of objects in the `notes` array.
pub mod add_notes;

/// Adds tags to notes.
pub mod add_tags;

/// Checks if these notes can be created.
///
/// Accepts an array of objects which define parameters for candidate notes (see [add_note]) and returns an array of booleans indicating whether the parameters at the corresponding index could be used to create a new note.
pub mod can_add_notes;

/// Checks if these notes can be created, with detailed error messages.
///
/// Accepts an array of objects which define parameters for candidate notes (see [add_note]) and returns an array of objects with fields `can_add` and `error`.
pub mod can_add_notes_with_error_detail;

/// Clears all the unused tags in the notes.
pub mod clear_unused_tags;

/// Deletes notes.
///
/// If a note has several cards associated with it, all associated cards will be deleted
pub mod delete_notes;

/// Finds a list of notes that match a query.
///
/// Query syntax is documented [here](https://docs.ankiweb.net/searching.html).
pub mod find_notes;

/// Gets all tags added to a note.
pub mod get_note_tags;

/// Gets the complete list of tags.
pub mod get_tags;

/// Gets information about a note.
///
/// Returns a list of objects containing for each note ID the note fields, tags, note type, and the cards belonging to the note.
pub mod notes_info;

/// Gets the notes' last modified times.
///
/// Returns a list of objects containing for each note ID the modification time.
pub mod notes_mod_time;

/// Removes all empty notes.
pub mod remove_empty_notes;

/// Removes a tag from notes.
pub mod remove_tags;

/// Replaces a tag in notes.
pub mod replace_tags;

/// Replaces a tag in all the notes.
pub mod replace_tags_in_all_notes;

/// Modify the fields and/or tags of an existing note.
///
/// In other words, combines [update_note_fields] and [update_note_tags].
/// Please see their documentation for an explanation of all properties.
///
/// Either `fields` or `tags` property can be omitted without affecting the other.
/// Thus valid requests to [update_note_fields] also work with [update_note].
/// The note must have the `fields` property to update the optional audio, video, or picture objects.
///
/// If neither `fields` nor `tags` are provided, the method will fail.
/// Fields are updated first and are not rolled back if updating tags fails.
/// Tags are not updated if updating the fields fails.
///
/// *Note:* These changes will not reflect in the note currently opened in the _Card Browser_ dialog.
/// See [this issue](https://github.com/FooSoft/anki-connect/issues/82) for further details.
/// As a workaround, [crate::graphical_actions::gui_browse] can be used to switch to an unrelated note and back for the new information to be reflected.
pub mod update_note;

/// Modify the fields of an existing note.
///
/// You can also include audio, video, or picture files which will be added to the note.
/// Please see the documentation for [add_note] for an explanation of objects in the `audio`, `video`, or `picture` array.
///
/// *Note:* These changes will not reflect in the note currently opened in the _Card Browser_ dialog.
/// See [this issue](https://github.com/FooSoft/anki-connect/issues/82) for further details.
/// As a workaround, [crate::graphical_actions::gui_browse] can be used to switch to an unrelated note and back for the new information to be reflected.
pub mod update_note_fields;

/// Updates a note's model, fields, and tags.
///
/// This allows you to change the note's model, update its fields with new content, and set new tags.
pub mod update_note_model;

/// Replaces a note's tags.
///
/// Old tags will be removed.
pub mod update_note_tags;