rustenium_cdp_definitions/browser_protocol/web_authn/
command_builders.rs1use super::commands::*;
2impl Enable {
3 pub fn builder() -> EnableBuilder {
4 <EnableBuilder as Default>::default()
5 }
6}
7#[derive(Default, Clone)]
8pub struct EnableBuilder {
9 enable_ui: Option<bool>,
10}
11impl EnableBuilder {
12 pub fn enable_ui(mut self, enable_ui: impl Into<bool>) -> Self {
13 self.enable_ui = Some(enable_ui.into());
14 self
15 }
16 pub fn build(self) -> Enable {
17 Enable {
18 method: EnableMethod::Enable,
19 params: EnableParams {
20 enable_ui: self.enable_ui,
21 },
22 }
23 }
24}
25#[derive(Debug, Clone, Default)]
26pub struct DisableBuilder;
27impl DisableBuilder {
28 pub fn new() -> Self {
29 Self
30 }
31 pub fn build(self) -> Disable {
32 Disable {
33 method: DisableMethod::Disable,
34 params: DisableParams {},
35 }
36 }
37}
38impl Disable {
39 pub fn builder() -> DisableBuilder {
40 DisableBuilder
41 }
42}
43impl AddVirtualAuthenticator {
44 pub fn builder() -> AddVirtualAuthenticatorBuilder {
45 <AddVirtualAuthenticatorBuilder as Default>::default()
46 }
47}
48#[derive(Default, Clone)]
49pub struct AddVirtualAuthenticatorBuilder {
50 options: Option<super::types::VirtualAuthenticatorOptions>,
51}
52impl AddVirtualAuthenticatorBuilder {
53 pub fn options(
54 mut self,
55 options: impl Into<super::types::VirtualAuthenticatorOptions>,
56 ) -> Self {
57 self.options = Some(options.into());
58 self
59 }
60 pub fn build(self) -> Result<AddVirtualAuthenticator, String> {
61 Ok(AddVirtualAuthenticator {
62 method: AddVirtualAuthenticatorMethod::AddVirtualAuthenticator,
63 params: AddVirtualAuthenticatorParams {
64 options: self
65 .options
66 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(options)))?,
67 },
68 })
69 }
70}
71impl SetResponseOverrideBits {
72 pub fn builder() -> SetResponseOverrideBitsBuilder {
73 <SetResponseOverrideBitsBuilder as Default>::default()
74 }
75}
76#[derive(Default, Clone)]
77pub struct SetResponseOverrideBitsBuilder {
78 authenticator_id: Option<super::types::AuthenticatorId>,
79 is_bogus_signature: Option<bool>,
80 is_bad_uv: Option<bool>,
81 is_bad_up: Option<bool>,
82}
83impl SetResponseOverrideBitsBuilder {
84 pub fn authenticator_id(
85 mut self,
86 authenticator_id: impl Into<super::types::AuthenticatorId>,
87 ) -> Self {
88 self.authenticator_id = Some(authenticator_id.into());
89 self
90 }
91 pub fn is_bogus_signature(mut self, is_bogus_signature: impl Into<bool>) -> Self {
92 self.is_bogus_signature = Some(is_bogus_signature.into());
93 self
94 }
95 pub fn is_bad_uv(mut self, is_bad_uv: impl Into<bool>) -> Self {
96 self.is_bad_uv = Some(is_bad_uv.into());
97 self
98 }
99 pub fn is_bad_up(mut self, is_bad_up: impl Into<bool>) -> Self {
100 self.is_bad_up = Some(is_bad_up.into());
101 self
102 }
103 pub fn build(self) -> Result<SetResponseOverrideBits, String> {
104 Ok(SetResponseOverrideBits {
105 method: SetResponseOverrideBitsMethod::SetResponseOverrideBits,
106 params: SetResponseOverrideBitsParams {
107 authenticator_id: self.authenticator_id.ok_or_else(|| {
108 format!(
109 "Field `{}` is mandatory.",
110 std::stringify!(authenticator_id)
111 )
112 })?,
113 is_bogus_signature: self.is_bogus_signature,
114 is_bad_uv: self.is_bad_uv,
115 is_bad_up: self.is_bad_up,
116 },
117 })
118 }
119}
120impl RemoveVirtualAuthenticator {
121 pub fn builder() -> RemoveVirtualAuthenticatorBuilder {
122 <RemoveVirtualAuthenticatorBuilder as Default>::default()
123 }
124}
125#[derive(Default, Clone)]
126pub struct RemoveVirtualAuthenticatorBuilder {
127 authenticator_id: Option<super::types::AuthenticatorId>,
128}
129impl RemoveVirtualAuthenticatorBuilder {
130 pub fn authenticator_id(
131 mut self,
132 authenticator_id: impl Into<super::types::AuthenticatorId>,
133 ) -> Self {
134 self.authenticator_id = Some(authenticator_id.into());
135 self
136 }
137 pub fn build(self) -> Result<RemoveVirtualAuthenticator, String> {
138 Ok(RemoveVirtualAuthenticator {
139 method: RemoveVirtualAuthenticatorMethod::RemoveVirtualAuthenticator,
140 params: RemoveVirtualAuthenticatorParams {
141 authenticator_id: self.authenticator_id.ok_or_else(|| {
142 format!(
143 "Field `{}` is mandatory.",
144 std::stringify!(authenticator_id)
145 )
146 })?,
147 },
148 })
149 }
150}
151impl AddCredential {
152 pub fn builder() -> AddCredentialBuilder {
153 <AddCredentialBuilder as Default>::default()
154 }
155}
156#[derive(Default, Clone)]
157pub struct AddCredentialBuilder {
158 authenticator_id: Option<super::types::AuthenticatorId>,
159 credential: Option<super::types::Credential>,
160}
161impl AddCredentialBuilder {
162 pub fn authenticator_id(
163 mut self,
164 authenticator_id: impl Into<super::types::AuthenticatorId>,
165 ) -> Self {
166 self.authenticator_id = Some(authenticator_id.into());
167 self
168 }
169 pub fn credential(mut self, credential: impl Into<super::types::Credential>) -> Self {
170 self.credential = Some(credential.into());
171 self
172 }
173 pub fn build(self) -> Result<AddCredential, String> {
174 Ok(AddCredential {
175 method: AddCredentialMethod::AddCredential,
176 params: AddCredentialParams {
177 authenticator_id: self.authenticator_id.ok_or_else(|| {
178 format!(
179 "Field `{}` is mandatory.",
180 std::stringify!(authenticator_id)
181 )
182 })?,
183 credential: self.credential.ok_or_else(|| {
184 format!("Field `{}` is mandatory.", std::stringify!(credential))
185 })?,
186 },
187 })
188 }
189}
190impl GetCredential {
191 pub fn builder() -> GetCredentialBuilder {
192 <GetCredentialBuilder as Default>::default()
193 }
194}
195#[derive(Default, Clone)]
196pub struct GetCredentialBuilder {
197 authenticator_id: Option<super::types::AuthenticatorId>,
198 credential_id: Option<crate::Binary>,
199}
200impl GetCredentialBuilder {
201 pub fn authenticator_id(
202 mut self,
203 authenticator_id: impl Into<super::types::AuthenticatorId>,
204 ) -> Self {
205 self.authenticator_id = Some(authenticator_id.into());
206 self
207 }
208 pub fn credential_id(mut self, credential_id: impl Into<crate::Binary>) -> Self {
209 self.credential_id = Some(credential_id.into());
210 self
211 }
212 pub fn build(self) -> Result<GetCredential, String> {
213 Ok(GetCredential {
214 method: GetCredentialMethod::GetCredential,
215 params: GetCredentialParams {
216 authenticator_id: self.authenticator_id.ok_or_else(|| {
217 format!(
218 "Field `{}` is mandatory.",
219 std::stringify!(authenticator_id)
220 )
221 })?,
222 credential_id: self.credential_id.ok_or_else(|| {
223 format!("Field `{}` is mandatory.", std::stringify!(credential_id))
224 })?,
225 },
226 })
227 }
228}
229impl GetCredentials {
230 pub fn builder() -> GetCredentialsBuilder {
231 <GetCredentialsBuilder as Default>::default()
232 }
233}
234#[derive(Default, Clone)]
235pub struct GetCredentialsBuilder {
236 authenticator_id: Option<super::types::AuthenticatorId>,
237}
238impl GetCredentialsBuilder {
239 pub fn authenticator_id(
240 mut self,
241 authenticator_id: impl Into<super::types::AuthenticatorId>,
242 ) -> Self {
243 self.authenticator_id = Some(authenticator_id.into());
244 self
245 }
246 pub fn build(self) -> Result<GetCredentials, String> {
247 Ok(GetCredentials {
248 method: GetCredentialsMethod::GetCredentials,
249 params: GetCredentialsParams {
250 authenticator_id: self.authenticator_id.ok_or_else(|| {
251 format!(
252 "Field `{}` is mandatory.",
253 std::stringify!(authenticator_id)
254 )
255 })?,
256 },
257 })
258 }
259}
260impl RemoveCredential {
261 pub fn builder() -> RemoveCredentialBuilder {
262 <RemoveCredentialBuilder as Default>::default()
263 }
264}
265#[derive(Default, Clone)]
266pub struct RemoveCredentialBuilder {
267 authenticator_id: Option<super::types::AuthenticatorId>,
268 credential_id: Option<crate::Binary>,
269}
270impl RemoveCredentialBuilder {
271 pub fn authenticator_id(
272 mut self,
273 authenticator_id: impl Into<super::types::AuthenticatorId>,
274 ) -> Self {
275 self.authenticator_id = Some(authenticator_id.into());
276 self
277 }
278 pub fn credential_id(mut self, credential_id: impl Into<crate::Binary>) -> Self {
279 self.credential_id = Some(credential_id.into());
280 self
281 }
282 pub fn build(self) -> Result<RemoveCredential, String> {
283 Ok(RemoveCredential {
284 method: RemoveCredentialMethod::RemoveCredential,
285 params: RemoveCredentialParams {
286 authenticator_id: self.authenticator_id.ok_or_else(|| {
287 format!(
288 "Field `{}` is mandatory.",
289 std::stringify!(authenticator_id)
290 )
291 })?,
292 credential_id: self.credential_id.ok_or_else(|| {
293 format!("Field `{}` is mandatory.", std::stringify!(credential_id))
294 })?,
295 },
296 })
297 }
298}
299impl ClearCredentials {
300 pub fn builder() -> ClearCredentialsBuilder {
301 <ClearCredentialsBuilder as Default>::default()
302 }
303}
304#[derive(Default, Clone)]
305pub struct ClearCredentialsBuilder {
306 authenticator_id: Option<super::types::AuthenticatorId>,
307}
308impl ClearCredentialsBuilder {
309 pub fn authenticator_id(
310 mut self,
311 authenticator_id: impl Into<super::types::AuthenticatorId>,
312 ) -> Self {
313 self.authenticator_id = Some(authenticator_id.into());
314 self
315 }
316 pub fn build(self) -> Result<ClearCredentials, String> {
317 Ok(ClearCredentials {
318 method: ClearCredentialsMethod::ClearCredentials,
319 params: ClearCredentialsParams {
320 authenticator_id: self.authenticator_id.ok_or_else(|| {
321 format!(
322 "Field `{}` is mandatory.",
323 std::stringify!(authenticator_id)
324 )
325 })?,
326 },
327 })
328 }
329}
330impl SetUserVerified {
331 pub fn builder() -> SetUserVerifiedBuilder {
332 <SetUserVerifiedBuilder as Default>::default()
333 }
334}
335#[derive(Default, Clone)]
336pub struct SetUserVerifiedBuilder {
337 authenticator_id: Option<super::types::AuthenticatorId>,
338 is_user_verified: Option<bool>,
339}
340impl SetUserVerifiedBuilder {
341 pub fn authenticator_id(
342 mut self,
343 authenticator_id: impl Into<super::types::AuthenticatorId>,
344 ) -> Self {
345 self.authenticator_id = Some(authenticator_id.into());
346 self
347 }
348 pub fn is_user_verified(mut self, is_user_verified: impl Into<bool>) -> Self {
349 self.is_user_verified = Some(is_user_verified.into());
350 self
351 }
352 pub fn build(self) -> Result<SetUserVerified, String> {
353 Ok(SetUserVerified {
354 method: SetUserVerifiedMethod::SetUserVerified,
355 params: SetUserVerifiedParams {
356 authenticator_id: self.authenticator_id.ok_or_else(|| {
357 format!(
358 "Field `{}` is mandatory.",
359 std::stringify!(authenticator_id)
360 )
361 })?,
362 is_user_verified: self.is_user_verified.ok_or_else(|| {
363 format!(
364 "Field `{}` is mandatory.",
365 std::stringify!(is_user_verified)
366 )
367 })?,
368 },
369 })
370 }
371}
372impl SetAutomaticPresenceSimulation {
373 pub fn builder() -> SetAutomaticPresenceSimulationBuilder {
374 <SetAutomaticPresenceSimulationBuilder as Default>::default()
375 }
376}
377#[derive(Default, Clone)]
378pub struct SetAutomaticPresenceSimulationBuilder {
379 authenticator_id: Option<super::types::AuthenticatorId>,
380 enabled: Option<bool>,
381}
382impl SetAutomaticPresenceSimulationBuilder {
383 pub fn authenticator_id(
384 mut self,
385 authenticator_id: impl Into<super::types::AuthenticatorId>,
386 ) -> Self {
387 self.authenticator_id = Some(authenticator_id.into());
388 self
389 }
390 pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
391 self.enabled = Some(enabled.into());
392 self
393 }
394 pub fn build(self) -> Result<SetAutomaticPresenceSimulation, String> {
395 Ok(SetAutomaticPresenceSimulation {
396 method: SetAutomaticPresenceSimulationMethod::SetAutomaticPresenceSimulation,
397 params: SetAutomaticPresenceSimulationParams {
398 authenticator_id: self.authenticator_id.ok_or_else(|| {
399 format!(
400 "Field `{}` is mandatory.",
401 std::stringify!(authenticator_id)
402 )
403 })?,
404 enabled: self
405 .enabled
406 .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
407 },
408 })
409 }
410}
411impl SetCredentialProperties {
412 pub fn builder() -> SetCredentialPropertiesBuilder {
413 <SetCredentialPropertiesBuilder as Default>::default()
414 }
415}
416#[derive(Default, Clone)]
417pub struct SetCredentialPropertiesBuilder {
418 authenticator_id: Option<super::types::AuthenticatorId>,
419 credential_id: Option<crate::Binary>,
420 backup_eligibility: Option<bool>,
421 backup_state: Option<bool>,
422}
423impl SetCredentialPropertiesBuilder {
424 pub fn authenticator_id(
425 mut self,
426 authenticator_id: impl Into<super::types::AuthenticatorId>,
427 ) -> Self {
428 self.authenticator_id = Some(authenticator_id.into());
429 self
430 }
431 pub fn credential_id(mut self, credential_id: impl Into<crate::Binary>) -> Self {
432 self.credential_id = Some(credential_id.into());
433 self
434 }
435 pub fn backup_eligibility(mut self, backup_eligibility: impl Into<bool>) -> Self {
436 self.backup_eligibility = Some(backup_eligibility.into());
437 self
438 }
439 pub fn backup_state(mut self, backup_state: impl Into<bool>) -> Self {
440 self.backup_state = Some(backup_state.into());
441 self
442 }
443 pub fn build(self) -> Result<SetCredentialProperties, String> {
444 Ok(SetCredentialProperties {
445 method: SetCredentialPropertiesMethod::SetCredentialProperties,
446 params: SetCredentialPropertiesParams {
447 authenticator_id: self.authenticator_id.ok_or_else(|| {
448 format!(
449 "Field `{}` is mandatory.",
450 std::stringify!(authenticator_id)
451 )
452 })?,
453 credential_id: self.credential_id.ok_or_else(|| {
454 format!("Field `{}` is mandatory.", std::stringify!(credential_id))
455 })?,
456 backup_eligibility: self.backup_eligibility,
457 backup_state: self.backup_state,
458 },
459 })
460 }
461}