car_integrations/calendar/
mod.rs1use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5
6use super::{Availability, IntegrationError};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct Calendar {
10 pub id: String,
12 pub title: String,
14 pub source: Option<String>,
16 pub color: Option<String>,
18 pub writable: bool,
20}
21
22#[derive(Debug, Clone, Serialize, Deserialize)]
23pub struct Event {
24 pub id: String,
25 pub calendar_id: String,
26 pub title: String,
27 pub start: DateTime<Utc>,
28 pub end: DateTime<Utc>,
29 #[serde(default)]
30 pub all_day: bool,
31 pub location: Option<String>,
32 pub notes: Option<String>,
33 #[serde(default)]
34 pub attendees: Vec<String>,
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct CalendarListing {
39 #[serde(flatten)]
40 pub availability: Availability,
41 pub calendars: Vec<Calendar>,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
45pub struct EventListing {
46 #[serde(flatten)]
47 pub availability: Availability,
48 pub events: Vec<Event>,
49}
50
51pub fn list_calendars() -> Result<CalendarListing, IntegrationError> {
52 Ok(CalendarListing {
53 availability: current_backend_pending(),
54 calendars: vec![],
55 })
56}
57
58pub fn list_events(
61 _start: DateTime<Utc>,
62 _end: DateTime<Utc>,
63 _calendar_ids: &[String],
64) -> Result<EventListing, IntegrationError> {
65 Ok(EventListing {
66 availability: current_backend_pending(),
67 events: vec![],
68 })
69}
70
71fn current_backend_pending() -> Availability {
72 #[cfg(target_os = "macos")]
73 {
74 Availability::pending(
75 "eventkit",
76 "EventKit backend not yet wired. API shape is stable; \
77 downstream apps can code against it now.",
78 )
79 }
80 #[cfg(target_os = "windows")]
81 {
82 Availability::pending(
83 "msgraph",
84 "MS Graph / Outlook MAPI backends not yet wired. API shape \
85 is stable; downstream apps can code against it now.",
86 )
87 }
88 #[cfg(target_os = "linux")]
89 {
90 Availability::pending(
91 "eds",
92 "Evolution Data Server + CalDAV backends not yet wired. \
93 API shape is stable; downstream apps can code against it now.",
94 )
95 }
96 #[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]
97 {
98 Availability::pending("none", "Unsupported OS — no calendar backend modeled.")
99 }
100}