View Source AnkiConnect.Actions.Deck (anki_connect v0.1.1)
Deck actions.
All functions are delegated inside AnkiConnect
module, so you should import them from there.
Link to this section Summary
Functions
Moves cards with the given IDs to a different deck, creating the deck if it doesn’t exist yet.
Creates a new configuration group with the given name.
Creates a new empty deck. Will not overwrite a deck that exists with the same name.
Gets the complete list of deck names for the current user.
Gets the complete list of deck names and their respective IDs for the current user.
Deletes decks with the given names.
Gets the configuration group object for the given deck.
Gets statistics such as total cards and cards due for the given decks.
Accepts an array of card IDs and returns an object with each deck name as a key, and its value an array of the given cards which belong to it.
Removes the configuration group with the given ID.
Saves the given configuration group.
Changes the configuration group for the given decks to the one with the given ID.
Link to this section Functions
Moves cards with the given IDs to a different deck, creating the deck if it doesn’t exist yet.
sample-param
Sample param:
%{
cards: [1502098034045, 1502098034048, 1502298033753],
deck: "Japanese::JLPT N3"
}
sample-result
Sample result:
{:ok, nil}
@spec clone_deck_config_id(%{name: String.t(), clone_from: integer()}) :: {:ok, integer()} | {:error, any()}
Creates a new configuration group with the given name.
Clones from the group with the given ID, or from the default group if this is unspecified. Returns the ID of the new configuration group.
sample-param
Sample param:
%{
name: "Copy of Default",
clone_from: 1
}
sample-result
Sample result:
{:ok, 1502972374573}
Creates a new empty deck. Will not overwrite a deck that exists with the same name.
sample-param
Sample param:
%{
deck: "Japanese::Tokyo"
}
sample-result
Sample result:
{:ok, nil}
Gets the complete list of deck names for the current user.
sample-result
Sample result:
{:ok, ["Default"]}
Gets the complete list of deck names and their respective IDs for the current user.
sample-result
Sample result:
{:ok, %{"Default" => 1}}
Deletes decks with the given names.
Warning: this will not only delete the decks, but also all the cards contained in those decks.
sample-param
Sample param:
%{
decks: ["Japanese::JLPT N5", "Easy Spanish"],
}
sample-result
Sample result:
{:ok, nil}
Gets the configuration group object for the given deck.
sample-param
Sample param:
%{
deck: "Default"
}
sample-result
Sample result:
{:ok, %{
"lapse" => %{
"leechFails" => 8,
"delays" => [10],
"minInt" => 1,
"leechAction" => 0,
"mult" => 0
},
"dyn" => false,
"autoplay" => true,
"mod" => 1502970872,
"id" => 1,
"maxTaken" => 60,
"new" => %{
"bury" => true,
"order" => 1,
"initialFactor" => 2500,
"perDay" => 20,
"delays" => [1, 10],
"separate" => true,
"ints" => [1, 4, 7]
},
"name" => "Default",
"rev" => %{
"bury" => true,
"ivlFct" => 1,
"ease4" => 1.3,
"maxIvl" => 36500,
"perDay" => 100,
"minSpace" => 1,
"fuzz" => 0.05
},
"timer" => 0,
"replayq" => true,
"usn" => -1
}}
Gets statistics such as total cards and cards due for the given decks.
sample-param
Sample param:
%{
decks: ["Japanese::JLPT N5", "Easy Spanish"]
}
sample-result
Sample result:
{:ok, %{
"1651445861967" => %{
"deck_id" => 1651445861967,
"name" => "Japanese::JLPT N5",
"new_count" => 20,
"learn_count" => 0,
"review_count" => 0,
"total_in_deck" => 1506
},
"1651445861960" => %{
"deck_id" => 1651445861960,
"name" => "Easy Spanish",
"new_count" => 26,
"learn_count" => 10,
"review_count" => 5,
"total_in_deck" => 852
}
}}
Accepts an array of card IDs and returns an object with each deck name as a key, and its value an array of the given cards which belong to it.
sample-param
Sample param:
%{
cards: [1502298036657, 1502298033753, 1502032366472]
}
sample-result
Sample result:
{:ok, %{
"Default" => [1502032366472],
"Japanese::JLPT N3" => [1502298036657, 1502298033753]
}}
Removes the configuration group with the given ID.
sample-param
Sample param:
%{
config_id: 1502972374573
}
sample-result
Sample result:
{:ok, nil}
Saves the given configuration group.
sample-param
Sample param:
%{
config: %{
dyn: false,
id: 1,
autoplay: true,
lapse: %{
delays: [10],
leech_action: 0,
leech_fails: 8,
minInt: 1,
mult: 0
},
max_taken: 60,
mod: 1502970872,
name: "Default",
new: %{
bury: true,
delays: [1, 10],
initial_factor: 2500,
ints: [1, 4, 7],
order: 1,
per_day: 20,
separate: true
},
rev: %{
bury: true,
ease4: 1.3,
fuzz: 0.05,
ivlFct: 1,
max_ivl: 36500,
min_space: 1,
per_day: 100
},
replayq: true,
timer: 0,
usn: -1
}
}
sample-result
Sample result:
{:ok, nil}
@spec set_deck_config_id(%{decks: [String.t()], config_id: integer()}) :: {:ok, nil} | {:error, any()}
Changes the configuration group for the given decks to the one with the given ID.
sample-param
Sample param:
%{
decks: ["Default"],
config_id: 1
}
sample-result
Sample result:
{:ok, nil}