1 #![allow(unused_imports)]
2 use super::*;
3 use wasm_bindgen::prelude::*;
4 #[wasm_bindgen]
5 extern "C" {
6     # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PushSubscriptionInit)]
7     #[derive(Debug, Clone, PartialEq, Eq)]
8     #[doc = "The `PushSubscriptionInit` dictionary."]
9     #[doc = ""]
10     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
11     pub type PushSubscriptionInit;
12 }
13 impl PushSubscriptionInit {
14     #[doc = "Construct a new `PushSubscriptionInit`."]
15     #[doc = ""]
16     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
new(endpoint: &str, scope: &str) -> Self17     pub fn new(endpoint: &str, scope: &str) -> Self {
18         #[allow(unused_mut)]
19         let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
20         ret.endpoint(endpoint);
21         ret.scope(scope);
22         ret
23     }
24     #[doc = "Change the `appServerKey` field of this object."]
25     #[doc = ""]
26     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
app_server_key(&mut self, val: Option<&::js_sys::Object>) -> &mut Self27     pub fn app_server_key(&mut self, val: Option<&::js_sys::Object>) -> &mut Self {
28         use wasm_bindgen::JsValue;
29         let r = ::js_sys::Reflect::set(
30             self.as_ref(),
31             &JsValue::from("appServerKey"),
32             &JsValue::from(val),
33         );
34         debug_assert!(
35             r.is_ok(),
36             "setting properties should never fail on our dictionary objects"
37         );
38         let _ = r;
39         self
40     }
41     #[doc = "Change the `authSecret` field of this object."]
42     #[doc = ""]
43     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
auth_secret(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self44     pub fn auth_secret(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self {
45         use wasm_bindgen::JsValue;
46         let r = ::js_sys::Reflect::set(
47             self.as_ref(),
48             &JsValue::from("authSecret"),
49             &JsValue::from(val),
50         );
51         debug_assert!(
52             r.is_ok(),
53             "setting properties should never fail on our dictionary objects"
54         );
55         let _ = r;
56         self
57     }
58     #[doc = "Change the `endpoint` field of this object."]
59     #[doc = ""]
60     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
endpoint(&mut self, val: &str) -> &mut Self61     pub fn endpoint(&mut self, val: &str) -> &mut Self {
62         use wasm_bindgen::JsValue;
63         let r = ::js_sys::Reflect::set(
64             self.as_ref(),
65             &JsValue::from("endpoint"),
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 `p256dhKey` field of this object."]
76     #[doc = ""]
77     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
p256dh_key(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self78     pub fn p256dh_key(&mut self, val: Option<&::js_sys::ArrayBuffer>) -> &mut Self {
79         use wasm_bindgen::JsValue;
80         let r = ::js_sys::Reflect::set(
81             self.as_ref(),
82             &JsValue::from("p256dhKey"),
83             &JsValue::from(val),
84         );
85         debug_assert!(
86             r.is_ok(),
87             "setting properties should never fail on our dictionary objects"
88         );
89         let _ = r;
90         self
91     }
92     #[doc = "Change the `scope` field of this object."]
93     #[doc = ""]
94     #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionInit`*"]
scope(&mut self, val: &str) -> &mut Self95     pub fn scope(&mut self, val: &str) -> &mut Self {
96         use wasm_bindgen::JsValue;
97         let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("scope"), &JsValue::from(val));
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 }
106