fluminus v1.4.1 Fluminus.API.File View Source
Provides an abstraction over a file/directory in LumiNUS, and operations possible on them using LumiNUS API.
Struct fields:
:id
- id of the file:name
- the name of the file:directory?
- whether this file is a directory:children
-nil
indicated the need to fetch, otherwise it contains a list of its children. ifdirectory?
isfalse
, then this field contains an empty list.:allow_upload?
- whether this is a student submission folder.:multimedia?
- whether this is a multimedia file.
Link to this section Summary
Functions
Downloads the given file to the location specified by path
.
Creates a Elixir.Fluminus.API.File
struct from the API response retrieved by Lesson
.
Creates Elixir.Fluminus.API.File
struct from a Module
.
Obtains the download url for a given file.
Loads the children of a given Elixir.Fluminus.API.File
struct.
Link to this section Types
t()
View Sourcet() :: %Fluminus.API.File{ allow_upload?: bool(), children: [Fluminus.API.File.t()] | nil, directory?: bool(), id: String.t(), multimedia?: bool(), name: String.t() }
Link to this section Functions
download(file, auth, path, verbose \\ false)
View Sourcedownload(Fluminus.API.File.t(), Fluminus.Authorization.t(), Path.t(), bool()) :: :ok | {:error, :exists | any()}
Downloads the given file to the location specified by path
.
This function will return {:error, :exists}
if the file already exists in the given path
from_lesson(api_response)
View Sourcefrom_lesson(api_response :: any()) :: Fluminus.API.File.t() | nil
Creates a Elixir.Fluminus.API.File
struct from the API response retrieved by Lesson
.
from_module(module, auth)
View Sourcefrom_module(Fluminus.API.Module.t(), Fluminus.Authorization.t()) :: {:ok, Fluminus.API.File.t()} | :error
Creates Elixir.Fluminus.API.File
struct from a Module
.
get_download_url(file, auth)
View Sourceget_download_url(Fluminus.API.File.t(), Fluminus.Authorization.t()) :: {:ok, String.t()} | {:error, any()}
Obtains the download url for a given file.
Note that the download url of a directory is a url to that directory zipped.
load_children(file, auth)
View Sourceload_children(Fluminus.API.File.t(), Fluminus.Authorization.t()) :: {:ok, Fluminus.API.File.t()} | :error
Loads the children of a given Elixir.Fluminus.API.File
struct.