mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00

- Dropped the protobuf extensions in favor of explicitly listing out methods in both services if we want to implement both, as it's clearer. - Move Service/Method wrappers into a separate crate that the various clients can import, to easily get at the list of backend services and their correct indices and comments.
112 lines
2.6 KiB
Protocol Buffer
112 lines
2.6 KiB
Protocol Buffer
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
syntax = "proto3";
|
|
|
|
option java_multiple_files = true;
|
|
|
|
package anki.notes;
|
|
|
|
import "anki/notetypes.proto";
|
|
import "anki/collection.proto";
|
|
import "anki/decks.proto";
|
|
import "anki/cards.proto";
|
|
|
|
service NotesService {
|
|
rpc NewNote(notetypes.NotetypeId) returns (Note);
|
|
rpc AddNote(AddNoteRequest) returns (AddNoteResponse);
|
|
rpc DefaultsForAdding(DefaultsForAddingRequest) returns (DeckAndNotetype);
|
|
rpc DefaultDeckForNotetype(notetypes.NotetypeId) returns (decks.DeckId);
|
|
rpc UpdateNotes(UpdateNotesRequest) returns (collection.OpChanges);
|
|
rpc GetNote(NoteId) returns (Note);
|
|
rpc RemoveNotes(RemoveNotesRequest) returns (collection.OpChangesWithCount);
|
|
rpc ClozeNumbersInNote(Note) returns (ClozeNumbersInNoteResponse);
|
|
rpc AfterNoteUpdates(AfterNoteUpdatesRequest)
|
|
returns (collection.OpChangesWithCount);
|
|
rpc FieldNamesForNotes(FieldNamesForNotesRequest)
|
|
returns (FieldNamesForNotesResponse);
|
|
rpc NoteFieldsCheck(Note) returns (NoteFieldsCheckResponse);
|
|
rpc CardsOfNote(NoteId) returns (cards.CardIds);
|
|
rpc GetSingleNotetypeOfNotes(notes.NoteIds) returns (notetypes.NotetypeId);
|
|
}
|
|
|
|
// Implicitly includes any of the above methods that are not listed in the
|
|
// backend service.
|
|
service BackendNotesService {}
|
|
|
|
message NoteId {
|
|
int64 nid = 1;
|
|
}
|
|
|
|
message NoteIds {
|
|
repeated int64 note_ids = 1;
|
|
}
|
|
|
|
message Note {
|
|
int64 id = 1;
|
|
string guid = 2;
|
|
int64 notetype_id = 3;
|
|
uint32 mtime_secs = 4;
|
|
int32 usn = 5;
|
|
repeated string tags = 6;
|
|
repeated string fields = 7;
|
|
}
|
|
|
|
message AddNoteRequest {
|
|
Note note = 1;
|
|
int64 deck_id = 2;
|
|
}
|
|
|
|
message AddNoteResponse {
|
|
int64 note_id = 1;
|
|
collection.OpChanges changes = 2;
|
|
}
|
|
|
|
message UpdateNotesRequest {
|
|
repeated Note notes = 1;
|
|
bool skip_undo_entry = 2;
|
|
}
|
|
|
|
message DefaultsForAddingRequest {
|
|
int64 home_deck_of_current_review_card = 1;
|
|
}
|
|
|
|
message DeckAndNotetype {
|
|
int64 deck_id = 1;
|
|
int64 notetype_id = 2;
|
|
}
|
|
|
|
message RemoveNotesRequest {
|
|
repeated int64 note_ids = 1;
|
|
repeated int64 card_ids = 2;
|
|
}
|
|
|
|
message ClozeNumbersInNoteResponse {
|
|
repeated uint32 numbers = 1;
|
|
}
|
|
|
|
message AfterNoteUpdatesRequest {
|
|
repeated int64 nids = 1;
|
|
bool mark_notes_modified = 2;
|
|
bool generate_cards = 3;
|
|
}
|
|
|
|
message FieldNamesForNotesRequest {
|
|
repeated int64 nids = 1;
|
|
}
|
|
|
|
message FieldNamesForNotesResponse {
|
|
repeated string fields = 1;
|
|
}
|
|
|
|
message NoteFieldsCheckResponse {
|
|
enum State {
|
|
NORMAL = 0;
|
|
EMPTY = 1;
|
|
DUPLICATE = 2;
|
|
MISSING_CLOZE = 3;
|
|
NOTETYPE_NOT_CLOZE = 4;
|
|
FIELD_NOT_CLOZE = 5;
|
|
}
|
|
State state = 1;
|
|
}
|