Command-line and Emacs Calendar Client
1(** Core event functionality and data access *) 2 3type event_id = string 4(** Event ID type *) 5 6type t 7(** Event type representing a calendar event *) 8 9type date_error = [ `Msg of string ] 10 11val create : 12 fs:Eio.Fs.dir_ty Eio.Path.t -> 13 calendar_dir_path:string -> 14 summary:string -> 15 start:Icalendar.date_or_datetime -> 16 ?end_: 17 [ `Duration of Icalendar.params * Ptime.Span.t 18 | `Dtend of Icalendar.params * Icalendar.date_or_datetime ] -> 19 ?location:string -> 20 ?description:string -> 21 ?recurrence:Icalendar.recurrence -> 22 string -> 23 t 24(** Create a new event with required properties. 25 26 The start and end times can be specified as Icalendar.timestamp values, 27 which allows for directly using any of the three RFC5545 time formats: 28 - `Utc time: Fixed to absolute UTC time 29 - `Local time: Floating local time (follows user's timezone) 30 - `With_tzid (time, timezone): Local time with timezone reference *) 31 32val edit : 33 ?summary:string -> 34 ?start:Icalendar.date_or_datetime -> 35 ?end_: 36 [ `Duration of Icalendar.params * Ptime.Span.t 37 | `Dtend of Icalendar.params * Icalendar.date_or_datetime ] -> 38 ?location:string -> 39 ?description:string -> 40 ?recurrence:Icalendar.recurrence -> 41 t -> 42 t 43(** Edit an existing event. *) 44 45val events_of_icalendar : 46 string -> file:Eio.Fs.dir_ty Eio.Path.t -> Icalendar.calendar -> t list 47 48val to_ical_event : t -> Icalendar.event 49val to_ical_calendar : t -> Icalendar.calendar 50val get_id : t -> event_id 51val get_summary : t -> string option 52 53val get_start : t -> Ptime.t 54(** Get the start time of an event. Note that local times are converted to UTC 55 based on their timezone information. If no timezone is specified, the system 56 timezone is used. *) 57 58val get_end : t -> Ptime.t option 59(** Get the end time of an event. Like get_start, times are converted to UTC 60 based on timezone information. Returns None if the event doesn't have an end 61 time. *) 62 63val is_date : t -> bool 64(** Returns true if either the start or end timestamp is specified as a date 65 instead of a datetime. *) 66 67val get_start_timezone : t -> string option 68val get_end_timezone : t -> string option 69val get_duration : t -> Ptime.span option 70val get_location : t -> string option 71val get_description : t -> string option 72val get_recurrence : t -> Icalendar.recurrence option 73val get_calendar_name : t -> string 74val get_file : t -> Eio.Fs.dir_ty Eio.Path.t 75 76type comparator = t -> t -> int 77(** Event comparator function type *) 78 79val by_start : comparator 80(** Compare events by start time, earlier times come first *) 81 82val by_end : comparator 83(** Compare events by end time, earlier times come first. Events with end times 84 come after those without *) 85 86val by_summary : comparator 87(** Compare events by summary alphabetically. Events with summaries come before 88 those without *) 89 90val by_location : comparator 91(** Compare events by location alphabetically. Events with locations come before 92 those without *) 93 94val by_calendar_name : comparator 95(** Compare events by calendar_name name alphabetically *) 96 97val descending : comparator -> comparator 98(** Reverse the order of a comparator *) 99 100val chain : comparator -> comparator -> comparator 101(** Chain two comparators together, using the second one as a tiebreaker when 102 the first one returns equality (0) *) 103 104(** Functions for formatting various data structures as strings *) 105 106type format = [ `Text | `Entries | `Json | `Csv | `Ics | `Sexp ] 107(** Format type for output *) 108 109(** Functions for formatting specific event types *) 110val format_event : ?format:format -> ?tz:Timedesc.Time_zone.t -> t -> string 111(** Format a single event, optionally using the specified timezone *) 112 113val format_events : 114 ?format:format -> ?tz:Timedesc.Time_zone.t -> t list -> string 115(** Format a list of events, optionally using the specified timezone *) 116 117val expand_recurrences : from:Ptime.t option -> to_:Ptime.t -> t -> t list