-
Notifications
You must be signed in to change notification settings - Fork 54
/
types.go
163 lines (135 loc) · 4.43 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
package fedcm
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"fmt"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// LoginState whether this is a sign-up or sign-in action for this account,
// i.e. whether this account has ever been used to sign in to this RP before.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/FedCm#type-LoginState
type LoginState string
// String returns the LoginState as string value.
func (t LoginState) String() string {
return string(t)
}
// LoginState values.
const (
LoginStateSignIn LoginState = "SignIn"
LoginStateSignUp LoginState = "SignUp"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t LoginState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t LoginState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *LoginState) UnmarshalEasyJSON(in *jlexer.Lexer) {
v := in.String()
switch LoginState(v) {
case LoginStateSignIn:
*t = LoginStateSignIn
case LoginStateSignUp:
*t = LoginStateSignUp
default:
in.AddError(fmt.Errorf("unknown LoginState value: %v", v))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *LoginState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// DialogType the types of FedCM dialogs.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/FedCm#type-DialogType
type DialogType string
// String returns the DialogType as string value.
func (t DialogType) String() string {
return string(t)
}
// DialogType values.
const (
DialogTypeAccountChooser DialogType = "AccountChooser"
DialogTypeAutoReauthn DialogType = "AutoReauthn"
DialogTypeConfirmIdpLogin DialogType = "ConfirmIdpLogin"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DialogType) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DialogType) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DialogType) UnmarshalEasyJSON(in *jlexer.Lexer) {
v := in.String()
switch DialogType(v) {
case DialogTypeAccountChooser:
*t = DialogTypeAccountChooser
case DialogTypeAutoReauthn:
*t = DialogTypeAutoReauthn
case DialogTypeConfirmIdpLogin:
*t = DialogTypeConfirmIdpLogin
default:
in.AddError(fmt.Errorf("unknown DialogType value: %v", v))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DialogType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// DialogButton the buttons on the FedCM dialog.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/FedCm#type-DialogButton
type DialogButton string
// String returns the DialogButton as string value.
func (t DialogButton) String() string {
return string(t)
}
// DialogButton values.
const (
DialogButtonConfirmIdpLoginContinue DialogButton = "ConfirmIdpLoginContinue"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t DialogButton) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t DialogButton) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *DialogButton) UnmarshalEasyJSON(in *jlexer.Lexer) {
v := in.String()
switch DialogButton(v) {
case DialogButtonConfirmIdpLoginContinue:
*t = DialogButtonConfirmIdpLoginContinue
default:
in.AddError(fmt.Errorf("unknown DialogButton value: %v", v))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *DialogButton) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Account corresponds to IdentityRequestAccount.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/FedCm#type-Account
type Account struct {
AccountID string `json:"accountId"`
Email string `json:"email"`
Name string `json:"name"`
GivenName string `json:"givenName"`
PictureURL string `json:"pictureUrl"`
IdpConfigURL string `json:"idpConfigUrl"`
IdpLoginURL string `json:"idpLoginUrl"`
LoginState LoginState `json:"loginState"`
TermsOfServiceURL string `json:"termsOfServiceUrl,omitempty"` // These two are only set if the loginState is signUp
PrivacyPolicyURL string `json:"privacyPolicyUrl,omitempty"`
}