AttachmentsInterface

The attachments of one client. The paths it returns name files under the client's attachments directory; in the browser they name OPFS entries.

The SDK stores and transfers the file an app gives it. It makes no preview or thumbnail: an app that shows an image makes its own from the local file. The SDK retries no failed upload or download. A thrown XmtpError.Attachment says in its retryable detail whether the same call can succeed later. A Failed status has no such detail: its failure decides it by the ATCH cause table, from cause, from httpStatus for the HttpStatus cause, and from retryable for the Credential cause.

Inheritors

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract suspend fun create(source: AttachmentSource): PendingAttachment

Stage a new attachment and return it before any request. Send its remote attachment, then upload it.

Link copied to clipboard
abstract suspend fun deleteLocal(remote: RemoteAttachment)

Delete the attachment's local files and records.

Link copied to clipboard
abstract suspend fun download(remote: RemoteAttachment): DownloadedAttachment

Download, verify, and decrypt the attachment into the attachments directory, or return the file a completed download left there. A failed download is not retried.

Link copied to clipboard
abstract suspend fun listLocal(): List<LocalAttachment>

The plaintext attachment files this client keeps.

Link copied to clipboard
abstract suspend fun listPending(): List<PendingAttachment>

Every pending attachment that has not completed its upload.

Link copied to clipboard
abstract suspend fun localPath(remote: RemoteAttachment): String

The path of the attachment's plaintext file. The file exists only after a download or a create on this client.

Link copied to clipboard
abstract fun offered(): Boolean

Whether the deployment's server configuration offers attachments.

Link copied to clipboard
abstract suspend fun pending(remote: RemoteAttachment): PendingAttachment

The pending attachment for this remote attachment.