Anki/proto/anki/cards.proto
RumovZ 31b7464c67
Add card meta for persisting custom scheduling state (#2040)
* Add card meta for persisting custom scheduling state

* Rename meta -> custom_data

* Enforce limits on size of custom data

Large values will slow down table scans of the cards table, and it's
easier to be strict now and possibly relax things in the future than
the opposite.

* Pack card states and customData into a single message

+ default customData to empty if it can't be parsed

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2022-09-02 11:22:49 +10:00

67 lines
1.4 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.cards;
import "anki/generic.proto";
import "anki/collection.proto";
service CardsService {
rpc GetCard(CardId) returns (Card);
rpc UpdateCards(UpdateCardsRequest) returns (collection.OpChanges);
rpc RemoveCards(RemoveCardsRequest) returns (generic.Empty);
rpc SetDeck(SetDeckRequest) returns (collection.OpChangesWithCount);
rpc SetFlag(SetFlagRequest) returns (collection.OpChangesWithCount);
}
message CardId {
int64 cid = 1;
}
message CardIds {
repeated int64 cids = 1;
}
message Card {
int64 id = 1;
int64 note_id = 2;
int64 deck_id = 3;
uint32 template_idx = 4;
int64 mtime_secs = 5;
sint32 usn = 6;
uint32 ctype = 7;
sint32 queue = 8;
sint32 due = 9;
uint32 interval = 10;
uint32 ease_factor = 11;
uint32 reps = 12;
uint32 lapses = 13;
uint32 remaining_steps = 14;
sint32 original_due = 15;
int64 original_deck_id = 16;
uint32 flags = 17;
optional uint32 original_position = 18;
string custom_data = 19;
}
message UpdateCardsRequest {
repeated Card cards = 1;
bool skip_undo_entry = 2;
}
message RemoveCardsRequest {
repeated int64 card_ids = 1;
}
message SetDeckRequest {
repeated int64 card_ids = 1;
int64 deck_id = 2;
}
message SetFlagRequest {
repeated int64 card_ids = 1;
uint32 flag = 2;
}