calendaring_sync.adapters.jmap module#

The JMAP adapter, which syncs one account’s calendar events through calendaring-jmap.

It needs the jmap extra, as Install shows. Adapters explains every rule it follows, and Server compatibility how each tested server behaves.

calendaring_sync.adapters.jmap.FINGERPRINT_SCHEME = 'jmap-canonical-1'#

The name of the canonical fingerprint this adapter computes. A change to how it’s computed gets a new name, so every scope is listed again.

calendaring_sync.adapters.jmap.MEDIA_TYPE = 'application/jscalendar+json'#

The media type of a JMAP scope’s content, JSCalendar (RFC 8984).

calendaring_sync.adapters.jmap.PAGE_SIZE = 100#

How many events one /changes page reports, and one page of a full listing holds. Below every tested server’s maxObjectsInGet.

class calendaring_sync.adapters.jmap.JMAPAdapter(replica, client, *, account_id, scope_id=None)[source]#

Bases: SyncAdapter

Syncs one account’s calendar events through a synchronous calendaring-jmap client.

The account’s events are one scope. The content create() and change() take is a JSCalendar event as UTF-8 JSON. A create’s must have a uid and at least one calendar in calendarIds, and so must a change to a create not sent yet; anything else raises ValueError. The server picks a created event’s id, and waiting() always returns an empty list. A write the server won’t take as it was sent becomes a conflict of kind NOT_ALLOWED. Any other failure calendaring-jmap reports, such as a refused login, reaches you as its JMAPError, unchanged.

Parameters:
  • replica (Replica) – Where the sync state is kept.

  • client (JMAPClient) – The server’s client.

  • account_id (str) – The account whose events to sync, such as the one the client’s get_account_id() returns, or a shared account’s id.

  • scope_id (str | None) – The scope’s id. Defaults to the client’s session URL, without a login and spelled one way, then #, the account id and /CalendarEvent, so accounts on two servers never share a scope.

Raises:

TypeError – If an argument has the wrong type, such as an asynchronous client.

Examples

A sync, an edit, and the sync that pushes it:

adapter = JMAPAdapter(replica, client, account_id=client.get_account_id())
adapter.sync()
key = adapter.create(event_json_bytes)
adapter.sync()
class calendaring_sync.adapters.jmap.AsyncJMAPAdapter(replica, client, *, account_id, scope_id=None)[source]#

Bases: AsyncAdapter

JMAPAdapter for an asynchronous client.

Its methods are coroutines, as AsyncAdapter describes; everything else is as JMAPAdapter describes.

Raises:

TypeError – If an argument has the wrong type, such as a synchronous client.

Last updated on 2026-11-11.