summaryrefslogtreecommitdiff
path: root/src/api/search_results.rs
diff options
context:
space:
mode:
authorniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 19:11:24 +0100
committerniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2025-01-26 19:11:24 +0100
commitc622eab39ac7dd9f794b5d60eb937e29c9b3bd6e (patch)
treea75067a661250a4ed74096929083948f65c01fdb /src/api/search_results.rs
parent5891af7e8c1411029fe1ad9c6d3182f88bcf3dfd (diff)
add api documentation
Diffstat (limited to 'src/api/search_results.rs')
-rw-r--r--src/api/search_results.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/api/search_results.rs b/src/api/search_results.rs
index f53bce8..cd47054 100644
--- a/src/api/search_results.rs
+++ b/src/api/search_results.rs
@@ -4,12 +4,22 @@ use crate::database::song::Song;
use crate::AppState;
use actix_web::{get, web, HttpResponse};
use serde::Deserialize;
+use utoipa::IntoParams;
-#[derive(Deserialize)]
+#[derive(Deserialize, IntoParams)]
struct SearchQueryOptions {
name: Option<String>,
}
+#[utoipa::path(
+ params(SearchQueryOptions),
+ context_path = "/api",
+ description = "Performs a search based on the 'name' parameter and returns a list.",
+ responses(
+ (status = 200, description = "Return a list of artists, albums and songs"),
+ (status = 400, description = "Errors found, unfulfilled request"),
+ ),
+)]
#[get("/search-results")]
pub async fn search_results(
app_state: web::Data<AppState>,