85 lines
1.7 KiB
Protocol Buffer
85 lines
1.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package torrent;
|
|
|
|
service Torrents {
|
|
// Add a torrent from a magnet link or .torrent file and start downloading it.
|
|
rpc Add(AddRequest) returns (AddResponse);
|
|
// Get the current status of a single torrent.
|
|
rpc Status(StatusRequest) returns (TorrentStatus);
|
|
// List all torrents known to the daemon.
|
|
rpc List(ListRequest) returns (ListResponse);
|
|
// Remove a torrent from tracking.
|
|
rpc Remove(RemoveRequest) returns (RemoveResponse);
|
|
// Pause a downloading torrent.
|
|
rpc Pause(PauseRequest) returns (PauseResponse);
|
|
// Resume a paused torrent.
|
|
rpc Resume(ResumeRequest) returns (ResumeResponse);
|
|
}
|
|
|
|
message AddRequest {
|
|
string magnet = 1;
|
|
// Optional output directory override. Empty means use torad's default.
|
|
string output_dir = 2;
|
|
}
|
|
|
|
message AddResponse {
|
|
string id = 1;
|
|
}
|
|
|
|
message StatusRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message ListRequest {}
|
|
|
|
message ListResponse {
|
|
repeated TorrentStatus torrents = 1;
|
|
}
|
|
|
|
message RemoveRequest {
|
|
string id = 1;
|
|
bool delete_files = 2;
|
|
}
|
|
|
|
message RemoveResponse {}
|
|
|
|
message PauseRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message PauseResponse {}
|
|
|
|
message ResumeRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message ResumeResponse {}
|
|
|
|
enum State {
|
|
STATE_UNSPECIFIED = 0;
|
|
PENDING = 1;
|
|
DOWNLOADING = 2;
|
|
PAUSED = 3;
|
|
FINISHED = 4;
|
|
ERROR = 5;
|
|
}
|
|
|
|
message TorrentStatus {
|
|
string id = 1;
|
|
string info_hash = 2;
|
|
string name = 3;
|
|
string source = 4;
|
|
string output_path = 5;
|
|
uint64 total_bytes = 6;
|
|
uint64 downloaded_bytes = 7;
|
|
State state = 8;
|
|
string error_message = 9;
|
|
uint64 download_speed_bps = 10;
|
|
uint64 eta_seconds = 11;
|
|
uint64 uploaded_bytes = 12;
|
|
uint64 upload_speed_bps = 13;
|
|
uint32 peers = 14;
|
|
uint32 seeds = 15;
|
|
}
|