Skip to main content

web_sys/features/
gen_PushSubscriptionOptionsInit.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = PushSubscriptionOptionsInit)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `PushSubscriptionOptionsInit` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
12    pub type PushSubscriptionOptionsInit;
13    #[doc = "Get the `applicationServerKey` field of this object."]
14    #[doc = ""]
15    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
16    #[wasm_bindgen(method, getter = "applicationServerKey")]
17    pub fn get_application_server_key(
18        this: &PushSubscriptionOptionsInit,
19    ) -> ::wasm_bindgen::JsValue;
20    #[doc = "Change the `applicationServerKey` field of this object."]
21    #[doc = ""]
22    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
23    #[wasm_bindgen(method, setter = "applicationServerKey")]
24    pub fn set_application_server_key(
25        this: &PushSubscriptionOptionsInit,
26        val: &::wasm_bindgen::JsValue,
27    );
28    #[doc = "Change the `applicationServerKey` field of this object."]
29    #[doc = ""]
30    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
31    #[wasm_bindgen(method, setter = "applicationServerKey")]
32    pub fn set_application_server_key_opt_buffer_source(
33        this: &PushSubscriptionOptionsInit,
34        val: Option<&::js_sys::Object>,
35    );
36    #[doc = "Change the `applicationServerKey` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
39    #[wasm_bindgen(method, setter = "applicationServerKey")]
40    pub fn set_application_server_key_opt_u8_slice(
41        this: &PushSubscriptionOptionsInit,
42        val: Option<&mut [u8]>,
43    );
44    #[doc = "Change the `applicationServerKey` field of this object."]
45    #[doc = ""]
46    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
47    #[wasm_bindgen(method, setter = "applicationServerKey")]
48    pub fn set_application_server_key_opt_u8_array(
49        this: &PushSubscriptionOptionsInit,
50        val: Option<&::js_sys::Uint8Array>,
51    );
52    #[doc = "Change the `applicationServerKey` field of this object."]
53    #[doc = ""]
54    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
55    #[wasm_bindgen(method, setter = "applicationServerKey")]
56    pub fn set_application_server_key_opt_str(
57        this: &PushSubscriptionOptionsInit,
58        val: Option<&str>,
59    );
60    #[doc = "Get the `userVisibleOnly` field of this object."]
61    #[doc = ""]
62    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
63    #[wasm_bindgen(method, getter = "userVisibleOnly")]
64    pub fn get_user_visible_only(this: &PushSubscriptionOptionsInit) -> Option<bool>;
65    #[doc = "Change the `userVisibleOnly` field of this object."]
66    #[doc = ""]
67    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
68    #[wasm_bindgen(method, setter = "userVisibleOnly")]
69    pub fn set_user_visible_only(this: &PushSubscriptionOptionsInit, val: bool);
70}
71impl PushSubscriptionOptionsInit {
72    #[doc = "Construct a new `PushSubscriptionOptionsInit`."]
73    #[doc = ""]
74    #[doc = "*This API requires the following crate features to be activated: `PushSubscriptionOptionsInit`*"]
75    pub fn new() -> Self {
76        #[allow(unused_mut)]
77        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
78        ret
79    }
80    #[deprecated = "Use `set_application_server_key()` instead."]
81    pub fn application_server_key(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self {
82        self.set_application_server_key(val.unwrap_or(&::wasm_bindgen::JsValue::NULL));
83        self
84    }
85    #[deprecated = "Use `set_user_visible_only()` instead."]
86    pub fn user_visible_only(&mut self, val: bool) -> &mut Self {
87        self.set_user_visible_only(val);
88        self
89    }
90}
91impl Default for PushSubscriptionOptionsInit {
92    fn default() -> Self {
93        Self::new()
94    }
95}