open Remind_sync open Utils type rem = { original_uuid : string; (** Original UID from the iCalendar event *) summary : string; (** Summary or title of the reminder *) date : Timedesc.Date.t; (** Date specification (day, month, year) *) end_date : Timedesc.Date.t option; (** Optional end date for a date range *) time : Timedesc.Time.t option; (** Optional time specification (hour, minute) *) duration : Timedesc.Span.t option; (** Optional duration for timed events *) recurring : Icalendar.event list; (** List of events that are part of the same recurring series: these are only the overrides, not the master event *) } [@@deriving show] (** A complete REM command *) let empty = { original_uuid = ""; summary = ""; date = Timedesc.Date.Ymd.make_exn ~year:1970 ~month:1 ~day:1; end_date = None; time = None; duration = None; recurring = []; } let string_of_rem rem = let b = Buffer.create 256 in Buffer.add_string b "REM "; Buffer.add_string b (spf "INFO \"UID: %s\" " rem.original_uuid); Buffer.add_string b (Timedesc.Date.to_rfc3339 rem.date); (match rem.time with | Some time -> Buffer.add_string b " AT "; Buffer.add_string b (string_of_time time) | None -> ()); (match rem.duration with | Some duration -> Buffer.add_string b " DURATION "; Buffer.add_string b (string_of_span duration); Buffer.add_string b "" | None -> ()); (match rem.end_date with | Some end_date -> Buffer.add_string b " THROUGH "; Buffer.add_string b (Timedesc.Date.to_rfc3339 end_date) | None -> ()); Buffer.add_string b " MSG "; Buffer.add_string b rem.summary; Buffer.contents b