use http::Method;
use serde_json::json;
use crate::{RequestData, common::command::FormatRequestData};
#[derive(Debug)]
pub enum FirefoxCommand {
InstallAddon {
path: String,
temporary: Option<bool>,
},
FullScreenshot {},
}
impl FormatRequestData for FirefoxCommand {
fn format_request(&self, session_id: &crate::SessionId) -> RequestData {
match &self {
FirefoxCommand::InstallAddon {
path,
temporary,
} => {
RequestData::new(Method::POST, format!("/session/{}/moz/addon/install", session_id))
.add_body(json!({
"path": path,
"temporary": temporary
}))
}
FirefoxCommand::FullScreenshot {} => RequestData::new(
Method::GET,
format!("/session/{}/moz/screenshot/full", session_id),
),
}
}
}