The Files API: upload a file once and reference it by id.
Jibu.Content builds the reference blocks.
Results are the API's JSON with string keys. See the files guide.
Summary
Functions
Deletes a file.
Downloads a file's content as a binary. The API allows this only for files it created.
Retrieves a file's metadata.
Returns one page. query takes the API's parameters, such as :limit and :after_id.
Streams all files across pages, forward only. Raises Jibu.Error when a page fails.
Uploads a file from disk. The content type comes from the file extension.
Uploads a binary under the given filename and content type.
Functions
@spec delete(Req.Request.t(), String.t()) :: {:ok, map()} | {:error, Jibu.Error.t()}
Deletes a file.
@spec download(Req.Request.t(), String.t()) :: {:ok, binary()} | {:error, Jibu.Error.t()}
Downloads a file's content as a binary. The API allows this only for files it created.
@spec get(Req.Request.t(), String.t()) :: {:ok, map()} | {:error, Jibu.Error.t()}
Retrieves a file's metadata.
@spec list(Req.Request.t(), keyword()) :: {:ok, map()} | {:error, Jibu.Error.t()}
Returns one page. query takes the API's parameters, such as :limit and :after_id.
@spec stream(Req.Request.t(), keyword()) :: Enumerable.t()
Streams all files across pages, forward only. Raises Jibu.Error when a page fails.
@spec upload(Req.Request.t(), Path.t()) :: {:ok, map()} | {:error, Jibu.Error.t()}
Uploads a file from disk. The content type comes from the file extension.
A missing or unreadable file raises File.Error, like Jibu.Content.image/2.
@spec upload_data(Req.Request.t(), iodata() | Enumerable.t(), String.t(), String.t()) :: {:ok, map()} | {:error, Jibu.Error.t()}
Uploads a binary under the given filename and content type.