Skip to main content

romm_api/endpoints/
system.rs

1//! System and authentication helper endpoints (heartbeat, stats, profile).
2
3use serde_json::Value;
4
5use super::Endpoint;
6
7/// `GET /api/heartbeat` — server metadata (authenticated when credentials are set).
8#[derive(Debug, Default, Clone)]
9pub struct GetHeartbeat;
10
11impl Endpoint for GetHeartbeat {
12    type Output = Value;
13
14    fn method(&self) -> &'static str {
15        "GET"
16    }
17
18    fn path(&self) -> String {
19        "/api/heartbeat".into()
20    }
21}
22
23/// `GET /api/stats` — aggregate library statistics.
24#[derive(Debug, Default, Clone)]
25pub struct GetStats;
26
27impl Endpoint for GetStats {
28    type Output = Value;
29
30    fn method(&self) -> &'static str {
31        "GET"
32    }
33
34    fn path(&self) -> String {
35        "/api/stats".into()
36    }
37}
38
39/// `GET /api/users/me` — current user profile.
40#[derive(Debug, Default, Clone)]
41pub struct GetUsersMe;
42
43impl Endpoint for GetUsersMe {
44    type Output = Value;
45
46    fn method(&self) -> &'static str {
47        "GET"
48    }
49
50    fn path(&self) -> String {
51        "/api/users/me".into()
52    }
53}