vendor/github.com/go-rod/rod/lib/proto/autofill.go
172 lines · 5271 bytes
1// This file is generated by "./lib/proto/generate"
2
3package proto
4
5/*
6
7Autofill
8
9Defines commands and events for Autofill.
10
11*/
12
13// AutofillCreditCard ...
14type AutofillCreditCard struct {
15 // Number 16-digit credit card number.
16 Number string `json:"number"`
17
18 // Name of the credit card owner.
19 Name string `json:"name"`
20
21 // ExpiryMonth 2-digit expiry month.
22 ExpiryMonth string `json:"expiryMonth"`
23
24 // ExpiryYear 4-digit expiry year.
25 ExpiryYear string `json:"expiryYear"`
26
27 // Cvc 3-digit card verification code.
28 Cvc string `json:"cvc"`
29}
30
31// AutofillAddressField ...
32type AutofillAddressField struct {
33 // Name address field name, for example GIVEN_NAME.
34 Name string `json:"name"`
35
36 // Value address field value, for example Jon Doe.
37 Value string `json:"value"`
38}
39
40// AutofillAddressFields A list of address fields.
41type AutofillAddressFields struct {
42 // Fields ...
43 Fields []*AutofillAddressField `json:"fields"`
44}
45
46// AutofillAddress ...
47type AutofillAddress struct {
48 // Fields fields and values defining an address.
49 Fields []*AutofillAddressField `json:"fields"`
50}
51
52// AutofillAddressUI Defines how an address can be displayed like in chrome://settings/addresses.
53// 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.
54// The following address UI for instance:
55// [[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}], [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]]
56// should allow the receiver to render:
57// Jon Doe
58// Munich 81456.
59type AutofillAddressUI struct {
60 // AddressFields A two dimension array containing the representation of values from an address profile.
61 AddressFields []*AutofillAddressFields `json:"addressFields"`
62}
63
64// AutofillFillingStrategy Specified whether a filled field was done so by using the html autocomplete attribute or autofill heuristics.
65type AutofillFillingStrategy string
66
67const (
68 // AutofillFillingStrategyAutocompleteAttribute enum const.
69 AutofillFillingStrategyAutocompleteAttribute AutofillFillingStrategy = "autocompleteAttribute"
70
71 // AutofillFillingStrategyAutofillInferred enum const.
72 AutofillFillingStrategyAutofillInferred AutofillFillingStrategy = "autofillInferred"
73)
74
75// AutofillFilledField ...
76type AutofillFilledField struct {
77 // HTMLType The type of the field, e.g text, password etc.
78 HTMLType string `json:"htmlType"`
79
80 // ID the html id
81 ID string `json:"id"`
82
83 // Name the html name
84 Name string `json:"name"`
85
86 // Value the field value
87 Value string `json:"value"`
88
89 // AutofillType The actual field type, e.g FAMILY_NAME
90 AutofillType string `json:"autofillType"`
91
92 // FillingStrategy The filling strategy
93 FillingStrategy AutofillFillingStrategy `json:"fillingStrategy"`
94
95 // FrameID The frame the field belongs to
96 FrameID PageFrameID `json:"frameId"`
97
98 // FieldID The form field's DOM node
99 FieldID DOMBackendNodeID `json:"fieldId"`
100}
101
102// AutofillTrigger Trigger autofill on a form identified by the fieldId.
103// If the field and related form cannot be autofilled, returns an error.
104type AutofillTrigger struct {
105 // FieldID Identifies a field that serves as an anchor for autofill.
106 FieldID DOMBackendNodeID `json:"fieldId"`
107
108 // FrameID (optional) Identifies the frame that field belongs to.
109 FrameID PageFrameID `json:"frameId,omitempty"`
110
111 // Card Credit card information to fill out the form. Credit card data is not saved.
112 Card *AutofillCreditCard `json:"card"`
113}
114
115// ProtoReq name.
116func (m AutofillTrigger) ProtoReq() string { return "Autofill.trigger" }
117
118// Call sends the request.
119func (m AutofillTrigger) Call(c Client) error {
120 return call(m.ProtoReq(), m, nil, c)
121}
122
123// AutofillSetAddresses Set addresses so that developers can verify their forms implementation.
124type AutofillSetAddresses struct {
125 // Addresses ...
126 Addresses []*AutofillAddress `json:"addresses"`
127}
128
129// ProtoReq name.
130func (m AutofillSetAddresses) ProtoReq() string { return "Autofill.setAddresses" }
131
132// Call sends the request.
133func (m AutofillSetAddresses) Call(c Client) error {
134 return call(m.ProtoReq(), m, nil, c)
135}
136
137// AutofillDisable Disables autofill domain notifications.
138type AutofillDisable struct{}
139
140// ProtoReq name.
141func (m AutofillDisable) ProtoReq() string { return "Autofill.disable" }
142
143// Call sends the request.
144func (m AutofillDisable) Call(c Client) error {
145 return call(m.ProtoReq(), m, nil, c)
146}
147
148// AutofillEnable Enables autofill domain notifications.
149type AutofillEnable struct{}
150
151// ProtoReq name.
152func (m AutofillEnable) ProtoReq() string { return "Autofill.enable" }
153
154// Call sends the request.
155func (m AutofillEnable) Call(c Client) error {
156 return call(m.ProtoReq(), m, nil, c)
157}
158
159// AutofillAddressFormFilled Emitted when an address form is filled.
160type AutofillAddressFormFilled struct {
161 // FilledFields Information about the fields that were filled
162 FilledFields []*AutofillFilledField `json:"filledFields"`
163
164 // AddressUI An UI representation of the address used to fill the form.
165 // Consists of a 2D array where each child represents an address/profile line.
166 AddressUI *AutofillAddressUI `json:"addressUi"`
167}
168
169// ProtoEvent name.
170func (evt AutofillAddressFormFilled) ProtoEvent() string {
171 return "Autofill.addressFormFilled"
172}