Attachments

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.

Properties

Link copied to clipboard

Whether the current object has been destroyed and its reference is gone in the Rust side.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override 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
open suspend override fun deleteLocal(remote: RemoteAttachment)

Delete the attachment's local files and records.

Link copied to clipboard
open override fun destroy()
Link copied to clipboard
open suspend override 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
open suspend override fun listLocal(): List<LocalAttachment>

The plaintext attachment files this client keeps.

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

Every pending attachment that has not completed its upload.

Link copied to clipboard
open suspend override 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
open override fun offered(): Boolean

Whether the deployment's server configuration offers attachments.

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

The pending attachment for this remote attachment.