1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
pub mod methods {
    use serde::{Deserialize, Serialize};

    use crate::protocol::types::{JsFloat, JsUInt};
    use crate::protocol::Method;

    #[derive(Serialize, Debug)]
    #[serde(rename_all = "camelCase")]
    pub struct DispatchMouseEvent<'a> {
        #[serde(rename = "type")]
        pub event_type: &'a str,
        pub x: JsFloat,
        pub y: JsFloat,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub button: Option<&'a str>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub click_count: Option<JsUInt>,
    }
    impl<'a> Default for DispatchMouseEvent<'a> {
        fn default() -> Self {
            DispatchMouseEvent {
                event_type: "mouseMoved",
                x: 0.0,
                y: 0.0,
                button: None,
                click_count: None,
            }
        }
    }
    #[derive(Debug, Deserialize)]
    #[serde(rename_all = "camelCase")]
    pub struct DispatchMouseEventReturnObject {}
    impl<'a> Method for DispatchMouseEvent<'a> {
        const NAME: &'static str = "Input.dispatchMouseEvent";
        type ReturnObject = DispatchMouseEventReturnObject;
    }

    #[derive(Serialize, Debug)]
    #[serde(rename_all = "camelCase")]
    pub struct DispatchKeyEvent<'a> {
        #[serde(rename = "type")]
        pub event_type: &'a str,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub key: Option<&'a str>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub text: Option<&'a str>,
        #[serde(skip_serializing_if = "Option::is_none")]
        pub code: Option<&'a str>,
        pub windows_virtual_key_code: JsUInt,
        pub native_virtual_key_code: JsUInt,
    }
    #[derive(Debug, Deserialize)]
    #[serde(rename_all = "camelCase")]
    pub struct DispatchKeyEventReturnObject {}
    impl<'a> Method for DispatchKeyEvent<'a> {
        const NAME: &'static str = "Input.dispatchKeyEvent";
        type ReturnObject = DispatchKeyEventReturnObject;
    }
}