Add some more proto messages

This commit is contained in:
chmanie 2023-05-20 12:16:25 +02:00
parent f76ba00ce4
commit 81229ce757
2 changed files with 23 additions and 6 deletions

View File

@ -5,25 +5,32 @@ service Library {
rpc GetLibraryNode (LibraryNodeRequest) returns (LibraryNodeResponse); rpc GetLibraryNode (LibraryNodeRequest) returns (LibraryNodeResponse);
} }
// To signal whether it's loading data (for frontend only probably) // To signal whether it's loading data (for frontend only probably -
// could also be used for clients?)
enum LibraryNodeState { enum LibraryNodeState {
LIBRARY_NODE_STATE_UNSPECIFIED = 0; LIBRARY_NODE_STATE_UNSPECIFIED = 0;
LIBRARY_NODE_STATE_PENDING = 1; LIBRARY_NODE_STATE_PENDING = 1;
LIBRARY_NODE_STATE_DONE = 2; LIBRARY_NODE_STATE_DONE = 2;
} }
message Album {
string title = 1;
optional string release_date = 2;
}
message Artist {
string name = 1;
}
message Track { message Track {
// Including provider // Including provider
string uuid = 1; string uuid = 1;
string artist = 2; string artist = 2;
string title = 3; string title = 3;
optional uint32 duration = 4;
} }
message LibraryNodeRequest { message LibraryNode {
string uuid = 1;
}
message LibraryNodeResponse {
// Including provider // Including provider
string uuid = 1; string uuid = 1;
string name = 2; string name = 2;
@ -33,3 +40,11 @@ message LibraryNodeResponse {
repeated Track tracks = 6; repeated Track tracks = 6;
bool is_queable = 7; bool is_queable = 7;
} }
message LibraryNodeRequest {
string uuid = 1;
}
message LibraryNodeResponse {
LibraryNode node = 1;
}

View File

@ -2,6 +2,8 @@ pub mod proto;
use async_trait::async_trait; use async_trait::async_trait;
use proto::crabidy::LibraryNode;
#[async_trait] #[async_trait]
pub trait ProviderClient: std::fmt::Debug + Send + Sync { pub trait ProviderClient: std::fmt::Debug + Send + Sync {
async fn get_urls_for_track(&self, track_uuid: &str) -> Result<Vec<String>, ProviderError>; async fn get_urls_for_track(&self, track_uuid: &str) -> Result<Vec<String>, ProviderError>;