diff --git a/link_file_types.go b/link_file_types.go index 16344e0..5781615 100644 --- a/link_file_types.go +++ b/link_file_types.go @@ -7,6 +7,11 @@ type CreateFileReq struct { Hash string // Encrypted content hash MIMEType string // MIME Type + // ClientUID is used for draft ownership tracking. In case of upload failure, + // the client can recognize its own draft and continue the upload. + // Per official Proton Drive API (OpenAPI spec). + ClientUID string `json:",omitempty"` + ContentKeyPacket string // The block's key packet, encrypted with the node key. ContentKeyPacketSignature string // Unencrypted signature of the content session key, signed with the NodeKey diff --git a/link_types.go b/link_types.go index 387f240..cf37930 100644 --- a/link_types.go +++ b/link_types.go @@ -182,3 +182,29 @@ const ( RevisionStateObsolete RevisionStateDeleted ) + +// CheckAvailableHashesReq is used to check which file name hashes are available +// for upload in a given folder. Per official Proton Drive API (OpenAPI spec). +type CheckAvailableHashesReq struct { + Hashes []string + + // ClientUID filters pending drafts. If provided, only drafts NOT belonging + // to these client UIDs will be returned in PendingHashes. + ClientUID []string `json:",omitempty"` +} + +// CheckAvailableHashesRes contains the results of a hash availability check. +type CheckAvailableHashesRes struct { + AvailableHashes []string + PendingHashes []PendingHashData +} + +// PendingHashData represents a pending draft that conflicts with a requested hash. +type PendingHashData struct { + Hash string + RevisionID string + LinkID string + + // ClientUID identifies which client created this pending draft. + ClientUID string `json:",omitempty"` +}