maxcountryman_web_sys/features/
gen_PublicKeyCredentialRequestOptions.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PublicKeyCredentialRequestOptions)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `PublicKeyCredentialRequestOptions` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
11    pub type PublicKeyCredentialRequestOptions;
12}
13impl PublicKeyCredentialRequestOptions {
14    #[doc = "Construct a new `PublicKeyCredentialRequestOptions`."]
15    #[doc = ""]
16    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
17    pub fn new(challenge: &::js_sys::Object) -> Self {
18        #[allow(unused_mut)]
19        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20        ret.challenge(challenge);
21        ret
22    }
23    #[doc = "Change the `allowCredentials` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
26    pub fn allow_credentials(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
27        use wasm_bindgen::JsValue;
28        let r = ::js_sys::Reflect::set(
29            self.as_ref(),
30            &JsValue::from("allowCredentials"),
31            &JsValue::from(val),
32        );
33        debug_assert!(
34            r.is_ok(),
35            "setting properties should never fail on our dictionary objects"
36        );
37        let _ = r;
38        self
39    }
40    #[doc = "Change the `challenge` field of this object."]
41    #[doc = ""]
42    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
43    pub fn challenge(&mut self, val: &::js_sys::Object) -> &mut Self {
44        use wasm_bindgen::JsValue;
45        let r = ::js_sys::Reflect::set(
46            self.as_ref(),
47            &JsValue::from("challenge"),
48            &JsValue::from(val),
49        );
50        debug_assert!(
51            r.is_ok(),
52            "setting properties should never fail on our dictionary objects"
53        );
54        let _ = r;
55        self
56    }
57    #[cfg(feature = "AuthenticationExtensionsClientInputs")]
58    #[doc = "Change the `extensions` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `AuthenticationExtensionsClientInputs`, `PublicKeyCredentialRequestOptions`*"]
61    pub fn extensions(&mut self, val: &AuthenticationExtensionsClientInputs) -> &mut Self {
62        use wasm_bindgen::JsValue;
63        let r = ::js_sys::Reflect::set(
64            self.as_ref(),
65            &JsValue::from("extensions"),
66            &JsValue::from(val),
67        );
68        debug_assert!(
69            r.is_ok(),
70            "setting properties should never fail on our dictionary objects"
71        );
72        let _ = r;
73        self
74    }
75    #[doc = "Change the `rpId` field of this object."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
78    pub fn rp_id(&mut self, val: &str) -> &mut Self {
79        use wasm_bindgen::JsValue;
80        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("rpId"), &JsValue::from(val));
81        debug_assert!(
82            r.is_ok(),
83            "setting properties should never fail on our dictionary objects"
84        );
85        let _ = r;
86        self
87    }
88    #[doc = "Change the `timeout` field of this object."]
89    #[doc = ""]
90    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`*"]
91    pub fn timeout(&mut self, val: u32) -> &mut Self {
92        use wasm_bindgen::JsValue;
93        let r = ::js_sys::Reflect::set(
94            self.as_ref(),
95            &JsValue::from("timeout"),
96            &JsValue::from(val),
97        );
98        debug_assert!(
99            r.is_ok(),
100            "setting properties should never fail on our dictionary objects"
101        );
102        let _ = r;
103        self
104    }
105    #[cfg(feature = "UserVerificationRequirement")]
106    #[doc = "Change the `userVerification` field of this object."]
107    #[doc = ""]
108    #[doc = "*This API requires the following crate features to be activated: `PublicKeyCredentialRequestOptions`, `UserVerificationRequirement`*"]
109    pub fn user_verification(&mut self, val: UserVerificationRequirement) -> &mut Self {
110        use wasm_bindgen::JsValue;
111        let r = ::js_sys::Reflect::set(
112            self.as_ref(),
113            &JsValue::from("userVerification"),
114            &JsValue::from(val),
115        );
116        debug_assert!(
117            r.is_ok(),
118            "setting properties should never fail on our dictionary objects"
119        );
120        let _ = r;
121        self
122    }
123}