FileStorageApi.Container behaviour (file_storage_api v2.1.2)

Module for handling asset containers

Summary

Functions

Will create container with binary as input for bucket name

List all files in the container.

Types

@type options() :: [
  max_results: non_neg_integer(),
  marker: String.t(),
  connection: atom() | map() | keyword()
]
@type t() :: %FileStorageApi.Container{
  date: DateTime.t(),
  files: [FileStorageApi.File.t()],
  max_results: non_neg_integer(),
  name: String.t(),
  next_marker: String.t()
}

Callbacks

Link to this callback

create(t, arg2, map)

@callback create(String.t(), atom() | map(), map()) :: {:ok, map()} | {:error, map()}
Link to this callback

list_files(t, arg2, options)

@callback list_files(String.t(), atom() | map(), options()) ::
  {:ok, [t()]} | {:error, map()}

Functions

Link to this function

create(container_name, opts \\ %{})

@spec create(String.t(), map()) :: any()

Will create container with binary as input for bucket name

Opts allows for setting cors_policy as map or true will only be applied to S3

Link to this function

list_files(container_name, options \\ [])

@spec list_files(String.t(), options()) :: Enumerable.t()

List all files in the container.

Options are available for max_results: which can be adjusted.

It's build around stream so will automatically use the markers to get as many items as are in the bucket.