Refactor the proto

This commit is contained in:
Alexander
2026-05-07 17:02:46 +02:00
parent 3d111f9008
commit 54d94b939e
5 changed files with 371 additions and 248 deletions
+28 -32
View File
@@ -9,30 +9,14 @@ enum Provider {
PROVIDER_MUSICBRAINZ = 1;
}
// MetadataService provides music metadata aggregation.
service MetadataService {
// GetArtist retrieves an artist by ID or external source ID.
rpc GetArtist(GetArtistRequest) returns (Artist);
// SearchArtists searches for artists by name.
rpc GetArtist(GetArtistRequest) returns (GetArtistResponse);
rpc SearchArtists(SearchArtistsRequest) returns (SearchArtistsResponse);
// GetAlbum retrieves an album by ID.
rpc GetAlbum(GetAlbumRequest) returns (Album);
// GetArtistAlbums retrieves all albums by an artist.
rpc GetAlbum(GetAlbumRequest) returns (GetAlbumResponse);
rpc GetArtistAlbums(GetArtistAlbumsRequest) returns (GetArtistAlbumsResponse);
// GetTrack retrieves a track by ID.
rpc GetTrack(GetTrackRequest) returns (Track);
// GetAlbumTracks retrieves all tracks on an album.
rpc GetTrack(GetTrackRequest) returns (GetTrackResponse);
rpc GetAlbumTracks(GetAlbumTracksRequest) returns (GetAlbumTracksResponse);
// SearchAlbums searches for albums by name, optionally filtered by artist.
rpc SearchAlbums(SearchAlbumsRequest) returns (SearchAlbumsResponse);
// SyncArtist triggers ingestion of an artist from external sources.
rpc SyncArtist(SyncArtistRequest) returns (SyncArtistResponse);
}
@@ -40,10 +24,10 @@ service MetadataService {
message GetArtistRequest {
oneof identifier {
string id = 1; // Internal UUID
ExternalID external = 2; // External source ID (e.g., musicbrainz MBID)
string id = 1;
ExternalID external = 2;
}
Provider provider = 3; // UNSPECIFIED = query all providers
Provider provider = 3;
}
message SearchArtistsRequest {
@@ -90,11 +74,6 @@ message SearchAlbumsRequest {
Provider provider = 5;
}
message SearchAlbumsResponse {
repeated Album albums = 1;
int32 total = 2;
}
message SyncArtistRequest {
oneof target {
string name = 1;
@@ -105,20 +84,37 @@ message SyncArtistRequest {
// Responses
message GetArtistResponse {
Artist artist = 1;
}
message SearchArtistsResponse {
repeated Artist artists = 1;
int32 total = 2;
}
message GetAlbumResponse {
Album album = 1;
}
message GetArtistAlbumsResponse {
repeated Album albums = 1;
int32 total = 2;
}
message GetTrackResponse {
Track track = 1;
}
message GetAlbumTracksResponse {
repeated Track tracks = 1;
}
message SearchAlbumsResponse {
repeated Album albums = 1;
int32 total = 2;
}
message SyncArtistResponse {
Artist artist = 1;
int32 albums_synced = 2;
@@ -131,7 +127,7 @@ message Artist {
string id = 1;
string name = 2;
string sort_name = 3;
string artist_type = 4; // person, group, orchestra, etc.
string artist_type = 4;
string country = 5;
string formed_date = 6;
string disbanded_date = 7;
@@ -144,7 +140,7 @@ message Artist {
message Album {
string id = 1;
string title = 2;
string album_type = 3; // album, ep, single, compilation
string album_type = 3;
string release_date = 4;
string upc = 5;
int32 total_tracks = 6;
@@ -190,13 +186,13 @@ message Genre {
message ArtistCredit {
Artist artist = 1;
string role = 2; // primary, featured, remixer, producer
string role = 2;
int32 position = 3;
string join_phrase = 4; // " & ", " feat. ", etc.
string join_phrase = 4;
}
message ExternalID {
string source = 1; // musicbrainz, spotify, discogs, etc.
string source = 1;
string source_id = 2;
string url = 3;
}