electron_sys/interface/
client_request_options.rs1use crate::class::Session;
2use js_sys::JsString;
3use wasm_bindgen::prelude::*;
4
5#[wasm_bindgen]
6#[derive(Clone, Debug, Default)]
7pub struct ClientRequestOptions {
8 host: Option<JsString>,
9 hostname: Option<JsString>,
10 method: Option<JsString>,
11 partition: Option<JsString>,
12 path: Option<JsString>,
13 port: Option<usize>,
14 protocol: Option<JsString>,
15 redirect: Option<JsString>,
16 session: Option<Session>,
17 url: Option<JsString>,
18}
19
20#[wasm_bindgen]
21impl ClientRequestOptions {
22 #[allow(clippy::too_many_arguments)]
23 #[wasm_bindgen(constructor)]
24 pub fn new(
25 host: Option<JsString>,
26 hostname: Option<JsString>,
27 method: Option<JsString>,
28 partition: Option<JsString>,
29 path: Option<JsString>,
30 port: Option<usize>,
31 protocol: Option<JsString>,
32 redirect: Option<JsString>,
33 session: Option<Session>,
34 url: Option<JsString>,
35 ) -> ClientRequestOptions {
36 ClientRequestOptions {
37 host,
38 hostname,
39 method,
40 partition,
41 path,
42 port,
43 protocol,
44 redirect,
45 session,
46 url,
47 }
48 }
49
50 #[wasm_bindgen(getter)]
51 pub fn host(&self) -> Option<JsString> {
52 self.host.clone()
53 }
54
55 #[wasm_bindgen(setter)]
56 pub fn set_host(&mut self, value: Option<JsString>) {
57 self.host = value;
58 }
59
60 #[wasm_bindgen(getter)]
61 pub fn hostname(&self) -> Option<JsString> {
62 self.hostname.clone()
63 }
64
65 #[wasm_bindgen(setter)]
66 pub fn set_hostname(&mut self, value: Option<JsString>) {
67 self.hostname = value;
68 }
69
70 #[wasm_bindgen(getter)]
71 pub fn method(&self) -> Option<JsString> {
72 self.method.clone()
73 }
74
75 #[wasm_bindgen(setter)]
76 pub fn set_method(&mut self, value: Option<JsString>) {
77 self.method = value;
78 }
79
80 #[wasm_bindgen(getter)]
81 pub fn partition(&self) -> Option<JsString> {
82 self.partition.clone()
83 }
84
85 #[wasm_bindgen(setter)]
86 pub fn set_partition(&mut self, value: Option<JsString>) {
87 self.partition = value;
88 }
89
90 #[wasm_bindgen(getter)]
91 pub fn path(&self) -> Option<JsString> {
92 self.path.clone()
93 }
94
95 #[wasm_bindgen(setter)]
96 pub fn set_path(&mut self, value: Option<JsString>) {
97 self.path = value;
98 }
99
100 #[wasm_bindgen(getter)]
101 pub fn port(&self) -> Option<usize> {
102 self.port
103 }
104
105 #[wasm_bindgen(setter)]
106 pub fn set_port(&mut self, value: Option<usize>) {
107 self.port = value;
108 }
109
110 #[wasm_bindgen(getter)]
111 pub fn protocol(&self) -> Option<JsString> {
112 self.protocol.clone()
113 }
114
115 #[wasm_bindgen(setter)]
116 pub fn set_protocol(&mut self, value: Option<JsString>) {
117 self.protocol = value;
118 }
119
120 #[wasm_bindgen(getter)]
121 pub fn redirect(&self) -> Option<JsString> {
122 self.redirect.clone()
123 }
124
125 #[wasm_bindgen(setter)]
126 pub fn set_redirect(&mut self, value: Option<JsString>) {
127 self.redirect = value;
128 }
129
130 #[wasm_bindgen(getter)]
131 pub fn session(&self) -> Option<Session> {
132 self.session.clone()
133 }
134
135 #[wasm_bindgen(setter)]
136 pub fn set_session(&mut self, value: Option<Session>) {
137 self.session = value;
138 }
139
140 #[wasm_bindgen(getter)]
141 pub fn url(&self) -> Option<JsString> {
142 self.url.clone()
143 }
144
145 #[wasm_bindgen(setter)]
146 pub fn set_url(&mut self, value: Option<JsString>) {
147 self.url = value;
148 }
149}