1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* The MIT License (MIT)
*
* Copyright (c) 2023 DaniƩl Kerkmann <daniel@kerkmann.dev>
*
* 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.
*/
/// Opens the _Add Cards_ dialog with the provided details prefilled.
///
/// If the dialog is already open, it will be reopened with the new provided details.
///
/// Audio, video, and picture files can be embedded into the fields via the `audio`, `video`, and `picture` keys, respectively.
/// Refer to the documentation of [add_note] and [store_media_file] for an explanation of these fields.
///
/// The result is the ID of the note that would be added in case the user chose to confirm the _Add Cards_ dialogue.
///
/// [add_note]: crate::note_actions::add_note
/// [store_media_file]: crate::media_actions::store_media_file
/// Answers the current card.
///
/// Returns `true` if succeeded or `false` otherwise.
/// Note that the answer for the current card must be displayed before any answer can be accepted by Anki.
/// Invokes the Card Browser dialog and searches for a given query.
///
/// Query syntax is [documented here](https://docs.ankiweb.net/searching.html).
///
/// Returns an array of the card IDs that were found.
///
/// Optionally, the `reorder_cards` property can be provided to reorder the cards shown in the _Card Browser_.
/// This is an array including the `order` and `column_id` objects. `order` can be either `ascending` or `descending` while `column_id` can be one of several column identifiers (as documented in the [Anki source code](https://github.com/ankitects/anki/blob/main/rslib/src/browser_table.rs)).
/// The specified column needs to be visible in the _Card Browser_.
/// Requests a database check.
///
/// Does not wait for the check to complete.
/// Therefore, the action will always return `true` even if errors are detected during the database check.
/// Gets information about the currently displayed card.
///
/// Returns `null` if not in review mode.
/// Opens the _Deck Browser_ dialog.
/// Opens the _Deck Overview_ dialog for the deck with the given name.
///
/// Returns `true` if succeeded or `false` otherwise.
/// Starts review for the deck with the given name.
///
/// Returns `true` if succeeded or `false` otherwise.
/// Opens the _Edit_ dialog for the given note.
///
/// This dialog is similar to the _Edit Current_ dialog, except it:
/// - has a _Preview_ button to preview the cards for the note
/// - has a _Browse_ button to open the browser with these cards
/// - has _Previous/Back_ buttons to navigate the history of the dialog
/// - has no bar with the _Close_ button
/// Gracefully closes Anki.
///
/// This operation is asynchronous, so it will return immediately and won't wait until the Anki process actually terminates.
/// Opens the _Import..._ dialog, with an optional file path.
///
/// Brings up the dialog for the user to review the import.
/// Supports all file types that Anki supports.
/// Opens the system file dialog if no path is provided.
/// Forward slashes must be used in the path on Windows.
///
/// Only supported for Anki 2.1.52+.
/// Selects a card in the _Card Browser_ dialog.
///
/// The _Card Browser_ must be open. Nothing will happen if it is not.
///
/// Returns `true` if the _Card Browser_ is open, `false` otherwise.
/// Gets the selected notes in the _Card Browser_ dialog.
///
/// Returns an empty list if the _Card Browser_ dialog is not open.
/// Shows the answer side of the current card.
///
/// Returns `true` if in review mode or `false` otherwise.
/// Shows the question side of the current card.
///
/// Returns `true` if in review mode or `false` otherwise.
/// Starts or resets the `timerStarted` value for the current card.
///
/// Useful for deferring the start time to when it is displayed via the API, allowing the recorded time taken to answer the card to be more accurate when calling [gui_answer_card].
/// Undoes the last action/card.
///
/// Returns `true` if succeeded or `false` otherwise.