1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// SPDX-License-Identifier: Apache-2.0
//! Calendar and reminders tool arguments and structured results.
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
fn default_page_limit() -> u32 {
25
}
/// Arguments for `calendar_list_events`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct ListEventsParams {
/// Calendar ids from `calendar_list_calendars`. Omit for every calendar that holds events.
#[serde(default)]
pub calendars: Vec<String>,
/// Start of the range, as an ISO-8601 date or timestamp. Included.
pub start: String,
/// End of the range, as an ISO-8601 date or timestamp. Excluded.
pub end: String,
/// Page size. Omitted means 25. More than 100 is rejected.
#[serde(default = "default_page_limit")]
pub limit: u32,
/// Cursor from the previous page.
#[serde(default)]
pub cursor: Option<String>,
}
/// Arguments for `calendar_get_event`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct GetByIdParams {
/// Opaque id from a list result.
pub id: String,
}
/// Arguments for `calendar_create_event`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct CreateEventParams {
/// Calendar id from `calendar_list_calendars`. It must hold events.
pub calendar: String,
/// Title of the event.
pub summary: String,
/// Notes.
#[serde(default)]
pub description: Option<String>,
/// Start: an ISO-8601 date for an all-day event, otherwise a timestamp.
pub start: String,
/// End. Omit for one hour after the start, or one day for an all-day event.
#[serde(default)]
pub end: Option<String>,
/// IANA time zone name, such as Europe/Berlin. Omit for UTC.
#[serde(default)]
pub time_zone: Option<String>,
/// Guests' email addresses, one plain address each (name@example.com), at most 50.
/// iCloud emails each one an invitation. Omit for an event with no guests.
#[serde(default)]
pub attendees: Option<Vec<String>>,
}
/// Arguments for `calendar_update_event`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct UpdateEventParams {
/// Opaque event id.
pub id: String,
/// The `etag` from the last read. A different one means the event changed.
pub etag: String,
/// New title. Omit to keep it.
#[serde(default)]
pub summary: Option<String>,
/// New notes. Omit to keep them.
#[serde(default)]
pub description: Option<String>,
/// New start. Omit to keep it.
#[serde(default)]
pub start: Option<String>,
/// New end. Omit to keep it.
#[serde(default)]
pub end: Option<String>,
/// IANA time zone for the new times. Omit to keep the event's zone.
#[serde(default)]
pub time_zone: Option<String>,
/// For a repeating event: the `recurrence_id` of one occurrence to change on its own.
/// Omit to change the whole series. Changing one occurrence needs `start` and `end`.
#[serde(default)]
pub occurrence: Option<String>,
/// The whole new guest list for the series, one plain address each, at most 50. It
/// replaces the old list: iCloud emails an invitation to each added guest and a
/// cancellation to each removed one. An empty list removes every guest. Omit to
/// leave the guests alone. Not allowed with `occurrence`. Leave your own address out.
#[serde(default)]
pub attendees: Option<Vec<String>>,
}
/// Arguments for the delete tools.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct DeleteParams {
/// Opaque id.
pub id: String,
/// The `etag` from the last read.
pub etag: String,
}
/// Arguments for `reminders_list`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct ListRemindersParams {
/// List id from `reminders_list_lists`. Omit for every list.
#[serde(default)]
pub list: Option<String>,
/// Also return completed reminders. Omitted means open reminders only.
#[serde(default)]
pub include_completed: Option<bool>,
/// Page size. Omitted means 25. More than 100 is rejected.
#[serde(default = "default_page_limit")]
pub limit: u32,
/// Cursor from the previous page.
#[serde(default)]
pub cursor: Option<String>,
}
/// Arguments for `reminders_create`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct CreateReminderParams {
/// List id from `reminders_list_lists`.
pub list: String,
/// Title.
pub title: String,
/// Notes.
#[serde(default)]
pub notes: Option<String>,
/// Due date or timestamp, ISO-8601.
#[serde(default)]
pub due: Option<String>,
/// Priority from 1 (highest) to 9.
#[serde(default)]
pub priority: Option<u8>,
}
/// Arguments for `reminders_update`.
#[derive(Debug, Default, Deserialize, JsonSchema)]
pub struct UpdateReminderParams {
/// Opaque reminder id.
pub id: String,
/// The `etag` from the last read.
pub etag: String,
/// New title. Omit to keep it.
#[serde(default)]
pub title: Option<String>,
/// New notes. Omit to keep them.
#[serde(default)]
pub notes: Option<String>,
/// New due date. Omit to keep it; an empty string removes it.
#[serde(default)]
pub due: Option<String>,
/// New priority, 1 to 9. Omit to keep it; 0 removes it.
#[serde(default)]
pub priority: Option<u8>,
/// Mark completed or open. Omit to keep it.
#[serde(default)]
pub completed: Option<bool>,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct CalendarOut {
pub(crate) id: String,
/// As the calendar's owner named it.
pub(crate) name: String,
/// `events`, `tasks` or `both`.
pub(crate) kind: &'static str,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct CalendarListOut {
pub(crate) calendars: Vec<CalendarOut>,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct EventOut {
pub(crate) id: String,
pub(crate) etag: String,
pub(crate) uid: String,
/// As the event's author wrote it.
pub(crate) summary: String,
/// As the event's author wrote it.
pub(crate) description: String,
pub(crate) start: String,
pub(crate) end: String,
pub(crate) time_zone: Option<String>,
pub(crate) all_day: bool,
pub(crate) recurring: bool,
/// Pass as `occurrence` to change only this occurrence.
pub(crate) recurrence_id: Option<String>,
/// As the event's author entered them.
pub(crate) attendees: Vec<String>,
pub(crate) alarms: Vec<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct EventListOut {
pub(crate) events: Vec<EventOut>,
pub(crate) next_cursor: Option<String>,
/// Items that could not be read and were skipped.
pub(crate) warnings: u32,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct WriteOut {
pub(crate) id: String,
/// The new `etag`, when the write returned one.
pub(crate) etag: Option<String>,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct DeleteOut {
pub(crate) deleted: bool,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct ReminderListOut {
pub(crate) id: String,
/// As the calendar's owner named it.
pub(crate) name: String,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct ReminderListsOut {
pub(crate) lists: Vec<ReminderListOut>,
/// Says that lists the Reminders app upgraded are not reachable.
pub(crate) note: &'static str,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct ReminderOut {
pub(crate) id: String,
pub(crate) etag: String,
/// As the reminder's author wrote it.
pub(crate) title: String,
/// As the reminder's author wrote it.
pub(crate) notes: String,
pub(crate) due: Option<String>,
pub(crate) priority: Option<u8>,
pub(crate) completed: bool,
}
#[derive(Debug, Serialize, JsonSchema)]
pub(crate) struct RemindersOut {
pub(crate) reminders: Vec<ReminderOut>,
pub(crate) next_cursor: Option<String>,
/// Items that could not be read and were skipped.
pub(crate) warnings: u32,
}