View Source AnkiConnect.Specs.NoteSpec (anki_connect v0.1.1)

Includes type specs for note.

Link to this section Summary

Types

t()

Notes passed to AnkiConnect.Actions.Note.add_note/1 and AnkiConnect.Actions.Note.add_notes/1 functions follow this spec.

Link to this section Types

@type t() :: %{
  deck_name: String.t(),
  model_name: String.t(),
  fields: %{Front: String.t(), Back: String.t()},
  options:
    %{
      allow_duplicate: boolean() | nil,
      duplicate_scope: String.t() | nil,
      duplicate_scope_options:
        %{
          deck_name: String.t() | nil,
          check_children: boolean() | nil,
          check_all_models: boolean() | nil
        }
        | nil
    }
    | nil,
  tags: [String.t()] | nil,
  audio: [AnkiConnect.Specs.FileSpec.t()] | nil,
  video: [AnkiConnect.Specs.FileSpec.t()] | nil,
  picture: [AnkiConnect.Specs.FileSpec.t()] | nil
}

Notes passed to AnkiConnect.Actions.Note.add_note/1 and AnkiConnect.Actions.Note.add_notes/1 functions follow this spec.

options

Options

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 map can be used to specify some additional settings:

  • duplicate_scope_options.deck_name will specify which deck to use for checking duplicates in. If nil, the target deck will be used.
  • duplicate_scope_options.check_children will change whether or not 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.

saving-media

Saving media

Anki-Connect can download audio, video, and picture files and embed them in newly created notes. To do this, you need to specify the audio, video, and picture fields in the note with a list of files (refer to AnkiConnect.Specs.FileSpec for syntax).