calendaring_jmap.objects.attachment module#

JMAP event attachment object.

Wraps a JSCalendar Link (RFC 8984 Section 1.4.11) whose rel marks it as an attachment, as returned in a CalendarEvent's links property.

class calendaring_jmap.objects.attachment.JMAPAttachment(link_id, href=None, blob_id=None, title=None, content_type=None, size=None)[source]#

Bases: object

An event attachment, backed by a JSCalendar Link object.

Variables:
  • link_id (str) – The key under which this Link appears in the event's links map.

  • href (str | None) – URL from which the attachment can be fetched, or None if the Link carries a blobId instead (a calendars-draft extension this client does not itself write, see attach_to_event()).

  • blob_id (str | None) – The referenced blob's id, when the server returns one.

  • title (str | None) – Human-readable description of the attachment.

  • content_type (str | None) – Media type of the attachment, if known.

  • size (int | None) – Size in octets, if known.

blob_id: str | None = None#
content_type: str | None = None#
classmethod from_jmap(link_id, data)[source]#

Construct a JMAPAttachment from a raw JSCalendar Link dict.

Unknown keys in data are silently ignored so that forward compatibility is maintained as the spec evolves.

Return type:

JMAPAttachment

href: str | None = None#
static is_attachment(link_data)[source]#

Return whether a raw JSCalendar Link dict represents an attachment.

A Link is an attachment when its rel is "enclosure" (RFC 8984 Section 1.4.11); other links entries (e.g. a conference URL) are not.

Known Cyrus limitation, confirmed live: Cyrus (3.13.7-545-gc04cece19) accepts a Link with rel: "enclosure" with no error, but does not reliably persist it (other rel values round-trip fine, isolating this to that one value). An attachment written by attach_to_event() may therefore not be classified as one by this method when read back from Cyrus. Stalwart has no such issue.

Return type:

bool

size: int | None = None#
title: str | None = None#

Last updated on 2026-11-01.