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
/changespage reports, and one page of a full listing holds. Below every tested server’smaxObjectsInGet.
- class calendaring_sync.adapters.jmap.JMAPAdapter(replica, client, *, account_id, scope_id=None)[source]#
Bases:
SyncAdapterSyncs one account’s calendar events through a synchronous calendaring-jmap client.
The account’s events are one scope. The content
create()andchange()take is a JSCalendar event as UTF-8 JSON. A create’s must have auidand at least one calendar incalendarIds, and so must a change to a create not sent yet; anything else raisesValueError. The server picks a created event’s id, andwaiting()always returns an empty list. A write the server won’t take as it was sent becomes a conflict of kindNOT_ALLOWED. Any other failure calendaring-jmap reports, such as a refused login, reaches you as itsJMAPError, 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’sget_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:
AsyncAdapterJMAPAdapterfor an asynchronous client.Its methods are coroutines, as
AsyncAdapterdescribes; everything else is asJMAPAdapterdescribes.- Raises:
TypeError – If an argument has the wrong type, such as a synchronous client.