use super::Client;
use crate::{
error::Result,
requests::hotkeys::{KeyModifiers, Request},
responses::hotkeys as responses,
};
pub struct Hotkeys<'a> {
pub(super) client: &'a Client,
}
impl Hotkeys<'_> {
#[doc(alias = "GetHotkeyList")]
pub async fn list(&self) -> Result<Vec<String>> {
self.client
.send_message::<_, responses::Hotkeys>(Request::List)
.await
.map(|h| h.hotkeys)
}
#[doc(alias = "TriggerHotkeyByName")]
pub async fn trigger_by_name(&self, name: &str, context: Option<&str>) -> Result<()> {
self.client
.send_message(Request::TriggerByName { name, context })
.await
}
#[doc(alias = "TriggerHotkeyByKeySequence")]
pub async fn trigger_by_sequence(&self, id: &str, modifiers: KeyModifiers) -> Result<()> {
self.client
.send_message(Request::TriggerBySequence { id, modifiers })
.await
}
}