(sigil jmap mailbox)
(sigil jmap mailbox) - JMAP Mailbox Operations
Provides mailbox listing, lookup, creation, update, and deletion via JMAP Mailbox/get and Mailbox/set methods (RFC 8621).
Exports
jmap-mailboxesprocedureGet all mailboxes from the server.
Returns a list of mailbox dicts, each containing fields like id:, name:, role:, totalEmails:, unreadEmails:, etc.
(define mailboxes (jmap-mailboxes client))
(for-each (lambda (mb) (display (dict-ref mb name:)))
mailboxes)jmap-mailbox-by-roleprocedureFind a mailbox by its role.
Standard JMAP roles include "inbox", "drafts", "sent", "trash", "junk", "archive". Returns the mailbox dict or #f if no mailbox has the given role.
(jmap-mailbox-by-role client "inbox")
; => #{ id: "mb1" name: "Inbox" role: "inbox" ... }jmap-mailbox-by-nameprocedureFind a mailbox by its display name.
Returns the first mailbox whose name matches, or #f.
(jmap-mailbox-by-name client "Projects")
; => #{ id: "mb5" name: "Projects" ... }jmap-mailbox-create!variableCreate a new mailbox.
Returns the server-assigned ID of the created mailbox.
(jmap-mailbox-create! client "Projects" parent-id: inbox-id)
; => "mb-new-123"jmap-mailbox-update!procedureUpdate a mailbox's properties.
The updates dict contains the properties to change.
(jmap-mailbox-update! client mailbox-id #{ name: "New Name" })jmap-mailbox-destroy!variableDelete a mailbox.
When on-destroy-remove-emails: is #t, emails only in this mailbox are also destroyed. Default is #f.
(jmap-mailbox-destroy! client mailbox-id)