Command-line and Emacs Calendar Client
1(** Functions for managing calendar directories with strings of .ics files *)
2
3type t
4(** A directory of strings, where each calendar_name is a subdirectory
5 containing .ics files *)
6
7val create :
8 fs:Eio.Fs.dir_ty Eio.Path.t -> string -> (t, [> `Msg of string ]) result
9(** Create a calendar_dir from a directory path. Returns Ok with the
10 calendar_dir if successful, or Error with a message if the directory cannot
11 be created or accessed. *)
12
13val list_calendar_names :
14 fs:Eio.Fs.dir_ty Eio.Path.t -> t -> (string list, [> `Msg of string ]) result
15(** List available strings in the calendar_dir. Returns Ok with the list of
16 string names if successful, or Error with a message if the directory cannot
17 be read. *)
18
19val get_calendar_events :
20 fs:Eio.Fs.dir_ty Eio.Path.t ->
21 t ->
22 string ->
23 (Event.t list, [> `Msg of string | `Not_found ]) result
24(** Get all calendar files in a string. If the calendar_name doesn't exist in
25 the cache, it will be loaded from disk. *)
26
27val get_events :
28 fs:Eio.Fs.dir_ty Eio.Path.t -> t -> (Event.t list, [> `Msg of string ]) result
29(** Get all events in all calendar_names. This will load any strings that
30 haven't been loaded yet. *)
31
32val add_event :
33 fs:Eio.Fs.dir_ty Eio.Path.t ->
34 t ->
35 Event.t list ->
36 Event.t ->
37 (Event.t list, [> `Msg of string ]) result
38(** Add an event to the calendar directory. Takes the current events list and returns
39 an updated events list with the new event added. *)
40
41val edit_event :
42 fs:Eio.Fs.dir_ty Eio.Path.t ->
43 t ->
44 Event.t list ->
45 Event.t ->
46 (Event.t list, [> `Msg of string ]) result
47(** Edit an event in the calendar directory. Takes the current events list and returns
48 an updated events list with the event updated. *)
49
50val delete_event :
51 fs:Eio.Fs.dir_ty Eio.Path.t ->
52 t ->
53 Event.t list ->
54 Event.t ->
55 (Event.t list, [> `Msg of string ]) result
56(** Delete an event from the calendar directory. Takes the current events list and returns
57 an updated events list with the event removed. *)
58
59val get_path : t -> string