Protocol definitions for external service adapters.
Defines three integration protocols:
Protocol definitions for external service adapters. Defines three integration protocols: - ISmtpProvider — outbound email via SMTP - IImapMailbox — inbound email via IMAP - ITwilioMessaging — Twilio SMS and WhatsApp messaging - IFileSource — remote files to import (FTPS) - ISoapClient — SOAP 1.1 operations (WCF services)
Protocol for reading files a remote system drops in a directory.
Protocol for reading files a remote system drops in a directory.
(fetch-file! this path)Download the file at path.
Returns: Map with: :success? - boolean :content - bytes :error - map, as for list-files! (if failed)
Download the file at path.
Returns:
Map with:
:success? - boolean
:content - bytes
:error - map, as for list-files! (if failed)(list-files! this dir)(list-files! this dir opts)List the regular files in dir, sorted by name.
Args: opts - map (optional): :match - exact name, regex (whole name) or collection of names :skip - names to leave out, e.g. files already processed
Returns: Map with: :success? - boolean :files - vector of RemoteFile maps {:name :path :size :modified-at} :error - map {:type :external-error :message :host :attempts :cause} (if failed)
List the regular files in dir, sorted by name.
Args:
opts - map (optional):
:match - exact name, regex (whole name) or collection of names
:skip - names to leave out, e.g. files already processed
Returns:
Map with:
:success? - boolean
:files - vector of RemoteFile maps {:name :path :size :modified-at}
:error - map {:type :external-error :message :host :attempts :cause} (if failed)Protocol for reading messages from an IMAP mailbox.
Protocol for reading messages from an IMAP mailbox.
(close! this)Close IMAP connection. Returns true.
Close IMAP connection. Returns true.
(delete-message! this uid)(delete-message! this uid opts)Delete a message by UID, in (:folder opts) or the configured folder. Only that message is expunged, which needs the server's UIDPLUS; without it the message is flagged \Deleted, which fetches skip, and :expunged? is false.
Returns: Map with :success?, :expunged? and optional :error (:not-found when no such UID)
Delete a message by UID, in (:folder opts) or the configured folder. Only that message is expunged, which needs the server's UIDPLUS; without it the message is flagged \Deleted, which fetches skip, and :expunged? is false. Returns: Map with :success?, :expunged? and optional :error (:not-found when no such UID)
(fetch-messages! this)(fetch-messages! this opts)Fetch messages from the mailbox, oldest first. Selection runs on the server; content is read only for the selected messages, and reading does not mark them read.
Args: opts - ImapFetchOptions map (optional): :folder - folder name (default INBOX) :limit - max messages to fetch (default 100) :unread-only? - fetch only unread messages :since - only messages received at or after this inst :include-raw? - add :raw, the RFC 822 bytes, to each message
Returns: Map with: :success? - boolean :messages - vector of InboundMessage maps, with :attachments and :folder; pass the message as opts to mark-read! or delete-message!, since a UID only means something within its folder :count - integer :error - map {:message :type} (if failed)
Fetch messages from the mailbox, oldest first. Selection runs on the
server; content is read only for the selected messages, and reading does
not mark them read.
Args:
opts - ImapFetchOptions map (optional):
:folder - folder name (default INBOX)
:limit - max messages to fetch (default 100)
:unread-only? - fetch only unread messages
:since - only messages received at or after this inst
:include-raw? - add :raw, the RFC 822 bytes, to each message
Returns:
Map with:
:success? - boolean
:messages - vector of InboundMessage maps, with :attachments and
:folder; pass the message as opts to mark-read! or
delete-message!, since a UID only means something
within its folder
:count - integer
:error - map {:message :type} (if failed)(fetch-unread! this)(fetch-unread! this limit)Fetch unread messages. Returns same shape as fetch-messages!.
Fetch unread messages. Returns same shape as fetch-messages!.
(mark-read! this uid)(mark-read! this uid opts)Mark a message as read by UID, in (:folder opts) or the configured folder.
Returns: Map with :success? and optional :error (:not-found when no such UID)
Mark a message as read by UID, in (:folder opts) or the configured folder. Returns: Map with :success? and optional :error (:not-found when no such UID)
Protocol for outbound SMTP email sending.
Protocol for outbound SMTP email sending.
(send-email! this email)Send an email synchronously.
Args: email - OutboundEmail map with :to :from :subject :body etc.
Returns: Map with: :success? - boolean :message-id - string (if successful) :error - map {:message :type} (if failed)
Send an email synchronously.
Args:
email - OutboundEmail map with :to :from :subject :body etc.
Returns:
Map with:
:success? - boolean
:message-id - string (if successful)
:error - map {:message :type} (if failed)(send-email-async! this email)Send an email asynchronously. Returns a future of the send-email! result.
Send an email asynchronously. Returns a future of the send-email! result.
(test-connection! this)Verify SMTP server is reachable and credentials are valid.
Returns: Map with: :success? - boolean :error - map {:message :type} (if failed)
Verify SMTP server is reachable and credentials are valid.
Returns:
Map with:
:success? - boolean
:error - map {:message :type} (if failed)Protocol for calling operations on a SOAP 1.1 service.
Protocol for calling operations on a SOAP 1.1 service.
(call! this operation request)(call! this operation request opts)Call operation (keyword or string, e.g. :GetListEntries) with request.
Args: request - map, or [name value] pairs where member order matters; names are the contract's element names, as written opts - per-call overrides of the operation's settings (:timeout-ms, :arrays, :retry-faults ...)
Returns: Map with: :success? - boolean :body - the response element as data, kebab-case keys :result - its <Operation>Result :error - {:type :fault :code :message :detail} for a SOAP fault, {:type :external-error :message :endpoint :attempts :cause} when there was no usable answer, or :circuit-open
Call operation (keyword or string, e.g. :GetListEntries) with request.
Args:
request - map, or [name value] pairs where member order matters; names
are the contract's element names, as written
opts - per-call overrides of the operation's settings (:timeout-ms,
:arrays, :retry-faults ...)
Returns:
Map with:
:success? - boolean
:body - the response element as data, kebab-case keys
:result - its <Operation>Result
:error - {:type :fault :code :message :detail} for a SOAP fault,
{:type :external-error :message :endpoint :attempts :cause}
when there was no usable answer, or :circuit-openProtocol for sending SMS and WhatsApp messages via Twilio.
Protocol for sending SMS and WhatsApp messages via Twilio.
(get-message-status! this sid)Get the delivery status of a message by SID.
Returns: Map with: :success? - boolean :status - string (e.g. "delivered", "failed") :error - map {:message :type} (if failed)
Get the delivery status of a message by SID.
Returns:
Map with:
:success? - boolean
:status - string (e.g. "delivered", "failed")
:error - map {:message :type} (if failed)(send-sms! this input)Send an SMS message.
Args: input - SendMessageInput map with :to :body and optional :from
Returns: MessageResult map with :success? :message-sid :status :error
Send an SMS message. Args: input - SendMessageInput map with :to :body and optional :from Returns: MessageResult map with :success? :message-sid :status :error
(send-whatsapp! this input)Send a WhatsApp message. Automatically prefixes whatsapp: to To/From.
Args: input - SendMessageInput map with :to :body and optional :from
Returns: MessageResult map with :success? :message-sid :status :error
Send a WhatsApp message. Automatically prefixes whatsapp: to To/From. Args: input - SendMessageInput map with :to :body and optional :from Returns: MessageResult map with :success? :message-sid :status :error
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |