Expand description
High-level Proton Drive client (Rust port).
Built on top of proton_sdk. Milestone 1 covers session-backed read
operations: resolving the My Files folder, fetching node metadata and
enumerating folder children.
use proton_sdk::config::ProtonClientConfiguration;
use proton_sdk::session::{PasswordMode, ProtonApiSession, ResumeParameters};
use proton_drive_rs::ProtonDriveClient;
let config = ProtonClientConfiguration::new("external-drive-myapp@0.1.0-alpha");
let session = ProtonApiSession::resume(config, ResumeParameters {
session_id: "uid".into(),
username: "user@proton.me".into(),
user_id: "user-id".into(),
access_token: "access".into(),
refresh_token: "refresh".into(),
scopes: vec![],
is_waiting_for_second_factor_code: false,
password_mode: PasswordMode::Single,
})?;
let drive = ProtonDriveClient::new(&session, b"mailbox-password".to_vec());
let root = drive.get_my_files_folder().await?;
let child_uids = drive.enumerate_folder_children_node_uids(&root.uid).await?;
for child in drive.enumerate_nodes(&child_uids).await? {
println!("{} ({:?})", child.name, child.kind);
}Re-exports§
pub use proton_sdk;
Structs§
- Bookmark
- A public link the user has saved to their account (“bookmark”). Opening it visits the public URL; there is no local copy.
- Cached
Node Info - A cached node plus the two derived values that node-mutating operations (move / rename) would otherwise recompute from the decrypted name.
- Device
- A registered device. Mirrors C#
Device. - Drive
Entity Cache - Typed entity cache over a shared
CacheRepository. Cloning shares the underlying store. - Drive
Event Scope Id - Identifies an event scope to enumerate. C#
DriveEventScopeId. - Encrypted
Cache Repository - At-rest-encryption wrapper around any
CacheRepository. Mirrors C#EncryptedCacheRepository. - External
Invitation - A pending invitation to a non-Proton email address. The invitee must sign up before the share can be finalized; until then it lives as an external invite.
- InMemory
Cache Repository - Thread-safe in-memory
CacheRepository. Mirrors C#InMemoryCacheRepository. - Incoming
Invitation - An invitation addressed to the current user (shared with me), pending
accept or reject. The
invitation_idis the handle foraccept_invitationandreject_invitation. - KeySalt
- A per-key bcrypt salt from
core/v4/keys/salts. - Node
- A decrypted Drive node (folder or file).
- Photo
Upload Metadata - Caller-supplied metadata for a photo upload. Mirrors C#
PhotosFileUploadMetadata: all fields are optional.capture_timedefaults to the upload time when unset;main_photo_uidlinks a related photo (live/burst) to its main photo;tagsclassify the photo. - Photos
Timeline Item - One photos-timeline entry: a photo node and its capture time (epoch
seconds). C#
PhotosTimelineItem(NodeUid Uid, DateTime CaptureTime). - Proton
Drive Client - High-level Proton Drive client.
- Proton
Photos Client - High-level Proton Photos client.
- Public
Link - A public share link on a node.
- Share
Invitation - A pending invitation to a Proton user (not yet accepted).
- Share
Member - A member of a share (an invitation that has been accepted).
- Thumbnail
- A caller-supplied, already-rendered thumbnail to attach to an upload.
Enums§
- Device
Type - The platform a device runs on. Mirrors C#
DeviceType; the discriminant is the wire value. - Drive
Event - A remote data-update event in a volume’s event scope.
- External
Invitation State - State of an external (non-Proton) invitation.
- Member
Role - A sharing permission role. The wire form is a permissions bitmask
(
Read = 4,Write = 2,Admin = 16); Proton only uses three combinations. - Node
Kind - Folder- or file-specific node data.
- Photo
Tag - Photo classification tags. C#
Proton.Drive.Sdk.Nodes.PhotoTag. - Revision
State - The state of a file revision. Mirrors C#
Proton.Drive.Sdk.Nodes.RevisionState(the wireApiRevisionStatealso has aDraft = 0that never surfaces on a node’s active revision). - Thumbnail
Type - The kind of a thumbnail. Mirrors C#
Proton.Drive.Sdk.Nodes.ThumbnailType.
Traits§
- Cache
Repository - A string key/value cache with secondary tag indexing.