Skip to content

Commit 315073b

Browse files
committed
feat(drive): add ClientUID support for draft ownership tracking
Add ClientUID field to Drive API types per official Proton Drive OpenAPI spec: - CreateFileReq.ClientUID: identifies which client created a file draft - CheckAvailableHashesReq.ClientUID: filters pending drafts by client UIDs - CheckAvailableHashesRes/PendingHashData: returns draft ownership info This enables clients to: - Safely auto-replace their own failed upload drafts - Avoid overwriting concurrent uploads from other clients Reference: ProtonDriveApps/sdk driveTypes.ts (auto-generated from OpenAPI)
1 parent d3c27c8 commit 315073b

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

link_file_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ type CreateFileReq struct {
77
Hash string // Encrypted content hash
88
MIMEType string // MIME Type
99

10+
// ClientUID is used for draft ownership tracking. In case of upload failure,
11+
// the client can recognize its own draft and continue the upload.
12+
// Per official Proton Drive API (OpenAPI spec).
13+
ClientUID string `json:",omitempty"`
14+
1015
ContentKeyPacket string // The block's key packet, encrypted with the node key.
1116
ContentKeyPacketSignature string // Unencrypted signature of the content session key, signed with the NodeKey
1217

link_types.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,29 @@ const (
182182
RevisionStateObsolete
183183
RevisionStateDeleted
184184
)
185+
186+
// CheckAvailableHashesReq is used to check which file name hashes are available
187+
// for upload in a given folder. Per official Proton Drive API (OpenAPI spec).
188+
type CheckAvailableHashesReq struct {
189+
Hashes []string
190+
191+
// ClientUID filters pending drafts. If provided, only drafts NOT belonging
192+
// to these client UIDs will be returned in PendingHashes.
193+
ClientUID []string `json:",omitempty"`
194+
}
195+
196+
// CheckAvailableHashesRes contains the results of a hash availability check.
197+
type CheckAvailableHashesRes struct {
198+
AvailableHashes []string
199+
PendingHashes []PendingHashData
200+
}
201+
202+
// PendingHashData represents a pending draft that conflicts with a requested hash.
203+
type PendingHashData struct {
204+
Hash string
205+
RevisionID string
206+
LinkID string
207+
208+
// ClientUID identifies which client created this pending draft.
209+
ClientUID string `json:",omitempty"`
210+
}

0 commit comments

Comments
 (0)