Skip to main content

rustenium_cdp_definitions/browser_protocol/input/
command_builders.rs

1use super::commands::*;
2impl DispatchDragEvent {
3    pub fn builder() -> DispatchDragEventBuilder {
4        <DispatchDragEventBuilder as Default>::default()
5    }
6}
7#[derive(Default, Clone)]
8pub struct DispatchDragEventBuilder {
9    r#type: Option<DispatchDragEventType>,
10    x: Option<f64>,
11    y: Option<f64>,
12    data: Option<super::types::DragData>,
13    modifiers: Option<i64>,
14}
15impl DispatchDragEventBuilder {
16    pub fn r#type(mut self, r#type: impl Into<DispatchDragEventType>) -> Self {
17        self.r#type = Some(r#type.into());
18        self
19    }
20    pub fn x(mut self, x: impl Into<f64>) -> Self {
21        self.x = Some(x.into());
22        self
23    }
24    pub fn y(mut self, y: impl Into<f64>) -> Self {
25        self.y = Some(y.into());
26        self
27    }
28    pub fn data(mut self, data: impl Into<super::types::DragData>) -> Self {
29        self.data = Some(data.into());
30        self
31    }
32    pub fn modifiers(mut self, modifiers: impl Into<i64>) -> Self {
33        self.modifiers = Some(modifiers.into());
34        self
35    }
36    pub fn build(self) -> Result<DispatchDragEvent, String> {
37        Ok(DispatchDragEvent {
38            method: DispatchDragEventMethod::DispatchDragEvent,
39            params: DispatchDragEventParams {
40                r#type: self
41                    .r#type
42                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(r#type)))?,
43                x: self
44                    .x
45                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
46                y: self
47                    .y
48                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
49                data: self
50                    .data
51                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(data)))?,
52                modifiers: self.modifiers,
53            },
54        })
55    }
56}
57impl DispatchKeyEvent {
58    pub fn builder() -> DispatchKeyEventBuilder {
59        <DispatchKeyEventBuilder as Default>::default()
60    }
61}
62#[derive(Default, Clone)]
63pub struct DispatchKeyEventBuilder {
64    r#type: Option<DispatchKeyEventType>,
65    modifiers: Option<i64>,
66    timestamp: Option<super::types::TimeSinceEpoch>,
67    text: Option<String>,
68    unmodified_text: Option<String>,
69    key_identifier: Option<String>,
70    code: Option<String>,
71    key: Option<String>,
72    windows_virtual_key_code: Option<i64>,
73    native_virtual_key_code: Option<i64>,
74    auto_repeat: Option<bool>,
75    is_keypad: Option<bool>,
76    is_system_key: Option<bool>,
77    location: Option<i64>,
78    commands: Option<Vec<String>>,
79}
80impl DispatchKeyEventBuilder {
81    pub fn r#type(mut self, r#type: impl Into<DispatchKeyEventType>) -> Self {
82        self.r#type = Some(r#type.into());
83        self
84    }
85    pub fn modifiers(mut self, modifiers: impl Into<i64>) -> Self {
86        self.modifiers = Some(modifiers.into());
87        self
88    }
89    pub fn timestamp(mut self, timestamp: impl Into<super::types::TimeSinceEpoch>) -> Self {
90        self.timestamp = Some(timestamp.into());
91        self
92    }
93    pub fn text(mut self, text: impl Into<String>) -> Self {
94        self.text = Some(text.into());
95        self
96    }
97    pub fn unmodified_text(mut self, unmodified_text: impl Into<String>) -> Self {
98        self.unmodified_text = Some(unmodified_text.into());
99        self
100    }
101    pub fn key_identifier(mut self, key_identifier: impl Into<String>) -> Self {
102        self.key_identifier = Some(key_identifier.into());
103        self
104    }
105    pub fn code(mut self, code: impl Into<String>) -> Self {
106        self.code = Some(code.into());
107        self
108    }
109    pub fn key(mut self, key: impl Into<String>) -> Self {
110        self.key = Some(key.into());
111        self
112    }
113    pub fn windows_virtual_key_code(mut self, windows_virtual_key_code: impl Into<i64>) -> Self {
114        self.windows_virtual_key_code = Some(windows_virtual_key_code.into());
115        self
116    }
117    pub fn native_virtual_key_code(mut self, native_virtual_key_code: impl Into<i64>) -> Self {
118        self.native_virtual_key_code = Some(native_virtual_key_code.into());
119        self
120    }
121    pub fn auto_repeat(mut self, auto_repeat: impl Into<bool>) -> Self {
122        self.auto_repeat = Some(auto_repeat.into());
123        self
124    }
125    pub fn is_keypad(mut self, is_keypad: impl Into<bool>) -> Self {
126        self.is_keypad = Some(is_keypad.into());
127        self
128    }
129    pub fn is_system_key(mut self, is_system_key: impl Into<bool>) -> Self {
130        self.is_system_key = Some(is_system_key.into());
131        self
132    }
133    pub fn location(mut self, location: impl Into<i64>) -> Self {
134        self.location = Some(location.into());
135        self
136    }
137    pub fn command(mut self, command: impl Into<String>) -> Self {
138        let v = self.commands.get_or_insert(Vec::new());
139        v.push(command.into());
140        self
141    }
142    pub fn commands<I, S>(mut self, commands: I) -> Self
143    where
144        I: IntoIterator<Item = S>,
145        S: Into<String>,
146    {
147        let v = self.commands.get_or_insert(Vec::new());
148        for val in commands {
149            v.push(val.into());
150        }
151        self
152    }
153    pub fn build(self) -> Result<DispatchKeyEvent, String> {
154        Ok(DispatchKeyEvent {
155            method: DispatchKeyEventMethod::DispatchKeyEvent,
156            params: DispatchKeyEventParams {
157                r#type: self
158                    .r#type
159                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(r#type)))?,
160                modifiers: self.modifiers,
161                timestamp: self.timestamp,
162                text: self.text,
163                unmodified_text: self.unmodified_text,
164                key_identifier: self.key_identifier,
165                code: self.code,
166                key: self.key,
167                windows_virtual_key_code: self.windows_virtual_key_code,
168                native_virtual_key_code: self.native_virtual_key_code,
169                auto_repeat: self.auto_repeat,
170                is_keypad: self.is_keypad,
171                is_system_key: self.is_system_key,
172                location: self.location,
173                commands: self.commands,
174            },
175        })
176    }
177}
178impl InsertText {
179    pub fn builder() -> InsertTextBuilder {
180        <InsertTextBuilder as Default>::default()
181    }
182}
183#[derive(Default, Clone)]
184pub struct InsertTextBuilder {
185    text: Option<String>,
186}
187impl InsertTextBuilder {
188    pub fn text(mut self, text: impl Into<String>) -> Self {
189        self.text = Some(text.into());
190        self
191    }
192    pub fn build(self) -> Result<InsertText, String> {
193        Ok(InsertText {
194            method: InsertTextMethod::InsertText,
195            params: InsertTextParams {
196                text: self
197                    .text
198                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
199            },
200        })
201    }
202}
203impl ImeSetComposition {
204    pub fn builder() -> ImeSetCompositionBuilder {
205        <ImeSetCompositionBuilder as Default>::default()
206    }
207}
208#[derive(Default, Clone)]
209pub struct ImeSetCompositionBuilder {
210    text: Option<String>,
211    selection_start: Option<i64>,
212    selection_end: Option<i64>,
213    replacement_start: Option<i64>,
214    replacement_end: Option<i64>,
215}
216impl ImeSetCompositionBuilder {
217    pub fn text(mut self, text: impl Into<String>) -> Self {
218        self.text = Some(text.into());
219        self
220    }
221    pub fn selection_start(mut self, selection_start: impl Into<i64>) -> Self {
222        self.selection_start = Some(selection_start.into());
223        self
224    }
225    pub fn selection_end(mut self, selection_end: impl Into<i64>) -> Self {
226        self.selection_end = Some(selection_end.into());
227        self
228    }
229    pub fn replacement_start(mut self, replacement_start: impl Into<i64>) -> Self {
230        self.replacement_start = Some(replacement_start.into());
231        self
232    }
233    pub fn replacement_end(mut self, replacement_end: impl Into<i64>) -> Self {
234        self.replacement_end = Some(replacement_end.into());
235        self
236    }
237    pub fn build(self) -> Result<ImeSetComposition, String> {
238        Ok(ImeSetComposition {
239            method: ImeSetCompositionMethod::ImeSetComposition,
240            params: ImeSetCompositionParams {
241                text: self
242                    .text
243                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(text)))?,
244                selection_start: self.selection_start.ok_or_else(|| {
245                    format!("Field `{}` is mandatory.", std::stringify!(selection_start))
246                })?,
247                selection_end: self.selection_end.ok_or_else(|| {
248                    format!("Field `{}` is mandatory.", std::stringify!(selection_end))
249                })?,
250                replacement_start: self.replacement_start,
251                replacement_end: self.replacement_end,
252            },
253        })
254    }
255}
256impl DispatchMouseEvent {
257    pub fn builder() -> DispatchMouseEventBuilder {
258        <DispatchMouseEventBuilder as Default>::default()
259    }
260}
261#[derive(Default, Clone)]
262pub struct DispatchMouseEventBuilder {
263    r#type: Option<DispatchMouseEventType>,
264    x: Option<f64>,
265    y: Option<f64>,
266    modifiers: Option<i64>,
267    timestamp: Option<super::types::TimeSinceEpoch>,
268    button: Option<super::types::MouseButton>,
269    buttons: Option<i64>,
270    click_count: Option<i64>,
271    force: Option<f64>,
272    tangential_pressure: Option<f64>,
273    tilt_x: Option<f64>,
274    tilt_y: Option<f64>,
275    twist: Option<i64>,
276    delta_x: Option<f64>,
277    delta_y: Option<f64>,
278    pointer_type: Option<DispatchMouseEventPointerType>,
279}
280impl DispatchMouseEventBuilder {
281    pub fn r#type(mut self, r#type: impl Into<DispatchMouseEventType>) -> Self {
282        self.r#type = Some(r#type.into());
283        self
284    }
285    pub fn x(mut self, x: impl Into<f64>) -> Self {
286        self.x = Some(x.into());
287        self
288    }
289    pub fn y(mut self, y: impl Into<f64>) -> Self {
290        self.y = Some(y.into());
291        self
292    }
293    pub fn modifiers(mut self, modifiers: impl Into<i64>) -> Self {
294        self.modifiers = Some(modifiers.into());
295        self
296    }
297    pub fn timestamp(mut self, timestamp: impl Into<super::types::TimeSinceEpoch>) -> Self {
298        self.timestamp = Some(timestamp.into());
299        self
300    }
301    pub fn button(mut self, button: impl Into<super::types::MouseButton>) -> Self {
302        self.button = Some(button.into());
303        self
304    }
305    pub fn buttons(mut self, buttons: impl Into<i64>) -> Self {
306        self.buttons = Some(buttons.into());
307        self
308    }
309    pub fn click_count(mut self, click_count: impl Into<i64>) -> Self {
310        self.click_count = Some(click_count.into());
311        self
312    }
313    pub fn force(mut self, force: impl Into<f64>) -> Self {
314        self.force = Some(force.into());
315        self
316    }
317    pub fn tangential_pressure(mut self, tangential_pressure: impl Into<f64>) -> Self {
318        self.tangential_pressure = Some(tangential_pressure.into());
319        self
320    }
321    pub fn tilt_x(mut self, tilt_x: impl Into<f64>) -> Self {
322        self.tilt_x = Some(tilt_x.into());
323        self
324    }
325    pub fn tilt_y(mut self, tilt_y: impl Into<f64>) -> Self {
326        self.tilt_y = Some(tilt_y.into());
327        self
328    }
329    pub fn twist(mut self, twist: impl Into<i64>) -> Self {
330        self.twist = Some(twist.into());
331        self
332    }
333    pub fn delta_x(mut self, delta_x: impl Into<f64>) -> Self {
334        self.delta_x = Some(delta_x.into());
335        self
336    }
337    pub fn delta_y(mut self, delta_y: impl Into<f64>) -> Self {
338        self.delta_y = Some(delta_y.into());
339        self
340    }
341    pub fn pointer_type(mut self, pointer_type: impl Into<DispatchMouseEventPointerType>) -> Self {
342        self.pointer_type = Some(pointer_type.into());
343        self
344    }
345    pub fn build(self) -> Result<DispatchMouseEvent, String> {
346        Ok(DispatchMouseEvent {
347            method: DispatchMouseEventMethod::DispatchMouseEvent,
348            params: DispatchMouseEventParams {
349                r#type: self
350                    .r#type
351                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(r#type)))?,
352                x: self
353                    .x
354                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
355                y: self
356                    .y
357                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
358                modifiers: self.modifiers,
359                timestamp: self.timestamp,
360                button: self.button,
361                buttons: self.buttons,
362                click_count: self.click_count,
363                force: self.force,
364                tangential_pressure: self.tangential_pressure,
365                tilt_x: self.tilt_x,
366                tilt_y: self.tilt_y,
367                twist: self.twist,
368                delta_x: self.delta_x,
369                delta_y: self.delta_y,
370                pointer_type: self.pointer_type,
371            },
372        })
373    }
374}
375impl DispatchTouchEvent {
376    pub fn builder() -> DispatchTouchEventBuilder {
377        <DispatchTouchEventBuilder as Default>::default()
378    }
379}
380#[derive(Default, Clone)]
381pub struct DispatchTouchEventBuilder {
382    r#type: Option<DispatchTouchEventType>,
383    touch_points: Option<Vec<super::types::TouchPoint>>,
384    modifiers: Option<i64>,
385    timestamp: Option<super::types::TimeSinceEpoch>,
386}
387impl DispatchTouchEventBuilder {
388    pub fn r#type(mut self, r#type: impl Into<DispatchTouchEventType>) -> Self {
389        self.r#type = Some(r#type.into());
390        self
391    }
392    pub fn touch_point(mut self, touch_point: impl Into<super::types::TouchPoint>) -> Self {
393        let v = self.touch_points.get_or_insert(Vec::new());
394        v.push(touch_point.into());
395        self
396    }
397    pub fn touch_points<I, S>(mut self, touch_points: I) -> Self
398    where
399        I: IntoIterator<Item = S>,
400        S: Into<super::types::TouchPoint>,
401    {
402        let v = self.touch_points.get_or_insert(Vec::new());
403        for val in touch_points {
404            v.push(val.into());
405        }
406        self
407    }
408    pub fn modifiers(mut self, modifiers: impl Into<i64>) -> Self {
409        self.modifiers = Some(modifiers.into());
410        self
411    }
412    pub fn timestamp(mut self, timestamp: impl Into<super::types::TimeSinceEpoch>) -> Self {
413        self.timestamp = Some(timestamp.into());
414        self
415    }
416    pub fn build(self) -> Result<DispatchTouchEvent, String> {
417        Ok(DispatchTouchEvent {
418            method: DispatchTouchEventMethod::DispatchTouchEvent,
419            params: DispatchTouchEventParams {
420                r#type: self
421                    .r#type
422                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(r#type)))?,
423                touch_points: self.touch_points.ok_or_else(|| {
424                    format!("Field `{}` is mandatory.", std::stringify!(touch_points))
425                })?,
426                modifiers: self.modifiers,
427                timestamp: self.timestamp,
428            },
429        })
430    }
431}
432#[derive(Debug, Clone, Default)]
433pub struct CancelDraggingBuilder;
434impl CancelDraggingBuilder {
435    pub fn new() -> Self {
436        Self
437    }
438    pub fn build(self) -> CancelDragging {
439        CancelDragging {
440            method: CancelDraggingMethod::CancelDragging,
441            params: CancelDraggingParams {},
442        }
443    }
444}
445impl CancelDragging {
446    pub fn builder() -> CancelDraggingBuilder {
447        CancelDraggingBuilder
448    }
449}
450impl EmulateTouchFromMouseEvent {
451    pub fn builder() -> EmulateTouchFromMouseEventBuilder {
452        <EmulateTouchFromMouseEventBuilder as Default>::default()
453    }
454}
455#[derive(Default, Clone)]
456pub struct EmulateTouchFromMouseEventBuilder {
457    r#type: Option<EmulateTouchFromMouseEventType>,
458    x: Option<i64>,
459    y: Option<i64>,
460    button: Option<super::types::MouseButton>,
461    timestamp: Option<super::types::TimeSinceEpoch>,
462    delta_x: Option<f64>,
463    delta_y: Option<f64>,
464    modifiers: Option<i64>,
465    click_count: Option<i64>,
466}
467impl EmulateTouchFromMouseEventBuilder {
468    pub fn r#type(mut self, r#type: impl Into<EmulateTouchFromMouseEventType>) -> Self {
469        self.r#type = Some(r#type.into());
470        self
471    }
472    pub fn x(mut self, x: impl Into<i64>) -> Self {
473        self.x = Some(x.into());
474        self
475    }
476    pub fn y(mut self, y: impl Into<i64>) -> Self {
477        self.y = Some(y.into());
478        self
479    }
480    pub fn button(mut self, button: impl Into<super::types::MouseButton>) -> Self {
481        self.button = Some(button.into());
482        self
483    }
484    pub fn timestamp(mut self, timestamp: impl Into<super::types::TimeSinceEpoch>) -> Self {
485        self.timestamp = Some(timestamp.into());
486        self
487    }
488    pub fn delta_x(mut self, delta_x: impl Into<f64>) -> Self {
489        self.delta_x = Some(delta_x.into());
490        self
491    }
492    pub fn delta_y(mut self, delta_y: impl Into<f64>) -> Self {
493        self.delta_y = Some(delta_y.into());
494        self
495    }
496    pub fn modifiers(mut self, modifiers: impl Into<i64>) -> Self {
497        self.modifiers = Some(modifiers.into());
498        self
499    }
500    pub fn click_count(mut self, click_count: impl Into<i64>) -> Self {
501        self.click_count = Some(click_count.into());
502        self
503    }
504    pub fn build(self) -> Result<EmulateTouchFromMouseEvent, String> {
505        Ok(EmulateTouchFromMouseEvent {
506            method: EmulateTouchFromMouseEventMethod::EmulateTouchFromMouseEvent,
507            params: EmulateTouchFromMouseEventParams {
508                r#type: self
509                    .r#type
510                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(r#type)))?,
511                x: self
512                    .x
513                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
514                y: self
515                    .y
516                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
517                button: self
518                    .button
519                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(button)))?,
520                timestamp: self.timestamp,
521                delta_x: self.delta_x,
522                delta_y: self.delta_y,
523                modifiers: self.modifiers,
524                click_count: self.click_count,
525            },
526        })
527    }
528}
529impl SetIgnoreInputEvents {
530    pub fn builder() -> SetIgnoreInputEventsBuilder {
531        <SetIgnoreInputEventsBuilder as Default>::default()
532    }
533}
534#[derive(Default, Clone)]
535pub struct SetIgnoreInputEventsBuilder {
536    ignore: Option<bool>,
537}
538impl SetIgnoreInputEventsBuilder {
539    pub fn ignore(mut self, ignore: impl Into<bool>) -> Self {
540        self.ignore = Some(ignore.into());
541        self
542    }
543    pub fn build(self) -> Result<SetIgnoreInputEvents, String> {
544        Ok(SetIgnoreInputEvents {
545            method: SetIgnoreInputEventsMethod::SetIgnoreInputEvents,
546            params: SetIgnoreInputEventsParams {
547                ignore: self
548                    .ignore
549                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(ignore)))?,
550            },
551        })
552    }
553}
554impl SetInterceptDrags {
555    pub fn builder() -> SetInterceptDragsBuilder {
556        <SetInterceptDragsBuilder as Default>::default()
557    }
558}
559#[derive(Default, Clone)]
560pub struct SetInterceptDragsBuilder {
561    enabled: Option<bool>,
562}
563impl SetInterceptDragsBuilder {
564    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
565        self.enabled = Some(enabled.into());
566        self
567    }
568    pub fn build(self) -> Result<SetInterceptDrags, String> {
569        Ok(SetInterceptDrags {
570            method: SetInterceptDragsMethod::SetInterceptDrags,
571            params: SetInterceptDragsParams {
572                enabled: self
573                    .enabled
574                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
575            },
576        })
577    }
578}
579impl SynthesizePinchGesture {
580    pub fn builder() -> SynthesizePinchGestureBuilder {
581        <SynthesizePinchGestureBuilder as Default>::default()
582    }
583}
584#[derive(Default, Clone)]
585pub struct SynthesizePinchGestureBuilder {
586    x: Option<f64>,
587    y: Option<f64>,
588    scale_factor: Option<f64>,
589    relative_speed: Option<i64>,
590    gesture_source_type: Option<super::types::GestureSourceType>,
591}
592impl SynthesizePinchGestureBuilder {
593    pub fn x(mut self, x: impl Into<f64>) -> Self {
594        self.x = Some(x.into());
595        self
596    }
597    pub fn y(mut self, y: impl Into<f64>) -> Self {
598        self.y = Some(y.into());
599        self
600    }
601    pub fn scale_factor(mut self, scale_factor: impl Into<f64>) -> Self {
602        self.scale_factor = Some(scale_factor.into());
603        self
604    }
605    pub fn relative_speed(mut self, relative_speed: impl Into<i64>) -> Self {
606        self.relative_speed = Some(relative_speed.into());
607        self
608    }
609    pub fn gesture_source_type(
610        mut self,
611        gesture_source_type: impl Into<super::types::GestureSourceType>,
612    ) -> Self {
613        self.gesture_source_type = Some(gesture_source_type.into());
614        self
615    }
616    pub fn build(self) -> Result<SynthesizePinchGesture, String> {
617        Ok(SynthesizePinchGesture {
618            method: SynthesizePinchGestureMethod::SynthesizePinchGesture,
619            params: SynthesizePinchGestureParams {
620                x: self
621                    .x
622                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
623                y: self
624                    .y
625                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
626                scale_factor: self.scale_factor.ok_or_else(|| {
627                    format!("Field `{}` is mandatory.", std::stringify!(scale_factor))
628                })?,
629                relative_speed: self.relative_speed,
630                gesture_source_type: self.gesture_source_type,
631            },
632        })
633    }
634}
635impl SynthesizeScrollGesture {
636    pub fn builder() -> SynthesizeScrollGestureBuilder {
637        <SynthesizeScrollGestureBuilder as Default>::default()
638    }
639}
640#[derive(Default, Clone)]
641pub struct SynthesizeScrollGestureBuilder {
642    x: Option<f64>,
643    y: Option<f64>,
644    x_distance: Option<f64>,
645    y_distance: Option<f64>,
646    x_overscroll: Option<f64>,
647    y_overscroll: Option<f64>,
648    prevent_fling: Option<bool>,
649    speed: Option<i64>,
650    gesture_source_type: Option<super::types::GestureSourceType>,
651    repeat_count: Option<i64>,
652    repeat_delay_ms: Option<i64>,
653    interaction_marker_name: Option<String>,
654}
655impl SynthesizeScrollGestureBuilder {
656    pub fn x(mut self, x: impl Into<f64>) -> Self {
657        self.x = Some(x.into());
658        self
659    }
660    pub fn y(mut self, y: impl Into<f64>) -> Self {
661        self.y = Some(y.into());
662        self
663    }
664    pub fn x_distance(mut self, x_distance: impl Into<f64>) -> Self {
665        self.x_distance = Some(x_distance.into());
666        self
667    }
668    pub fn y_distance(mut self, y_distance: impl Into<f64>) -> Self {
669        self.y_distance = Some(y_distance.into());
670        self
671    }
672    pub fn x_overscroll(mut self, x_overscroll: impl Into<f64>) -> Self {
673        self.x_overscroll = Some(x_overscroll.into());
674        self
675    }
676    pub fn y_overscroll(mut self, y_overscroll: impl Into<f64>) -> Self {
677        self.y_overscroll = Some(y_overscroll.into());
678        self
679    }
680    pub fn prevent_fling(mut self, prevent_fling: impl Into<bool>) -> Self {
681        self.prevent_fling = Some(prevent_fling.into());
682        self
683    }
684    pub fn speed(mut self, speed: impl Into<i64>) -> Self {
685        self.speed = Some(speed.into());
686        self
687    }
688    pub fn gesture_source_type(
689        mut self,
690        gesture_source_type: impl Into<super::types::GestureSourceType>,
691    ) -> Self {
692        self.gesture_source_type = Some(gesture_source_type.into());
693        self
694    }
695    pub fn repeat_count(mut self, repeat_count: impl Into<i64>) -> Self {
696        self.repeat_count = Some(repeat_count.into());
697        self
698    }
699    pub fn repeat_delay_ms(mut self, repeat_delay_ms: impl Into<i64>) -> Self {
700        self.repeat_delay_ms = Some(repeat_delay_ms.into());
701        self
702    }
703    pub fn interaction_marker_name(mut self, interaction_marker_name: impl Into<String>) -> Self {
704        self.interaction_marker_name = Some(interaction_marker_name.into());
705        self
706    }
707    pub fn build(self) -> Result<SynthesizeScrollGesture, String> {
708        Ok(SynthesizeScrollGesture {
709            method: SynthesizeScrollGestureMethod::SynthesizeScrollGesture,
710            params: SynthesizeScrollGestureParams {
711                x: self
712                    .x
713                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
714                y: self
715                    .y
716                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
717                x_distance: self.x_distance,
718                y_distance: self.y_distance,
719                x_overscroll: self.x_overscroll,
720                y_overscroll: self.y_overscroll,
721                prevent_fling: self.prevent_fling,
722                speed: self.speed,
723                gesture_source_type: self.gesture_source_type,
724                repeat_count: self.repeat_count,
725                repeat_delay_ms: self.repeat_delay_ms,
726                interaction_marker_name: self.interaction_marker_name,
727            },
728        })
729    }
730}
731impl SynthesizeTapGesture {
732    pub fn builder() -> SynthesizeTapGestureBuilder {
733        <SynthesizeTapGestureBuilder as Default>::default()
734    }
735}
736#[derive(Default, Clone)]
737pub struct SynthesizeTapGestureBuilder {
738    x: Option<f64>,
739    y: Option<f64>,
740    duration: Option<i64>,
741    tap_count: Option<i64>,
742    gesture_source_type: Option<super::types::GestureSourceType>,
743}
744impl SynthesizeTapGestureBuilder {
745    pub fn x(mut self, x: impl Into<f64>) -> Self {
746        self.x = Some(x.into());
747        self
748    }
749    pub fn y(mut self, y: impl Into<f64>) -> Self {
750        self.y = Some(y.into());
751        self
752    }
753    pub fn duration(mut self, duration: impl Into<i64>) -> Self {
754        self.duration = Some(duration.into());
755        self
756    }
757    pub fn tap_count(mut self, tap_count: impl Into<i64>) -> Self {
758        self.tap_count = Some(tap_count.into());
759        self
760    }
761    pub fn gesture_source_type(
762        mut self,
763        gesture_source_type: impl Into<super::types::GestureSourceType>,
764    ) -> Self {
765        self.gesture_source_type = Some(gesture_source_type.into());
766        self
767    }
768    pub fn build(self) -> Result<SynthesizeTapGesture, String> {
769        Ok(SynthesizeTapGesture {
770            method: SynthesizeTapGestureMethod::SynthesizeTapGesture,
771            params: SynthesizeTapGestureParams {
772                x: self
773                    .x
774                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(x)))?,
775                y: self
776                    .y
777                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(y)))?,
778                duration: self.duration,
779                tap_count: self.tap_count,
780                gesture_source_type: self.gesture_source_type,
781            },
782        })
783    }
784}