use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TouchPoint {
x: f64,
y: f64,
#[serde(skip_serializing_if = "Option::is_none")]
radiusX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
radiusY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
rotationAngle: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
force: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tangentialPressure: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tiltX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tiltY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
twist: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
id: Option<f64>,
}
impl TouchPoint {
pub fn builder(x: f64, y: f64) -> TouchPointBuilder {
TouchPointBuilder {
x: x,
y: y,
radiusX: None,
radiusY: None,
rotationAngle: None,
force: None,
tangentialPressure: None,
tiltX: None,
tiltY: None,
twist: None,
id: None,
}
}
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn radiusX(&self) -> Option<f64> { self.radiusX }
pub fn radiusY(&self) -> Option<f64> { self.radiusY }
pub fn rotationAngle(&self) -> Option<f64> { self.rotationAngle }
pub fn force(&self) -> Option<f64> { self.force }
pub fn tangentialPressure(&self) -> Option<f64> { self.tangentialPressure }
pub fn tiltX(&self) -> Option<f64> { self.tiltX }
pub fn tiltY(&self) -> Option<f64> { self.tiltY }
pub fn twist(&self) -> Option<i64> { self.twist }
pub fn id(&self) -> Option<f64> { self.id }
}
pub struct TouchPointBuilder {
x: f64,
y: f64,
radiusX: Option<f64>,
radiusY: Option<f64>,
rotationAngle: Option<f64>,
force: Option<f64>,
tangentialPressure: Option<f64>,
tiltX: Option<f64>,
tiltY: Option<f64>,
twist: Option<i64>,
id: Option<f64>,
}
impl TouchPointBuilder {
pub fn radiusX(mut self, radiusX: f64) -> Self { self.radiusX = Some(radiusX); self }
pub fn radiusY(mut self, radiusY: f64) -> Self { self.radiusY = Some(radiusY); self }
pub fn rotationAngle(mut self, rotationAngle: f64) -> Self { self.rotationAngle = Some(rotationAngle); self }
pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
pub fn tangentialPressure(mut self, tangentialPressure: f64) -> Self { self.tangentialPressure = Some(tangentialPressure); self }
pub fn tiltX(mut self, tiltX: f64) -> Self { self.tiltX = Some(tiltX); self }
pub fn tiltY(mut self, tiltY: f64) -> Self { self.tiltY = Some(tiltY); self }
pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
pub fn id(mut self, id: f64) -> Self { self.id = Some(id); self }
pub fn build(self) -> TouchPoint {
TouchPoint {
x: self.x,
y: self.y,
radiusX: self.radiusX,
radiusY: self.radiusY,
rotationAngle: self.rotationAngle,
force: self.force,
tangentialPressure: self.tangentialPressure,
tiltX: self.tiltX,
tiltY: self.tiltY,
twist: self.twist,
id: self.id,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum GestureSourceType {
#[default]
#[serde(rename = "default")]
Default,
#[serde(rename = "touch")]
Touch,
#[serde(rename = "mouse")]
Mouse,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum MouseButton {
#[default]
#[serde(rename = "none")]
None,
#[serde(rename = "left")]
Left,
#[serde(rename = "middle")]
Middle,
#[serde(rename = "right")]
Right,
#[serde(rename = "back")]
Back,
#[serde(rename = "forward")]
Forward,
}
pub type TimeSinceEpoch = f64;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragDataItem<'a> {
mimeType: Cow<'a, str>,
data: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
baseURL: Option<Cow<'a, str>>,
}
impl<'a> DragDataItem<'a> {
pub fn builder(mimeType: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> DragDataItemBuilder<'a> {
DragDataItemBuilder {
mimeType: mimeType.into(),
data: data.into(),
title: None,
baseURL: None,
}
}
pub fn mimeType(&self) -> &str { self.mimeType.as_ref() }
pub fn data(&self) -> &str { self.data.as_ref() }
pub fn title(&self) -> Option<&str> { self.title.as_deref() }
pub fn baseURL(&self) -> Option<&str> { self.baseURL.as_deref() }
}
pub struct DragDataItemBuilder<'a> {
mimeType: Cow<'a, str>,
data: Cow<'a, str>,
title: Option<Cow<'a, str>>,
baseURL: Option<Cow<'a, str>>,
}
impl<'a> DragDataItemBuilder<'a> {
pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
pub fn baseURL(mut self, baseURL: impl Into<Cow<'a, str>>) -> Self { self.baseURL = Some(baseURL.into()); self }
pub fn build(self) -> DragDataItem<'a> {
DragDataItem {
mimeType: self.mimeType,
data: self.data,
title: self.title,
baseURL: self.baseURL,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DragData<'a> {
items: Vec<DragDataItem<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
files: Option<Vec<Cow<'a, str>>>,
dragOperationsMask: i64,
}
impl<'a> DragData<'a> {
pub fn builder(items: Vec<DragDataItem<'a>>, dragOperationsMask: i64) -> DragDataBuilder<'a> {
DragDataBuilder {
items: items,
files: None,
dragOperationsMask: dragOperationsMask,
}
}
pub fn items(&self) -> &[DragDataItem<'a>] { &self.items }
pub fn files(&self) -> Option<&[Cow<'a, str>]> { self.files.as_deref() }
pub fn dragOperationsMask(&self) -> i64 { self.dragOperationsMask }
}
pub struct DragDataBuilder<'a> {
items: Vec<DragDataItem<'a>>,
files: Option<Vec<Cow<'a, str>>>,
dragOperationsMask: i64,
}
impl<'a> DragDataBuilder<'a> {
pub fn files(mut self, files: Vec<Cow<'a, str>>) -> Self { self.files = Some(files); self }
pub fn build(self) -> DragData<'a> {
DragData {
items: self.items,
files: self.files,
dragOperationsMask: self.dragOperationsMask,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchDragEventParams<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
x: f64,
y: f64,
data: DragData<'a>,
#[serde(skip_serializing_if = "Option::is_none")]
modifiers: Option<i64>,
}
impl<'a> DispatchDragEventParams<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64, data: DragData<'a>) -> DispatchDragEventParamsBuilder<'a> {
DispatchDragEventParamsBuilder {
type_: type_.into(),
x: x,
y: y,
data: data,
modifiers: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn data(&self) -> &DragData<'a> { &self.data }
pub fn modifiers(&self) -> Option<i64> { self.modifiers }
}
pub struct DispatchDragEventParamsBuilder<'a> {
type_: Cow<'a, str>,
x: f64,
y: f64,
data: DragData<'a>,
modifiers: Option<i64>,
}
impl<'a> DispatchDragEventParamsBuilder<'a> {
pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
pub fn build(self) -> DispatchDragEventParams<'a> {
DispatchDragEventParams {
type_: self.type_,
x: self.x,
y: self.y,
data: self.data,
modifiers: self.modifiers,
}
}
}
impl<'a> DispatchDragEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchDragEvent"; }
impl<'a> crate::CdpCommand<'a> for DispatchDragEventParams<'a> {
const METHOD: &'static str = "Input.dispatchDragEvent";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchKeyEventParams<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none")]
modifiers: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<TimeSinceEpoch>,
#[serde(skip_serializing_if = "Option::is_none")]
text: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
unmodifiedText: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
keyIdentifier: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
code: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
windowsVirtualKeyCode: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
nativeVirtualKeyCode: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
autoRepeat: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
isKeypad: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
isSystemKey: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
location: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
commands: Option<Vec<Cow<'a, str>>>,
}
impl<'a> DispatchKeyEventParams<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>) -> DispatchKeyEventParamsBuilder<'a> {
DispatchKeyEventParamsBuilder {
type_: type_.into(),
modifiers: None,
timestamp: None,
text: None,
unmodifiedText: None,
keyIdentifier: None,
code: None,
key: None,
windowsVirtualKeyCode: None,
nativeVirtualKeyCode: None,
autoRepeat: None,
isKeypad: None,
isSystemKey: None,
location: None,
commands: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn modifiers(&self) -> Option<i64> { self.modifiers }
pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
pub fn text(&self) -> Option<&str> { self.text.as_deref() }
pub fn unmodifiedText(&self) -> Option<&str> { self.unmodifiedText.as_deref() }
pub fn keyIdentifier(&self) -> Option<&str> { self.keyIdentifier.as_deref() }
pub fn code(&self) -> Option<&str> { self.code.as_deref() }
pub fn key(&self) -> Option<&str> { self.key.as_deref() }
pub fn windowsVirtualKeyCode(&self) -> Option<i64> { self.windowsVirtualKeyCode }
pub fn nativeVirtualKeyCode(&self) -> Option<i64> { self.nativeVirtualKeyCode }
pub fn autoRepeat(&self) -> Option<bool> { self.autoRepeat }
pub fn isKeypad(&self) -> Option<bool> { self.isKeypad }
pub fn isSystemKey(&self) -> Option<bool> { self.isSystemKey }
pub fn location(&self) -> Option<i64> { self.location }
pub fn commands(&self) -> Option<&[Cow<'a, str>]> { self.commands.as_deref() }
}
pub struct DispatchKeyEventParamsBuilder<'a> {
type_: Cow<'a, str>,
modifiers: Option<i64>,
timestamp: Option<TimeSinceEpoch>,
text: Option<Cow<'a, str>>,
unmodifiedText: Option<Cow<'a, str>>,
keyIdentifier: Option<Cow<'a, str>>,
code: Option<Cow<'a, str>>,
key: Option<Cow<'a, str>>,
windowsVirtualKeyCode: Option<i64>,
nativeVirtualKeyCode: Option<i64>,
autoRepeat: Option<bool>,
isKeypad: Option<bool>,
isSystemKey: Option<bool>,
location: Option<i64>,
commands: Option<Vec<Cow<'a, str>>>,
}
impl<'a> DispatchKeyEventParamsBuilder<'a> {
pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
pub fn unmodifiedText(mut self, unmodifiedText: impl Into<Cow<'a, str>>) -> Self { self.unmodifiedText = Some(unmodifiedText.into()); self }
pub fn keyIdentifier(mut self, keyIdentifier: impl Into<Cow<'a, str>>) -> Self { self.keyIdentifier = Some(keyIdentifier.into()); self }
pub fn code(mut self, code: impl Into<Cow<'a, str>>) -> Self { self.code = Some(code.into()); self }
pub fn key(mut self, key: impl Into<Cow<'a, str>>) -> Self { self.key = Some(key.into()); self }
pub fn windowsVirtualKeyCode(mut self, windowsVirtualKeyCode: i64) -> Self { self.windowsVirtualKeyCode = Some(windowsVirtualKeyCode); self }
pub fn nativeVirtualKeyCode(mut self, nativeVirtualKeyCode: i64) -> Self { self.nativeVirtualKeyCode = Some(nativeVirtualKeyCode); self }
pub fn autoRepeat(mut self, autoRepeat: bool) -> Self { self.autoRepeat = Some(autoRepeat); self }
pub fn isKeypad(mut self, isKeypad: bool) -> Self { self.isKeypad = Some(isKeypad); self }
pub fn isSystemKey(mut self, isSystemKey: bool) -> Self { self.isSystemKey = Some(isSystemKey); self }
pub fn location(mut self, location: i64) -> Self { self.location = Some(location); self }
pub fn commands(mut self, commands: Vec<Cow<'a, str>>) -> Self { self.commands = Some(commands); self }
pub fn build(self) -> DispatchKeyEventParams<'a> {
DispatchKeyEventParams {
type_: self.type_,
modifiers: self.modifiers,
timestamp: self.timestamp,
text: self.text,
unmodifiedText: self.unmodifiedText,
keyIdentifier: self.keyIdentifier,
code: self.code,
key: self.key,
windowsVirtualKeyCode: self.windowsVirtualKeyCode,
nativeVirtualKeyCode: self.nativeVirtualKeyCode,
autoRepeat: self.autoRepeat,
isKeypad: self.isKeypad,
isSystemKey: self.isSystemKey,
location: self.location,
commands: self.commands,
}
}
}
impl<'a> DispatchKeyEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchKeyEvent"; }
impl<'a> crate::CdpCommand<'a> for DispatchKeyEventParams<'a> {
const METHOD: &'static str = "Input.dispatchKeyEvent";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InsertTextParams<'a> {
text: Cow<'a, str>,
}
impl<'a> InsertTextParams<'a> {
pub fn builder(text: impl Into<Cow<'a, str>>) -> InsertTextParamsBuilder<'a> {
InsertTextParamsBuilder {
text: text.into(),
}
}
pub fn text(&self) -> &str { self.text.as_ref() }
}
pub struct InsertTextParamsBuilder<'a> {
text: Cow<'a, str>,
}
impl<'a> InsertTextParamsBuilder<'a> {
pub fn build(self) -> InsertTextParams<'a> {
InsertTextParams {
text: self.text,
}
}
}
impl<'a> InsertTextParams<'a> { pub const METHOD: &'static str = "Input.insertText"; }
impl<'a> crate::CdpCommand<'a> for InsertTextParams<'a> {
const METHOD: &'static str = "Input.insertText";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ImeSetCompositionParams<'a> {
text: Cow<'a, str>,
selectionStart: i64,
selectionEnd: i64,
#[serde(skip_serializing_if = "Option::is_none")]
replacementStart: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
replacementEnd: Option<i64>,
}
impl<'a> ImeSetCompositionParams<'a> {
pub fn builder(text: impl Into<Cow<'a, str>>, selectionStart: i64, selectionEnd: i64) -> ImeSetCompositionParamsBuilder<'a> {
ImeSetCompositionParamsBuilder {
text: text.into(),
selectionStart: selectionStart,
selectionEnd: selectionEnd,
replacementStart: None,
replacementEnd: None,
}
}
pub fn text(&self) -> &str { self.text.as_ref() }
pub fn selectionStart(&self) -> i64 { self.selectionStart }
pub fn selectionEnd(&self) -> i64 { self.selectionEnd }
pub fn replacementStart(&self) -> Option<i64> { self.replacementStart }
pub fn replacementEnd(&self) -> Option<i64> { self.replacementEnd }
}
pub struct ImeSetCompositionParamsBuilder<'a> {
text: Cow<'a, str>,
selectionStart: i64,
selectionEnd: i64,
replacementStart: Option<i64>,
replacementEnd: Option<i64>,
}
impl<'a> ImeSetCompositionParamsBuilder<'a> {
pub fn replacementStart(mut self, replacementStart: i64) -> Self { self.replacementStart = Some(replacementStart); self }
pub fn replacementEnd(mut self, replacementEnd: i64) -> Self { self.replacementEnd = Some(replacementEnd); self }
pub fn build(self) -> ImeSetCompositionParams<'a> {
ImeSetCompositionParams {
text: self.text,
selectionStart: self.selectionStart,
selectionEnd: self.selectionEnd,
replacementStart: self.replacementStart,
replacementEnd: self.replacementEnd,
}
}
}
impl<'a> ImeSetCompositionParams<'a> { pub const METHOD: &'static str = "Input.imeSetComposition"; }
impl<'a> crate::CdpCommand<'a> for ImeSetCompositionParams<'a> {
const METHOD: &'static str = "Input.imeSetComposition";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchMouseEventParams<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
x: f64,
y: f64,
#[serde(skip_serializing_if = "Option::is_none")]
modifiers: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<TimeSinceEpoch>,
#[serde(skip_serializing_if = "Option::is_none")]
button: Option<MouseButton>,
#[serde(skip_serializing_if = "Option::is_none")]
buttons: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
clickCount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
force: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tangentialPressure: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tiltX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
tiltY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
twist: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
deltaX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
deltaY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
pointerType: Option<Cow<'a, str>>,
}
impl<'a> DispatchMouseEventParams<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64) -> DispatchMouseEventParamsBuilder<'a> {
DispatchMouseEventParamsBuilder {
type_: type_.into(),
x: x,
y: y,
modifiers: None,
timestamp: None,
button: None,
buttons: None,
clickCount: None,
force: None,
tangentialPressure: None,
tiltX: None,
tiltY: None,
twist: None,
deltaX: None,
deltaY: None,
pointerType: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn modifiers(&self) -> Option<i64> { self.modifiers }
pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
pub fn button(&self) -> Option<&MouseButton> { self.button.as_ref() }
pub fn buttons(&self) -> Option<i64> { self.buttons }
pub fn clickCount(&self) -> Option<u64> { self.clickCount }
pub fn force(&self) -> Option<f64> { self.force }
pub fn tangentialPressure(&self) -> Option<f64> { self.tangentialPressure }
pub fn tiltX(&self) -> Option<f64> { self.tiltX }
pub fn tiltY(&self) -> Option<f64> { self.tiltY }
pub fn twist(&self) -> Option<i64> { self.twist }
pub fn deltaX(&self) -> Option<f64> { self.deltaX }
pub fn deltaY(&self) -> Option<f64> { self.deltaY }
pub fn pointerType(&self) -> Option<&str> { self.pointerType.as_deref() }
}
pub struct DispatchMouseEventParamsBuilder<'a> {
type_: Cow<'a, str>,
x: f64,
y: f64,
modifiers: Option<i64>,
timestamp: Option<TimeSinceEpoch>,
button: Option<MouseButton>,
buttons: Option<i64>,
clickCount: Option<u64>,
force: Option<f64>,
tangentialPressure: Option<f64>,
tiltX: Option<f64>,
tiltY: Option<f64>,
twist: Option<i64>,
deltaX: Option<f64>,
deltaY: Option<f64>,
pointerType: Option<Cow<'a, str>>,
}
impl<'a> DispatchMouseEventParamsBuilder<'a> {
pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
pub fn button(mut self, button: MouseButton) -> Self { self.button = Some(button); self }
pub fn buttons(mut self, buttons: i64) -> Self { self.buttons = Some(buttons); self }
pub fn clickCount(mut self, clickCount: u64) -> Self { self.clickCount = Some(clickCount); self }
pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
pub fn tangentialPressure(mut self, tangentialPressure: f64) -> Self { self.tangentialPressure = Some(tangentialPressure); self }
pub fn tiltX(mut self, tiltX: f64) -> Self { self.tiltX = Some(tiltX); self }
pub fn tiltY(mut self, tiltY: f64) -> Self { self.tiltY = Some(tiltY); self }
pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
pub fn deltaX(mut self, deltaX: f64) -> Self { self.deltaX = Some(deltaX); self }
pub fn deltaY(mut self, deltaY: f64) -> Self { self.deltaY = Some(deltaY); self }
pub fn pointerType(mut self, pointerType: impl Into<Cow<'a, str>>) -> Self { self.pointerType = Some(pointerType.into()); self }
pub fn build(self) -> DispatchMouseEventParams<'a> {
DispatchMouseEventParams {
type_: self.type_,
x: self.x,
y: self.y,
modifiers: self.modifiers,
timestamp: self.timestamp,
button: self.button,
buttons: self.buttons,
clickCount: self.clickCount,
force: self.force,
tangentialPressure: self.tangentialPressure,
tiltX: self.tiltX,
tiltY: self.tiltY,
twist: self.twist,
deltaX: self.deltaX,
deltaY: self.deltaY,
pointerType: self.pointerType,
}
}
}
impl<'a> DispatchMouseEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchMouseEvent"; }
impl<'a> crate::CdpCommand<'a> for DispatchMouseEventParams<'a> {
const METHOD: &'static str = "Input.dispatchMouseEvent";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DispatchTouchEventParams<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
touchPoints: Vec<TouchPoint>,
#[serde(skip_serializing_if = "Option::is_none")]
modifiers: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<TimeSinceEpoch>,
}
impl<'a> DispatchTouchEventParams<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>, touchPoints: Vec<TouchPoint>) -> DispatchTouchEventParamsBuilder<'a> {
DispatchTouchEventParamsBuilder {
type_: type_.into(),
touchPoints: touchPoints,
modifiers: None,
timestamp: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn touchPoints(&self) -> &[TouchPoint] { &self.touchPoints }
pub fn modifiers(&self) -> Option<i64> { self.modifiers }
pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
}
pub struct DispatchTouchEventParamsBuilder<'a> {
type_: Cow<'a, str>,
touchPoints: Vec<TouchPoint>,
modifiers: Option<i64>,
timestamp: Option<TimeSinceEpoch>,
}
impl<'a> DispatchTouchEventParamsBuilder<'a> {
pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
pub fn build(self) -> DispatchTouchEventParams<'a> {
DispatchTouchEventParams {
type_: self.type_,
touchPoints: self.touchPoints,
modifiers: self.modifiers,
timestamp: self.timestamp,
}
}
}
impl<'a> DispatchTouchEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchTouchEvent"; }
impl<'a> crate::CdpCommand<'a> for DispatchTouchEventParams<'a> {
const METHOD: &'static str = "Input.dispatchTouchEvent";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct CancelDraggingParams {}
impl CancelDraggingParams { pub const METHOD: &'static str = "Input.cancelDragging"; }
impl<'a> crate::CdpCommand<'a> for CancelDraggingParams {
const METHOD: &'static str = "Input.cancelDragging";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EmulateTouchFromMouseEventParams<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
x: i32,
y: i32,
button: MouseButton,
#[serde(skip_serializing_if = "Option::is_none")]
timestamp: Option<TimeSinceEpoch>,
#[serde(skip_serializing_if = "Option::is_none")]
deltaX: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
deltaY: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
modifiers: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
clickCount: Option<u64>,
}
impl<'a> EmulateTouchFromMouseEventParams<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>, x: i32, y: i32, button: MouseButton) -> EmulateTouchFromMouseEventParamsBuilder<'a> {
EmulateTouchFromMouseEventParamsBuilder {
type_: type_.into(),
x: x,
y: y,
button: button,
timestamp: None,
deltaX: None,
deltaY: None,
modifiers: None,
clickCount: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn x(&self) -> i32 { self.x }
pub fn y(&self) -> i32 { self.y }
pub fn button(&self) -> &MouseButton { &self.button }
pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
pub fn deltaX(&self) -> Option<f64> { self.deltaX }
pub fn deltaY(&self) -> Option<f64> { self.deltaY }
pub fn modifiers(&self) -> Option<i64> { self.modifiers }
pub fn clickCount(&self) -> Option<u64> { self.clickCount }
}
pub struct EmulateTouchFromMouseEventParamsBuilder<'a> {
type_: Cow<'a, str>,
x: i32,
y: i32,
button: MouseButton,
timestamp: Option<TimeSinceEpoch>,
deltaX: Option<f64>,
deltaY: Option<f64>,
modifiers: Option<i64>,
clickCount: Option<u64>,
}
impl<'a> EmulateTouchFromMouseEventParamsBuilder<'a> {
pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
pub fn deltaX(mut self, deltaX: f64) -> Self { self.deltaX = Some(deltaX); self }
pub fn deltaY(mut self, deltaY: f64) -> Self { self.deltaY = Some(deltaY); self }
pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
pub fn clickCount(mut self, clickCount: u64) -> Self { self.clickCount = Some(clickCount); self }
pub fn build(self) -> EmulateTouchFromMouseEventParams<'a> {
EmulateTouchFromMouseEventParams {
type_: self.type_,
x: self.x,
y: self.y,
button: self.button,
timestamp: self.timestamp,
deltaX: self.deltaX,
deltaY: self.deltaY,
modifiers: self.modifiers,
clickCount: self.clickCount,
}
}
}
impl<'a> EmulateTouchFromMouseEventParams<'a> { pub const METHOD: &'static str = "Input.emulateTouchFromMouseEvent"; }
impl<'a> crate::CdpCommand<'a> for EmulateTouchFromMouseEventParams<'a> {
const METHOD: &'static str = "Input.emulateTouchFromMouseEvent";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetIgnoreInputEventsParams {
ignore: bool,
}
impl SetIgnoreInputEventsParams {
pub fn builder(ignore: bool) -> SetIgnoreInputEventsParamsBuilder {
SetIgnoreInputEventsParamsBuilder {
ignore: ignore,
}
}
pub fn ignore(&self) -> bool { self.ignore }
}
pub struct SetIgnoreInputEventsParamsBuilder {
ignore: bool,
}
impl SetIgnoreInputEventsParamsBuilder {
pub fn build(self) -> SetIgnoreInputEventsParams {
SetIgnoreInputEventsParams {
ignore: self.ignore,
}
}
}
impl SetIgnoreInputEventsParams { pub const METHOD: &'static str = "Input.setIgnoreInputEvents"; }
impl<'a> crate::CdpCommand<'a> for SetIgnoreInputEventsParams {
const METHOD: &'static str = "Input.setIgnoreInputEvents";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetInterceptDragsParams {
enabled: bool,
}
impl SetInterceptDragsParams {
pub fn builder(enabled: bool) -> SetInterceptDragsParamsBuilder {
SetInterceptDragsParamsBuilder {
enabled: enabled,
}
}
pub fn enabled(&self) -> bool { self.enabled }
}
pub struct SetInterceptDragsParamsBuilder {
enabled: bool,
}
impl SetInterceptDragsParamsBuilder {
pub fn build(self) -> SetInterceptDragsParams {
SetInterceptDragsParams {
enabled: self.enabled,
}
}
}
impl SetInterceptDragsParams { pub const METHOD: &'static str = "Input.setInterceptDrags"; }
impl<'a> crate::CdpCommand<'a> for SetInterceptDragsParams {
const METHOD: &'static str = "Input.setInterceptDrags";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizePinchGestureParams {
x: f64,
y: f64,
scaleFactor: f64,
#[serde(skip_serializing_if = "Option::is_none")]
relativeSpeed: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
gestureSourceType: Option<GestureSourceType>,
}
impl SynthesizePinchGestureParams {
pub fn builder(x: f64, y: f64, scaleFactor: f64) -> SynthesizePinchGestureParamsBuilder {
SynthesizePinchGestureParamsBuilder {
x: x,
y: y,
scaleFactor: scaleFactor,
relativeSpeed: None,
gestureSourceType: None,
}
}
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn scaleFactor(&self) -> f64 { self.scaleFactor }
pub fn relativeSpeed(&self) -> Option<i64> { self.relativeSpeed }
pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
}
pub struct SynthesizePinchGestureParamsBuilder {
x: f64,
y: f64,
scaleFactor: f64,
relativeSpeed: Option<i64>,
gestureSourceType: Option<GestureSourceType>,
}
impl SynthesizePinchGestureParamsBuilder {
pub fn relativeSpeed(mut self, relativeSpeed: i64) -> Self { self.relativeSpeed = Some(relativeSpeed); self }
pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
pub fn build(self) -> SynthesizePinchGestureParams {
SynthesizePinchGestureParams {
x: self.x,
y: self.y,
scaleFactor: self.scaleFactor,
relativeSpeed: self.relativeSpeed,
gestureSourceType: self.gestureSourceType,
}
}
}
impl SynthesizePinchGestureParams { pub const METHOD: &'static str = "Input.synthesizePinchGesture"; }
impl<'a> crate::CdpCommand<'a> for SynthesizePinchGestureParams {
const METHOD: &'static str = "Input.synthesizePinchGesture";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeScrollGestureParams<'a> {
x: f64,
y: f64,
#[serde(skip_serializing_if = "Option::is_none")]
xDistance: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
yDistance: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
xOverscroll: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
yOverscroll: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
preventFling: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
speed: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
gestureSourceType: Option<GestureSourceType>,
#[serde(skip_serializing_if = "Option::is_none")]
repeatCount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
repeatDelayMs: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
interactionMarkerName: Option<Cow<'a, str>>,
}
impl<'a> SynthesizeScrollGestureParams<'a> {
pub fn builder(x: f64, y: f64) -> SynthesizeScrollGestureParamsBuilder<'a> {
SynthesizeScrollGestureParamsBuilder {
x: x,
y: y,
xDistance: None,
yDistance: None,
xOverscroll: None,
yOverscroll: None,
preventFling: None,
speed: None,
gestureSourceType: None,
repeatCount: None,
repeatDelayMs: None,
interactionMarkerName: None,
}
}
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn xDistance(&self) -> Option<f64> { self.xDistance }
pub fn yDistance(&self) -> Option<f64> { self.yDistance }
pub fn xOverscroll(&self) -> Option<f64> { self.xOverscroll }
pub fn yOverscroll(&self) -> Option<f64> { self.yOverscroll }
pub fn preventFling(&self) -> Option<bool> { self.preventFling }
pub fn speed(&self) -> Option<i64> { self.speed }
pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
pub fn repeatCount(&self) -> Option<u64> { self.repeatCount }
pub fn repeatDelayMs(&self) -> Option<i64> { self.repeatDelayMs }
pub fn interactionMarkerName(&self) -> Option<&str> { self.interactionMarkerName.as_deref() }
}
pub struct SynthesizeScrollGestureParamsBuilder<'a> {
x: f64,
y: f64,
xDistance: Option<f64>,
yDistance: Option<f64>,
xOverscroll: Option<f64>,
yOverscroll: Option<f64>,
preventFling: Option<bool>,
speed: Option<i64>,
gestureSourceType: Option<GestureSourceType>,
repeatCount: Option<u64>,
repeatDelayMs: Option<i64>,
interactionMarkerName: Option<Cow<'a, str>>,
}
impl<'a> SynthesizeScrollGestureParamsBuilder<'a> {
pub fn xDistance(mut self, xDistance: f64) -> Self { self.xDistance = Some(xDistance); self }
pub fn yDistance(mut self, yDistance: f64) -> Self { self.yDistance = Some(yDistance); self }
pub fn xOverscroll(mut self, xOverscroll: f64) -> Self { self.xOverscroll = Some(xOverscroll); self }
pub fn yOverscroll(mut self, yOverscroll: f64) -> Self { self.yOverscroll = Some(yOverscroll); self }
pub fn preventFling(mut self, preventFling: bool) -> Self { self.preventFling = Some(preventFling); self }
pub fn speed(mut self, speed: i64) -> Self { self.speed = Some(speed); self }
pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
pub fn repeatCount(mut self, repeatCount: u64) -> Self { self.repeatCount = Some(repeatCount); self }
pub fn repeatDelayMs(mut self, repeatDelayMs: i64) -> Self { self.repeatDelayMs = Some(repeatDelayMs); self }
pub fn interactionMarkerName(mut self, interactionMarkerName: impl Into<Cow<'a, str>>) -> Self { self.interactionMarkerName = Some(interactionMarkerName.into()); self }
pub fn build(self) -> SynthesizeScrollGestureParams<'a> {
SynthesizeScrollGestureParams {
x: self.x,
y: self.y,
xDistance: self.xDistance,
yDistance: self.yDistance,
xOverscroll: self.xOverscroll,
yOverscroll: self.yOverscroll,
preventFling: self.preventFling,
speed: self.speed,
gestureSourceType: self.gestureSourceType,
repeatCount: self.repeatCount,
repeatDelayMs: self.repeatDelayMs,
interactionMarkerName: self.interactionMarkerName,
}
}
}
impl<'a> SynthesizeScrollGestureParams<'a> { pub const METHOD: &'static str = "Input.synthesizeScrollGesture"; }
impl<'a> crate::CdpCommand<'a> for SynthesizeScrollGestureParams<'a> {
const METHOD: &'static str = "Input.synthesizeScrollGesture";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SynthesizeTapGestureParams {
x: f64,
y: f64,
#[serde(skip_serializing_if = "Option::is_none")]
duration: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
tapCount: Option<u64>,
#[serde(skip_serializing_if = "Option::is_none")]
gestureSourceType: Option<GestureSourceType>,
}
impl SynthesizeTapGestureParams {
pub fn builder(x: f64, y: f64) -> SynthesizeTapGestureParamsBuilder {
SynthesizeTapGestureParamsBuilder {
x: x,
y: y,
duration: None,
tapCount: None,
gestureSourceType: None,
}
}
pub fn x(&self) -> f64 { self.x }
pub fn y(&self) -> f64 { self.y }
pub fn duration(&self) -> Option<i64> { self.duration }
pub fn tapCount(&self) -> Option<u64> { self.tapCount }
pub fn gestureSourceType(&self) -> Option<&GestureSourceType> { self.gestureSourceType.as_ref() }
}
pub struct SynthesizeTapGestureParamsBuilder {
x: f64,
y: f64,
duration: Option<i64>,
tapCount: Option<u64>,
gestureSourceType: Option<GestureSourceType>,
}
impl SynthesizeTapGestureParamsBuilder {
pub fn duration(mut self, duration: i64) -> Self { self.duration = Some(duration); self }
pub fn tapCount(mut self, tapCount: u64) -> Self { self.tapCount = Some(tapCount); self }
pub fn gestureSourceType(mut self, gestureSourceType: GestureSourceType) -> Self { self.gestureSourceType = Some(gestureSourceType); self }
pub fn build(self) -> SynthesizeTapGestureParams {
SynthesizeTapGestureParams {
x: self.x,
y: self.y,
duration: self.duration,
tapCount: self.tapCount,
gestureSourceType: self.gestureSourceType,
}
}
}
impl SynthesizeTapGestureParams { pub const METHOD: &'static str = "Input.synthesizeTapGesture"; }
impl<'a> crate::CdpCommand<'a> for SynthesizeTapGestureParams {
const METHOD: &'static str = "Input.synthesizeTapGesture";
type Response = crate::EmptyReturns;
}