diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3a2e9a3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true +end_of_line = lf + +[*.{proto}] +indent_style = space +indent_size = 2 + +[*.{md,markdown}] +trim_trailing_whitespace = false diff --git a/crabidy-core/buf.yaml b/crabidy-core/buf.yaml new file mode 100644 index 0000000..c126332 --- /dev/null +++ b/crabidy-core/buf.yaml @@ -0,0 +1 @@ +version: v1 diff --git a/crabidy-core/build.rs b/crabidy-core/build.rs index 42ae371..c580b63 100644 --- a/crabidy-core/build.rs +++ b/crabidy-core/build.rs @@ -1,4 +1,4 @@ fn main() -> Result<(), Box> { - tonic_build::compile_protos("proto/crabidy.proto")?; + tonic_build::compile_protos("crabidy/v1/crabidy.proto")?; Ok(()) } diff --git a/crabidy-core/proto/crabidy.proto b/crabidy-core/crabidy/v1/crabidy.proto similarity index 65% rename from crabidy-core/proto/crabidy.proto rename to crabidy-core/crabidy/v1/crabidy.proto index bd944e4..681b028 100644 --- a/crabidy-core/proto/crabidy.proto +++ b/crabidy-core/crabidy/v1/crabidy.proto @@ -1,12 +1,13 @@ syntax = "proto3"; -package crabidy; +package crabidy.v1; -service Library { - rpc GetLibraryNode (LibraryNodeRequest) returns (LibraryNodeResponse); +service LibraryService { + rpc GetLibraryNode(GetLibraryNodeRequest) returns (GetLibraryNodeResponse); + rpc GetTrack(GetTrackRequest) returns (GetTrackResponse); } // To signal whether it's loading data (for frontend only probably - -// could also be used for clients?) +// could also be used for fetching from providers?) enum LibraryNodeState { LIBRARY_NODE_STATE_UNSPECIFIED = 0; LIBRARY_NODE_STATE_PENDING = 1; @@ -41,10 +42,18 @@ message LibraryNode { bool is_queable = 7; } -message LibraryNodeRequest { +message GetLibraryNodeRequest { string uuid = 1; } -message LibraryNodeResponse { +message GetLibraryNodeResponse { LibraryNode node = 1; } + +message GetTrackRequest { + string uuid = 1; +} + +message GetTrackResponse { + Track track = 1; +} diff --git a/crabidy-core/src/lib.rs b/crabidy-core/src/lib.rs index 1634754..c3a350c 100644 --- a/crabidy-core/src/lib.rs +++ b/crabidy-core/src/lib.rs @@ -2,7 +2,7 @@ pub mod proto; use async_trait::async_trait; -use proto::crabidy::LibraryNode; + #[async_trait] pub trait ProviderClient: std::fmt::Debug + Send + Sync { diff --git a/crabidy-core/src/proto.rs b/crabidy-core/src/proto.rs index e2b88c7..440325c 100644 --- a/crabidy-core/src/proto.rs +++ b/crabidy-core/src/proto.rs @@ -1,4 +1,4 @@ pub mod crabidy { // The string specified here must match the proto package name - tonic::include_proto!("crabidy"); + tonic::include_proto!("crabidy.v1"); }