// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html syntax = "proto3"; package anki.sync; import "anki/generic.proto"; service SyncService { rpc SyncMedia(SyncAuth) returns (generic.Empty); rpc AbortSync(generic.Empty) returns (generic.Empty); rpc AbortMediaSync(generic.Empty) returns (generic.Empty); rpc BeforeUpload(generic.Empty) returns (generic.Empty); rpc SyncLogin(SyncLoginRequest) returns (SyncAuth); rpc SyncStatus(SyncAuth) returns (SyncStatusResponse); rpc SyncCollection(SyncAuth) returns (SyncCollectionResponse); rpc FullUpload(SyncAuth) returns (generic.Empty); rpc FullDownload(SyncAuth) returns (generic.Empty); rpc SyncServerMethod(SyncServerMethodRequest) returns (generic.Json); } message SyncAuth { string hkey = 1; uint32 host_number = 2; } message SyncLoginRequest { string username = 1; string password = 2; } message SyncStatusResponse { enum Required { NO_CHANGES = 0; NORMAL_SYNC = 1; FULL_SYNC = 2; } Required required = 1; } message SyncCollectionResponse { enum ChangesRequired { NO_CHANGES = 0; NORMAL_SYNC = 1; FULL_SYNC = 2; // local collection has no cards; upload not an option FULL_DOWNLOAD = 3; // remote collection has no cards; download not an option FULL_UPLOAD = 4; } uint32 host_number = 1; string server_message = 2; ChangesRequired required = 3; } message SyncServerMethodRequest { enum Method { HOST_KEY = 0; META = 1; START = 2; APPLY_GRAVES = 3; APPLY_CHANGES = 4; CHUNK = 5; APPLY_CHUNK = 6; SANITY_CHECK = 7; FINISH = 8; ABORT = 9; // caller must reopen after these two are called FULL_UPLOAD = 10; FULL_DOWNLOAD = 11; } Method method = 1; bytes data = 2; }