calendaring_jmap.objects.calendar_object module#

JMAP calendar resource object.

Wraps a raw JSCalendar CalendarEvent dict with a minimal interface: .id, .parent, get_data, get_icalendar_instance, edit_icalendar_instance, and save.

class calendaring_jmap.objects.calendar_object.JMAPCalendarObject(data, parent)[source]#

Bases: object

Thin wrapper around a raw JSCalendar CalendarEvent dict.

Stores the server's JSON response as-is. No JMAP field names are mapped to typed attributes: callers work with the dict directly via get_data(), or convert to iCalendar via get_icalendar_instance().

Variables:
  • data (dict) – Raw JSCalendar CalendarEvent dict as returned by CalendarEvent/get.

  • parent – The JMAPCalendar this object belongs to, or None when fetched without a calendar context (e.g. via get_event()).

data: dict#
edit_icalendar_instance()[source]#

Borrow an editable icalendar.Calendar for this object.

Yields the cached icalendar.Calendar for in-place editing. Call save() after the with block to persist changes to the server.

Note: save() is sync-only. Async-backed calendars cannot use this path yet.

Example:

with obj.edit_icalendar_instance() as cal:
    cal.subcomponents[0]["SUMMARY"] = vText("New title")
obj.save()
get_data()[source]#

Return the raw JSCalendar dict as returned by CalendarEvent/get.

Return type:

dict

get_icalendar_instance()[source]#

Return an icalendar.Calendar for this object.

The result is cached after the first conversion. Treat it as read-only; use edit_icalendar_instance() to make and persist changes.

Return type:

Calendar

property id: str#

Server-assigned JMAP event ID.

parent: JMAPCalendar | None#
save()[source]#

Persist changes made via edit_icalendar_instance() to the server.

If edit_icalendar_instance() was used, the (possibly edited) icalendar object is converted back to a JSCalendar dict first. If it wasn't, data is sent as-is, with no round trip through iCalendar.

Raises:
  • JMAPMethodError – If no parent calendar is set (parent is None).

  • RuntimeError – If called on an async-backed calendar.

  • ValueError – If edit_icalendar_instance() was used and the edit leaves the object missing UID/DTSTART, or with DTEND before DTSTART; raised by the conversion back to JSCalendar, before update_event is ever called.

Return type:

None

Last updated on 2026-11-01.