ordinary-api 0.8.2

API server for Ordinary
Documentation
// Copyright (C) 2026 Ordinary Labs, LLC.
//
// SPDX-License-Identifier: AGPL-3.0-only

use crate::server::OrdinaryApiServerState;
use crate::server::openapi::ADMIN;
use axum::extract::State;
use axum::http::{StatusCode, header};
use axum::response::IntoResponse;
use ordinary_config::OrdinaryApiLimits;
use std::sync::Arc;

#[utoipa::path(
    get,
    path = "/limits",
    tag = ADMIN,
    responses(
        (status = 200, description = "limits for this instance", body = OrdinaryApiLimits),
    ),
)]
pub async fn limits(State(state): State<Arc<OrdinaryApiServerState>>) -> impl IntoResponse {
    (
        StatusCode::OK,
        [(header::CONTENT_TYPE, "application/json")],
        state.limits.clone(),
    )
}

#[utoipa::path(
    get,
    path = "/healthz",
    tag = ADMIN,
    responses(
        (status = 200, description = "health check endpoint for this instance"),
    ),
)]
pub async fn health() -> impl IntoResponse {
    StatusCode::OK
}