1mod contract;
4mod extract;
5mod pagination;
6mod routes;
7
8use axum::{
9 http::StatusCode,
10 response::{IntoResponse, Response},
11};
12pub use contract::{ApiDocument, ApiRouteInfo};
13pub use extract::{Json, Path, Query};
14pub use pagination::{Page, PageMeta, Paginated, Pagination, PaginationMeta};
15pub use routes::{RouteInfo, Routes};
16pub use schemars as schema;
17pub use schemars::JsonSchema as ApiSchema;
18use serde::Serialize;
19
20#[derive(Debug, Clone)]
22pub struct Created<T>(pub T);
23
24impl<T: Serialize> IntoResponse for Created<T> {
25 fn into_response(self) -> Response {
26 (StatusCode::CREATED, Json(self.0)).into_response()
27 }
28}
29
30#[derive(Debug, Clone, Copy)]
32pub struct NoContent;
33
34impl IntoResponse for NoContent {
35 fn into_response(self) -> Response {
36 StatusCode::NO_CONTENT.into_response()
37 }
38}
39
40pub async fn health() -> Json<HealthResponse> {
42 Json(HealthResponse { status: "ok" })
43}
44
45#[derive(Debug, Serialize, ApiSchema)]
47pub struct HealthResponse {
48 pub status: &'static str,
50}