// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html syntax = "proto3"; package anki.import_export; import "anki/collection.proto"; import "anki/decks.proto"; import "anki/notes.proto"; import "anki/generic.proto"; service ImportExportService { rpc ImportCollectionPackage(ImportCollectionPackageRequest) returns (generic.Empty); rpc ExportCollectionPackage(ExportCollectionPackageRequest) returns (generic.Empty); rpc ImportAnkiPackage(ImportAnkiPackageRequest) returns (ImportAnkiPackageResponse); rpc ExportAnkiPackage(ExportAnkiPackageRequest) returns (generic.Empty); } message ImportCollectionPackageRequest { string col_path = 1; string backup_path = 2; string media_folder = 3; } message ExportCollectionPackageRequest { string out_path = 1; bool include_media = 2; bool legacy = 3; } message ImportAnkiPackageRequest { string package_path = 1; } message ImportAnkiPackageResponse { message Note { notes.NoteId id = 1; repeated string fields = 2; } message Log { repeated Note new = 1; repeated Note updated = 2; repeated Note duplicate = 3; repeated Note conflicting = 4; } collection.OpChanges changes = 1; Log log = 2; } message ExportAnkiPackageRequest { string out_path = 1; bool with_scheduling = 2; bool with_media = 3; oneof selector { generic.Empty whole_collection = 4; decks.DeckId deck_id = 5; notes.NoteIds note_ids = 6; } } message PackageMetadata { enum Version { VERSION_UNKNOWN = 0; // When `meta` missing, and collection.anki2 file present. VERSION_LEGACY_1 = 1; // When `meta` missing, and collection.anki21 file present. VERSION_LEGACY_2 = 2; // Implies MediaEntry media map, and zstd compression. // collection.21b file VERSION_LATEST = 3; } Version version = 1; } message MediaEntries { message MediaEntry { string name = 1; uint32 size = 2; bytes sha1 = 3; /// Legacy media maps may include gaps in the media list, so the original /// file index is recorded when importing from a HashMap. This field is not /// set when exporting. optional uint32 legacy_zip_filename = 255; } repeated MediaEntry entries = 1; }