Skip to main content

rustenium_cdp_definitions/browser_protocol/autofill/
commands.rs

1use serde::{Deserialize, Serialize};
2#[doc = "Trigger autofill on a form identified by the fieldId.\nIf the field and related form cannot be autofilled, returns an error.\n[trigger](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-trigger)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct TriggerParams {
5    #[doc = "Identifies a field that serves as an anchor for autofill."]
6    #[serde(rename = "fieldId")]
7    pub field_id: crate::browser_protocol::dom::types::BackendNodeId,
8    #[doc = "Identifies the frame that field belongs to."]
9    #[serde(rename = "frameId")]
10    #[serde(skip_serializing_if = "Option::is_none")]
11    #[serde(default)]
12    pub frame_id: Option<crate::browser_protocol::page::types::FrameId>,
13    #[doc = "Credit card information to fill out the form. Credit card data is not saved.  Mutually exclusive with `address`."]
14    #[serde(rename = "card")]
15    #[serde(skip_serializing_if = "Option::is_none")]
16    #[serde(default)]
17    pub card: Option<super::types::CreditCard>,
18    #[doc = "Address to fill out the form. Address data is not saved. Mutually exclusive with `card`."]
19    #[serde(rename = "address")]
20    #[serde(skip_serializing_if = "Option::is_none")]
21    #[serde(default)]
22    pub address: Option<super::types::Address>,
23}
24impl TriggerParams {
25    pub fn new(field_id: impl Into<crate::browser_protocol::dom::types::BackendNodeId>) -> Self {
26        Self {
27            field_id: field_id.into(),
28            frame_id: None,
29            card: None,
30            address: None,
31        }
32    }
33}
34#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
35pub enum TriggerMethod {
36    #[serde(rename = "Autofill.trigger")]
37    Trigger,
38}
39#[doc = "Trigger autofill on a form identified by the fieldId.\nIf the field and related form cannot be autofilled, returns an error.\n[trigger](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-trigger)"]
40#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
41pub struct Trigger {
42    pub method: TriggerMethod,
43    pub params: TriggerParams,
44}
45impl Trigger {
46    pub const IDENTIFIER: &'static str = "Autofill.trigger";
47    pub fn identifier(&self) -> &'static str {
48        Self::IDENTIFIER
49    }
50}
51impl crate::CommandResult for Trigger {
52    type Result = super::results::TriggerResult;
53}
54#[doc = "Set addresses so that developers can verify their forms implementation.\n[setAddresses](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-setAddresses)"]
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
56pub struct SetAddressesParams {
57    #[doc = "Test addresses for the available countries."]
58    #[serde(rename = "addresses")]
59    #[serde(skip_serializing_if = "Vec::is_empty")]
60    pub addresses: Vec<super::types::Address>,
61}
62impl SetAddressesParams {
63    pub fn new(addresses: Vec<super::types::Address>) -> Self {
64        Self { addresses }
65    }
66}
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
68pub enum SetAddressesMethod {
69    #[serde(rename = "Autofill.setAddresses")]
70    SetAddresses,
71}
72#[doc = "Set addresses so that developers can verify their forms implementation.\n[setAddresses](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-setAddresses)"]
73#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
74pub struct SetAddresses {
75    pub method: SetAddressesMethod,
76    pub params: SetAddressesParams,
77}
78impl SetAddresses {
79    pub const IDENTIFIER: &'static str = "Autofill.setAddresses";
80    pub fn identifier(&self) -> &'static str {
81        Self::IDENTIFIER
82    }
83}
84impl crate::CommandResult for SetAddresses {
85    type Result = super::results::SetAddressesResult;
86}
87#[doc = "Disables autofill domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-disable)"]
88#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
89pub struct DisableParams {}
90#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
91pub enum DisableMethod {
92    #[serde(rename = "Autofill.disable")]
93    Disable,
94}
95#[doc = "Disables autofill domain notifications.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-disable)"]
96#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
97pub struct Disable {
98    pub method: DisableMethod,
99    pub params: DisableParams,
100}
101impl Disable {
102    pub const IDENTIFIER: &'static str = "Autofill.disable";
103    pub fn identifier(&self) -> &'static str {
104        Self::IDENTIFIER
105    }
106}
107impl crate::CommandResult for Disable {
108    type Result = super::results::DisableResult;
109}
110#[doc = "Enables autofill domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-enable)"]
111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
112pub struct EnableParams {}
113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
114pub enum EnableMethod {
115    #[serde(rename = "Autofill.enable")]
116    Enable,
117}
118#[doc = "Enables autofill domain notifications.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Autofill/#method-enable)"]
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120pub struct Enable {
121    pub method: EnableMethod,
122    pub params: EnableParams,
123}
124impl Enable {
125    pub const IDENTIFIER: &'static str = "Autofill.enable";
126    pub fn identifier(&self) -> &'static str {
127        Self::IDENTIFIER
128    }
129}
130impl crate::CommandResult for Enable {
131    type Result = super::results::EnableResult;
132}
133group_enum ! (AutofillCommands { Trigger (Trigger) , SetAddresses (SetAddresses) , Disable (Disable) , Enable (Enable) } + identifiable);