openapi docs

This commit is contained in:
Sebastian Hugentobler 2025-07-02 22:06:16 +02:00
parent 41206abac1
commit 9cf671ac94
Signed by: shu
SSH key fingerprint: SHA256:ppcx6MlixdNZd5EUM1nkHOKoyQYoJwzuQKXM6J/t66M
8 changed files with 15 additions and 0 deletions

View file

@ -36,6 +36,7 @@ impl HttpStatus for RetrieveError {
} }
http_error!(RetrieveError); http_error!(RetrieveError);
/// Get the first page of all authors.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/authors", path = "/authors",
@ -51,6 +52,7 @@ pub async fn handler_init(State(state): State<Arc<AppState>>) -> Result<Response
.context(AuthorsSnafu) .context(AuthorsSnafu)
} }
/// Get a paginated list of all authors.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/authors/{cursor}/{sort_order}", path = "/authors/{cursor}/{sort_order}",
@ -113,6 +115,7 @@ impl HttpStatus for SingleError {
} }
http_error!(SingleError); http_error!(SingleError);
/// Get a single author and all their books.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/authors/{id}", path = "/authors/{id}",

View file

@ -38,6 +38,7 @@ impl HttpStatus for RetrieveError {
} }
http_error!(RetrieveError); http_error!(RetrieveError);
/// Get the first page of all books.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/books", path = "/books",
@ -53,6 +54,7 @@ pub async fn handler_init(State(state): State<Arc<AppState>>) -> Result<Response
.context(BooksSnafu) .context(BooksSnafu)
} }
/// Get a paginated list of all books.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/books/{cursor}/{sort_order}", path = "/books/{cursor}/{sort_order}",
@ -134,6 +136,7 @@ impl HttpStatus for DownloadError {
} }
http_error!(DownloadError); http_error!(DownloadError);
/// Download a book file in the specified format.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/book/{id}/{format}", path = "/book/{id}/{format}",

View file

@ -41,6 +41,7 @@ impl HttpStatus for RetrieveError {
} }
http_error!(RetrieveError); http_error!(RetrieveError);
/// Get the thumbnail for a book cover.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/cover/{id}/thumbnail", path = "/cover/{id}/thumbnail",
@ -67,6 +68,7 @@ pub async fn thumbnail(
.context(CoverSnafu) .context(CoverSnafu)
} }
/// Get the full-size cover for a book.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/cover/{id}", path = "/cover/{id}",

View file

@ -44,6 +44,7 @@ pub struct Params {
/// Query for a search request. /// Query for a search request.
query: String, query: String,
} }
/// Search for books based on a query.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/search", path = "/search",

View file

@ -36,6 +36,7 @@ impl HttpStatus for RetrieveError {
} }
http_error!(RetrieveError); http_error!(RetrieveError);
/// Get the first page of all series.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/series", path = "/series",
@ -51,6 +52,7 @@ pub async fn handler_init(State(state): State<Arc<AppState>>) -> Result<Response
.context(SeriesSnafu) .context(SeriesSnafu)
} }
/// Get a paginated list of all series.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/series/{cursor}/{sort_order}", path = "/series/{cursor}/{sort_order}",
@ -113,6 +115,7 @@ impl HttpStatus for SingleError {
} }
http_error!(SingleError); http_error!(SingleError);
/// Get a single series and all its books.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/series/{id}", path = "/series/{id}",

View file

@ -43,6 +43,7 @@ impl HttpStatus for RecentError {
} }
http_error!(RecentError); http_error!(RecentError);
/// Get recently added books as an OPDS feed.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/recent", path = "/recent",

View file

@ -50,6 +50,7 @@ pub struct Params {
/// Query for a search request. /// Query for a search request.
query: String, query: String,
} }
/// Search for books and return results as an OPDS feed.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/search", path = "/search",

View file

@ -10,6 +10,7 @@ use rust_embed::RustEmbed;
pub struct Files; pub struct Files;
/// Get static file from the 'static' folder. /// Get static file from the 'static' folder.
/// Serve a static file.
#[utoipa::path( #[utoipa::path(
get, get,
path = "/static/{*file}", path = "/static/{*file}",