Module documents

Source
Expand description

Interact with the documents store or transfer files across apps.

§Examples

use std::str::FromStr;

use ashpd::{
    documents::{Documents, Permission},
    AppID,
};

async fn run() -> ashpd::Result<()> {
    let proxy = Documents::new().await?;

    println!("{:#?}", proxy.mount_point().await?);
    let app_id = AppID::from_str("org.mozilla.firefox").unwrap();
    for (doc_id, host_path) in proxy.list(Some(&app_id)).await? {
        if doc_id == "f2ee988d".into() {
            let info = proxy.info(doc_id).await?;
            println!("{:#?}", info);
        }
    }

    proxy
        .grant_permissions("f2ee988d", &app_id, &[Permission::GrantPermissions])
        .await?;
    proxy
        .revoke_permissions("f2ee988d", &app_id, &[Permission::Write])
        .await?;

    proxy.delete("f2ee988d").await?;

    Ok(())
}

Structs§

DocumentID
The ID of a file in the document store.
Documents
The interface lets sandboxed applications make files from the outside world available to sandboxed applications in a controlled way.
FileTransfer
The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.

Enums§

DocumentFlags
Document flags
Permission
The possible permissions to grant to a specific application for a specific document.

Type Aliases§

Permissions
A HashMap mapping application IDs to the permissions for that application