The Attachments resource: the three-step flow of requesting an upload URL, uploading raw bytes to storage, and registering the file against a transaction.
Summary
Functions
Removes a previously registered attachment.
Step 3: registers a file_url (from request_upload/2, or an
externally-hosted image) against a transaction so it appears in the
Monzo app's transaction detail screen.
Step 1: obtains a temporary, pre-signed URL to upload the attachment to, and the resulting public URL of the file once uploaded.
Step 2: uploads raw file bytes directly to a pre-signed URL returned by
request_upload/2. This talks directly to Monzo's file storage, not the
Monzo API, so it does not use the client's bearer auth or retry policy.
Types
@type upload_params() :: %{ file_name: String.t(), file_type: String.t(), content_length: non_neg_integer() }
Functions
@spec deregister(Monzo.Client.t(), String.t()) :: :ok | {:error, Exception.t()}
Removes a previously registered attachment.
@spec register(Monzo.Client.t(), register_params()) :: {:ok, Monzo.Attachment.t()} | {:error, Exception.t()}
Step 3: registers a file_url (from request_upload/2, or an
externally-hosted image) against a transaction so it appears in the
Monzo app's transaction detail screen.
@spec request_upload(Monzo.Client.t(), upload_params()) :: {:ok, upload_result()} | {:error, Exception.t()}
Step 1: obtains a temporary, pre-signed URL to upload the attachment to, and the resulting public URL of the file once uploaded.
@spec upload_bytes(Monzo.Client.t(), String.t(), iodata(), String.t()) :: :ok | {:error, Exception.t()}
Step 2: uploads raw file bytes directly to a pre-signed URL returned by
request_upload/2. This talks directly to Monzo's file storage, not the
Monzo API, so it does not use the client's bearer auth or retry policy.