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 Collection.t -> 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 Collection.t -> 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_collection : t -> Collection.t 74val get_file : t -> Eio.Fs.dir_ty Eio.Path.t 75val get_recurrence_ids : t -> Icalendar.event list 76 77type comparator = t -> t -> int 78(** Event comparator function type *) 79 80val by_start : comparator 81(** Compare events by start time, earlier times come first *) 82 83val by_end : comparator 84(** Compare events by end time, earlier times come first. Events with end times 85 come after those without *) 86 87val by_summary : comparator 88(** Compare events by summary alphabetically. Events with summaries come before 89 those without *) 90 91val by_location : comparator 92(** Compare events by location alphabetically. Events with locations come before 93 those without *) 94 95val by_collection : comparator 96(** Compare events by collection name alphabetically *) 97 98val descending : comparator -> comparator 99(** Reverse the order of a comparator *) 100 101val chain : comparator -> comparator -> comparator 102(** Chain two comparators together, using the second one as a tiebreaker when 103 the first one returns equality (0) *) 104 105(** Functions for formatting various data structures as strings *) 106 107type format = [ `Text | `Entries | `Json | `Csv | `Ics | `Sexp ] 108(** Format type for output *) 109 110(** Functions for formatting specific event types *) 111val format_event : ?format:format -> ?tz:Timedesc.Time_zone.t -> t -> string 112(** Format a single event, optionally using the specified timezone *) 113 114val format_events : 115 ?format:format -> ?tz:Timedesc.Time_zone.t -> t list -> string 116(** Format a list of events, optionally using the specified timezone *) 117 118val expand_recurrences : from:Ptime.t option -> to_:Ptime.t -> t -> t list