A file in the user's Dropbox, as returned by the files endpoints
(/files/get_metadata, /files/list_folder, /files/upload, ...).
Built by Magpie.Metadata.decode/1. Timestamps are DateTime structs and
content_hash is a first-class field, so integrity checks and "has it
changed?" comparisons need no digging through string keys:
{:ok, %Magpie.FileMetadata{} = file} = Magpie.Files.get_metadata(client, "/report.pdf")
file.size
# => 48_213
DateTime.diff(DateTime.utc_now(), file.server_modified, :day)
# => 3
file.content_hash == Magpie.Metadata.content_hash(File.read!("report.pdf"))
# => trueNested objects Dropbox may attach (sharing_info, media_info,
symlink_info, export_info, file_lock_info and property_groups)
are kept as the raw maps Dropbox returned.
Summary
Functions
Builds the struct from a decoded FileMetadata JSON object.
Types
@type t() :: %Magpie.FileMetadata{ client_modified: DateTime.t() | nil, content_hash: String.t() | nil, export_info: map() | nil, file_lock_info: map() | nil, has_explicit_shared_members: boolean() | nil, id: String.t(), is_downloadable: boolean(), media_info: map() | nil, name: String.t(), parent_shared_folder_id: String.t() | nil, path_display: String.t() | nil, path_lower: String.t() | nil, preview_url: String.t() | nil, property_groups: [map()] | nil, rev: String.t(), server_modified: DateTime.t() | nil, sharing_info: map() | nil, size: non_neg_integer(), symlink_info: map() | nil }
Functions
Builds the struct from a decoded FileMetadata JSON object.
Prefer Magpie.Metadata.decode/1, which also handles folders and deleted
entries by looking at the ".tag".