backend/api/
versions.rs

1//! `/api/v1/versions` Returns info about api versions
2use axum::{Json, http::StatusCode, response::IntoResponse};
3use serde::Serialize;
4
5#[derive(Serialize)]
6struct Response {
7    unstable_features: UnstableFeatures,
8    versions: Vec<String>,
9}
10
11#[derive(Serialize)]
12struct UnstableFeatures;
13
14/// `GET /api/versions` Returns info about api versions.
15///
16/// requires auth: no
17///
18/// ### Response Example
19/// ```
20/// json!({
21///     "unstable_features": {},
22///     "versions": [
23///         "1"
24///     ]
25/// });
26/// ```
27pub async fn versions() -> impl IntoResponse {
28    let response = Response {
29        unstable_features: UnstableFeatures,
30        // TODO: Find a way to dynamically update this possibly?
31        versions: vec![String::from("1")],
32    };
33
34    (StatusCode::OK, Json(response))
35}