From c622eab39ac7dd9f794b5d60eb937e29c9b3bd6e Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Sun, 26 Jan 2025 19:11:24 +0100 Subject: add api documentation --- src/api/search_results.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/api/search_results.rs') 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, } +#[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, -- cgit v1.2.3