Skip to main content

nextcloud_goa/
proxy.rs

1//! D-Bus proxy interfaces for GNOME Online Accounts.
2
3use std::collections::HashMap;
4use zbus::proxy;
5use zbus::zvariant::{OwnedObjectPath, OwnedValue};
6
7/// A mapping of property names to their variant values.
8pub type PropertyMap = HashMap<String, OwnedValue>;
9
10/// A mapping of interface names to their property dictionaries.
11pub type InterfaceMap = HashMap<String, PropertyMap>;
12
13/// A mapping of object paths to their interfaces and properties.
14pub type ManagedObjectsMap = HashMap<OwnedObjectPath, InterfaceMap>;
15
16/// Proxy interface for `org.freedesktop.DBus.ObjectManager`.
17#[proxy(
18    default_service = "org.gnome.OnlineAccounts",
19    default_path = "/org/gnome/OnlineAccounts",
20    interface = "org.freedesktop.DBus.ObjectManager"
21)]
22pub trait ObjectManager {
23    /// Retrieves all managed objects under `/org/gnome/OnlineAccounts`.
24    fn get_managed_objects(&self) -> zbus::Result<ManagedObjectsMap>;
25}
26
27/// Proxy interface for `org.gnome.OnlineAccounts.Account`.
28#[proxy(
29    default_service = "org.gnome.OnlineAccounts",
30    interface = "org.gnome.OnlineAccounts.Account"
31)]
32pub trait Account {
33    /// Account unique identifier.
34    #[zbus(property)]
35    fn id(&self) -> zbus::Result<String>;
36
37    /// Technical identity (user name or email).
38    #[zbus(property)]
39    fn identity(&self) -> zbus::Result<String>;
40
41    /// Presentation identity for display.
42    #[zbus(property)]
43    fn presentation_identity(&self) -> zbus::Result<String>;
44
45    /// Provider type string (e.g. "owncloud").
46    #[zbus(property)]
47    fn provider_type(&self) -> zbus::Result<String>;
48}
49
50/// Proxy interface for `org.gnome.OnlineAccounts.Files`.
51#[proxy(
52    default_service = "org.gnome.OnlineAccounts",
53    interface = "org.gnome.OnlineAccounts.Files"
54)]
55pub trait Files {
56    /// WebDAV endpoint URI.
57    #[zbus(property)]
58    fn uri(&self) -> zbus::Result<String>;
59}
60
61/// Proxy interface for `org.gnome.OnlineAccounts.PasswordBased`.
62#[proxy(
63    default_service = "org.gnome.OnlineAccounts",
64    interface = "org.gnome.OnlineAccounts.PasswordBased"
65)]
66pub trait PasswordBased {
67    /// Retrieves the stored password.
68    fn get_password(&self, id: &str) -> zbus::Result<String>;
69}