sentrystr_api/
models.rs

1use chrono::{DateTime, Utc};
2use sentrystr::Level;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize)]
6pub struct EventResponse {
7    pub nostr_event_id: String,
8    pub author: String,
9    pub received_at: DateTime<Utc>,
10    pub event: EventData,
11}
12
13#[derive(Debug, Serialize, Deserialize)]
14pub struct EventData {
15    pub event_id: String,
16    pub timestamp: DateTime<Utc>,
17    pub platform: String,
18    pub level: Level,
19    pub logger: Option<String>,
20    pub transaction: Option<String>,
21    pub server_name: Option<String>,
22    pub release: Option<String>,
23    pub environment: Option<String>,
24    pub message: Option<String>,
25    pub tags: std::collections::HashMap<String, String>,
26    pub extra: std::collections::HashMap<String, serde_json::Value>,
27}
28
29#[derive(Debug, Deserialize)]
30pub struct EventQuery {
31    pub author: Option<String>,
32    pub level: Option<String>,
33    pub service: Option<String>,
34    pub environment: Option<String>,
35    pub component: Option<String>,
36    pub severity: Option<String>,
37    pub since: Option<DateTime<Utc>>,
38    pub until: Option<DateTime<Utc>>,
39    pub limit: Option<usize>,
40}
41
42#[derive(Debug, Serialize)]
43pub struct EventsResponse {
44    pub events: Vec<EventResponse>,
45    pub total: usize,
46}
47
48#[derive(Debug, Serialize)]
49pub struct HealthResponse {
50    pub status: String,
51    pub timestamp: DateTime<Utc>,
52}