use serde::{Deserialize, Serialize};
#[doc = "Dispatches a drag event into the page.\n[dispatchDragEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchDragEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchDragEventParams {
#[doc = "Type of the drag event."]
#[serde(rename = "type")]
pub r#type: DispatchDragEventType,
#[doc = "X coordinate of the event relative to the main frame's viewport in CSS pixels."]
#[serde(rename = "x")]
pub x: f64,
#[doc = "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport."]
#[serde(rename = "y")]
pub y: f64,
#[serde(rename = "data")]
pub data: super::types::DragData,
#[doc = "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0)."]
#[serde(rename = "modifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub modifiers: Option<i64>,
}
#[doc = "Type of the drag event."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DispatchDragEventType {
#[serde(rename = "dragEnter")]
DragEnter,
#[serde(rename = "dragOver")]
DragOver,
#[serde(rename = "drop")]
Drop,
#[serde(rename = "dragCancel")]
DragCancel,
}
impl DispatchDragEventParams {
pub fn new(
r#type: impl Into<DispatchDragEventType>,
x: impl Into<f64>,
y: impl Into<f64>,
data: impl Into<super::types::DragData>,
) -> Self {
Self {
r#type: r#type.into(),
x: x.into(),
y: y.into(),
data: data.into(),
modifiers: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DispatchDragEventMethod {
#[serde(rename = "Input.dispatchDragEvent")]
DispatchDragEvent,
}
#[doc = "Dispatches a drag event into the page.\n[dispatchDragEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchDragEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchDragEvent {
pub method: DispatchDragEventMethod,
pub params: DispatchDragEventParams,
}
impl DispatchDragEvent {
pub const IDENTIFIER: &'static str = "Input.dispatchDragEvent";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DispatchDragEvent {
type Result = super::results::DispatchDragEventResult;
}
#[doc = "Dispatches a key event to the page.\n[dispatchKeyEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchKeyEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchKeyEventParams {
#[doc = "Type of the key event."]
#[serde(rename = "type")]
pub r#type: DispatchKeyEventType,
#[doc = "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0)."]
#[serde(rename = "modifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub modifiers: Option<i64>,
#[doc = "Time at which the event occurred."]
#[serde(rename = "timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub timestamp: Option<super::types::TimeSinceEpoch>,
#[doc = "Text as generated by processing a virtual key code with a keyboard layout. Not needed for\nfor `keyUp` and `rawKeyDown` events (default: \"\")"]
#[serde(rename = "text")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub text: Option<String>,
#[doc = "Text that would have been generated by the keyboard if no modifiers were pressed (except for\nshift). Useful for shortcut (accelerator) key handling (default: \"\")."]
#[serde(rename = "unmodifiedText")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub unmodified_text: Option<String>,
#[doc = "Unique key identifier (e.g., 'U+0041') (default: \"\")."]
#[serde(rename = "keyIdentifier")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub key_identifier: Option<String>,
#[doc = "Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: \"\")."]
#[serde(rename = "code")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub code: Option<String>,
#[doc = "Unique DOM defined string value describing the meaning of the key in the context of active\nmodifiers, keyboard layout, etc (e.g., 'AltGr') (default: \"\")."]
#[serde(rename = "key")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub key: Option<String>,
#[doc = "Windows virtual key code (default: 0)."]
#[serde(rename = "windowsVirtualKeyCode")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub windows_virtual_key_code: Option<i64>,
#[doc = "Native virtual key code (default: 0)."]
#[serde(rename = "nativeVirtualKeyCode")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub native_virtual_key_code: Option<i64>,
#[doc = "Whether the event was generated from auto repeat (default: false)."]
#[serde(rename = "autoRepeat")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub auto_repeat: Option<bool>,
#[doc = "Whether the event was generated from the keypad (default: false)."]
#[serde(rename = "isKeypad")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub is_keypad: Option<bool>,
#[doc = "Whether the event was a system key event (default: false)."]
#[serde(rename = "isSystemKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub is_system_key: Option<bool>,
#[doc = "Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:\n0)."]
#[serde(rename = "location")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub location: Option<i64>,
#[doc = "Editing commands to send with the key event (e.g., 'selectAll') (default: []).\nThese are related to but not equal the command names used in `document.execCommand` and NSStandardKeyBindingResponding.\nSee https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h for valid command names."]
#[serde(rename = "commands")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub commands: Option<Vec<String>>,
}
#[doc = "Type of the key event."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DispatchKeyEventType {
#[serde(rename = "keyDown")]
KeyDown,
#[serde(rename = "keyUp")]
KeyUp,
#[serde(rename = "rawKeyDown")]
RawKeyDown,
#[serde(rename = "char")]
Char,
}
impl DispatchKeyEventParams {
pub fn new(r#type: impl Into<DispatchKeyEventType>) -> Self {
Self {
r#type: r#type.into(),
modifiers: None,
timestamp: None,
text: None,
unmodified_text: None,
key_identifier: None,
code: None,
key: None,
windows_virtual_key_code: None,
native_virtual_key_code: None,
auto_repeat: None,
is_keypad: None,
is_system_key: None,
location: None,
commands: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DispatchKeyEventMethod {
#[serde(rename = "Input.dispatchKeyEvent")]
DispatchKeyEvent,
}
#[doc = "Dispatches a key event to the page.\n[dispatchKeyEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchKeyEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchKeyEvent {
pub method: DispatchKeyEventMethod,
pub params: DispatchKeyEventParams,
}
impl DispatchKeyEvent {
pub const IDENTIFIER: &'static str = "Input.dispatchKeyEvent";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DispatchKeyEvent {
type Result = super::results::DispatchKeyEventResult;
}
#[doc = "This method emulates inserting text that doesn't come from a key press,\nfor example an emoji keyboard or an IME.\n[insertText](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-insertText)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsertTextParams {
#[doc = "The text to insert."]
#[serde(rename = "text")]
pub text: String,
}
impl InsertTextParams {
pub fn new(text: impl Into<String>) -> Self {
Self { text: text.into() }
}
}
impl<T: Into<String>> From<T> for InsertTextParams {
fn from(url: T) -> Self {
InsertTextParams::new(url)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum InsertTextMethod {
#[serde(rename = "Input.insertText")]
InsertText,
}
#[doc = "This method emulates inserting text that doesn't come from a key press,\nfor example an emoji keyboard or an IME.\n[insertText](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-insertText)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsertText {
pub method: InsertTextMethod,
pub params: InsertTextParams,
}
impl InsertText {
pub const IDENTIFIER: &'static str = "Input.insertText";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for InsertText {
type Result = super::results::InsertTextResult;
}
#[doc = "This method sets the current candidate text for IME.\nUse imeCommitComposition to commit the final text.\nUse imeSetComposition with empty string as text to cancel composition.\n[imeSetComposition](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-imeSetComposition)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ImeSetCompositionParams {
#[doc = "The text to insert"]
#[serde(rename = "text")]
pub text: String,
#[doc = "selection start"]
#[serde(rename = "selectionStart")]
pub selection_start: i64,
#[doc = "selection end"]
#[serde(rename = "selectionEnd")]
pub selection_end: i64,
#[doc = "replacement start"]
#[serde(rename = "replacementStart")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub replacement_start: Option<i64>,
#[doc = "replacement end"]
#[serde(rename = "replacementEnd")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub replacement_end: Option<i64>,
}
impl ImeSetCompositionParams {
pub fn new(
text: impl Into<String>,
selection_start: impl Into<i64>,
selection_end: impl Into<i64>,
) -> Self {
Self {
text: text.into(),
selection_start: selection_start.into(),
selection_end: selection_end.into(),
replacement_start: None,
replacement_end: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum ImeSetCompositionMethod {
#[serde(rename = "Input.imeSetComposition")]
ImeSetComposition,
}
#[doc = "This method sets the current candidate text for IME.\nUse imeCommitComposition to commit the final text.\nUse imeSetComposition with empty string as text to cancel composition.\n[imeSetComposition](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-imeSetComposition)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ImeSetComposition {
pub method: ImeSetCompositionMethod,
pub params: ImeSetCompositionParams,
}
impl ImeSetComposition {
pub const IDENTIFIER: &'static str = "Input.imeSetComposition";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for ImeSetComposition {
type Result = super::results::ImeSetCompositionResult;
}
#[doc = "Dispatches a mouse event to the page.\n[dispatchMouseEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchMouseEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchMouseEventParams {
#[doc = "Type of the mouse event."]
#[serde(rename = "type")]
pub r#type: DispatchMouseEventType,
#[doc = "X coordinate of the event relative to the main frame's viewport in CSS pixels."]
#[serde(rename = "x")]
pub x: f64,
#[doc = "Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to\nthe top of the viewport and Y increases as it proceeds towards the bottom of the viewport."]
#[serde(rename = "y")]
pub y: f64,
#[doc = "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0)."]
#[serde(rename = "modifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub modifiers: Option<i64>,
#[doc = "Time at which the event occurred."]
#[serde(rename = "timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub timestamp: Option<super::types::TimeSinceEpoch>,
#[doc = "Mouse button (default: \"none\")."]
#[serde(rename = "button")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub button: Option<super::types::MouseButton>,
#[doc = "A number indicating which buttons are pressed on the mouse when a mouse event is triggered.\nLeft=1, Right=2, Middle=4, Back=8, Forward=16, None=0."]
#[serde(rename = "buttons")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub buttons: Option<i64>,
#[doc = "Number of times the mouse button was clicked (default: 0)."]
#[serde(rename = "clickCount")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub click_count: Option<i64>,
#[doc = "The normalized pressure, which has a range of [0,1] (default: 0)."]
#[serde(rename = "force")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub force: Option<f64>,
#[doc = "The normalized tangential pressure, which has a range of [-1,1] (default: 0)."]
#[serde(rename = "tangentialPressure")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub tangential_pressure: Option<f64>,
#[doc = "The plane angle between the Y-Z plane and the plane containing both the stylus axis and the Y axis, in degrees of the range [-90,90], a positive tiltX is to the right (default: 0)."]
#[serde(rename = "tiltX")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub tilt_x: Option<f64>,
#[doc = "The plane angle between the X-Z plane and the plane containing both the stylus axis and the X axis, in degrees of the range [-90,90], a positive tiltY is towards the user (default: 0)."]
#[serde(rename = "tiltY")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub tilt_y: Option<f64>,
#[doc = "The clockwise rotation of a pen stylus around its own major axis, in degrees in the range [0,359] (default: 0)."]
#[serde(rename = "twist")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub twist: Option<i64>,
#[doc = "X delta in CSS pixels for mouse wheel event (default: 0)."]
#[serde(rename = "deltaX")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub delta_x: Option<f64>,
#[doc = "Y delta in CSS pixels for mouse wheel event (default: 0)."]
#[serde(rename = "deltaY")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub delta_y: Option<f64>,
#[doc = "Pointer type (default: \"mouse\")."]
#[serde(rename = "pointerType")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub pointer_type: Option<DispatchMouseEventPointerType>,
}
#[doc = "Type of the mouse event."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DispatchMouseEventType {
#[serde(rename = "mousePressed")]
MousePressed,
#[serde(rename = "mouseReleased")]
MouseReleased,
#[serde(rename = "mouseMoved")]
MouseMoved,
#[serde(rename = "mouseWheel")]
MouseWheel,
}
#[doc = "Pointer type (default: \"mouse\")."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DispatchMouseEventPointerType {
#[serde(rename = "mouse")]
Mouse,
#[serde(rename = "pen")]
Pen,
}
impl DispatchMouseEventParams {
pub fn new(
r#type: impl Into<DispatchMouseEventType>,
x: impl Into<f64>,
y: impl Into<f64>,
) -> Self {
Self {
r#type: r#type.into(),
x: x.into(),
y: y.into(),
modifiers: None,
timestamp: None,
button: None,
buttons: None,
click_count: None,
force: None,
tangential_pressure: None,
tilt_x: None,
tilt_y: None,
twist: None,
delta_x: None,
delta_y: None,
pointer_type: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DispatchMouseEventMethod {
#[serde(rename = "Input.dispatchMouseEvent")]
DispatchMouseEvent,
}
#[doc = "Dispatches a mouse event to the page.\n[dispatchMouseEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchMouseEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchMouseEvent {
pub method: DispatchMouseEventMethod,
pub params: DispatchMouseEventParams,
}
impl DispatchMouseEvent {
pub const IDENTIFIER: &'static str = "Input.dispatchMouseEvent";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DispatchMouseEvent {
type Result = super::results::DispatchMouseEventResult;
}
#[doc = "Dispatches a touch event to the page.\n[dispatchTouchEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchTouchEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchTouchEventParams {
#[doc = "Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while\nTouchStart and TouchMove must contains at least one."]
#[serde(rename = "type")]
pub r#type: DispatchTouchEventType,
#[doc = "Active touch points on the touch device. One event per any changed point (compared to\nprevious touch event in a sequence) is generated, emulating pressing/moving/releasing points\none by one."]
#[serde(rename = "touchPoints")]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub touch_points: Vec<super::types::TouchPoint>,
#[doc = "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0)."]
#[serde(rename = "modifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub modifiers: Option<i64>,
#[doc = "Time at which the event occurred."]
#[serde(rename = "timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub timestamp: Option<super::types::TimeSinceEpoch>,
}
#[doc = "Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while\nTouchStart and TouchMove must contains at least one."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DispatchTouchEventType {
#[serde(rename = "touchStart")]
TouchStart,
#[serde(rename = "touchEnd")]
TouchEnd,
#[serde(rename = "touchMove")]
TouchMove,
#[serde(rename = "touchCancel")]
TouchCancel,
}
impl DispatchTouchEventParams {
pub fn new(
r#type: impl Into<DispatchTouchEventType>,
touch_points: Vec<super::types::TouchPoint>,
) -> Self {
Self {
r#type: r#type.into(),
touch_points,
modifiers: None,
timestamp: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DispatchTouchEventMethod {
#[serde(rename = "Input.dispatchTouchEvent")]
DispatchTouchEvent,
}
#[doc = "Dispatches a touch event to the page.\n[dispatchTouchEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchTouchEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DispatchTouchEvent {
pub method: DispatchTouchEventMethod,
pub params: DispatchTouchEventParams,
}
impl DispatchTouchEvent {
pub const IDENTIFIER: &'static str = "Input.dispatchTouchEvent";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DispatchTouchEvent {
type Result = super::results::DispatchTouchEventResult;
}
#[doc = "Cancels any active dragging in the page.\n[cancelDragging](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-cancelDragging)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CancelDraggingParams {}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum CancelDraggingMethod {
#[serde(rename = "Input.cancelDragging")]
CancelDragging,
}
#[doc = "Cancels any active dragging in the page.\n[cancelDragging](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-cancelDragging)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CancelDragging {
pub method: CancelDraggingMethod,
pub params: CancelDraggingParams,
}
impl CancelDragging {
pub const IDENTIFIER: &'static str = "Input.cancelDragging";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for CancelDragging {
type Result = super::results::CancelDraggingResult;
}
#[doc = "Emulates touch event from the mouse event parameters.\n[emulateTouchFromMouseEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-emulateTouchFromMouseEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EmulateTouchFromMouseEventParams {
#[doc = "Type of the mouse event."]
#[serde(rename = "type")]
pub r#type: EmulateTouchFromMouseEventType,
#[doc = "X coordinate of the mouse pointer in DIP."]
#[serde(rename = "x")]
pub x: i64,
#[doc = "Y coordinate of the mouse pointer in DIP."]
#[serde(rename = "y")]
pub y: i64,
#[doc = "Mouse button. Only \"none\", \"left\", \"right\" are supported."]
#[serde(rename = "button")]
pub button: super::types::MouseButton,
#[doc = "Time at which the event occurred (default: current time)."]
#[serde(rename = "timestamp")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub timestamp: Option<super::types::TimeSinceEpoch>,
#[doc = "X delta in DIP for mouse wheel event (default: 0)."]
#[serde(rename = "deltaX")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub delta_x: Option<f64>,
#[doc = "Y delta in DIP for mouse wheel event (default: 0)."]
#[serde(rename = "deltaY")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub delta_y: Option<f64>,
#[doc = "Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8\n(default: 0)."]
#[serde(rename = "modifiers")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub modifiers: Option<i64>,
#[doc = "Number of times the mouse button was clicked (default: 0)."]
#[serde(rename = "clickCount")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub click_count: Option<i64>,
}
#[doc = "Type of the mouse event."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum EmulateTouchFromMouseEventType {
#[serde(rename = "mousePressed")]
MousePressed,
#[serde(rename = "mouseReleased")]
MouseReleased,
#[serde(rename = "mouseMoved")]
MouseMoved,
#[serde(rename = "mouseWheel")]
MouseWheel,
}
impl EmulateTouchFromMouseEventParams {
pub fn new(
r#type: impl Into<EmulateTouchFromMouseEventType>,
x: impl Into<i64>,
y: impl Into<i64>,
button: impl Into<super::types::MouseButton>,
) -> Self {
Self {
r#type: r#type.into(),
x: x.into(),
y: y.into(),
button: button.into(),
timestamp: None,
delta_x: None,
delta_y: None,
modifiers: None,
click_count: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum EmulateTouchFromMouseEventMethod {
#[serde(rename = "Input.emulateTouchFromMouseEvent")]
EmulateTouchFromMouseEvent,
}
#[doc = "Emulates touch event from the mouse event parameters.\n[emulateTouchFromMouseEvent](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-emulateTouchFromMouseEvent)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EmulateTouchFromMouseEvent {
pub method: EmulateTouchFromMouseEventMethod,
pub params: EmulateTouchFromMouseEventParams,
}
impl EmulateTouchFromMouseEvent {
pub const IDENTIFIER: &'static str = "Input.emulateTouchFromMouseEvent";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for EmulateTouchFromMouseEvent {
type Result = super::results::EmulateTouchFromMouseEventResult;
}
#[doc = "Ignores input events (useful while auditing page).\n[setIgnoreInputEvents](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-setIgnoreInputEvents)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetIgnoreInputEventsParams {
#[doc = "Ignores input events processing when set to true."]
#[serde(rename = "ignore")]
pub ignore: bool,
}
impl SetIgnoreInputEventsParams {
pub fn new(ignore: impl Into<bool>) -> Self {
Self {
ignore: ignore.into(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SetIgnoreInputEventsMethod {
#[serde(rename = "Input.setIgnoreInputEvents")]
SetIgnoreInputEvents,
}
#[doc = "Ignores input events (useful while auditing page).\n[setIgnoreInputEvents](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-setIgnoreInputEvents)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetIgnoreInputEvents {
pub method: SetIgnoreInputEventsMethod,
pub params: SetIgnoreInputEventsParams,
}
impl SetIgnoreInputEvents {
pub const IDENTIFIER: &'static str = "Input.setIgnoreInputEvents";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for SetIgnoreInputEvents {
type Result = super::results::SetIgnoreInputEventsResult;
}
#[doc = "Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events.\nDrag and drop behavior can be directly controlled via `Input.dispatchDragEvent`.\n[setInterceptDrags](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-setInterceptDrags)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetInterceptDragsParams {
#[serde(rename = "enabled")]
pub enabled: bool,
}
impl SetInterceptDragsParams {
pub fn new(enabled: impl Into<bool>) -> Self {
Self {
enabled: enabled.into(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SetInterceptDragsMethod {
#[serde(rename = "Input.setInterceptDrags")]
SetInterceptDrags,
}
#[doc = "Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events.\nDrag and drop behavior can be directly controlled via `Input.dispatchDragEvent`.\n[setInterceptDrags](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-setInterceptDrags)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetInterceptDrags {
pub method: SetInterceptDragsMethod,
pub params: SetInterceptDragsParams,
}
impl SetInterceptDrags {
pub const IDENTIFIER: &'static str = "Input.setInterceptDrags";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for SetInterceptDrags {
type Result = super::results::SetInterceptDragsResult;
}
#[doc = "Synthesizes a pinch gesture over a time period by issuing appropriate touch events.\n[synthesizePinchGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizePinchGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizePinchGestureParams {
#[doc = "X coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "x")]
pub x: f64,
#[doc = "Y coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "y")]
pub y: f64,
#[doc = "Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out)."]
#[serde(rename = "scaleFactor")]
pub scale_factor: f64,
#[doc = "Relative pointer speed in pixels per second (default: 800)."]
#[serde(rename = "relativeSpeed")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub relative_speed: Option<i64>,
#[doc = "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type)."]
#[serde(rename = "gestureSourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub gesture_source_type: Option<super::types::GestureSourceType>,
}
impl SynthesizePinchGestureParams {
pub fn new(x: impl Into<f64>, y: impl Into<f64>, scale_factor: impl Into<f64>) -> Self {
Self {
x: x.into(),
y: y.into(),
scale_factor: scale_factor.into(),
relative_speed: None,
gesture_source_type: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SynthesizePinchGestureMethod {
#[serde(rename = "Input.synthesizePinchGesture")]
SynthesizePinchGesture,
}
#[doc = "Synthesizes a pinch gesture over a time period by issuing appropriate touch events.\n[synthesizePinchGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizePinchGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizePinchGesture {
pub method: SynthesizePinchGestureMethod,
pub params: SynthesizePinchGestureParams,
}
impl SynthesizePinchGesture {
pub const IDENTIFIER: &'static str = "Input.synthesizePinchGesture";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for SynthesizePinchGesture {
type Result = super::results::SynthesizePinchGestureResult;
}
#[doc = "Synthesizes a scroll gesture over a time period by issuing appropriate touch events.\n[synthesizeScrollGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizeScrollGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizeScrollGestureParams {
#[doc = "X coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "x")]
pub x: f64,
#[doc = "Y coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "y")]
pub y: f64,
#[doc = "The distance to scroll along the X axis (positive to scroll left)."]
#[serde(rename = "xDistance")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub x_distance: Option<f64>,
#[doc = "The distance to scroll along the Y axis (positive to scroll up)."]
#[serde(rename = "yDistance")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub y_distance: Option<f64>,
#[doc = "The number of additional pixels to scroll back along the X axis, in addition to the given\ndistance."]
#[serde(rename = "xOverscroll")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub x_overscroll: Option<f64>,
#[doc = "The number of additional pixels to scroll back along the Y axis, in addition to the given\ndistance."]
#[serde(rename = "yOverscroll")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub y_overscroll: Option<f64>,
#[doc = "Prevent fling (default: true)."]
#[serde(rename = "preventFling")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub prevent_fling: Option<bool>,
#[doc = "Swipe speed in pixels per second (default: 800)."]
#[serde(rename = "speed")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub speed: Option<i64>,
#[doc = "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type)."]
#[serde(rename = "gestureSourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub gesture_source_type: Option<super::types::GestureSourceType>,
#[doc = "The number of times to repeat the gesture (default: 0)."]
#[serde(rename = "repeatCount")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub repeat_count: Option<i64>,
#[doc = "The number of milliseconds delay between each repeat. (default: 250)."]
#[serde(rename = "repeatDelayMs")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub repeat_delay_ms: Option<i64>,
#[doc = "The name of the interaction markers to generate, if not empty (default: \"\")."]
#[serde(rename = "interactionMarkerName")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub interaction_marker_name: Option<String>,
}
impl SynthesizeScrollGestureParams {
pub fn new(x: impl Into<f64>, y: impl Into<f64>) -> Self {
Self {
x: x.into(),
y: y.into(),
x_distance: None,
y_distance: None,
x_overscroll: None,
y_overscroll: None,
prevent_fling: None,
speed: None,
gesture_source_type: None,
repeat_count: None,
repeat_delay_ms: None,
interaction_marker_name: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SynthesizeScrollGestureMethod {
#[serde(rename = "Input.synthesizeScrollGesture")]
SynthesizeScrollGesture,
}
#[doc = "Synthesizes a scroll gesture over a time period by issuing appropriate touch events.\n[synthesizeScrollGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizeScrollGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizeScrollGesture {
pub method: SynthesizeScrollGestureMethod,
pub params: SynthesizeScrollGestureParams,
}
impl SynthesizeScrollGesture {
pub const IDENTIFIER: &'static str = "Input.synthesizeScrollGesture";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for SynthesizeScrollGesture {
type Result = super::results::SynthesizeScrollGestureResult;
}
#[doc = "Synthesizes a tap gesture over a time period by issuing appropriate touch events.\n[synthesizeTapGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizeTapGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizeTapGestureParams {
#[doc = "X coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "x")]
pub x: f64,
#[doc = "Y coordinate of the start of the gesture in CSS pixels."]
#[serde(rename = "y")]
pub y: f64,
#[doc = "Duration between touchdown and touchup events in ms (default: 50)."]
#[serde(rename = "duration")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub duration: Option<i64>,
#[doc = "Number of times to perform the tap (e.g. 2 for double tap, default: 1)."]
#[serde(rename = "tapCount")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub tap_count: Option<i64>,
#[doc = "Which type of input events to be generated (default: 'default', which queries the platform\nfor the preferred input type)."]
#[serde(rename = "gestureSourceType")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub gesture_source_type: Option<super::types::GestureSourceType>,
}
impl SynthesizeTapGestureParams {
pub fn new(x: impl Into<f64>, y: impl Into<f64>) -> Self {
Self {
x: x.into(),
y: y.into(),
duration: None,
tap_count: None,
gesture_source_type: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SynthesizeTapGestureMethod {
#[serde(rename = "Input.synthesizeTapGesture")]
SynthesizeTapGesture,
}
#[doc = "Synthesizes a tap gesture over a time period by issuing appropriate touch events.\n[synthesizeTapGesture](https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-synthesizeTapGesture)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SynthesizeTapGesture {
pub method: SynthesizeTapGestureMethod,
pub params: SynthesizeTapGestureParams,
}
impl SynthesizeTapGesture {
pub const IDENTIFIER: &'static str = "Input.synthesizeTapGesture";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for SynthesizeTapGesture {
type Result = super::results::SynthesizeTapGestureResult;
}
group_enum ! (InputCommands { DispatchDragEvent (DispatchDragEvent) , DispatchKeyEvent (DispatchKeyEvent) , InsertText (InsertText) , ImeSetComposition (ImeSetComposition) , DispatchMouseEvent (DispatchMouseEvent) , DispatchTouchEvent (DispatchTouchEvent) , CancelDragging (CancelDragging) , EmulateTouchFromMouseEvent (EmulateTouchFromMouseEvent) , SetIgnoreInputEvents (SetIgnoreInputEvents) , SetInterceptDrags (SetInterceptDrags) , SynthesizePinchGesture (SynthesizePinchGesture) , SynthesizeScrollGesture (SynthesizeScrollGesture) , SynthesizeTapGesture (SynthesizeTapGesture) } + identifiable);