Capsule v1.0.0 Capsule.Uploader behaviour View Source

Defines the behaviour for uploaders and provides a use macro for generating default implementations.

Link to this section Summary

Functions

Generates default implementations of store/3, build_options/3, and build_metadata/3.

Link to this section Types

Specs

option() :: {atom(), any()}

Specs

storage() :: atom()

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Generates default implementations of store/3, build_options/3, and build_metadata/3.

Options

  • :storages - required. A keyword list mapping storage keys to storage modules, or an MFA tuple {module, function, args} that returns such a list at runtime.

Link to this section Callbacks

Link to this callback

build_metadata(arg1, storage, list)

View Source

Specs

build_metadata(Capsule.Locator.t(), storage(), [option()]) ::
  Keyword.t() | map()
Link to this callback

build_options(any, storage, list)

View Source

Specs

build_options(any(), storage(), [option()]) :: [option()]
Link to this callback

store(any, storage, list)

View Source

Specs

store(any(), storage(), [option()]) ::
  {:ok, Capsule.Locator.t()} | {:error, any()}