use crate::{Error, Uri, proxy::Proxy};
#[derive(Debug)]
#[doc(alias = "org.freedesktop.portal.ProxyResolver")]
pub struct ProxyResolver(Proxy<'static>);
impl ProxyResolver {
pub async fn new() -> Result<Self, Error> {
let proxy = Proxy::new_desktop("org.freedesktop.portal.ProxyResolver").await?;
Ok(Self(proxy))
}
pub async fn with_connection(connection: zbus::Connection) -> Result<Self, Error> {
let proxy =
Proxy::new_desktop_with_connection(connection, "org.freedesktop.portal.ProxyResolver")
.await?;
Ok(Self(proxy))
}
pub fn version(&self) -> u32 {
self.0.version()
}
#[doc(alias = "Lookup")]
pub async fn lookup(&self, uri: &Uri) -> Result<Vec<Uri>, Error> {
self.0.call("Lookup", &(uri)).await
}
}
impl std::ops::Deref for ProxyResolver {
type Target = zbus::Proxy<'static>;
fn deref(&self) -> &Self::Target {
&self.0
}
}