pinakes-server: add utoipa annotations to all routes; fix tests

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I28cf5b7b7cff8e90e123d624d97cf9656a6a6964
This commit is contained in:
raf 2026-03-21 02:17:55 +03:00
commit 9d58927cb4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
60 changed files with 3493 additions and 242 deletions

View file

@ -49,6 +49,18 @@ fn escape_xml(s: &str) -> String {
.replace('\'', "&apos;")
}
#[utoipa::path(
get,
path = "/api/v1/media/{id}/stream/hls/master.m3u8",
tag = "streaming",
params(("id" = Uuid, Path, description = "Media item ID")),
responses(
(status = 200, description = "HLS master playlist"),
(status = 401, description = "Unauthorized"),
(status = 404, description = "Not found"),
),
security(("bearer_auth" = []))
)]
pub async fn hls_master_playlist(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@ -75,6 +87,22 @@ pub async fn hls_master_playlist(
build_response("application/vnd.apple.mpegurl", playlist)
}
#[utoipa::path(
get,
path = "/api/v1/media/{id}/stream/hls/{profile}/playlist.m3u8",
tag = "streaming",
params(
("id" = Uuid, Path, description = "Media item ID"),
("profile" = String, Path, description = "Transcode profile name"),
),
responses(
(status = 200, description = "HLS variant playlist"),
(status = 400, description = "Bad request"),
(status = 401, description = "Unauthorized"),
(status = 404, description = "Not found"),
),
security(("bearer_auth" = []))
)]
pub async fn hls_variant_playlist(
State(state): State<AppState>,
Path((id, profile)): Path<(Uuid, String)>,
@ -112,6 +140,23 @@ pub async fn hls_variant_playlist(
build_response("application/vnd.apple.mpegurl", playlist)
}
#[utoipa::path(
get,
path = "/api/v1/media/{id}/stream/hls/{profile}/{segment}",
tag = "streaming",
params(
("id" = Uuid, Path, description = "Media item ID"),
("profile" = String, Path, description = "Transcode profile name"),
("segment" = String, Path, description = "Segment filename"),
),
responses(
(status = 200, description = "HLS segment data"),
(status = 202, description = "Segment not yet available"),
(status = 400, description = "Bad request"),
(status = 401, description = "Unauthorized"),
),
security(("bearer_auth" = []))
)]
pub async fn hls_segment(
State(state): State<AppState>,
Path((id, profile, segment)): Path<(Uuid, String, String)>,
@ -167,6 +212,19 @@ pub async fn hls_segment(
))
}
#[utoipa::path(
get,
path = "/api/v1/media/{id}/stream/dash/manifest.mpd",
tag = "streaming",
params(("id" = Uuid, Path, description = "Media item ID")),
responses(
(status = 200, description = "DASH manifest"),
(status = 400, description = "Bad request"),
(status = 401, description = "Unauthorized"),
(status = 404, description = "Not found"),
),
security(("bearer_auth" = []))
)]
pub async fn dash_manifest(
State(state): State<AppState>,
Path(id): Path<Uuid>,
@ -216,6 +274,23 @@ pub async fn dash_manifest(
build_response("application/dash+xml", mpd)
}
#[utoipa::path(
get,
path = "/api/v1/media/{id}/stream/dash/{profile}/{segment}",
tag = "streaming",
params(
("id" = Uuid, Path, description = "Media item ID"),
("profile" = String, Path, description = "Transcode profile name"),
("segment" = String, Path, description = "Segment filename"),
),
responses(
(status = 200, description = "DASH segment data"),
(status = 202, description = "Segment not yet available"),
(status = 400, description = "Bad request"),
(status = 401, description = "Unauthorized"),
),
security(("bearer_auth" = []))
)]
pub async fn dash_segment(
State(state): State<AppState>,
Path((id, profile, segment)): Path<(Uuid, String, String)>,