1#![allow(dead_code)]
3use super::dom;
4use super::page;
5#[allow(unused_imports)]
6use super::types::*;
7#[allow(unused_imports)]
8use derive_builder::Builder;
9#[allow(unused_imports)]
10use serde::{Deserialize, Serialize};
11#[allow(unused_imports)]
12use serde_json::Value as Json;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum FillingStrategy {
16 #[serde(rename = "autocompleteAttribute")]
17 AutocompleteAttribute,
18 #[serde(rename = "autofillInferred")]
19 AutofillInferred,
20}
21#[allow(deprecated)]
22#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
23#[builder(setter(into, strip_option))]
24#[serde(rename_all = "camelCase")]
25pub struct CreditCard {
26 #[serde(default)]
27 #[doc = "16-digit credit card number."]
28 pub number: String,
29 #[serde(default)]
30 #[doc = "Name of the credit card owner."]
31 pub name: String,
32 #[serde(default)]
33 #[doc = "2-digit expiry month."]
34 pub expiry_month: String,
35 #[serde(default)]
36 #[doc = "4-digit expiry year."]
37 pub expiry_year: String,
38 #[serde(default)]
39 #[doc = "3-digit card verification code."]
40 pub cvc: String,
41}
42#[allow(deprecated)]
43#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
44#[builder(setter(into, strip_option))]
45#[serde(rename_all = "camelCase")]
46pub struct AddressField {
47 #[serde(default)]
48 #[doc = "address field name, for example GIVEN_NAME.\n The full list of supported field names:\n <https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/field_types.cc;l=38>"]
49 pub name: String,
50 #[serde(default)]
51 #[doc = "address field value, for example Jon Doe."]
52 pub value: String,
53}
54#[allow(deprecated)]
55#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
56#[builder(setter(into, strip_option))]
57#[serde(rename_all = "camelCase")]
58#[doc = "A list of address fields."]
59pub struct AddressFields {
60 pub fields: Vec<AddressField>,
61}
62#[allow(deprecated)]
63#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
64#[builder(setter(into, strip_option))]
65#[serde(rename_all = "camelCase")]
66pub struct Address {
67 #[doc = "fields and values defining an address."]
68 pub fields: Vec<AddressField>,
69}
70#[allow(deprecated)]
71#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
72#[builder(setter(into, strip_option))]
73#[serde(rename_all = "camelCase")]
74#[doc = "Defines how an address can be displayed like in chrome://settings/addresses.\n Address UI is a two dimensional array, each inner array is an \"address information line\", and when rendered in a UI surface should be displayed as such.\n The following address UI for instance:\n \\[\\[{name: \"GIVE_NAME\", value: \"Jon\"}, {name: \"FAMILY_NAME\", value: \"Doe\"}\\], \\[{name: \"CITY\", value: \"Munich\"}, {name: \"ZIP\", value: \"81456\"}\\]\\]\n should allow the receiver to render:\n Jon Doe\n Munich 81456"]
75pub struct AddressUi {
76 #[doc = "A two dimension array containing the representation of values from an address profile."]
77 pub address_fields: Vec<AddressFields>,
78}
79#[allow(deprecated)]
80#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
81#[builder(setter(into, strip_option))]
82#[serde(rename_all = "camelCase")]
83pub struct FilledField {
84 #[serde(default)]
85 #[doc = "The type of the field, e.g text, password etc."]
86 pub html_type: String,
87 #[serde(default)]
88 #[doc = "the html id"]
89 pub id: String,
90 #[serde(default)]
91 #[doc = "the html name"]
92 pub name: String,
93 #[serde(default)]
94 #[doc = "the field value"]
95 pub value: String,
96 #[serde(default)]
97 #[doc = "The actual field type, e.g FAMILY_NAME"]
98 pub autofill_type: String,
99 #[doc = "The filling strategy"]
100 pub filling_strategy: FillingStrategy,
101 #[doc = "The frame the field belongs to"]
102 pub frame_id: page::FrameId,
103 #[doc = "The form field's DOM node"]
104 pub field_id: dom::BackendNodeId,
105}
106#[allow(deprecated)]
107#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
108#[builder(setter(into, strip_option))]
109#[serde(rename_all = "camelCase")]
110#[doc = "Trigger autofill on a form identified by the fieldId.\n If the field and related form cannot be autofilled, returns an error."]
111pub struct Trigger {
112 #[doc = "Identifies a field that serves as an anchor for autofill."]
113 pub field_id: dom::BackendNodeId,
114 #[builder(default)]
115 #[serde(skip_serializing_if = "Option::is_none")]
116 #[doc = "Identifies the frame that field belongs to."]
117 pub frame_id: Option<page::FrameId>,
118 #[builder(default)]
119 #[serde(skip_serializing_if = "Option::is_none")]
120 #[doc = "Credit card information to fill out the form. Credit card data is not saved. Mutually exclusive with `address`."]
121 pub card: Option<CreditCard>,
122 #[builder(default)]
123 #[serde(skip_serializing_if = "Option::is_none")]
124 #[doc = "Address to fill out the form. Address data is not saved. Mutually exclusive with `card`."]
125 pub address: Option<Address>,
126}
127#[allow(deprecated)]
128#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
129#[builder(setter(into, strip_option))]
130#[serde(rename_all = "camelCase")]
131#[doc = "Set addresses so that developers can verify their forms implementation."]
132pub struct SetAddresses {
133 pub addresses: Vec<Address>,
134}
135#[allow(deprecated)]
136#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
137pub struct Disable(pub Option<Json>);
138#[allow(deprecated)]
139#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
140pub struct Enable(pub Option<Json>);
141#[allow(deprecated)]
142#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
143#[doc = "Trigger autofill on a form identified by the fieldId.\n If the field and related form cannot be autofilled, returns an error."]
144pub struct TriggerReturnObject(pub Option<Json>);
145#[allow(deprecated)]
146#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
147#[doc = "Set addresses so that developers can verify their forms implementation."]
148pub struct SetAddressesReturnObject(pub Option<Json>);
149#[allow(deprecated)]
150#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
151#[doc = "Disables autofill domain notifications."]
152pub struct DisableReturnObject(pub Option<Json>);
153#[allow(deprecated)]
154#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
155#[doc = "Enables autofill domain notifications."]
156pub struct EnableReturnObject(pub Option<Json>);
157#[allow(deprecated)]
158impl Method for Trigger {
159 const NAME: &'static str = "Autofill.trigger";
160 type ReturnObject = TriggerReturnObject;
161}
162#[allow(deprecated)]
163impl Method for SetAddresses {
164 const NAME: &'static str = "Autofill.setAddresses";
165 type ReturnObject = SetAddressesReturnObject;
166}
167#[allow(deprecated)]
168impl Method for Disable {
169 const NAME: &'static str = "Autofill.disable";
170 type ReturnObject = DisableReturnObject;
171}
172#[allow(deprecated)]
173impl Method for Enable {
174 const NAME: &'static str = "Autofill.enable";
175 type ReturnObject = EnableReturnObject;
176}
177#[allow(dead_code)]
178pub mod events {
179 #[allow(unused_imports)]
180 use super::super::types::*;
181 #[allow(unused_imports)]
182 use derive_builder::Builder;
183 #[allow(unused_imports)]
184 use serde::{Deserialize, Serialize};
185 #[allow(unused_imports)]
186 use serde_json::Value as Json;
187 #[allow(deprecated)]
188 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
189 pub struct AddressFormFilledEvent {
190 pub params: AddressFormFilledEventParams,
191 }
192 #[allow(deprecated)]
193 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
194 #[serde(rename_all = "camelCase")]
195 pub struct AddressFormFilledEventParams {
196 #[doc = "Information about the fields that were filled"]
197 pub filled_fields: Vec<super::FilledField>,
198 #[doc = "An UI representation of the address used to fill the form.\n Consists of a 2D array where each child represents an address/profile line."]
199 pub address_ui: super::AddressUi,
200 }
201}