-
Notifications
You must be signed in to change notification settings - Fork 54
/
types.go
117 lines (100 loc) · 4.29 KB
/
types.go
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package autofill
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"fmt"
"github.com/chromedp/cdproto/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// CreditCard [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-CreditCard
type CreditCard struct {
Number string `json:"number"` // 16-digit credit card number.
Name string `json:"name"` // Name of the credit card owner.
ExpiryMonth string `json:"expiryMonth"` // 2-digit expiry month.
ExpiryYear string `json:"expiryYear"` // 4-digit expiry year.
Cvc string `json:"cvc"` // 3-digit card verification code.
}
// AddressField [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-AddressField
type AddressField struct {
Name string `json:"name"` // address field name, for example GIVEN_NAME.
Value string `json:"value"` // address field value, for example Jon Doe.
}
// AddressFields a list of address fields.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-AddressFields
type AddressFields struct {
Fields []*AddressField `json:"fields"`
}
// Address [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-Address
type Address struct {
Fields []*AddressField `json:"fields"` // fields and values defining an address.
}
// AddressUI defines how an address can be displayed like in
// chrome://settings/addresses. 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. The following address UI for instance:
// [[{name: "GIVE_NAME", value: "Jon"}, {name: "FAMILY_NAME", value: "Doe"}],
// [{name: "CITY", value: "Munich"}, {name: "ZIP", value: "81456"}]] should
// allow the receiver to render: Jon Doe Munich 81456.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-AddressUI
type AddressUI struct {
AddressFields []*AddressFields `json:"addressFields"` // A two dimension array containing the repesentation of values from an address profile.
}
// FillingStrategy specified whether a filled field was done so by using the
// html autocomplete attribute or autofill heuristics.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-FillingStrategy
type FillingStrategy string
// String returns the FillingStrategy as string value.
func (t FillingStrategy) String() string {
return string(t)
}
// FillingStrategy values.
const (
FillingStrategyAutocompleteAttribute FillingStrategy = "autocompleteAttribute"
FillingStrategyAutofillInferred FillingStrategy = "autofillInferred"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t FillingStrategy) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t FillingStrategy) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *FillingStrategy) UnmarshalEasyJSON(in *jlexer.Lexer) {
v := in.String()
switch FillingStrategy(v) {
case FillingStrategyAutocompleteAttribute:
*t = FillingStrategyAutocompleteAttribute
case FillingStrategyAutofillInferred:
*t = FillingStrategyAutofillInferred
default:
in.AddError(fmt.Errorf("unknown FillingStrategy value: %v", v))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *FillingStrategy) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// FilledField [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Autofill#type-FilledField
type FilledField struct {
HTMLType string `json:"htmlType"` // The type of the field, e.g text, password etc.
ID string `json:"id"` // the html id
Name string `json:"name"` // the html name
Value string `json:"value"` // the field value
AutofillType string `json:"autofillType"` // The actual field type, e.g FAMILY_NAME
FillingStrategy FillingStrategy `json:"fillingStrategy"` // The filling strategy
FieldID cdp.BackendNodeID `json:"fieldId"` // The form field's DOM node
}