View Source Mobilizon.Web.Upload.Filter behaviour (Mobilizon v5.0.0-beta.1)

Upload Filter behaviour

This behaviour allows to run filtering actions just before a file is uploaded. This allows to:

  • morph in place the temporary file
  • change any field of a Mobilizon.Upload struct
  • cancel/stop the upload

Summary

Callbacks

@callback filter(Mobilizon.Web.Upload.t()) ::
  {:ok, :filtered}
  | {:ok, :noop}
  | {:ok, :filtered, Mobilizon.Web.Upload.t()}
  | {:error, String.t() | atom()}

Functions

@spec filter([module()], Mobilizon.Web.Upload.t()) ::
  {:ok, Mobilizon.Web.Upload.t()} | {:error, String.t() | atom()}