anki/proto/backend.proto

258 lines
5.4 KiB
Protocol Buffer
Raw Normal View History

syntax = "proto3";
2019-12-24 23:59:33 +01:00
package backend_proto;
message Empty {}
message BackendInit {
string collection_path = 1;
string media_folder_path = 2;
string media_db_path = 3;
}
// 1-15 reserved for future use; 2047 for errors
2019-12-24 23:59:33 +01:00
message BackendInput {
reserved 2047;
oneof value {
TemplateRequirementsIn template_requirements = 16;
SchedTimingTodayIn sched_timing_today = 17;
2020-01-06 03:18:20 +01:00
Empty deck_tree = 18;
FindCardsIn find_cards = 19;
BrowserRowsIn browser_rows = 20;
RenderCardIn render_card = 21;
int64 local_minutes_west = 22;
string strip_av_tags = 23;
ExtractAVTagsIn extract_av_tags = 24;
string expand_clozes_to_reveal_latex = 25;
2020-01-28 12:45:26 +01:00
AddFileToMediaFolderIn add_file_to_media_folder = 26;
SyncMediaIn sync_media = 27;
2020-02-10 08:58:54 +01:00
Empty check_media = 28;
}
}
2019-12-24 23:59:33 +01:00
message BackendOutput {
oneof value {
TemplateRequirementsOut template_requirements = 16;
SchedTimingTodayOut sched_timing_today = 17;
2020-01-06 03:18:20 +01:00
DeckTreeOut deck_tree = 18;
FindCardsOut find_cards = 19;
BrowserRowsOut browser_rows = 20;
RenderCardOut render_card = 21;
sint32 local_minutes_west = 22;
string strip_av_tags = 23;
ExtractAVTagsOut extract_av_tags = 24;
string expand_clozes_to_reveal_latex = 25;
2020-01-28 12:45:26 +01:00
string add_file_to_media_folder = 26;
Empty sync_media = 27;
2020-02-10 08:58:54 +01:00
MediaCheckOut check_media = 28;
BackendError error = 2047;
}
}
2019-12-24 23:59:33 +01:00
message BackendError {
oneof value {
2020-01-28 12:45:26 +01:00
StringError invalid_input = 1;
TemplateParseError template_parse = 2;
2020-01-28 12:45:26 +01:00
StringError io_error = 3;
StringError db_error = 4;
2020-02-04 10:39:31 +01:00
NetworkError network_error = 5;
SyncError sync_error = 6;
2020-02-02 12:02:20 +01:00
// user interrupted operation
Empty interrupted = 8;
}
}
message Progress {
oneof value {
MediaSyncProgress media_sync = 1;
2020-02-10 08:58:54 +01:00
uint32 media_check = 2;
}
}
2020-01-28 12:45:26 +01:00
message StringError {
string info = 1;
}
message TemplateParseError {
string info = 1;
bool q_side = 2;
}
2020-02-04 10:39:31 +01:00
message NetworkError {
string info = 1;
enum NetworkErrorKind {
OTHER = 0;
OFFLINE = 1;
TIMEOUT = 2;
PROXY_AUTH = 3;
}
NetworkErrorKind kind = 2;
}
message SyncError {
string info = 1;
enum SyncErrorKind {
OTHER = 0;
CONFLICT = 1;
SERVER_ERROR = 2;
CLIENT_TOO_OLD = 3;
AUTH_FAILED = 4;
SERVER_MESSAGE = 5;
2020-02-05 04:35:40 +01:00
MEDIA_CHECK_REQUIRED = 6;
RESYNC_REQUIRED = 7;
2020-02-04 10:39:31 +01:00
}
SyncErrorKind kind = 2;
}
message MediaSyncProgress {
uint32 checked = 1;
uint32 downloaded_files = 2;
uint32 downloaded_deletions = 3;
uint32 uploaded_files = 4;
uint32 uploaded_deletions = 5;
}
message MediaSyncUploadProgress {
uint32 files = 1;
uint32 deletions = 2;
}
message TemplateRequirementsIn {
repeated string template_front = 1;
map<string, uint32> field_names_to_ordinals = 2;
}
message TemplateRequirementsOut {
repeated TemplateRequirement requirements = 1;
}
message TemplateRequirement {
oneof value {
TemplateRequirementAll all = 1;
TemplateRequirementAny any = 2;
Empty none = 3;
}
}
message TemplateRequirementAll {
repeated uint32 ords = 1;
}
message TemplateRequirementAny {
repeated uint32 ords = 1;
}
message SchedTimingTodayIn {
int64 created_secs = 1;
sint32 created_mins_west = 2;
int64 now_secs = 3;
sint32 now_mins_west = 4;
sint32 rollover_hour = 5;
}
message SchedTimingTodayOut {
uint32 days_elapsed = 1;
int64 next_day_at = 2;
}
2020-01-06 03:18:20 +01:00
message DeckTreeOut {
DeckTreeNode top = 1;
}
message DeckTreeNode {
// the components of a deck, split on ::
repeated string names = 1;
int64 deck_id = 2;
uint32 review_count = 3;
uint32 learn_count = 4;
uint32 new_count = 5;
repeated DeckTreeNode children = 6;
bool collapsed = 7;
}
message FindCardsIn {
string search = 1;
}
message FindCardsOut {
repeated int64 card_ids = 1;
}
message BrowserRowsIn {
repeated int64 card_ids = 1;
}
message BrowserRowsOut {
// just sort fields for proof of concept
repeated string sort_fields = 1;
}
message RenderCardIn {
string question_template = 1;
string answer_template = 2;
map<string,string> fields = 3;
int32 card_ordinal = 4;
}
message RenderCardOut {
repeated RenderedTemplateNode question_nodes = 1;
repeated RenderedTemplateNode answer_nodes = 2;
}
message RenderedTemplateNode {
oneof value {
string text = 1;
RenderedTemplateReplacement replacement = 2;
}
}
message RenderedTemplateReplacement {
string field_name = 1;
string current_text = 2;
repeated string filters = 3;
}
message ExtractAVTagsIn {
string text = 1;
bool question_side = 2;
}
message ExtractAVTagsOut {
string text = 1;
repeated AVTag av_tags = 2;
}
message AVTag {
oneof value {
string sound_or_video = 1;
TTSTag tts = 2;
}
}
message TTSTag {
string field_text = 1;
string lang = 2;
repeated string voices = 3;
2020-01-26 05:28:17 +01:00
float speed = 4;
repeated string other_args = 5;
}
2020-01-28 12:45:26 +01:00
message AddFileToMediaFolderIn {
string desired_name = 1;
bytes data = 2;
}
message SyncMediaIn {
string hkey = 1;
string endpoint = 2;
2020-02-04 10:39:31 +01:00
}
2020-02-10 08:58:54 +01:00
message MediaCheckOut {
repeated string unused = 1;
repeated string missing = 2;
repeated string dirs = 3;
repeated string oversize = 4;
map<string,string> renamed = 5;
}