Folder listing and change-cursor endpoints (/files/list_folder*).
Listing pages keep their "cursor" and "has_more" keys, but every entry
is decoded into a Magpie.FileMetadata, Magpie.FolderMetadata or
Magpie.DeletedMetadata struct — see Magpie.Metadata.
Summary
Functions
A way to quickly get a cursor for the folder's state.
Starts returning the contents of a folder. opts accepts the other
/files/list_folder argument fields, e.g. "recursive", "limit",
"include_deleted" and "include_restorable_info".
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, each a Magpie.FileMetadata. opts accepts
the other /files/list_revisions argument fields, e.g. "mode",
"before_rev" and "include_restorable_info".
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
@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, "/path")More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-get_latest_cursor
@spec list_folder(Magpie.Client.t(), binary(), map()) :: Magpie.response()
Starts returning the contents of a folder. opts accepts the other
/files/list_folder argument fields, e.g. "recursive", "limit",
"include_deleted" and "include_restorable_info".
Example
{:ok, %{"entries" => [%Magpie.FolderMetadata{} | _], "cursor" => cursor, "has_more" => true}} =
Magpie.Files.ListFolder.list_folder(client, "/path")More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
@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, cursor)More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
@spec list_revisions(Magpie.Client.t(), binary(), number(), map()) :: Magpie.response()
Return revisions of a file, each a Magpie.FileMetadata. opts accepts
the other /files/list_revisions argument fields, e.g. "mode",
"before_rev" and "include_restorable_info".
Example
{:ok, %{"entries" => [%Magpie.FileMetadata{rev: rev} | _], "is_deleted" => false}} =
Magpie.Files.ListFolder.list_revisions(client, "/report.pdf")More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-list_revisions
@spec longpoll(Magpie.Client.t(), binary()) :: Magpie.response()
A longpoll endpoint to wait for changes on an account.
Example
Magpie.Files.ListFolder.longpoll(client, cursor)More info at: https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-longpoll
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(&match?(%Magpie.FileMetadata{}, &1))
|> Enum.map(& &1.name)