ChoreRunner.Downloads.StorageService behaviour (chore_runner v0.4.2)

Link to this section Summary

Types

Must have the appropriate file extension to be considered a valid name.

While both :path and :body are optional, at least one is required. The application will raise if both are provided.

Functions

See ChoreRunner.Downloads.TemporaryDiskStorageService.delete_file/1.

See ChoreRunner.Downloads.TemporaryDiskStorageService.file_url/2.

See ChoreRunner.Downloads.TemporaryDiskStorageService.list_files/0.

Link to this section Types

Specs

body() :: binary()

Specs

file() :: %{
  :id => String.t(),
  :name => String.t(),
  :type => String.t(),
  :created_at => DateTime.t(),
  optional(:chore_id) => String.t(),
  optional(atom()) => any()
}

Specs

file_path() :: String.t()

Specs

name() :: String.t()

Must have the appropriate file extension to be considered a valid name.

Specs

opts() :: [path: file_path(), body: body()]

While both :path and :body are optional, at least one is required. The application will raise if both are provided.

Specs

reason() :: any()

Link to this section Callbacks

Link to this callback

delete_file(file)

Specs

delete_file(file()) :: :ok | {:error, reason()}
Link to this callback

file_url(file, list)

Specs

file_url(file(), list()) :: String.t()

Specs

list_files() :: {:ok, [file()]} | {:error, reason()}
Link to this callback

save_file(name, opts)

Specs

save_file(name(), opts()) :: {:ok, file()} | {:error, reason()}

Link to this section Functions

Link to this function

delete_file(file)

See ChoreRunner.Downloads.TemporaryDiskStorageService.delete_file/1.

Link to this function

file_url(file, opts)

See ChoreRunner.Downloads.TemporaryDiskStorageService.file_url/2.

Link to this function

find_files_by_chore_id(chore_id)

See ChoreRunner.Downloads.TemporaryDiskStorageService.list_files/0.

Link to this function

save_file(name, opts)