| 1 | #![allow (unused_imports)] |
| 2 | #![allow (clippy::all)] |
| 3 | use super::*; |
| 4 | use wasm_bindgen::prelude::*; |
| 5 | #[wasm_bindgen ] |
| 6 | unsafeextern "C" { |
| 7 | # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RequestInit)] |
| 8 | #[derive (Debug, Clone, PartialEq, Eq)] |
| 9 | #[doc = "The `RequestInit` dictionary." ] |
| 10 | #[doc = "" ] |
| 11 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 12 | pub type RequestInit; |
| 13 | #[doc = "Get the `body` field of this object." ] |
| 14 | #[doc = "" ] |
| 15 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 16 | #[wasm_bindgen (method, getter = "body" )] |
| 17 | pub unsafefn get_body(this: &RequestInit) -> ::wasm_bindgen::JsValue; |
| 18 | #[doc = "Change the `body` field of this object." ] |
| 19 | #[doc = "" ] |
| 20 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 21 | #[wasm_bindgen (method, setter = "body" )] |
| 22 | pub unsafefn set_body(this: &RequestInit, val: &::wasm_bindgen::JsValue); |
| 23 | #[cfg (feature = "RequestCache" )] |
| 24 | #[doc = "Get the `cache` field of this object." ] |
| 25 | #[doc = "" ] |
| 26 | #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*" ] |
| 27 | #[wasm_bindgen (method, getter = "cache" )] |
| 28 | pub fn get_cache(this: &RequestInit) -> Option<RequestCache>; |
| 29 | #[cfg (feature = "RequestCache" )] |
| 30 | #[doc = "Change the `cache` field of this object." ] |
| 31 | #[doc = "" ] |
| 32 | #[doc = "*This API requires the following crate features to be activated: `RequestCache`, `RequestInit`*" ] |
| 33 | #[wasm_bindgen (method, setter = "cache" )] |
| 34 | pub fn set_cache(this: &RequestInit, val: RequestCache); |
| 35 | #[cfg (feature = "RequestCredentials" )] |
| 36 | #[doc = "Get the `credentials` field of this object." ] |
| 37 | #[doc = "" ] |
| 38 | #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*" ] |
| 39 | #[wasm_bindgen (method, getter = "credentials" )] |
| 40 | pub unsafefn get_credentials(this: &RequestInit) -> Option<RequestCredentials>; |
| 41 | #[cfg (feature = "RequestCredentials" )] |
| 42 | #[doc = "Change the `credentials` field of this object." ] |
| 43 | #[doc = "" ] |
| 44 | #[doc = "*This API requires the following crate features to be activated: `RequestCredentials`, `RequestInit`*" ] |
| 45 | #[wasm_bindgen (method, setter = "credentials" )] |
| 46 | pub unsafefn set_credentials(this: &RequestInit, val: RequestCredentials); |
| 47 | #[doc = "Get the `headers` field of this object." ] |
| 48 | #[doc = "" ] |
| 49 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 50 | #[wasm_bindgen (method, getter = "headers" )] |
| 51 | pub unsafefn get_headers(this: &RequestInit) -> ::wasm_bindgen::JsValue; |
| 52 | #[doc = "Change the `headers` field of this object." ] |
| 53 | #[doc = "" ] |
| 54 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 55 | #[wasm_bindgen (method, setter = "headers" )] |
| 56 | pub unsafefn set_headers(this: &RequestInit, val: &::wasm_bindgen::JsValue); |
| 57 | #[doc = "Get the `integrity` field of this object." ] |
| 58 | #[doc = "" ] |
| 59 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 60 | #[wasm_bindgen (method, getter = "integrity" )] |
| 61 | pub unsafefn get_integrity(this: &RequestInit) -> Option<::alloc::string::String>; |
| 62 | #[doc = "Change the `integrity` field of this object." ] |
| 63 | #[doc = "" ] |
| 64 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 65 | #[wasm_bindgen (method, setter = "integrity" )] |
| 66 | pub unsafefn set_integrity(this: &RequestInit, val: &str); |
| 67 | #[doc = "Get the `method` field of this object." ] |
| 68 | #[doc = "" ] |
| 69 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 70 | #[wasm_bindgen (method, getter = "method" )] |
| 71 | pub unsafefn get_method(this: &RequestInit) -> Option<::alloc::string::String>; |
| 72 | #[doc = "Change the `method` field of this object." ] |
| 73 | #[doc = "" ] |
| 74 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 75 | #[wasm_bindgen (method, setter = "method" )] |
| 76 | pub unsafefn set_method(this: &RequestInit, val: &str); |
| 77 | #[cfg (feature = "RequestMode" )] |
| 78 | #[doc = "Get the `mode` field of this object." ] |
| 79 | #[doc = "" ] |
| 80 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*" ] |
| 81 | #[wasm_bindgen (method, getter = "mode" )] |
| 82 | pub unsafefn get_mode(this: &RequestInit) -> Option<RequestMode>; |
| 83 | #[cfg (feature = "RequestMode" )] |
| 84 | #[doc = "Change the `mode` field of this object." ] |
| 85 | #[doc = "" ] |
| 86 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestMode`*" ] |
| 87 | #[wasm_bindgen (method, setter = "mode" )] |
| 88 | pub unsafefn set_mode(this: &RequestInit, val: RequestMode); |
| 89 | #[cfg (feature = "ObserverCallback" )] |
| 90 | #[doc = "Get the `observe` field of this object." ] |
| 91 | #[doc = "" ] |
| 92 | #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*" ] |
| 93 | #[wasm_bindgen (method, getter = "observe" )] |
| 94 | pub fn get_observe(this: &RequestInit) -> Option<ObserverCallback>; |
| 95 | #[cfg (feature = "ObserverCallback" )] |
| 96 | #[doc = "Change the `observe` field of this object." ] |
| 97 | #[doc = "" ] |
| 98 | #[doc = "*This API requires the following crate features to be activated: `ObserverCallback`, `RequestInit`*" ] |
| 99 | #[wasm_bindgen (method, setter = "observe" )] |
| 100 | pub fn set_observe(this: &RequestInit, val: &ObserverCallback); |
| 101 | #[cfg (feature = "RequestRedirect" )] |
| 102 | #[doc = "Get the `redirect` field of this object." ] |
| 103 | #[doc = "" ] |
| 104 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*" ] |
| 105 | #[wasm_bindgen (method, getter = "redirect" )] |
| 106 | pub fn get_redirect(this: &RequestInit) -> Option<RequestRedirect>; |
| 107 | #[cfg (feature = "RequestRedirect" )] |
| 108 | #[doc = "Change the `redirect` field of this object." ] |
| 109 | #[doc = "" ] |
| 110 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`, `RequestRedirect`*" ] |
| 111 | #[wasm_bindgen (method, setter = "redirect" )] |
| 112 | pub fn set_redirect(this: &RequestInit, val: RequestRedirect); |
| 113 | #[doc = "Get the `referrer` field of this object." ] |
| 114 | #[doc = "" ] |
| 115 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 116 | #[wasm_bindgen (method, getter = "referrer" )] |
| 117 | pub unsafefn get_referrer(this: &RequestInit) -> Option<::alloc::string::String>; |
| 118 | #[doc = "Change the `referrer` field of this object." ] |
| 119 | #[doc = "" ] |
| 120 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 121 | #[wasm_bindgen (method, setter = "referrer" )] |
| 122 | pub unsafefn set_referrer(this: &RequestInit, val: &str); |
| 123 | #[cfg (feature = "ReferrerPolicy" )] |
| 124 | #[doc = "Get the `referrerPolicy` field of this object." ] |
| 125 | #[doc = "" ] |
| 126 | #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*" ] |
| 127 | #[wasm_bindgen (method, getter = "referrerPolicy" )] |
| 128 | pub fn get_referrer_policy(this: &RequestInit) -> Option<ReferrerPolicy>; |
| 129 | #[cfg (feature = "ReferrerPolicy" )] |
| 130 | #[doc = "Change the `referrerPolicy` field of this object." ] |
| 131 | #[doc = "" ] |
| 132 | #[doc = "*This API requires the following crate features to be activated: `ReferrerPolicy`, `RequestInit`*" ] |
| 133 | #[wasm_bindgen (method, setter = "referrerPolicy" )] |
| 134 | pub fn set_referrer_policy(this: &RequestInit, val: ReferrerPolicy); |
| 135 | #[cfg (feature = "AbortSignal" )] |
| 136 | #[doc = "Get the `signal` field of this object." ] |
| 137 | #[doc = "" ] |
| 138 | #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*" ] |
| 139 | #[wasm_bindgen (method, getter = "signal" )] |
| 140 | pub unsafefn get_signal(this: &RequestInit) -> Option<AbortSignal>; |
| 141 | #[cfg (feature = "AbortSignal" )] |
| 142 | #[doc = "Change the `signal` field of this object." ] |
| 143 | #[doc = "" ] |
| 144 | #[doc = "*This API requires the following crate features to be activated: `AbortSignal`, `RequestInit`*" ] |
| 145 | #[wasm_bindgen (method, setter = "signal" )] |
| 146 | pub unsafefn set_signal(this: &RequestInit, val: Option<&AbortSignal>); |
| 147 | } |
| 148 | impl RequestInit { |
| 149 | #[doc = "Construct a new `RequestInit`." ] |
| 150 | #[doc = "" ] |
| 151 | #[doc = "*This API requires the following crate features to be activated: `RequestInit`*" ] |
| 152 | pub fn new() -> Self { |
| 153 | #[allow (unused_mut)] |
| 154 | let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); |
| 155 | ret |
| 156 | } |
| 157 | #[deprecated = "Use `set_body()` instead." ] |
| 158 | pub fn body(&mut self, val: Option<&::wasm_bindgen::JsValue>) -> &mut Self { |
| 159 | self.set_body(val.unwrap_or(&::wasm_bindgen::JsValue::NULL)); |
| 160 | self |
| 161 | } |
| 162 | #[cfg (feature = "RequestCache" )] |
| 163 | #[deprecated = "Use `set_cache()` instead." ] |
| 164 | pub fn cache(&mut self, val: RequestCache) -> &mut Self { |
| 165 | self.set_cache(val); |
| 166 | self |
| 167 | } |
| 168 | #[cfg (feature = "RequestCredentials" )] |
| 169 | #[deprecated = "Use `set_credentials()` instead." ] |
| 170 | pub fn credentials(&mut self, val: RequestCredentials) -> &mut Self { |
| 171 | self.set_credentials(val); |
| 172 | self |
| 173 | } |
| 174 | #[deprecated = "Use `set_headers()` instead." ] |
| 175 | pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { |
| 176 | self.set_headers(val); |
| 177 | self |
| 178 | } |
| 179 | #[deprecated = "Use `set_integrity()` instead." ] |
| 180 | pub fn integrity(&mut self, val: &str) -> &mut Self { |
| 181 | self.set_integrity(val); |
| 182 | self |
| 183 | } |
| 184 | #[deprecated = "Use `set_method()` instead." ] |
| 185 | pub fn method(&mut self, val: &str) -> &mut Self { |
| 186 | self.set_method(val); |
| 187 | self |
| 188 | } |
| 189 | #[cfg (feature = "RequestMode" )] |
| 190 | #[deprecated = "Use `set_mode()` instead." ] |
| 191 | pub fn mode(&mut self, val: RequestMode) -> &mut Self { |
| 192 | self.set_mode(val); |
| 193 | self |
| 194 | } |
| 195 | #[cfg (feature = "ObserverCallback" )] |
| 196 | #[deprecated = "Use `set_observe()` instead." ] |
| 197 | pub fn observe(&mut self, val: &ObserverCallback) -> &mut Self { |
| 198 | self.set_observe(val); |
| 199 | self |
| 200 | } |
| 201 | #[cfg (feature = "RequestRedirect" )] |
| 202 | #[deprecated = "Use `set_redirect()` instead." ] |
| 203 | pub fn redirect(&mut self, val: RequestRedirect) -> &mut Self { |
| 204 | self.set_redirect(val); |
| 205 | self |
| 206 | } |
| 207 | #[deprecated = "Use `set_referrer()` instead." ] |
| 208 | pub fn referrer(&mut self, val: &str) -> &mut Self { |
| 209 | self.set_referrer(val); |
| 210 | self |
| 211 | } |
| 212 | #[cfg (feature = "ReferrerPolicy" )] |
| 213 | #[deprecated = "Use `set_referrer_policy()` instead." ] |
| 214 | pub fn referrer_policy(&mut self, val: ReferrerPolicy) -> &mut Self { |
| 215 | self.set_referrer_policy(val); |
| 216 | self |
| 217 | } |
| 218 | #[cfg (feature = "AbortSignal" )] |
| 219 | #[deprecated = "Use `set_signal()` instead." ] |
| 220 | pub fn signal(&mut self, val: Option<&AbortSignal>) -> &mut Self { |
| 221 | self.set_signal(val); |
| 222 | self |
| 223 | } |
| 224 | } |
| 225 | impl Default for RequestInit { |
| 226 | fn default() -> Self { |
| 227 | Self::new() |
| 228 | } |
| 229 | } |
| 230 | |