Command-line and Emacs Calendar Client
1(** Filter-based searching and querying of calendar events *)
2
3type filter
4(** Type representing a query filter *)
5
6type sort_order = [ `Ascending | `Descending ]
7(** Type representing the sort order *)
8
9type sort_by = [ `Start | `End | `Summary | `Location | `Calendar ]
10(** Type representing sort criteria *)
11
12val summary_contains : string -> filter
13val description_contains : string -> filter
14val location_contains : string -> filter
15val in_collections : Collection.t list -> filter
16val recurring_only : unit -> filter
17val non_recurring_only : unit -> filter
18val with_id : Event.event_id -> filter
19val and_filter : filter list -> filter
20val or_filter : filter list -> filter
21val not_filter : filter -> filter
22
23val query_events :
24 fs:[> Eio.Fs.dir_ty ] Eio.Path.t ->
25 Calendar_dir.t ->
26 ?filter:filter ->
27 ?sort_by:[< `Calendar | `End | `Location | `Start | `Summary ] ->
28 ?order:[< `Ascending | `Descending ] ->
29 ?limit:int ->
30 unit ->
31 (Event.t list, [> `Msg of string ]) result
32(** Find events without expansion of recurring events. Returns Ok with the list
33 of events, or Error with a message. *)
34
35val query :
36 fs:[> Eio.Fs.dir_ty ] Eio.Path.t ->
37 Calendar_dir.t ->
38 ?filter:filter ->
39 from:Ptime.t option ->
40 to_:Ptime.t ->
41 ?sort_by:sort_by ->
42 ?order:sort_order ->
43 ?limit:int ->
44 unit ->
45 (Recur.instance list, [> `Msg of string ]) result
46(** Find events with expansion of recurring events. Returns Ok with the list of
47 instances, or Error with a message. *)
48
49(* Test-only helper functions *)
50val matches_filter : Event.t -> filter -> bool
51(** Check if an event matches the given filter *)
52
53val compare_events : sort_by -> sort_order -> Event.t -> Event.t -> int
54(** Compare two events based on the sort criteria and order *)