1use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
17pub enum LoginState {
18 SignIn,
20 SignUp,
22 #[serde(untagged)]
26 Unrecognized(String),
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
31pub enum DialogType {
32 AccountChooser,
34 AutoReauthn,
36 ConfirmIdpLogin,
38 Error,
40 #[serde(untagged)]
44 Unrecognized(String),
45}
46
47#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
49pub enum DialogButton {
50 ConfirmIdpLoginContinue,
52 ErrorGotIt,
54 ErrorMoreDetails,
56 #[serde(untagged)]
60 Unrecognized(String),
61}
62
63#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
65pub enum AccountUrlType {
66 TermsOfService,
68 PrivacyPolicy,
70 #[serde(untagged)]
74 Unrecognized(String),
75}
76
77#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
79pub struct Account {
80 #[serde(rename = "accountId")]
81 pub account_id: String,
82 pub email: String,
83 pub name: String,
84 #[serde(rename = "givenName")]
85 pub given_name: String,
86 #[serde(rename = "pictureUrl")]
87 pub picture_url: String,
88 #[serde(rename = "idpConfigUrl")]
89 pub idp_config_url: String,
90 #[serde(rename = "idpLoginUrl")]
91 pub idp_login_url: String,
92 #[serde(rename = "loginState")]
93 pub login_state: LoginState,
94 #[serde(
96 rename = "termsOfServiceUrl",
97 default,
98 skip_serializing_if = "Option::is_none"
99 )]
100 pub terms_of_service_url: Option<String>,
101 #[serde(
102 rename = "privacyPolicyUrl",
103 default,
104 skip_serializing_if = "Option::is_none"
105 )]
106 pub privacy_policy_url: Option<String>,
107}
108
109#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
111pub struct EnableParams {
112 #[serde(
116 rename = "disableRejectionDelay",
117 default,
118 skip_serializing_if = "Option::is_none"
119 )]
120 pub disable_rejection_delay: Option<bool>,
121}
122
123impl crate::typed::Command for EnableParams {
124 const METHOD: &'static str = "FedCm.enable";
125 type Returns = crate::typed::NoReturns;
126}
127
128#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
130pub struct DisableParams {}
131
132impl crate::typed::Command for DisableParams {
133 const METHOD: &'static str = "FedCm.disable";
134 type Returns = crate::typed::NoReturns;
135}
136
137#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
139pub struct SelectAccountParams {
140 #[serde(rename = "dialogId")]
141 pub dialog_id: String,
142 #[serde(rename = "accountIndex")]
143 pub account_index: i64,
144}
145
146impl crate::typed::Command for SelectAccountParams {
147 const METHOD: &'static str = "FedCm.selectAccount";
148 type Returns = crate::typed::NoReturns;
149}
150
151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
153pub struct ClickDialogButtonParams {
154 #[serde(rename = "dialogId")]
155 pub dialog_id: String,
156 #[serde(rename = "dialogButton")]
157 pub dialog_button: DialogButton,
158}
159
160impl crate::typed::Command for ClickDialogButtonParams {
161 const METHOD: &'static str = "FedCm.clickDialogButton";
162 type Returns = crate::typed::NoReturns;
163}
164
165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
167pub struct OpenUrlParams {
168 #[serde(rename = "dialogId")]
169 pub dialog_id: String,
170 #[serde(rename = "accountIndex")]
171 pub account_index: i64,
172 #[serde(rename = "accountUrlType")]
173 pub account_url_type: AccountUrlType,
174}
175
176impl crate::typed::Command for OpenUrlParams {
177 const METHOD: &'static str = "FedCm.openUrl";
178 type Returns = crate::typed::NoReturns;
179}
180
181#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
183pub struct DismissDialogParams {
184 #[serde(rename = "dialogId")]
185 pub dialog_id: String,
186 #[serde(
187 rename = "triggerCooldown",
188 default,
189 skip_serializing_if = "Option::is_none"
190 )]
191 pub trigger_cooldown: Option<bool>,
192}
193
194impl crate::typed::Command for DismissDialogParams {
195 const METHOD: &'static str = "FedCm.dismissDialog";
196 type Returns = crate::typed::NoReturns;
197}
198
199#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
204pub struct ResetCooldownParams {}
205
206impl crate::typed::Command for ResetCooldownParams {
207 const METHOD: &'static str = "FedCm.resetCooldown";
208 type Returns = crate::typed::NoReturns;
209}
210
211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
213pub struct DialogShownEvent {
214 #[serde(rename = "dialogId")]
215 pub dialog_id: String,
216 #[serde(rename = "dialogType")]
217 pub dialog_type: DialogType,
218 pub accounts: Vec<Account>,
219 pub title: String,
222 #[serde(default, skip_serializing_if = "Option::is_none")]
223 pub subtitle: Option<String>,
224}
225
226impl crate::typed::Event for DialogShownEvent {
227 const METHOD: &'static str = "FedCm.dialogShown";
228}
229
230#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
235pub struct DialogClosedEvent {
236 #[serde(rename = "dialogId")]
237 pub dialog_id: String,
238}
239
240impl crate::typed::Event for DialogClosedEvent {
241 const METHOD: &'static str = "FedCm.dialogClosed";
242}