2018-08-28 22:48:03 +00:00
|
|
|
defmodule Pleroma.Uploaders.Uploader do
|
|
|
|
@moduledoc """
|
|
|
|
Defines the contract to put an uploaded file to any backend.
|
|
|
|
"""
|
|
|
|
|
|
|
|
@doc """
|
|
|
|
Put a file to the backend.
|
|
|
|
|
2018-08-30 12:20:29 +00:00
|
|
|
Returns `{:ok, String.t } | {:error, String.t} containing the path of the
|
|
|
|
uploaded file, or error information if the file failed to be saved to the
|
|
|
|
respective backend.
|
2018-08-28 22:48:03 +00:00
|
|
|
"""
|
|
|
|
@callback put_file(
|
|
|
|
name :: String.t(),
|
|
|
|
uuid :: String.t(),
|
|
|
|
file :: File.t(),
|
|
|
|
content_type :: String.t(),
|
|
|
|
should_dedupe :: Boolean.t()
|
2018-08-30 01:07:28 +00:00
|
|
|
) :: {:ok, String.t()} | {:error, String.t()}
|
2018-08-28 22:48:03 +00:00
|
|
|
end
|