API consistency improvements
This commit is contained in:
parent
9707f4a96d
commit
bd5aeaf591
2 changed files with 14 additions and 14 deletions
src/server
|
@ -633,7 +633,7 @@ async fn get_artists(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/artists/{artist}",
|
||||
path = "/artist/{artist}",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
|
@ -654,15 +654,15 @@ async fn get_artist(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/artists/{artists}/albums/{album}",
|
||||
path = "/album/{album}/by/{artists}",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
("auth_query_param" = []),
|
||||
),
|
||||
params(
|
||||
("artists",),
|
||||
("album",),
|
||||
("artists",),
|
||||
),
|
||||
responses(
|
||||
(status = 200, body = dto::Album),
|
||||
|
@ -671,7 +671,7 @@ async fn get_artist(
|
|||
async fn get_album(
|
||||
_auth: Auth,
|
||||
State(index_manager): State<index::Manager>,
|
||||
Path((artists, name)): Path<(String, String)>,
|
||||
Path((name, artists)): Path<(String, String)>,
|
||||
) -> Result<Json<dto::Album>, APIError> {
|
||||
let artists = artists
|
||||
.split(API_ARRAY_SEPARATOR)
|
||||
|
@ -832,7 +832,7 @@ async fn get_genres(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/genres/{genre}",
|
||||
path = "/genre/{genre}",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
|
@ -853,7 +853,7 @@ async fn get_genre(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/genres/{genre}/albums",
|
||||
path = "/genre/{genre}/albums",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
|
@ -881,7 +881,7 @@ async fn get_genre_albums(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/genres/{genre}/artists",
|
||||
path = "/genre/{genre}/artists",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
|
@ -909,7 +909,7 @@ async fn get_genre_artists(
|
|||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/genres/{genre}/songs",
|
||||
path = "/genre/{genre}/songs",
|
||||
tag = "Collection",
|
||||
security(
|
||||
("auth_token" = []),
|
||||
|
|
|
@ -164,7 +164,7 @@ pub fn genres<VERSION: ProtocolVersion>() -> Request<()> {
|
|||
}
|
||||
|
||||
pub fn genre<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
||||
let endpoint = format!("/api/genres/{}", url_encode(genre));
|
||||
let endpoint = format!("/api/genre/{}", url_encode(genre));
|
||||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
|
@ -174,7 +174,7 @@ pub fn genre<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
|||
}
|
||||
|
||||
pub fn genre_albums<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
||||
let endpoint = format!("/api/genres/{}/albums", url_encode(genre));
|
||||
let endpoint = format!("/api/genre/{}/albums", url_encode(genre));
|
||||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
|
@ -184,7 +184,7 @@ pub fn genre_albums<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
|||
}
|
||||
|
||||
pub fn genre_artists<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
||||
let endpoint = format!("/api/genres/{}/artists", url_encode(genre));
|
||||
let endpoint = format!("/api/genre/{}/artists", url_encode(genre));
|
||||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
|
@ -194,7 +194,7 @@ pub fn genre_artists<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
|||
}
|
||||
|
||||
pub fn genre_songs<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
||||
let endpoint = format!("/api/genres/{}/songs", url_encode(genre));
|
||||
let endpoint = format!("/api/genre/{}/songs", url_encode(genre));
|
||||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
|
@ -207,7 +207,7 @@ pub fn random<VERSION: ProtocolVersion>() -> Request<()> {
|
|||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
.uri("/api/random")
|
||||
.uri("/api/albums/random")
|
||||
.body(())
|
||||
.unwrap()
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ pub fn recent<VERSION: ProtocolVersion>() -> Request<()> {
|
|||
Request::builder()
|
||||
.header("Accept-Version", VERSION::header_value())
|
||||
.method(Method::GET)
|
||||
.uri("/api/recent")
|
||||
.uri("/api/albums/recent")
|
||||
.body(())
|
||||
.unwrap()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue