Skip to main content

feagi_api/endpoints/
input.rs

1// Copyright 2025 Neuraville Inc.
2// Licensed under the Apache License, Version 2.0
3
4//! Input API Endpoints - Exact port from Python `/v1/input/*`
5
6// Removed - using crate::common::State instead
7use crate::common::ApiState;
8use crate::common::{ApiError, ApiResult, Json, State};
9use std::collections::HashMap;
10
11/// Get vision input configuration and settings.
12#[utoipa::path(
13    get,
14    path = "/v1/input/vision",
15    tag = "input",
16    responses(
17        (status = 200, description = "Vision input configuration", body = HashMap<String, serde_json::Value>),
18        (status = 500, description = "Internal server error")
19    )
20)]
21pub async fn get_vision(
22    State(_state): State<ApiState>,
23) -> ApiResult<Json<HashMap<String, serde_json::Value>>> {
24    // TODO: Get vision input configuration
25    Ok(Json(HashMap::new()))
26}
27
28/// Update vision input configuration.
29#[utoipa::path(
30    post,
31    path = "/v1/input/vision",
32    tag = "input",
33    responses(
34        (status = 200, description = "Vision input updated", content_type = "application/json"),
35        (status = 500, description = "Not yet implemented")
36    )
37)]
38pub async fn post_vision(
39    State(_state): State<ApiState>,
40    Json(_req): Json<HashMap<String, serde_json::Value>>,
41) -> ApiResult<Json<HashMap<String, String>>> {
42    Err(ApiError::internal("Not yet implemented"))
43}
44
45/// Get list of available input sources (vision, audio, etc.).
46#[utoipa::path(get, path = "/v1/input/sources", tag = "input")]
47pub async fn get_sources(State(_state): State<ApiState>) -> ApiResult<Json<Vec<String>>> {
48    Ok(Json(vec!["vision".to_string()]))
49}
50
51/// Configure input sources and their parameters.
52#[utoipa::path(post, path = "/v1/input/configure", tag = "input")]
53pub async fn post_configure(
54    State(_state): State<ApiState>,
55    Json(_req): Json<HashMap<String, serde_json::Value>>,
56) -> ApiResult<Json<HashMap<String, String>>> {
57    Ok(Json(HashMap::from([(
58        "message".to_string(),
59        "Input configured".to_string(),
60    )])))
61}