v0.4.0
Typed metadata. The files endpoints now describe files and folders with
structs instead of raw JSON maps with ".tag" keys. This changes the shape
of several results — the Upgrading to 0.4 guide lists
every affected call with the 0.3 and 0.4 versions side by side.
Added
Magpie.FileMetadata,Magpie.FolderMetadataandMagpie.DeletedMetadata
— typed structs for the three kinds of entry Dropbox returns, with
DateTimetimestamps (client_modified,server_modified), a first-class
content_hash,is_downloadabledefaulting totrue, and the nested
objects (sharing_info,media_info,file_lock_info, ...) kept as raw
mapsMagpie.Metadata— the decoder behind it:decode/2(by".tag", or by
an explicit:file/:folderkind for the endpoints Dropbox answers
untagged),unwrap/2for%{"metadata" => ...}results,decode_page/2
for listings anddecode_matches/1for search pages, so endpoints called
by hand throughMagpie.post/3can be decoded the same wayMagpie.Metadata.content_hash/1— computes Dropbox's block-wise SHA-256
content hash of a binary or a stream of chunks, to verify uploads and
downloads againstMagpie.FileMetadata.content_hash- Upgrading guide on HexDocs
Changed
- Breaking:
Magpie.Files.get_metadata/5,upload/6,upload_file/4,
restore/3,Magpie.Files.UploadSession.finish/8andfinish_data/5
return metadata structs instead of maps;Magpie.LiveView.UploadWriter's
meta/1carries the struct under:metadata - Breaking:
Magpie.Files.create_folder/2,delete_folder/2,copy/3
andmove/3return the struct directly — the%{"metadata" => ...}
envelope is gone - Breaking:
Magpie.Files.ListFolder.list_folder/3,
list_folder_continue/2,stream/3andlist_revisions/4decode every
entry; the page itself ("cursor","has_more","is_deleted") keeps
its string keys - Breaking:
Magpie.Files.search/3,search_continue/2and
search_stream/3decode each match's"metadata"into a struct,
flattening Dropbox's one-variant%{".tag" => "metadata", "metadata" => ...}
union - Req requirement bumped to
~> 0.7.4, andjason— which Magpie always
used to build theDropbox-API-Argheader — is now a declared dependency
instead of one inherited from Req
Deprecated
Magpie.Files.create_folder_to_struct/2,delete_folder_to_struct/2and
theMagpie.Folderstruct they build —create_folder/2and
delete_folder/2return the richer typed metadata themselves now