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(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/artists/{artist}",
|
path = "/artist/{artist}",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
|
@ -654,15 +654,15 @@ async fn get_artist(
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/artists/{artists}/albums/{album}",
|
path = "/album/{album}/by/{artists}",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
("auth_query_param" = []),
|
("auth_query_param" = []),
|
||||||
),
|
),
|
||||||
params(
|
params(
|
||||||
("artists",),
|
|
||||||
("album",),
|
("album",),
|
||||||
|
("artists",),
|
||||||
),
|
),
|
||||||
responses(
|
responses(
|
||||||
(status = 200, body = dto::Album),
|
(status = 200, body = dto::Album),
|
||||||
|
@ -671,7 +671,7 @@ async fn get_artist(
|
||||||
async fn get_album(
|
async fn get_album(
|
||||||
_auth: Auth,
|
_auth: Auth,
|
||||||
State(index_manager): State<index::Manager>,
|
State(index_manager): State<index::Manager>,
|
||||||
Path((artists, name)): Path<(String, String)>,
|
Path((name, artists)): Path<(String, String)>,
|
||||||
) -> Result<Json<dto::Album>, APIError> {
|
) -> Result<Json<dto::Album>, APIError> {
|
||||||
let artists = artists
|
let artists = artists
|
||||||
.split(API_ARRAY_SEPARATOR)
|
.split(API_ARRAY_SEPARATOR)
|
||||||
|
@ -832,7 +832,7 @@ async fn get_genres(
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/genres/{genre}",
|
path = "/genre/{genre}",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
|
@ -853,7 +853,7 @@ async fn get_genre(
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/genres/{genre}/albums",
|
path = "/genre/{genre}/albums",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
|
@ -881,7 +881,7 @@ async fn get_genre_albums(
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/genres/{genre}/artists",
|
path = "/genre/{genre}/artists",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
|
@ -909,7 +909,7 @@ async fn get_genre_artists(
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
get,
|
get,
|
||||||
path = "/genres/{genre}/songs",
|
path = "/genre/{genre}/songs",
|
||||||
tag = "Collection",
|
tag = "Collection",
|
||||||
security(
|
security(
|
||||||
("auth_token" = []),
|
("auth_token" = []),
|
||||||
|
|
|
@ -164,7 +164,7 @@ pub fn genres<VERSION: ProtocolVersion>() -> Request<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn genre<VERSION: ProtocolVersion>(genre: &str) -> 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()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.method(Method::GET)
|
||||||
|
@ -174,7 +174,7 @@ pub fn genre<VERSION: ProtocolVersion>(genre: &str) -> Request<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn genre_albums<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()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.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<()> {
|
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()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.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<()> {
|
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()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.method(Method::GET)
|
||||||
|
@ -207,7 +207,7 @@ pub fn random<VERSION: ProtocolVersion>() -> Request<()> {
|
||||||
Request::builder()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.method(Method::GET)
|
||||||
.uri("/api/random")
|
.uri("/api/albums/random")
|
||||||
.body(())
|
.body(())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ pub fn recent<VERSION: ProtocolVersion>() -> Request<()> {
|
||||||
Request::builder()
|
Request::builder()
|
||||||
.header("Accept-Version", VERSION::header_value())
|
.header("Accept-Version", VERSION::header_value())
|
||||||
.method(Method::GET)
|
.method(Method::GET)
|
||||||
.uri("/api/recent")
|
.uri("/api/albums/recent")
|
||||||
.body(())
|
.body(())
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue