Magpie.Files.ListFolder (Magpie v0.1.0)

Copy Markdown View Source

Folder listing and change-cursor endpoints (/files/list_folder*).

Summary

Functions

A way to quickly get a cursor for the folder's state.

Starts returning the contents of a folder.

Once a cursor has been retrieved from list_folder, use this to paginate through all files and retrieve updates to the folder, following the same rules as documented for list_folder.

Return revisions of a file.

A longpoll endpoint to wait for changes on an account.

Returns a lazy Stream over all entries of a folder, fetching pages through list_folder/2 + list_folder_continue/2 on demand — no cursor handling needed. Raises Magpie.Error if a page request fails.

Functions

get_latest_cursor(client, path)

@spec get_latest_cursor(Magpie.Client.t(), binary()) :: Magpie.response()

A way to quickly get a cursor for the folder's state.

##Example

Magpie.Files.ListFolder.get_latest_cursor client, ""

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

list_folder(client, path)

@spec list_folder(Magpie.Client.t(), binary()) :: Magpie.response()

Starts returning the contents of a folder.

##Example

Magpie.Files.ListFolder.list_folder client, "/path"

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

list_folder_continue(client, cursor)

@spec list_folder_continue(Magpie.Client.t(), binary()) :: Magpie.response()

Once a cursor has been retrieved from list_folder, use this to paginate through all files and retrieve updates to the folder, following the same rules as documented for list_folder.

##Example

Magpie.Files.ListFolder.list_folder_continue client, ""

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

list_revisions(client, path, limit \\ 10)

@spec list_revisions(Magpie.Client.t(), binary(), number()) :: Magpie.response()

Return revisions of a file.

##Example

Magpie.Files.ListFolder.list_revisions client, ""

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

longpoll(client, cursor)

@spec longpoll(Magpie.Client.t(), binary()) :: Magpie.response()

A longpoll endpoint to wait for changes on an account.

##Example

Magpie.Files.ListFolder.longpoll client, ""

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

stream(client, path)

Returns a lazy Stream over all entries of a folder, fetching pages through list_folder/2 + list_folder_continue/2 on demand — no cursor handling needed. Raises Magpie.Error if a page request fails.

Example

client
|> Magpie.Files.ListFolder.stream("/Photos")
|> Stream.filter(&(&1[".tag"] == "file"))
|> Enum.map(& &1["name"])