use serde::{Deserialize, Serialize};
pub type TargetId = String;
pub type SessionId = String;
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TargetInfo {
#[serde(rename = "targetId")]
pub target_id: TargetId,
pub r#type: String,
pub title: String,
pub url: String,
pub attached: bool,
#[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
pub parent_id: Option<TargetId>,
#[serde(rename = "openerId", default, skip_serializing_if = "Option::is_none")]
pub opener_id: Option<TargetId>,
#[serde(rename = "canAccessOpener")]
pub can_access_opener: bool,
#[serde(
rename = "openerFrameId",
default,
skip_serializing_if = "Option::is_none"
)]
pub opener_frame_id: Option<crate::protocol::page::FrameId>,
#[serde(
rename = "parentFrameId",
default,
skip_serializing_if = "Option::is_none"
)]
pub parent_frame_id: Option<crate::protocol::page::FrameId>,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub subtype: Option<String>,
#[serde(
rename = "embedderData",
default,
skip_serializing_if = "Option::is_none"
)]
pub embedder_data: Option<serde_json::Value>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct FilterEntry {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub exclude: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub r#type: Option<String>,
}
pub type TargetFilter = Vec<FilterEntry>;
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoteLocation {
pub host: String,
pub port: i64,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WindowState {
#[serde(rename = "normal")]
Normal,
#[serde(rename = "minimized")]
Minimized,
#[serde(rename = "maximized")]
Maximized,
#[serde(rename = "fullscreen")]
Fullscreen,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ActivateTargetParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
impl crate::typed::Command for ActivateTargetParams {
const METHOD: &'static str = "Target.activateTarget";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AttachToTargetParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub flatten: Option<bool>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AttachToTargetReturns {
#[serde(rename = "sessionId")]
pub session_id: SessionId,
}
impl crate::typed::Command for AttachToTargetParams {
const METHOD: &'static str = "Target.attachToTarget";
type Returns = AttachToTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AttachToBrowserTargetParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AttachToBrowserTargetReturns {
#[serde(rename = "sessionId")]
pub session_id: SessionId,
}
impl crate::typed::Command for AttachToBrowserTargetParams {
const METHOD: &'static str = "Target.attachToBrowserTarget";
type Returns = AttachToBrowserTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CloseTargetParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CloseTargetReturns {
pub success: bool,
}
impl crate::typed::Command for CloseTargetParams {
const METHOD: &'static str = "Target.closeTarget";
type Returns = CloseTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ExposeDevToolsProtocolParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
#[serde(
rename = "bindingName",
default,
skip_serializing_if = "Option::is_none"
)]
pub binding_name: Option<String>,
#[serde(
rename = "inheritPermissions",
default,
skip_serializing_if = "Option::is_none"
)]
pub inherit_permissions: Option<bool>,
}
impl crate::typed::Command for ExposeDevToolsProtocolParams {
const METHOD: &'static str = "Target.exposeDevToolsProtocol";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CreateBrowserContextParams {
#[serde(
rename = "disposeOnDetach",
default,
skip_serializing_if = "Option::is_none"
)]
pub dispose_on_detach: Option<bool>,
#[serde(
rename = "proxyServer",
default,
skip_serializing_if = "Option::is_none"
)]
pub proxy_server: Option<String>,
#[serde(
rename = "proxyBypassList",
default,
skip_serializing_if = "Option::is_none"
)]
pub proxy_bypass_list: Option<String>,
#[serde(
rename = "originsWithUniversalNetworkAccess",
default,
skip_serializing_if = "Option::is_none"
)]
pub origins_with_universal_network_access: Option<Vec<String>>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CreateBrowserContextReturns {
#[serde(rename = "browserContextId")]
pub browser_context_id: crate::protocol::browser::BrowserContextId,
}
impl crate::typed::Command for CreateBrowserContextParams {
const METHOD: &'static str = "Target.createBrowserContext";
type Returns = CreateBrowserContextReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserContextsParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserContextsReturns {
#[serde(rename = "browserContextIds")]
pub browser_context_ids: Vec<crate::protocol::browser::BrowserContextId>,
#[serde(
rename = "defaultBrowserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub default_browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
}
impl crate::typed::Command for GetBrowserContextsParams {
const METHOD: &'static str = "Target.getBrowserContexts";
type Returns = GetBrowserContextsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CreateTargetParams {
pub url: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub left: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub top: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(
rename = "windowState",
default,
skip_serializing_if = "Option::is_none"
)]
pub window_state: Option<WindowState>,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
#[serde(
rename = "enableBeginFrameControl",
default,
skip_serializing_if = "Option::is_none"
)]
pub enable_begin_frame_control: Option<bool>,
#[serde(rename = "newWindow", default, skip_serializing_if = "Option::is_none")]
pub new_window: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub background: Option<bool>,
#[serde(rename = "forTab", default, skip_serializing_if = "Option::is_none")]
pub for_tab: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub hidden: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub focus: Option<bool>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CreateTargetReturns {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
impl crate::typed::Command for CreateTargetParams {
const METHOD: &'static str = "Target.createTarget";
type Returns = CreateTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DetachFromTargetParams {
#[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")]
pub session_id: Option<SessionId>,
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
impl crate::typed::Command for DetachFromTargetParams {
const METHOD: &'static str = "Target.detachFromTarget";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisposeBrowserContextParams {
#[serde(rename = "browserContextId")]
pub browser_context_id: crate::protocol::browser::BrowserContextId,
}
impl crate::typed::Command for DisposeBrowserContextParams {
const METHOD: &'static str = "Target.disposeBrowserContext";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTargetInfoParams {
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTargetInfoReturns {
#[serde(rename = "targetInfo")]
pub target_info: TargetInfo,
}
impl crate::typed::Command for GetTargetInfoParams {
const METHOD: &'static str = "Target.getTargetInfo";
type Returns = GetTargetInfoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTargetsParams {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filter: Option<TargetFilter>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTargetsReturns {
#[serde(rename = "targetInfos")]
pub target_infos: Vec<TargetInfo>,
}
impl crate::typed::Command for GetTargetsParams {
const METHOD: &'static str = "Target.getTargets";
type Returns = GetTargetsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SendMessageToTargetParams {
pub message: String,
#[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")]
pub session_id: Option<SessionId>,
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
impl crate::typed::Command for SendMessageToTargetParams {
const METHOD: &'static str = "Target.sendMessageToTarget";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetAutoAttachParams {
#[serde(rename = "autoAttach")]
pub auto_attach: bool,
#[serde(rename = "waitForDebuggerOnStart")]
pub wait_for_debugger_on_start: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub flatten: Option<bool>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filter: Option<TargetFilter>,
}
impl crate::typed::Command for SetAutoAttachParams {
const METHOD: &'static str = "Target.setAutoAttach";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AutoAttachRelatedParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
#[serde(rename = "waitForDebuggerOnStart")]
pub wait_for_debugger_on_start: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filter: Option<TargetFilter>,
}
impl crate::typed::Command for AutoAttachRelatedParams {
const METHOD: &'static str = "Target.autoAttachRelated";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDiscoverTargetsParams {
pub discover: bool,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub filter: Option<TargetFilter>,
}
impl crate::typed::Command for SetDiscoverTargetsParams {
const METHOD: &'static str = "Target.setDiscoverTargets";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetRemoteLocationsParams {
pub locations: Vec<RemoteLocation>,
}
impl crate::typed::Command for SetRemoteLocationsParams {
const METHOD: &'static str = "Target.setRemoteLocations";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDevToolsTargetParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDevToolsTargetReturns {
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
impl crate::typed::Command for GetDevToolsTargetParams {
const METHOD: &'static str = "Target.getDevToolsTarget";
type Returns = GetDevToolsTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct OpenDevToolsParams {
#[serde(rename = "targetId")]
pub target_id: TargetId,
#[serde(rename = "panelId", default, skip_serializing_if = "Option::is_none")]
pub panel_id: Option<String>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct OpenDevToolsReturns {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
impl crate::typed::Command for OpenDevToolsParams {
const METHOD: &'static str = "Target.openDevTools";
type Returns = OpenDevToolsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AttachedToTargetEvent {
#[serde(rename = "sessionId")]
pub session_id: SessionId,
#[serde(rename = "targetInfo")]
pub target_info: TargetInfo,
#[serde(rename = "waitingForDebugger")]
pub waiting_for_debugger: bool,
}
impl crate::typed::Event for AttachedToTargetEvent {
const METHOD: &'static str = "Target.attachedToTarget";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DetachedFromTargetEvent {
#[serde(rename = "sessionId")]
pub session_id: SessionId,
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
impl crate::typed::Event for DetachedFromTargetEvent {
const METHOD: &'static str = "Target.detachedFromTarget";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ReceivedMessageFromTargetEvent {
#[serde(rename = "sessionId")]
pub session_id: SessionId,
pub message: String,
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<TargetId>,
}
impl crate::typed::Event for ReceivedMessageFromTargetEvent {
const METHOD: &'static str = "Target.receivedMessageFromTarget";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TargetCreatedEvent {
#[serde(rename = "targetInfo")]
pub target_info: TargetInfo,
}
impl crate::typed::Event for TargetCreatedEvent {
const METHOD: &'static str = "Target.targetCreated";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TargetDestroyedEvent {
#[serde(rename = "targetId")]
pub target_id: TargetId,
}
impl crate::typed::Event for TargetDestroyedEvent {
const METHOD: &'static str = "Target.targetDestroyed";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TargetCrashedEvent {
#[serde(rename = "targetId")]
pub target_id: TargetId,
pub status: String,
#[serde(rename = "errorCode")]
pub error_code: i64,
}
impl crate::typed::Event for TargetCrashedEvent {
const METHOD: &'static str = "Target.targetCrashed";
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TargetInfoChangedEvent {
#[serde(rename = "targetInfo")]
pub target_info: TargetInfo,
}
impl crate::typed::Event for TargetInfoChangedEvent {
const METHOD: &'static str = "Target.targetInfoChanged";
}