Coffrify. Resources. Transfers
(Coffrify v0.9.0)
View Source
Transfers — Coffrify's core file-sharing primitive.
Server-side mode: the SDK creates a transfer record and returns presigned upload URLs. Clients PUT ciphertext directly to those URLs. The Coffrify API never sees plaintext.
Summary
Functions
Duplicate a transfer with a fresh short_code and reset download counter.
Create a transfer (server-side upload). Files must be uploaded separately to the returned signed URLs.
Delete a transfer.
Fetch a single transfer by id.
Lazy Stream over every transfer. Cursor-paginated under the hood.
List transfers (cursor-paginated). See iterate/2 for a lazy stream.
Return the share URL + a QR-code proxy URL.
Re-queue the AV scan for a transfer (sets scan_status=pending).
Assign or unfile (nil) this transfer to a folder.
Types
@type create_opts() :: %{ optional(:expires_in_hours) => pos_integer(), optional(:max_downloads) => pos_integer(), optional(:password) => String.t(), optional(:notify_email) => String.t(), optional(:custom_slug) => String.t(), optional(:transfer_title) => String.t(), optional(:transfer_message) => String.t() }
@type file_input() :: %{ :name => String.t(), :size => non_neg_integer(), optional(:mime_type) => String.t() }
@type list_opts() :: [ limit: pos_integer(), cursor: String.t() | nil, offset: non_neg_integer(), status: String.t() ]
Functions
@spec clone(Coffrify.t(), String.t(), map() | keyword()) :: {:ok, map()} | {:error, Exception.t()}
Duplicate a transfer with a fresh short_code and reset download counter.
@spec create(Coffrify.t(), [file_input()], create_opts()) :: {:ok, map()} | {:error, Exception.t()}
Create a transfer (server-side upload). Files must be uploaded separately to the returned signed URLs.
@spec delete(Coffrify.t(), String.t()) :: {:ok, map()} | {:error, Exception.t()}
Delete a transfer.
@spec get(Coffrify.t(), String.t()) :: {:ok, map()} | {:error, Exception.t()}
Fetch a single transfer by id.
@spec iterate( Coffrify.t(), keyword() ) :: Enumerable.t()
Lazy Stream over every transfer. Cursor-paginated under the hood.
Example
client
|> Coffrify.Resources.Transfers.iterate(page_size: 100, status: "active")
|> Stream.take(500)
|> Enum.each(&IO.inspect/1)
@spec list(Coffrify.t(), list_opts()) :: {:ok, map()} | {:error, Exception.t()}
List transfers (cursor-paginated). See iterate/2 for a lazy stream.
@spec qrcode(Coffrify.t(), String.t(), keyword()) :: {:ok, map()} | {:error, Exception.t()}
Return the share URL + a QR-code proxy URL.
@spec rescan(Coffrify.t(), String.t()) :: {:ok, map()} | {:error, Exception.t()}
Re-queue the AV scan for a transfer (sets scan_status=pending).
@spec set_folder(Coffrify.t(), String.t(), String.t() | nil) :: {:ok, map()} | {:error, Exception.t()}
Assign or unfile (nil) this transfer to a folder.