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:
objectAn event attachment, backed by a JSCalendar Link object.
- Variables:
link_id (
str) – The key under which this Link appears in the event'slinksmap.href (
str|None) – URL from which the attachment can be fetched, orNoneif the Link carries ablobIdinstead (a calendars-draft extension this client does not itself write, seeattach_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.
- classmethod from_jmap(link_id, data)[source]#
Construct a JMAPAttachment from a raw JSCalendar Link dict.
Unknown keys in
dataare silently ignored so that forward compatibility is maintained as the spec evolves.- Return type:
- static is_attachment(link_data)[source]#
Return whether a raw JSCalendar Link dict represents an attachment.
A Link is an attachment when its
relis"enclosure"(RFC 8984 Section 1.4.11); otherlinksentries (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 (otherrelvalues round-trip fine, isolating this to that one value). An attachment written byattach_to_event()may therefore not be classified as one by this method when read back from Cyrus. Stalwart has no such issue.- Return type: