Skip to main content

browser_protocol/input/
mod.rs

1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7#[serde(rename_all = "camelCase")]
8pub struct TouchPoint {
9    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
10    x: f64,
11    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
12    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
13    y: f64,
14    /// X radius of the touch area (default: 1.0).
15    #[serde(skip_serializing_if = "Option::is_none", rename = "radiusX")]
16    radius_x: Option<f64>,
17    /// Y radius of the touch area (default: 1.0).
18    #[serde(skip_serializing_if = "Option::is_none", rename = "radiusY")]
19    radius_y: Option<f64>,
20    /// Rotation angle (default: 0.0).
21    #[serde(skip_serializing_if = "Option::is_none", rename = "rotationAngle")]
22    rotation_angle: Option<f64>,
23    /// Force (default: 1.0).
24    #[serde(skip_serializing_if = "Option::is_none")]
25    force: Option<f64>,
26    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
27    #[serde(skip_serializing_if = "Option::is_none", rename = "tangentialPressure")]
28    tangential_pressure: Option<f64>,
29    /// 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)
30    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltX")]
31    tilt_x: Option<f64>,
32    /// 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).
33    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltY")]
34    tilt_y: Option<f64>,
35    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
36    #[serde(skip_serializing_if = "Option::is_none")]
37    twist: Option<i64>,
38    /// Identifier used to track touch sources between events, must be unique within an event.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    id: Option<f64>,
41}
42
43impl TouchPoint {
44    /// Creates a builder for this type with the required parameters:
45    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
46    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
47    pub fn builder(x: f64, y: f64) -> TouchPointBuilder {
48        TouchPointBuilder {
49            x: x,
50            y: y,
51            radius_x: None,
52            radius_y: None,
53            rotation_angle: None,
54            force: None,
55            tangential_pressure: None,
56            tilt_x: None,
57            tilt_y: None,
58            twist: None,
59            id: None,
60        }
61    }
62    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
63    pub fn x(&self) -> f64 { self.x }
64    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
65    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
66    pub fn y(&self) -> f64 { self.y }
67    /// X radius of the touch area (default: 1.0).
68    pub fn radius_x(&self) -> Option<f64> { self.radius_x }
69    /// Y radius of the touch area (default: 1.0).
70    pub fn radius_y(&self) -> Option<f64> { self.radius_y }
71    /// Rotation angle (default: 0.0).
72    pub fn rotation_angle(&self) -> Option<f64> { self.rotation_angle }
73    /// Force (default: 1.0).
74    pub fn force(&self) -> Option<f64> { self.force }
75    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
76    pub fn tangential_pressure(&self) -> Option<f64> { self.tangential_pressure }
77    /// 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)
78    pub fn tilt_x(&self) -> Option<f64> { self.tilt_x }
79    /// 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).
80    pub fn tilt_y(&self) -> Option<f64> { self.tilt_y }
81    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
82    pub fn twist(&self) -> Option<i64> { self.twist }
83    /// Identifier used to track touch sources between events, must be unique within an event.
84    pub fn id(&self) -> Option<f64> { self.id }
85}
86
87
88pub struct TouchPointBuilder {
89    x: f64,
90    y: f64,
91    radius_x: Option<f64>,
92    radius_y: Option<f64>,
93    rotation_angle: Option<f64>,
94    force: Option<f64>,
95    tangential_pressure: Option<f64>,
96    tilt_x: Option<f64>,
97    tilt_y: Option<f64>,
98    twist: Option<i64>,
99    id: Option<f64>,
100}
101
102impl TouchPointBuilder {
103    /// X radius of the touch area (default: 1.0).
104    pub fn radius_x(mut self, radius_x: f64) -> Self { self.radius_x = Some(radius_x); self }
105    /// Y radius of the touch area (default: 1.0).
106    pub fn radius_y(mut self, radius_y: f64) -> Self { self.radius_y = Some(radius_y); self }
107    /// Rotation angle (default: 0.0).
108    pub fn rotation_angle(mut self, rotation_angle: f64) -> Self { self.rotation_angle = Some(rotation_angle); self }
109    /// Force (default: 1.0).
110    pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
111    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
112    pub fn tangential_pressure(mut self, tangential_pressure: f64) -> Self { self.tangential_pressure = Some(tangential_pressure); self }
113    /// 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)
114    pub fn tilt_x(mut self, tilt_x: f64) -> Self { self.tilt_x = Some(tilt_x); self }
115    /// 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).
116    pub fn tilt_y(mut self, tilt_y: f64) -> Self { self.tilt_y = Some(tilt_y); self }
117    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
118    pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
119    /// Identifier used to track touch sources between events, must be unique within an event.
120    pub fn id(mut self, id: f64) -> Self { self.id = Some(id); self }
121    pub fn build(self) -> TouchPoint {
122        TouchPoint {
123            x: self.x,
124            y: self.y,
125            radius_x: self.radius_x,
126            radius_y: self.radius_y,
127            rotation_angle: self.rotation_angle,
128            force: self.force,
129            tangential_pressure: self.tangential_pressure,
130            tilt_x: self.tilt_x,
131            tilt_y: self.tilt_y,
132            twist: self.twist,
133            id: self.id,
134        }
135    }
136}
137
138
139#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
140pub enum GestureSourceType {
141    #[default]
142    #[serde(rename = "default")]
143    Default,
144    #[serde(rename = "touch")]
145    Touch,
146    #[serde(rename = "mouse")]
147    Mouse,
148}
149
150
151#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
152pub enum MouseButton {
153    #[default]
154    #[serde(rename = "none")]
155    None,
156    #[serde(rename = "left")]
157    Left,
158    #[serde(rename = "middle")]
159    Middle,
160    #[serde(rename = "right")]
161    Right,
162    #[serde(rename = "back")]
163    Back,
164    #[serde(rename = "forward")]
165    Forward,
166}
167
168/// UTC time in seconds, counted from January 1, 1970.
169
170pub type TimeSinceEpoch = f64;
171
172
173#[derive(Debug, Clone, Serialize, Deserialize, Default)]
174#[serde(rename_all = "camelCase")]
175pub struct DragDataItem<'a> {
176    /// Mime type of the dragged data.
177    #[serde(rename = "mimeType")]
178    mime_type: Cow<'a, str>,
179    /// Depending of the value of 'mimeType', it contains the dragged link,
180    /// text, HTML markup or any other data.
181    data: Cow<'a, str>,
182    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
183    #[serde(skip_serializing_if = "Option::is_none")]
184    title: Option<Cow<'a, str>>,
185    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
186    /// == "text/html".
187    #[serde(skip_serializing_if = "Option::is_none", rename = "baseURL")]
188    base_url: Option<Cow<'a, str>>,
189}
190
191impl<'a> DragDataItem<'a> {
192    /// Creates a builder for this type with the required parameters:
193    /// * `mime_type`: Mime type of the dragged data.
194    /// * `data`: Depending of the value of `mimeType`, it contains the dragged link, text, HTML markup or any other data.
195    pub fn builder(mime_type: impl Into<Cow<'a, str>>, data: impl Into<Cow<'a, str>>) -> DragDataItemBuilder<'a> {
196        DragDataItemBuilder {
197            mime_type: mime_type.into(),
198            data: data.into(),
199            title: None,
200            base_url: None,
201        }
202    }
203    /// Mime type of the dragged data.
204    pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
205    /// Depending of the value of 'mimeType', it contains the dragged link,
206    /// text, HTML markup or any other data.
207    pub fn data(&self) -> &str { self.data.as_ref() }
208    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
209    pub fn title(&self) -> Option<&str> { self.title.as_deref() }
210    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
211    /// == "text/html".
212    pub fn base_url(&self) -> Option<&str> { self.base_url.as_deref() }
213}
214
215
216pub struct DragDataItemBuilder<'a> {
217    mime_type: Cow<'a, str>,
218    data: Cow<'a, str>,
219    title: Option<Cow<'a, str>>,
220    base_url: Option<Cow<'a, str>>,
221}
222
223impl<'a> DragDataItemBuilder<'a> {
224    /// Title associated with a link. Only valid when 'mimeType' == "text/uri-list".
225    pub fn title(mut self, title: impl Into<Cow<'a, str>>) -> Self { self.title = Some(title.into()); self }
226    /// Stores the base URL for the contained markup. Only valid when 'mimeType'
227    /// == "text/html".
228    pub fn base_url(mut self, base_url: impl Into<Cow<'a, str>>) -> Self { self.base_url = Some(base_url.into()); self }
229    pub fn build(self) -> DragDataItem<'a> {
230        DragDataItem {
231            mime_type: self.mime_type,
232            data: self.data,
233            title: self.title,
234            base_url: self.base_url,
235        }
236    }
237}
238
239
240#[derive(Debug, Clone, Serialize, Deserialize, Default)]
241#[serde(rename_all = "camelCase")]
242pub struct DragData<'a> {
243    items: Vec<DragDataItem<'a>>,
244    /// List of filenames that should be included when dropping
245    #[serde(skip_serializing_if = "Option::is_none")]
246    files: Option<Vec<Cow<'a, str>>>,
247    /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
248    #[serde(rename = "dragOperationsMask")]
249    drag_operations_mask: i64,
250}
251
252impl<'a> DragData<'a> {
253    /// Creates a builder for this type with the required parameters:
254    /// * `items`: 
255    /// * `drag_operations_mask`: Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
256    pub fn builder(items: Vec<DragDataItem<'a>>, drag_operations_mask: i64) -> DragDataBuilder<'a> {
257        DragDataBuilder {
258            items: items,
259            files: None,
260            drag_operations_mask: drag_operations_mask,
261        }
262    }
263    pub fn items(&self) -> &[DragDataItem<'a>] { &self.items }
264    /// List of filenames that should be included when dropping
265    pub fn files(&self) -> Option<&[Cow<'a, str>]> { self.files.as_deref() }
266    /// Bit field representing allowed drag operations. Copy = 1, Link = 2, Move = 16
267    pub fn drag_operations_mask(&self) -> i64 { self.drag_operations_mask }
268}
269
270
271pub struct DragDataBuilder<'a> {
272    items: Vec<DragDataItem<'a>>,
273    files: Option<Vec<Cow<'a, str>>>,
274    drag_operations_mask: i64,
275}
276
277impl<'a> DragDataBuilder<'a> {
278    /// List of filenames that should be included when dropping
279    pub fn files(mut self, files: Vec<Cow<'a, str>>) -> Self { self.files = Some(files); self }
280    pub fn build(self) -> DragData<'a> {
281        DragData {
282            items: self.items,
283            files: self.files,
284            drag_operations_mask: self.drag_operations_mask,
285        }
286    }
287}
288
289/// Dispatches a drag event into the page.
290
291#[derive(Debug, Clone, Serialize, Deserialize, Default)]
292#[serde(rename_all = "camelCase")]
293pub struct DispatchDragEventParams<'a> {
294    /// Type of the drag event.
295    #[serde(rename = "type")]
296    type_: Cow<'a, str>,
297    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
298    x: f64,
299    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
300    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
301    y: f64,
302    data: DragData<'a>,
303    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
304    /// (default: 0).
305    #[serde(skip_serializing_if = "Option::is_none")]
306    modifiers: Option<i64>,
307}
308
309impl<'a> DispatchDragEventParams<'a> {
310    /// Creates a builder for this type with the required parameters:
311    /// * `type_`: Type of the drag event.
312    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
313    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
314    /// * `data`: 
315    pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64, data: DragData<'a>) -> DispatchDragEventParamsBuilder<'a> {
316        DispatchDragEventParamsBuilder {
317            type_: type_.into(),
318            x: x,
319            y: y,
320            data: data,
321            modifiers: None,
322        }
323    }
324    /// Type of the drag event.
325    pub fn type_(&self) -> &str { self.type_.as_ref() }
326    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
327    pub fn x(&self) -> f64 { self.x }
328    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
329    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
330    pub fn y(&self) -> f64 { self.y }
331    pub fn data(&self) -> &DragData<'a> { &self.data }
332    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
333    /// (default: 0).
334    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
335}
336
337
338pub struct DispatchDragEventParamsBuilder<'a> {
339    type_: Cow<'a, str>,
340    x: f64,
341    y: f64,
342    data: DragData<'a>,
343    modifiers: Option<i64>,
344}
345
346impl<'a> DispatchDragEventParamsBuilder<'a> {
347    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
348    /// (default: 0).
349    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
350    pub fn build(self) -> DispatchDragEventParams<'a> {
351        DispatchDragEventParams {
352            type_: self.type_,
353            x: self.x,
354            y: self.y,
355            data: self.data,
356            modifiers: self.modifiers,
357        }
358    }
359}
360
361impl<'a> DispatchDragEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchDragEvent"; }
362
363impl<'a> crate::CdpCommand<'a> for DispatchDragEventParams<'a> {
364    const METHOD: &'static str = "Input.dispatchDragEvent";
365    type Response = crate::EmptyReturns;
366}
367
368/// Dispatches a key event to the page.
369
370#[derive(Debug, Clone, Serialize, Deserialize, Default)]
371#[serde(rename_all = "camelCase")]
372pub struct DispatchKeyEventParams<'a> {
373    /// Type of the key event.
374    #[serde(rename = "type")]
375    type_: Cow<'a, str>,
376    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
377    /// (default: 0).
378    #[serde(skip_serializing_if = "Option::is_none")]
379    modifiers: Option<i64>,
380    /// Time at which the event occurred.
381    #[serde(skip_serializing_if = "Option::is_none")]
382    timestamp: Option<TimeSinceEpoch>,
383    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
384    /// for 'keyUp' and 'rawKeyDown' events (default: "")
385    #[serde(skip_serializing_if = "Option::is_none")]
386    text: Option<Cow<'a, str>>,
387    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
388    /// shift). Useful for shortcut (accelerator) key handling (default: "").
389    #[serde(skip_serializing_if = "Option::is_none", rename = "unmodifiedText")]
390    unmodified_text: Option<Cow<'a, str>>,
391    /// Unique key identifier (e.g., 'U+0041') (default: "").
392    #[serde(skip_serializing_if = "Option::is_none", rename = "keyIdentifier")]
393    key_identifier: Option<Cow<'a, str>>,
394    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
395    #[serde(skip_serializing_if = "Option::is_none")]
396    code: Option<Cow<'a, str>>,
397    /// Unique DOM defined string value describing the meaning of the key in the context of active
398    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
399    #[serde(skip_serializing_if = "Option::is_none")]
400    key: Option<Cow<'a, str>>,
401    /// Windows virtual key code (default: 0).
402    #[serde(skip_serializing_if = "Option::is_none", rename = "windowsVirtualKeyCode")]
403    windows_virtual_key_code: Option<i64>,
404    /// Native virtual key code (default: 0).
405    #[serde(skip_serializing_if = "Option::is_none", rename = "nativeVirtualKeyCode")]
406    native_virtual_key_code: Option<i64>,
407    /// Whether the event was generated from auto repeat (default: false).
408    #[serde(skip_serializing_if = "Option::is_none", rename = "autoRepeat")]
409    auto_repeat: Option<bool>,
410    /// Whether the event was generated from the keypad (default: false).
411    #[serde(skip_serializing_if = "Option::is_none", rename = "isKeypad")]
412    is_keypad: Option<bool>,
413    /// Whether the event was a system key event (default: false).
414    #[serde(skip_serializing_if = "Option::is_none", rename = "isSystemKey")]
415    is_system_key: Option<bool>,
416    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
417    /// 0).
418    #[serde(skip_serializing_if = "Option::is_none")]
419    location: Option<i64>,
420    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
421    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
422    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
423    #[serde(skip_serializing_if = "Option::is_none")]
424    commands: Option<Vec<Cow<'a, str>>>,
425}
426
427impl<'a> DispatchKeyEventParams<'a> {
428    /// Creates a builder for this type with the required parameters:
429    /// * `type_`: Type of the key event.
430    pub fn builder(type_: impl Into<Cow<'a, str>>) -> DispatchKeyEventParamsBuilder<'a> {
431        DispatchKeyEventParamsBuilder {
432            type_: type_.into(),
433            modifiers: None,
434            timestamp: None,
435            text: None,
436            unmodified_text: None,
437            key_identifier: None,
438            code: None,
439            key: None,
440            windows_virtual_key_code: None,
441            native_virtual_key_code: None,
442            auto_repeat: None,
443            is_keypad: None,
444            is_system_key: None,
445            location: None,
446            commands: None,
447        }
448    }
449    /// Type of the key event.
450    pub fn type_(&self) -> &str { self.type_.as_ref() }
451    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
452    /// (default: 0).
453    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
454    /// Time at which the event occurred.
455    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
456    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
457    /// for 'keyUp' and 'rawKeyDown' events (default: "")
458    pub fn text(&self) -> Option<&str> { self.text.as_deref() }
459    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
460    /// shift). Useful for shortcut (accelerator) key handling (default: "").
461    pub fn unmodified_text(&self) -> Option<&str> { self.unmodified_text.as_deref() }
462    /// Unique key identifier (e.g., 'U+0041') (default: "").
463    pub fn key_identifier(&self) -> Option<&str> { self.key_identifier.as_deref() }
464    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
465    pub fn code(&self) -> Option<&str> { self.code.as_deref() }
466    /// Unique DOM defined string value describing the meaning of the key in the context of active
467    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
468    pub fn key(&self) -> Option<&str> { self.key.as_deref() }
469    /// Windows virtual key code (default: 0).
470    pub fn windows_virtual_key_code(&self) -> Option<i64> { self.windows_virtual_key_code }
471    /// Native virtual key code (default: 0).
472    pub fn native_virtual_key_code(&self) -> Option<i64> { self.native_virtual_key_code }
473    /// Whether the event was generated from auto repeat (default: false).
474    pub fn auto_repeat(&self) -> Option<bool> { self.auto_repeat }
475    /// Whether the event was generated from the keypad (default: false).
476    pub fn is_keypad(&self) -> Option<bool> { self.is_keypad }
477    /// Whether the event was a system key event (default: false).
478    pub fn is_system_key(&self) -> Option<bool> { self.is_system_key }
479    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
480    /// 0).
481    pub fn location(&self) -> Option<i64> { self.location }
482    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
483    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
484    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
485    pub fn commands(&self) -> Option<&[Cow<'a, str>]> { self.commands.as_deref() }
486}
487
488
489pub struct DispatchKeyEventParamsBuilder<'a> {
490    type_: Cow<'a, str>,
491    modifiers: Option<i64>,
492    timestamp: Option<TimeSinceEpoch>,
493    text: Option<Cow<'a, str>>,
494    unmodified_text: Option<Cow<'a, str>>,
495    key_identifier: Option<Cow<'a, str>>,
496    code: Option<Cow<'a, str>>,
497    key: Option<Cow<'a, str>>,
498    windows_virtual_key_code: Option<i64>,
499    native_virtual_key_code: Option<i64>,
500    auto_repeat: Option<bool>,
501    is_keypad: Option<bool>,
502    is_system_key: Option<bool>,
503    location: Option<i64>,
504    commands: Option<Vec<Cow<'a, str>>>,
505}
506
507impl<'a> DispatchKeyEventParamsBuilder<'a> {
508    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
509    /// (default: 0).
510    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
511    /// Time at which the event occurred.
512    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
513    /// Text as generated by processing a virtual key code with a keyboard layout. Not needed for
514    /// for 'keyUp' and 'rawKeyDown' events (default: "")
515    pub fn text(mut self, text: impl Into<Cow<'a, str>>) -> Self { self.text = Some(text.into()); self }
516    /// Text that would have been generated by the keyboard if no modifiers were pressed (except for
517    /// shift). Useful for shortcut (accelerator) key handling (default: "").
518    pub fn unmodified_text(mut self, unmodified_text: impl Into<Cow<'a, str>>) -> Self { self.unmodified_text = Some(unmodified_text.into()); self }
519    /// Unique key identifier (e.g., 'U+0041') (default: "").
520    pub fn key_identifier(mut self, key_identifier: impl Into<Cow<'a, str>>) -> Self { self.key_identifier = Some(key_identifier.into()); self }
521    /// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: "").
522    pub fn code(mut self, code: impl Into<Cow<'a, str>>) -> Self { self.code = Some(code.into()); self }
523    /// Unique DOM defined string value describing the meaning of the key in the context of active
524    /// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: "").
525    pub fn key(mut self, key: impl Into<Cow<'a, str>>) -> Self { self.key = Some(key.into()); self }
526    /// Windows virtual key code (default: 0).
527    pub fn windows_virtual_key_code(mut self, windows_virtual_key_code: i64) -> Self { self.windows_virtual_key_code = Some(windows_virtual_key_code); self }
528    /// Native virtual key code (default: 0).
529    pub fn native_virtual_key_code(mut self, native_virtual_key_code: i64) -> Self { self.native_virtual_key_code = Some(native_virtual_key_code); self }
530    /// Whether the event was generated from auto repeat (default: false).
531    pub fn auto_repeat(mut self, auto_repeat: bool) -> Self { self.auto_repeat = Some(auto_repeat); self }
532    /// Whether the event was generated from the keypad (default: false).
533    pub fn is_keypad(mut self, is_keypad: bool) -> Self { self.is_keypad = Some(is_keypad); self }
534    /// Whether the event was a system key event (default: false).
535    pub fn is_system_key(mut self, is_system_key: bool) -> Self { self.is_system_key = Some(is_system_key); self }
536    /// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default:
537    /// 0).
538    pub fn location(mut self, location: i64) -> Self { self.location = Some(location); self }
539    /// Editing commands to send with the key event (e.g., 'selectAll') (default: \[\]).
540    /// These are related to but not equal the command names used in 'document.execCommand' and NSStandardKeyBindingResponding.
541    /// See <https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/editing/commands/editor_command_names.h> for valid command names.
542    pub fn commands(mut self, commands: Vec<Cow<'a, str>>) -> Self { self.commands = Some(commands); self }
543    pub fn build(self) -> DispatchKeyEventParams<'a> {
544        DispatchKeyEventParams {
545            type_: self.type_,
546            modifiers: self.modifiers,
547            timestamp: self.timestamp,
548            text: self.text,
549            unmodified_text: self.unmodified_text,
550            key_identifier: self.key_identifier,
551            code: self.code,
552            key: self.key,
553            windows_virtual_key_code: self.windows_virtual_key_code,
554            native_virtual_key_code: self.native_virtual_key_code,
555            auto_repeat: self.auto_repeat,
556            is_keypad: self.is_keypad,
557            is_system_key: self.is_system_key,
558            location: self.location,
559            commands: self.commands,
560        }
561    }
562}
563
564impl<'a> DispatchKeyEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchKeyEvent"; }
565
566impl<'a> crate::CdpCommand<'a> for DispatchKeyEventParams<'a> {
567    const METHOD: &'static str = "Input.dispatchKeyEvent";
568    type Response = crate::EmptyReturns;
569}
570
571/// This method emulates inserting text that doesn't come from a key press,
572/// for example an emoji keyboard or an IME.
573
574#[derive(Debug, Clone, Serialize, Deserialize, Default)]
575#[serde(rename_all = "camelCase")]
576pub struct InsertTextParams<'a> {
577    /// The text to insert.
578    text: Cow<'a, str>,
579}
580
581impl<'a> InsertTextParams<'a> {
582    /// Creates a builder for this type with the required parameters:
583    /// * `text`: The text to insert.
584    pub fn builder(text: impl Into<Cow<'a, str>>) -> InsertTextParamsBuilder<'a> {
585        InsertTextParamsBuilder {
586            text: text.into(),
587        }
588    }
589    /// The text to insert.
590    pub fn text(&self) -> &str { self.text.as_ref() }
591}
592
593
594pub struct InsertTextParamsBuilder<'a> {
595    text: Cow<'a, str>,
596}
597
598impl<'a> InsertTextParamsBuilder<'a> {
599    pub fn build(self) -> InsertTextParams<'a> {
600        InsertTextParams {
601            text: self.text,
602        }
603    }
604}
605
606impl<'a> InsertTextParams<'a> { pub const METHOD: &'static str = "Input.insertText"; }
607
608impl<'a> crate::CdpCommand<'a> for InsertTextParams<'a> {
609    const METHOD: &'static str = "Input.insertText";
610    type Response = crate::EmptyReturns;
611}
612
613/// This method sets the current candidate text for IME.
614/// Use imeCommitComposition to commit the final text.
615/// Use imeSetComposition with empty string as text to cancel composition.
616
617#[derive(Debug, Clone, Serialize, Deserialize, Default)]
618#[serde(rename_all = "camelCase")]
619pub struct ImeSetCompositionParams<'a> {
620    /// The text to insert
621    text: Cow<'a, str>,
622    /// selection start
623    #[serde(rename = "selectionStart")]
624    selection_start: i64,
625    /// selection end
626    #[serde(rename = "selectionEnd")]
627    selection_end: i64,
628    /// replacement start
629    #[serde(skip_serializing_if = "Option::is_none", rename = "replacementStart")]
630    replacement_start: Option<i64>,
631    /// replacement end
632    #[serde(skip_serializing_if = "Option::is_none", rename = "replacementEnd")]
633    replacement_end: Option<i64>,
634}
635
636impl<'a> ImeSetCompositionParams<'a> {
637    /// Creates a builder for this type with the required parameters:
638    /// * `text`: The text to insert
639    /// * `selection_start`: selection start
640    /// * `selection_end`: selection end
641    pub fn builder(text: impl Into<Cow<'a, str>>, selection_start: i64, selection_end: i64) -> ImeSetCompositionParamsBuilder<'a> {
642        ImeSetCompositionParamsBuilder {
643            text: text.into(),
644            selection_start: selection_start,
645            selection_end: selection_end,
646            replacement_start: None,
647            replacement_end: None,
648        }
649    }
650    /// The text to insert
651    pub fn text(&self) -> &str { self.text.as_ref() }
652    /// selection start
653    pub fn selection_start(&self) -> i64 { self.selection_start }
654    /// selection end
655    pub fn selection_end(&self) -> i64 { self.selection_end }
656    /// replacement start
657    pub fn replacement_start(&self) -> Option<i64> { self.replacement_start }
658    /// replacement end
659    pub fn replacement_end(&self) -> Option<i64> { self.replacement_end }
660}
661
662
663pub struct ImeSetCompositionParamsBuilder<'a> {
664    text: Cow<'a, str>,
665    selection_start: i64,
666    selection_end: i64,
667    replacement_start: Option<i64>,
668    replacement_end: Option<i64>,
669}
670
671impl<'a> ImeSetCompositionParamsBuilder<'a> {
672    /// replacement start
673    pub fn replacement_start(mut self, replacement_start: i64) -> Self { self.replacement_start = Some(replacement_start); self }
674    /// replacement end
675    pub fn replacement_end(mut self, replacement_end: i64) -> Self { self.replacement_end = Some(replacement_end); self }
676    pub fn build(self) -> ImeSetCompositionParams<'a> {
677        ImeSetCompositionParams {
678            text: self.text,
679            selection_start: self.selection_start,
680            selection_end: self.selection_end,
681            replacement_start: self.replacement_start,
682            replacement_end: self.replacement_end,
683        }
684    }
685}
686
687impl<'a> ImeSetCompositionParams<'a> { pub const METHOD: &'static str = "Input.imeSetComposition"; }
688
689impl<'a> crate::CdpCommand<'a> for ImeSetCompositionParams<'a> {
690    const METHOD: &'static str = "Input.imeSetComposition";
691    type Response = crate::EmptyReturns;
692}
693
694/// Dispatches a mouse event to the page.
695
696#[derive(Debug, Clone, Serialize, Deserialize, Default)]
697#[serde(rename_all = "camelCase")]
698pub struct DispatchMouseEventParams<'a> {
699    /// Type of the mouse event.
700    #[serde(rename = "type")]
701    type_: Cow<'a, str>,
702    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
703    x: f64,
704    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
705    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
706    y: f64,
707    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
708    /// (default: 0).
709    #[serde(skip_serializing_if = "Option::is_none")]
710    modifiers: Option<i64>,
711    /// Time at which the event occurred.
712    #[serde(skip_serializing_if = "Option::is_none")]
713    timestamp: Option<TimeSinceEpoch>,
714    /// Mouse button (default: "none").
715    #[serde(skip_serializing_if = "Option::is_none")]
716    button: Option<MouseButton>,
717    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
718    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
719    #[serde(skip_serializing_if = "Option::is_none")]
720    buttons: Option<i64>,
721    /// Number of times the mouse button was clicked (default: 0).
722    #[serde(skip_serializing_if = "Option::is_none", rename = "clickCount")]
723    click_count: Option<u64>,
724    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
725    #[serde(skip_serializing_if = "Option::is_none")]
726    force: Option<f64>,
727    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
728    #[serde(skip_serializing_if = "Option::is_none", rename = "tangentialPressure")]
729    tangential_pressure: Option<f64>,
730    /// 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).
731    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltX")]
732    tilt_x: Option<f64>,
733    /// 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).
734    #[serde(skip_serializing_if = "Option::is_none", rename = "tiltY")]
735    tilt_y: Option<f64>,
736    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
737    #[serde(skip_serializing_if = "Option::is_none")]
738    twist: Option<i64>,
739    /// X delta in CSS pixels for mouse wheel event (default: 0).
740    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaX")]
741    delta_x: Option<f64>,
742    /// Y delta in CSS pixels for mouse wheel event (default: 0).
743    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaY")]
744    delta_y: Option<f64>,
745    /// Pointer type (default: "mouse").
746    #[serde(skip_serializing_if = "Option::is_none", rename = "pointerType")]
747    pointer_type: Option<Cow<'a, str>>,
748}
749
750impl<'a> DispatchMouseEventParams<'a> {
751    /// Creates a builder for this type with the required parameters:
752    /// * `type_`: Type of the mouse event.
753    /// * `x`: X coordinate of the event relative to the main frame's viewport in CSS pixels.
754    /// * `y`: Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
755    pub fn builder(type_: impl Into<Cow<'a, str>>, x: f64, y: f64) -> DispatchMouseEventParamsBuilder<'a> {
756        DispatchMouseEventParamsBuilder {
757            type_: type_.into(),
758            x: x,
759            y: y,
760            modifiers: None,
761            timestamp: None,
762            button: None,
763            buttons: None,
764            click_count: None,
765            force: None,
766            tangential_pressure: None,
767            tilt_x: None,
768            tilt_y: None,
769            twist: None,
770            delta_x: None,
771            delta_y: None,
772            pointer_type: None,
773        }
774    }
775    /// Type of the mouse event.
776    pub fn type_(&self) -> &str { self.type_.as_ref() }
777    /// X coordinate of the event relative to the main frame's viewport in CSS pixels.
778    pub fn x(&self) -> f64 { self.x }
779    /// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to
780    /// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport.
781    pub fn y(&self) -> f64 { self.y }
782    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
783    /// (default: 0).
784    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
785    /// Time at which the event occurred.
786    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
787    /// Mouse button (default: "none").
788    pub fn button(&self) -> Option<&MouseButton> { self.button.as_ref() }
789    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
790    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
791    pub fn buttons(&self) -> Option<i64> { self.buttons }
792    /// Number of times the mouse button was clicked (default: 0).
793    pub fn click_count(&self) -> Option<u64> { self.click_count }
794    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
795    pub fn force(&self) -> Option<f64> { self.force }
796    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
797    pub fn tangential_pressure(&self) -> Option<f64> { self.tangential_pressure }
798    /// 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).
799    pub fn tilt_x(&self) -> Option<f64> { self.tilt_x }
800    /// 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).
801    pub fn tilt_y(&self) -> Option<f64> { self.tilt_y }
802    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
803    pub fn twist(&self) -> Option<i64> { self.twist }
804    /// X delta in CSS pixels for mouse wheel event (default: 0).
805    pub fn delta_x(&self) -> Option<f64> { self.delta_x }
806    /// Y delta in CSS pixels for mouse wheel event (default: 0).
807    pub fn delta_y(&self) -> Option<f64> { self.delta_y }
808    /// Pointer type (default: "mouse").
809    pub fn pointer_type(&self) -> Option<&str> { self.pointer_type.as_deref() }
810}
811
812
813pub struct DispatchMouseEventParamsBuilder<'a> {
814    type_: Cow<'a, str>,
815    x: f64,
816    y: f64,
817    modifiers: Option<i64>,
818    timestamp: Option<TimeSinceEpoch>,
819    button: Option<MouseButton>,
820    buttons: Option<i64>,
821    click_count: Option<u64>,
822    force: Option<f64>,
823    tangential_pressure: Option<f64>,
824    tilt_x: Option<f64>,
825    tilt_y: Option<f64>,
826    twist: Option<i64>,
827    delta_x: Option<f64>,
828    delta_y: Option<f64>,
829    pointer_type: Option<Cow<'a, str>>,
830}
831
832impl<'a> DispatchMouseEventParamsBuilder<'a> {
833    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
834    /// (default: 0).
835    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
836    /// Time at which the event occurred.
837    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
838    /// Mouse button (default: "none").
839    pub fn button(mut self, button: impl Into<MouseButton>) -> Self { self.button = Some(button.into()); self }
840    /// A number indicating which buttons are pressed on the mouse when a mouse event is triggered.
841    /// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0.
842    pub fn buttons(mut self, buttons: i64) -> Self { self.buttons = Some(buttons); self }
843    /// Number of times the mouse button was clicked (default: 0).
844    pub fn click_count(mut self, click_count: u64) -> Self { self.click_count = Some(click_count); self }
845    /// The normalized pressure, which has a range of \[0,1\] (default: 0).
846    pub fn force(mut self, force: f64) -> Self { self.force = Some(force); self }
847    /// The normalized tangential pressure, which has a range of \[-1,1\] (default: 0).
848    pub fn tangential_pressure(mut self, tangential_pressure: f64) -> Self { self.tangential_pressure = Some(tangential_pressure); self }
849    /// 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).
850    pub fn tilt_x(mut self, tilt_x: f64) -> Self { self.tilt_x = Some(tilt_x); self }
851    /// 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).
852    pub fn tilt_y(mut self, tilt_y: f64) -> Self { self.tilt_y = Some(tilt_y); self }
853    /// The clockwise rotation of a pen stylus around its own major axis, in degrees in the range \[0,359\] (default: 0).
854    pub fn twist(mut self, twist: i64) -> Self { self.twist = Some(twist); self }
855    /// X delta in CSS pixels for mouse wheel event (default: 0).
856    pub fn delta_x(mut self, delta_x: f64) -> Self { self.delta_x = Some(delta_x); self }
857    /// Y delta in CSS pixels for mouse wheel event (default: 0).
858    pub fn delta_y(mut self, delta_y: f64) -> Self { self.delta_y = Some(delta_y); self }
859    /// Pointer type (default: "mouse").
860    pub fn pointer_type(mut self, pointer_type: impl Into<Cow<'a, str>>) -> Self { self.pointer_type = Some(pointer_type.into()); self }
861    pub fn build(self) -> DispatchMouseEventParams<'a> {
862        DispatchMouseEventParams {
863            type_: self.type_,
864            x: self.x,
865            y: self.y,
866            modifiers: self.modifiers,
867            timestamp: self.timestamp,
868            button: self.button,
869            buttons: self.buttons,
870            click_count: self.click_count,
871            force: self.force,
872            tangential_pressure: self.tangential_pressure,
873            tilt_x: self.tilt_x,
874            tilt_y: self.tilt_y,
875            twist: self.twist,
876            delta_x: self.delta_x,
877            delta_y: self.delta_y,
878            pointer_type: self.pointer_type,
879        }
880    }
881}
882
883impl<'a> DispatchMouseEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchMouseEvent"; }
884
885impl<'a> crate::CdpCommand<'a> for DispatchMouseEventParams<'a> {
886    const METHOD: &'static str = "Input.dispatchMouseEvent";
887    type Response = crate::EmptyReturns;
888}
889
890/// Dispatches a touch event to the page.
891
892#[derive(Debug, Clone, Serialize, Deserialize, Default)]
893#[serde(rename_all = "camelCase")]
894pub struct DispatchTouchEventParams<'a> {
895    /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
896    /// TouchStart and TouchMove must contains at least one.
897    #[serde(rename = "type")]
898    type_: Cow<'a, str>,
899    /// Active touch points on the touch device. One event per any changed point (compared to
900    /// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
901    /// one by one.
902    #[serde(rename = "touchPoints")]
903    touch_points: Vec<TouchPoint>,
904    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
905    /// (default: 0).
906    #[serde(skip_serializing_if = "Option::is_none")]
907    modifiers: Option<i64>,
908    /// Time at which the event occurred.
909    #[serde(skip_serializing_if = "Option::is_none")]
910    timestamp: Option<TimeSinceEpoch>,
911}
912
913impl<'a> DispatchTouchEventParams<'a> {
914    /// Creates a builder for this type with the required parameters:
915    /// * `type_`: Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while TouchStart and TouchMove must contains at least one.
916    /// * `touch_points`: Active touch points on the touch device. One event per any changed point (compared to previous touch event in a sequence) is generated, emulating pressing/moving/releasing points one by one.
917    pub fn builder(type_: impl Into<Cow<'a, str>>, touch_points: Vec<TouchPoint>) -> DispatchTouchEventParamsBuilder<'a> {
918        DispatchTouchEventParamsBuilder {
919            type_: type_.into(),
920            touch_points: touch_points,
921            modifiers: None,
922            timestamp: None,
923        }
924    }
925    /// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while
926    /// TouchStart and TouchMove must contains at least one.
927    pub fn type_(&self) -> &str { self.type_.as_ref() }
928    /// Active touch points on the touch device. One event per any changed point (compared to
929    /// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points
930    /// one by one.
931    pub fn touch_points(&self) -> &[TouchPoint] { &self.touch_points }
932    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
933    /// (default: 0).
934    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
935    /// Time at which the event occurred.
936    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
937}
938
939
940pub struct DispatchTouchEventParamsBuilder<'a> {
941    type_: Cow<'a, str>,
942    touch_points: Vec<TouchPoint>,
943    modifiers: Option<i64>,
944    timestamp: Option<TimeSinceEpoch>,
945}
946
947impl<'a> DispatchTouchEventParamsBuilder<'a> {
948    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
949    /// (default: 0).
950    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
951    /// Time at which the event occurred.
952    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
953    pub fn build(self) -> DispatchTouchEventParams<'a> {
954        DispatchTouchEventParams {
955            type_: self.type_,
956            touch_points: self.touch_points,
957            modifiers: self.modifiers,
958            timestamp: self.timestamp,
959        }
960    }
961}
962
963impl<'a> DispatchTouchEventParams<'a> { pub const METHOD: &'static str = "Input.dispatchTouchEvent"; }
964
965impl<'a> crate::CdpCommand<'a> for DispatchTouchEventParams<'a> {
966    const METHOD: &'static str = "Input.dispatchTouchEvent";
967    type Response = crate::EmptyReturns;
968}
969
970#[derive(Debug, Clone, Serialize, Deserialize, Default)]
971pub struct CancelDraggingParams {}
972
973impl CancelDraggingParams { pub const METHOD: &'static str = "Input.cancelDragging"; }
974
975impl<'a> crate::CdpCommand<'a> for CancelDraggingParams {
976    const METHOD: &'static str = "Input.cancelDragging";
977    type Response = crate::EmptyReturns;
978}
979
980/// Emulates touch event from the mouse event parameters.
981
982#[derive(Debug, Clone, Serialize, Deserialize, Default)]
983#[serde(rename_all = "camelCase")]
984pub struct EmulateTouchFromMouseEventParams<'a> {
985    /// Type of the mouse event.
986    #[serde(rename = "type")]
987    type_: Cow<'a, str>,
988    /// X coordinate of the mouse pointer in DIP.
989    x: i32,
990    /// Y coordinate of the mouse pointer in DIP.
991    y: i32,
992    /// Mouse button. Only "none", "left", "right" are supported.
993    button: MouseButton,
994    /// Time at which the event occurred (default: current time).
995    #[serde(skip_serializing_if = "Option::is_none")]
996    timestamp: Option<TimeSinceEpoch>,
997    /// X delta in DIP for mouse wheel event (default: 0).
998    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaX")]
999    delta_x: Option<f64>,
1000    /// Y delta in DIP for mouse wheel event (default: 0).
1001    #[serde(skip_serializing_if = "Option::is_none", rename = "deltaY")]
1002    delta_y: Option<f64>,
1003    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
1004    /// (default: 0).
1005    #[serde(skip_serializing_if = "Option::is_none")]
1006    modifiers: Option<i64>,
1007    /// Number of times the mouse button was clicked (default: 0).
1008    #[serde(skip_serializing_if = "Option::is_none", rename = "clickCount")]
1009    click_count: Option<u64>,
1010}
1011
1012impl<'a> EmulateTouchFromMouseEventParams<'a> {
1013    /// Creates a builder for this type with the required parameters:
1014    /// * `type_`: Type of the mouse event.
1015    /// * `x`: X coordinate of the mouse pointer in DIP.
1016    /// * `y`: Y coordinate of the mouse pointer in DIP.
1017    /// * `button`: Mouse button. Only "none", "left", "right" are supported.
1018    pub fn builder(type_: impl Into<Cow<'a, str>>, x: i32, y: i32, button: impl Into<MouseButton>) -> EmulateTouchFromMouseEventParamsBuilder<'a> {
1019        EmulateTouchFromMouseEventParamsBuilder {
1020            type_: type_.into(),
1021            x: x,
1022            y: y,
1023            button: button.into(),
1024            timestamp: None,
1025            delta_x: None,
1026            delta_y: None,
1027            modifiers: None,
1028            click_count: None,
1029        }
1030    }
1031    /// Type of the mouse event.
1032    pub fn type_(&self) -> &str { self.type_.as_ref() }
1033    /// X coordinate of the mouse pointer in DIP.
1034    pub fn x(&self) -> i32 { self.x }
1035    /// Y coordinate of the mouse pointer in DIP.
1036    pub fn y(&self) -> i32 { self.y }
1037    /// Mouse button. Only "none", "left", "right" are supported.
1038    pub fn button(&self) -> &MouseButton { &self.button }
1039    /// Time at which the event occurred (default: current time).
1040    pub fn timestamp(&self) -> Option<&TimeSinceEpoch> { self.timestamp.as_ref() }
1041    /// X delta in DIP for mouse wheel event (default: 0).
1042    pub fn delta_x(&self) -> Option<f64> { self.delta_x }
1043    /// Y delta in DIP for mouse wheel event (default: 0).
1044    pub fn delta_y(&self) -> Option<f64> { self.delta_y }
1045    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
1046    /// (default: 0).
1047    pub fn modifiers(&self) -> Option<i64> { self.modifiers }
1048    /// Number of times the mouse button was clicked (default: 0).
1049    pub fn click_count(&self) -> Option<u64> { self.click_count }
1050}
1051
1052
1053pub struct EmulateTouchFromMouseEventParamsBuilder<'a> {
1054    type_: Cow<'a, str>,
1055    x: i32,
1056    y: i32,
1057    button: MouseButton,
1058    timestamp: Option<TimeSinceEpoch>,
1059    delta_x: Option<f64>,
1060    delta_y: Option<f64>,
1061    modifiers: Option<i64>,
1062    click_count: Option<u64>,
1063}
1064
1065impl<'a> EmulateTouchFromMouseEventParamsBuilder<'a> {
1066    /// Time at which the event occurred (default: current time).
1067    pub fn timestamp(mut self, timestamp: TimeSinceEpoch) -> Self { self.timestamp = Some(timestamp); self }
1068    /// X delta in DIP for mouse wheel event (default: 0).
1069    pub fn delta_x(mut self, delta_x: f64) -> Self { self.delta_x = Some(delta_x); self }
1070    /// Y delta in DIP for mouse wheel event (default: 0).
1071    pub fn delta_y(mut self, delta_y: f64) -> Self { self.delta_y = Some(delta_y); self }
1072    /// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8
1073    /// (default: 0).
1074    pub fn modifiers(mut self, modifiers: i64) -> Self { self.modifiers = Some(modifiers); self }
1075    /// Number of times the mouse button was clicked (default: 0).
1076    pub fn click_count(mut self, click_count: u64) -> Self { self.click_count = Some(click_count); self }
1077    pub fn build(self) -> EmulateTouchFromMouseEventParams<'a> {
1078        EmulateTouchFromMouseEventParams {
1079            type_: self.type_,
1080            x: self.x,
1081            y: self.y,
1082            button: self.button,
1083            timestamp: self.timestamp,
1084            delta_x: self.delta_x,
1085            delta_y: self.delta_y,
1086            modifiers: self.modifiers,
1087            click_count: self.click_count,
1088        }
1089    }
1090}
1091
1092impl<'a> EmulateTouchFromMouseEventParams<'a> { pub const METHOD: &'static str = "Input.emulateTouchFromMouseEvent"; }
1093
1094impl<'a> crate::CdpCommand<'a> for EmulateTouchFromMouseEventParams<'a> {
1095    const METHOD: &'static str = "Input.emulateTouchFromMouseEvent";
1096    type Response = crate::EmptyReturns;
1097}
1098
1099/// Ignores input events (useful while auditing page).
1100
1101#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1102#[serde(rename_all = "camelCase")]
1103pub struct SetIgnoreInputEventsParams {
1104    /// Ignores input events processing when set to true.
1105    ignore: bool,
1106}
1107
1108impl SetIgnoreInputEventsParams {
1109    /// Creates a builder for this type with the required parameters:
1110    /// * `ignore`: Ignores input events processing when set to true.
1111    pub fn builder(ignore: bool) -> SetIgnoreInputEventsParamsBuilder {
1112        SetIgnoreInputEventsParamsBuilder {
1113            ignore: ignore,
1114        }
1115    }
1116    /// Ignores input events processing when set to true.
1117    pub fn ignore(&self) -> bool { self.ignore }
1118}
1119
1120
1121pub struct SetIgnoreInputEventsParamsBuilder {
1122    ignore: bool,
1123}
1124
1125impl SetIgnoreInputEventsParamsBuilder {
1126    pub fn build(self) -> SetIgnoreInputEventsParams {
1127        SetIgnoreInputEventsParams {
1128            ignore: self.ignore,
1129        }
1130    }
1131}
1132
1133impl SetIgnoreInputEventsParams { pub const METHOD: &'static str = "Input.setIgnoreInputEvents"; }
1134
1135impl<'a> crate::CdpCommand<'a> for SetIgnoreInputEventsParams {
1136    const METHOD: &'static str = "Input.setIgnoreInputEvents";
1137    type Response = crate::EmptyReturns;
1138}
1139
1140/// Prevents default drag and drop behavior and instead emits 'Input.dragIntercepted' events.
1141/// Drag and drop behavior can be directly controlled via 'Input.dispatchDragEvent'.
1142
1143#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1144#[serde(rename_all = "camelCase")]
1145pub struct SetInterceptDragsParams {
1146    enabled: bool,
1147}
1148
1149impl SetInterceptDragsParams {
1150    /// Creates a builder for this type with the required parameters:
1151    /// * `enabled`: 
1152    pub fn builder(enabled: bool) -> SetInterceptDragsParamsBuilder {
1153        SetInterceptDragsParamsBuilder {
1154            enabled: enabled,
1155        }
1156    }
1157    pub fn enabled(&self) -> bool { self.enabled }
1158}
1159
1160
1161pub struct SetInterceptDragsParamsBuilder {
1162    enabled: bool,
1163}
1164
1165impl SetInterceptDragsParamsBuilder {
1166    pub fn build(self) -> SetInterceptDragsParams {
1167        SetInterceptDragsParams {
1168            enabled: self.enabled,
1169        }
1170    }
1171}
1172
1173impl SetInterceptDragsParams { pub const METHOD: &'static str = "Input.setInterceptDrags"; }
1174
1175impl<'a> crate::CdpCommand<'a> for SetInterceptDragsParams {
1176    const METHOD: &'static str = "Input.setInterceptDrags";
1177    type Response = crate::EmptyReturns;
1178}
1179
1180/// Synthesizes a pinch gesture over a time period by issuing appropriate touch events.
1181
1182#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1183#[serde(rename_all = "camelCase")]
1184pub struct SynthesizePinchGestureParams {
1185    /// X coordinate of the start of the gesture in CSS pixels.
1186    x: f64,
1187    /// Y coordinate of the start of the gesture in CSS pixels.
1188    y: f64,
1189    /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
1190    #[serde(rename = "scaleFactor")]
1191    scale_factor: f64,
1192    /// Relative pointer speed in pixels per second (default: 800).
1193    #[serde(skip_serializing_if = "Option::is_none", rename = "relativeSpeed")]
1194    relative_speed: Option<i64>,
1195    /// Which type of input events to be generated (default: 'default', which queries the platform
1196    /// for the preferred input type).
1197    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
1198    gesture_source_type: Option<GestureSourceType>,
1199}
1200
1201impl SynthesizePinchGestureParams {
1202    /// Creates a builder for this type with the required parameters:
1203    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
1204    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
1205    /// * `scale_factor`: Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
1206    pub fn builder(x: f64, y: f64, scale_factor: f64) -> SynthesizePinchGestureParamsBuilder {
1207        SynthesizePinchGestureParamsBuilder {
1208            x: x,
1209            y: y,
1210            scale_factor: scale_factor,
1211            relative_speed: None,
1212            gesture_source_type: None,
1213        }
1214    }
1215    /// X coordinate of the start of the gesture in CSS pixels.
1216    pub fn x(&self) -> f64 { self.x }
1217    /// Y coordinate of the start of the gesture in CSS pixels.
1218    pub fn y(&self) -> f64 { self.y }
1219    /// Relative scale factor after zooming (\>1.0 zooms in, \<1.0 zooms out).
1220    pub fn scale_factor(&self) -> f64 { self.scale_factor }
1221    /// Relative pointer speed in pixels per second (default: 800).
1222    pub fn relative_speed(&self) -> Option<i64> { self.relative_speed }
1223    /// Which type of input events to be generated (default: 'default', which queries the platform
1224    /// for the preferred input type).
1225    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
1226}
1227
1228
1229pub struct SynthesizePinchGestureParamsBuilder {
1230    x: f64,
1231    y: f64,
1232    scale_factor: f64,
1233    relative_speed: Option<i64>,
1234    gesture_source_type: Option<GestureSourceType>,
1235}
1236
1237impl SynthesizePinchGestureParamsBuilder {
1238    /// Relative pointer speed in pixels per second (default: 800).
1239    pub fn relative_speed(mut self, relative_speed: i64) -> Self { self.relative_speed = Some(relative_speed); self }
1240    /// Which type of input events to be generated (default: 'default', which queries the platform
1241    /// for the preferred input type).
1242    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
1243    pub fn build(self) -> SynthesizePinchGestureParams {
1244        SynthesizePinchGestureParams {
1245            x: self.x,
1246            y: self.y,
1247            scale_factor: self.scale_factor,
1248            relative_speed: self.relative_speed,
1249            gesture_source_type: self.gesture_source_type,
1250        }
1251    }
1252}
1253
1254impl SynthesizePinchGestureParams { pub const METHOD: &'static str = "Input.synthesizePinchGesture"; }
1255
1256impl<'a> crate::CdpCommand<'a> for SynthesizePinchGestureParams {
1257    const METHOD: &'static str = "Input.synthesizePinchGesture";
1258    type Response = crate::EmptyReturns;
1259}
1260
1261/// Synthesizes a scroll gesture over a time period by issuing appropriate touch events.
1262
1263#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1264#[serde(rename_all = "camelCase")]
1265pub struct SynthesizeScrollGestureParams<'a> {
1266    /// X coordinate of the start of the gesture in CSS pixels.
1267    x: f64,
1268    /// Y coordinate of the start of the gesture in CSS pixels.
1269    y: f64,
1270    /// The distance to scroll along the X axis (positive to scroll left).
1271    #[serde(skip_serializing_if = "Option::is_none", rename = "xDistance")]
1272    x_distance: Option<f64>,
1273    /// The distance to scroll along the Y axis (positive to scroll up).
1274    #[serde(skip_serializing_if = "Option::is_none", rename = "yDistance")]
1275    y_distance: Option<f64>,
1276    /// The number of additional pixels to scroll back along the X axis, in addition to the given
1277    /// distance.
1278    #[serde(skip_serializing_if = "Option::is_none", rename = "xOverscroll")]
1279    x_overscroll: Option<f64>,
1280    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
1281    /// distance.
1282    #[serde(skip_serializing_if = "Option::is_none", rename = "yOverscroll")]
1283    y_overscroll: Option<f64>,
1284    /// Prevent fling (default: true).
1285    #[serde(skip_serializing_if = "Option::is_none", rename = "preventFling")]
1286    prevent_fling: Option<bool>,
1287    /// Swipe speed in pixels per second (default: 800).
1288    #[serde(skip_serializing_if = "Option::is_none")]
1289    speed: Option<i64>,
1290    /// Which type of input events to be generated (default: 'default', which queries the platform
1291    /// for the preferred input type).
1292    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
1293    gesture_source_type: Option<GestureSourceType>,
1294    /// The number of times to repeat the gesture (default: 0).
1295    #[serde(skip_serializing_if = "Option::is_none", rename = "repeatCount")]
1296    repeat_count: Option<u64>,
1297    /// The number of milliseconds delay between each repeat. (default: 250).
1298    #[serde(skip_serializing_if = "Option::is_none", rename = "repeatDelayMs")]
1299    repeat_delay_ms: Option<i64>,
1300    /// The name of the interaction markers to generate, if not empty (default: "").
1301    #[serde(skip_serializing_if = "Option::is_none", rename = "interactionMarkerName")]
1302    interaction_marker_name: Option<Cow<'a, str>>,
1303}
1304
1305impl<'a> SynthesizeScrollGestureParams<'a> {
1306    /// Creates a builder for this type with the required parameters:
1307    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
1308    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
1309    pub fn builder(x: f64, y: f64) -> SynthesizeScrollGestureParamsBuilder<'a> {
1310        SynthesizeScrollGestureParamsBuilder {
1311            x: x,
1312            y: y,
1313            x_distance: None,
1314            y_distance: None,
1315            x_overscroll: None,
1316            y_overscroll: None,
1317            prevent_fling: None,
1318            speed: None,
1319            gesture_source_type: None,
1320            repeat_count: None,
1321            repeat_delay_ms: None,
1322            interaction_marker_name: None,
1323        }
1324    }
1325    /// X coordinate of the start of the gesture in CSS pixels.
1326    pub fn x(&self) -> f64 { self.x }
1327    /// Y coordinate of the start of the gesture in CSS pixels.
1328    pub fn y(&self) -> f64 { self.y }
1329    /// The distance to scroll along the X axis (positive to scroll left).
1330    pub fn x_distance(&self) -> Option<f64> { self.x_distance }
1331    /// The distance to scroll along the Y axis (positive to scroll up).
1332    pub fn y_distance(&self) -> Option<f64> { self.y_distance }
1333    /// The number of additional pixels to scroll back along the X axis, in addition to the given
1334    /// distance.
1335    pub fn x_overscroll(&self) -> Option<f64> { self.x_overscroll }
1336    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
1337    /// distance.
1338    pub fn y_overscroll(&self) -> Option<f64> { self.y_overscroll }
1339    /// Prevent fling (default: true).
1340    pub fn prevent_fling(&self) -> Option<bool> { self.prevent_fling }
1341    /// Swipe speed in pixels per second (default: 800).
1342    pub fn speed(&self) -> Option<i64> { self.speed }
1343    /// Which type of input events to be generated (default: 'default', which queries the platform
1344    /// for the preferred input type).
1345    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
1346    /// The number of times to repeat the gesture (default: 0).
1347    pub fn repeat_count(&self) -> Option<u64> { self.repeat_count }
1348    /// The number of milliseconds delay between each repeat. (default: 250).
1349    pub fn repeat_delay_ms(&self) -> Option<i64> { self.repeat_delay_ms }
1350    /// The name of the interaction markers to generate, if not empty (default: "").
1351    pub fn interaction_marker_name(&self) -> Option<&str> { self.interaction_marker_name.as_deref() }
1352}
1353
1354
1355pub struct SynthesizeScrollGestureParamsBuilder<'a> {
1356    x: f64,
1357    y: f64,
1358    x_distance: Option<f64>,
1359    y_distance: Option<f64>,
1360    x_overscroll: Option<f64>,
1361    y_overscroll: Option<f64>,
1362    prevent_fling: Option<bool>,
1363    speed: Option<i64>,
1364    gesture_source_type: Option<GestureSourceType>,
1365    repeat_count: Option<u64>,
1366    repeat_delay_ms: Option<i64>,
1367    interaction_marker_name: Option<Cow<'a, str>>,
1368}
1369
1370impl<'a> SynthesizeScrollGestureParamsBuilder<'a> {
1371    /// The distance to scroll along the X axis (positive to scroll left).
1372    pub fn x_distance(mut self, x_distance: f64) -> Self { self.x_distance = Some(x_distance); self }
1373    /// The distance to scroll along the Y axis (positive to scroll up).
1374    pub fn y_distance(mut self, y_distance: f64) -> Self { self.y_distance = Some(y_distance); self }
1375    /// The number of additional pixels to scroll back along the X axis, in addition to the given
1376    /// distance.
1377    pub fn x_overscroll(mut self, x_overscroll: f64) -> Self { self.x_overscroll = Some(x_overscroll); self }
1378    /// The number of additional pixels to scroll back along the Y axis, in addition to the given
1379    /// distance.
1380    pub fn y_overscroll(mut self, y_overscroll: f64) -> Self { self.y_overscroll = Some(y_overscroll); self }
1381    /// Prevent fling (default: true).
1382    pub fn prevent_fling(mut self, prevent_fling: bool) -> Self { self.prevent_fling = Some(prevent_fling); self }
1383    /// Swipe speed in pixels per second (default: 800).
1384    pub fn speed(mut self, speed: i64) -> Self { self.speed = Some(speed); self }
1385    /// Which type of input events to be generated (default: 'default', which queries the platform
1386    /// for the preferred input type).
1387    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
1388    /// The number of times to repeat the gesture (default: 0).
1389    pub fn repeat_count(mut self, repeat_count: u64) -> Self { self.repeat_count = Some(repeat_count); self }
1390    /// The number of milliseconds delay between each repeat. (default: 250).
1391    pub fn repeat_delay_ms(mut self, repeat_delay_ms: i64) -> Self { self.repeat_delay_ms = Some(repeat_delay_ms); self }
1392    /// The name of the interaction markers to generate, if not empty (default: "").
1393    pub fn interaction_marker_name(mut self, interaction_marker_name: impl Into<Cow<'a, str>>) -> Self { self.interaction_marker_name = Some(interaction_marker_name.into()); self }
1394    pub fn build(self) -> SynthesizeScrollGestureParams<'a> {
1395        SynthesizeScrollGestureParams {
1396            x: self.x,
1397            y: self.y,
1398            x_distance: self.x_distance,
1399            y_distance: self.y_distance,
1400            x_overscroll: self.x_overscroll,
1401            y_overscroll: self.y_overscroll,
1402            prevent_fling: self.prevent_fling,
1403            speed: self.speed,
1404            gesture_source_type: self.gesture_source_type,
1405            repeat_count: self.repeat_count,
1406            repeat_delay_ms: self.repeat_delay_ms,
1407            interaction_marker_name: self.interaction_marker_name,
1408        }
1409    }
1410}
1411
1412impl<'a> SynthesizeScrollGestureParams<'a> { pub const METHOD: &'static str = "Input.synthesizeScrollGesture"; }
1413
1414impl<'a> crate::CdpCommand<'a> for SynthesizeScrollGestureParams<'a> {
1415    const METHOD: &'static str = "Input.synthesizeScrollGesture";
1416    type Response = crate::EmptyReturns;
1417}
1418
1419/// Synthesizes a tap gesture over a time period by issuing appropriate touch events.
1420
1421#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1422#[serde(rename_all = "camelCase")]
1423pub struct SynthesizeTapGestureParams {
1424    /// X coordinate of the start of the gesture in CSS pixels.
1425    x: f64,
1426    /// Y coordinate of the start of the gesture in CSS pixels.
1427    y: f64,
1428    /// Duration between touchdown and touchup events in ms (default: 50).
1429    #[serde(skip_serializing_if = "Option::is_none")]
1430    duration: Option<i64>,
1431    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
1432    #[serde(skip_serializing_if = "Option::is_none", rename = "tapCount")]
1433    tap_count: Option<u64>,
1434    /// Which type of input events to be generated (default: 'default', which queries the platform
1435    /// for the preferred input type).
1436    #[serde(skip_serializing_if = "Option::is_none", rename = "gestureSourceType")]
1437    gesture_source_type: Option<GestureSourceType>,
1438}
1439
1440impl SynthesizeTapGestureParams {
1441    /// Creates a builder for this type with the required parameters:
1442    /// * `x`: X coordinate of the start of the gesture in CSS pixels.
1443    /// * `y`: Y coordinate of the start of the gesture in CSS pixels.
1444    pub fn builder(x: f64, y: f64) -> SynthesizeTapGestureParamsBuilder {
1445        SynthesizeTapGestureParamsBuilder {
1446            x: x,
1447            y: y,
1448            duration: None,
1449            tap_count: None,
1450            gesture_source_type: None,
1451        }
1452    }
1453    /// X coordinate of the start of the gesture in CSS pixels.
1454    pub fn x(&self) -> f64 { self.x }
1455    /// Y coordinate of the start of the gesture in CSS pixels.
1456    pub fn y(&self) -> f64 { self.y }
1457    /// Duration between touchdown and touchup events in ms (default: 50).
1458    pub fn duration(&self) -> Option<i64> { self.duration }
1459    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
1460    pub fn tap_count(&self) -> Option<u64> { self.tap_count }
1461    /// Which type of input events to be generated (default: 'default', which queries the platform
1462    /// for the preferred input type).
1463    pub fn gesture_source_type(&self) -> Option<&GestureSourceType> { self.gesture_source_type.as_ref() }
1464}
1465
1466
1467pub struct SynthesizeTapGestureParamsBuilder {
1468    x: f64,
1469    y: f64,
1470    duration: Option<i64>,
1471    tap_count: Option<u64>,
1472    gesture_source_type: Option<GestureSourceType>,
1473}
1474
1475impl SynthesizeTapGestureParamsBuilder {
1476    /// Duration between touchdown and touchup events in ms (default: 50).
1477    pub fn duration(mut self, duration: i64) -> Self { self.duration = Some(duration); self }
1478    /// Number of times to perform the tap (e.g. 2 for double tap, default: 1).
1479    pub fn tap_count(mut self, tap_count: u64) -> Self { self.tap_count = Some(tap_count); self }
1480    /// Which type of input events to be generated (default: 'default', which queries the platform
1481    /// for the preferred input type).
1482    pub fn gesture_source_type(mut self, gesture_source_type: impl Into<GestureSourceType>) -> Self { self.gesture_source_type = Some(gesture_source_type.into()); self }
1483    pub fn build(self) -> SynthesizeTapGestureParams {
1484        SynthesizeTapGestureParams {
1485            x: self.x,
1486            y: self.y,
1487            duration: self.duration,
1488            tap_count: self.tap_count,
1489            gesture_source_type: self.gesture_source_type,
1490        }
1491    }
1492}
1493
1494impl SynthesizeTapGestureParams { pub const METHOD: &'static str = "Input.synthesizeTapGesture"; }
1495
1496impl<'a> crate::CdpCommand<'a> for SynthesizeTapGestureParams {
1497    const METHOD: &'static str = "Input.synthesizeTapGesture";
1498    type Response = crate::EmptyReturns;
1499}