ElixirDropbox v0.0.8 ElixirDropbox.Files

This module contains endpoints and data types for basic file operations.

Link to this section Summary

Functions

Copy a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be copied

Create folder returns map

Create folder returns Folder struct

Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. A successful response indicates that the file or folder was deleted. The returned metadata will be the corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata object

Delete folder returns Folder struct

Download a file from a user’s Dropbox

Get a preview for a file

Get a temporary link to stream content of a file. This link will expire in four hours and afterwards you will get 410 Gone. Content-Type of the link is determined automatically by the file’s mime type

Get thumbnails for a list of images. We allow up to 25 thumbnails in a single batch

Move a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be moved

Restore a file to a specific revision

Create a new file with the contents provided in the request

Link to this section Functions

Link to this function copy(client, from_path, to_path)

Copy a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be copied.

Example

ElixirDropbox.Files.copy(client, “/Temp/first”, “/Tmp/second”)

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-copy_v2

Link to this function create_folder(client, path)
create_folder(Client, binary()) :: Map

Create folder returns map

Example

ElixirDropbox.Files.create_folder client, “/Path”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-create_folder

Link to this function create_folder_to_struct(client, path)
create_folder_to_struct(Client, binary()) :: Map

Create folder returns Folder struct

Example

ElixirDropbox.Files.create_folder_to_struct client, “/Path”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-create_folder

Link to this function delete_folder(client, path)

Delete the file or folder at a given path. If the path is a folder, all its contents will be deleted too. A successful response indicates that the file or folder was deleted. The returned metadata will be the corresponding FileMetadata or FolderMetadata for the item at time of deletion, and not a DeletedMetadata object.

Example

ElixirDropbox.Files.delete_folder client, “/Homework/math/Prime_Numbers.txt”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-delete_v2

Link to this function delete_folder_to_struct(client, path)

Delete folder returns Folder struct

Example

ElixirDropbox.Files.delete_folder_to_struct client, “/Path”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-delete

Link to this function download(client, path)

Download a file from a user’s Dropbox.

Example

ElixirDropbox.Files.download client, “/mypdf.pdf”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-download

Link to this function get_metadata(client, path, include_media_info \\ false, include_deleted \\ false, include_has_explicit_shared_members \\ false)

Returns the metadata for a file or folder.

Example

ElixirDropbox.Files.get_metadata client, “/mypdf.pdf”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata

Link to this function get_preview(client, path)

Get a preview for a file.

Example

ElixirDropbox.Files.get_preview client, “/mypdf.pdf”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-get_preview

Link to this function get_temporary_link(client, path)

Get a temporary link to stream content of a file. This link will expire in four hours and afterwards you will get 410 Gone. Content-Type of the link is determined automatically by the file’s mime type.

Example

ElixirDropbox.Files.get_temporary_link client, “/video.mp4”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-get_preview

Link to this function get_thumbnail(client, path, format \\ "jpeg", size \\ "w64h64")

Get a thumbnail for an image.

Example

ElixirDropbox.Files.get_thumbnail client, “/image.jpg”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-get_thumbnail

Link to this function get_thumbnail_batch(client, entries)

Get thumbnails for a list of images. We allow up to 25 thumbnails in a single batch.

Example

batch = %{ “path” => “/image.jpg”, “format” => “jpeg”, “size” => “w64h64”} entries = [batch] ElixirDropbox.Files.get_thumbnail_batch client, entries

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-get_thumbnail_batch

Link to this function move(client, from_path, to_path)

Move a file or folder to a different location in the user’s Dropbox. If the source path is a folder all its contents will be moved.

Example

ElixirDropbox.Files.move(client, “/Homework/math”, “/Homework/algebra”)

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-move

Link to this function restore(client, path, rev)

Restore a file to a specific revision.

Example

ElixirDropbox.Files.restore(client, “/root/word.docx”, “a1c10ce0dd78”)

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-restore

Link to this function search(client, path, query, start \\ 0, max_results \\ 100, mode \\ "filename")

Searches for files and folders.

Example

ElixirDropbox.Files.search(client, “/root”, “word.docx”)

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-search

Link to this function upload(client, path, file, mode \\ "add", autorename \\ true, mute \\ false)

Create a new file with the contents provided in the request.

Example

ElixirDropbox.Files.upload client, “/mypdf.pdf”, “/mypdf.pdf”

More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-upload