1use serde::{Deserialize, Serialize};
2#[doc = "Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.\n[setAcceptedEncodings](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setAcceptedEncodings)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct SetAcceptedEncodingsParams {
5 #[doc = "List of accepted content encodings."]
6 #[serde(rename = "encodings")]
7 #[serde(skip_serializing_if = "Vec::is_empty")]
8 pub encodings: Vec<super::types::ContentEncoding>,
9}
10impl SetAcceptedEncodingsParams {
11 pub fn new(encodings: Vec<super::types::ContentEncoding>) -> Self {
12 Self { encodings }
13 }
14}
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
16pub enum SetAcceptedEncodingsMethod {
17 #[serde(rename = "Network.setAcceptedEncodings")]
18 SetAcceptedEncodings,
19}
20#[doc = "Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.\n[setAcceptedEncodings](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setAcceptedEncodings)"]
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct SetAcceptedEncodings {
23 pub method: SetAcceptedEncodingsMethod,
24 pub params: SetAcceptedEncodingsParams,
25}
26impl SetAcceptedEncodings {
27 pub const IDENTIFIER: &'static str = "Network.setAcceptedEncodings";
28 pub fn identifier(&self) -> &'static str {
29 Self::IDENTIFIER
30 }
31}
32impl crate::CommandResult for SetAcceptedEncodings {
33 type Result = super::results::SetAcceptedEncodingsResult;
34}
35#[doc = "Clears accepted encodings set by setAcceptedEncodings\n[clearAcceptedEncodingsOverride](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearAcceptedEncodingsOverride)"]
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
37pub struct ClearAcceptedEncodingsOverrideParams {}
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
39pub enum ClearAcceptedEncodingsOverrideMethod {
40 #[serde(rename = "Network.clearAcceptedEncodingsOverride")]
41 ClearAcceptedEncodingsOverride,
42}
43#[doc = "Clears accepted encodings set by setAcceptedEncodings\n[clearAcceptedEncodingsOverride](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearAcceptedEncodingsOverride)"]
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct ClearAcceptedEncodingsOverride {
46 pub method: ClearAcceptedEncodingsOverrideMethod,
47 pub params: ClearAcceptedEncodingsOverrideParams,
48}
49impl ClearAcceptedEncodingsOverride {
50 pub const IDENTIFIER: &'static str = "Network.clearAcceptedEncodingsOverride";
51 pub fn identifier(&self) -> &'static str {
52 Self::IDENTIFIER
53 }
54}
55impl crate::CommandResult for ClearAcceptedEncodingsOverride {
56 type Result = super::results::ClearAcceptedEncodingsOverrideResult;
57}
58#[doc = "Clears browser cache.\n[clearBrowserCache](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCache)"]
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub struct ClearBrowserCacheParams {}
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
62pub enum ClearBrowserCacheMethod {
63 #[serde(rename = "Network.clearBrowserCache")]
64 ClearBrowserCache,
65}
66#[doc = "Clears browser cache.\n[clearBrowserCache](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCache)"]
67#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
68pub struct ClearBrowserCache {
69 pub method: ClearBrowserCacheMethod,
70 pub params: ClearBrowserCacheParams,
71}
72impl ClearBrowserCache {
73 pub const IDENTIFIER: &'static str = "Network.clearBrowserCache";
74 pub fn identifier(&self) -> &'static str {
75 Self::IDENTIFIER
76 }
77}
78impl crate::CommandResult for ClearBrowserCache {
79 type Result = super::results::ClearBrowserCacheResult;
80}
81#[doc = "Clears browser cookies.\n[clearBrowserCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCookies)"]
82#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
83pub struct ClearBrowserCookiesParams {}
84#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
85pub enum ClearBrowserCookiesMethod {
86 #[serde(rename = "Network.clearBrowserCookies")]
87 ClearBrowserCookies,
88}
89#[doc = "Clears browser cookies.\n[clearBrowserCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-clearBrowserCookies)"]
90#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
91pub struct ClearBrowserCookies {
92 pub method: ClearBrowserCookiesMethod,
93 pub params: ClearBrowserCookiesParams,
94}
95impl ClearBrowserCookies {
96 pub const IDENTIFIER: &'static str = "Network.clearBrowserCookies";
97 pub fn identifier(&self) -> &'static str {
98 Self::IDENTIFIER
99 }
100}
101impl crate::CommandResult for ClearBrowserCookies {
102 type Result = super::results::ClearBrowserCookiesResult;
103}
104#[doc = "Deletes browser cookies with matching name and url or domain/path/partitionKey pair.\n[deleteCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-deleteCookies)"]
105#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
106pub struct DeleteCookiesParams {
107 #[doc = "Name of the cookies to remove."]
108 #[serde(rename = "name")]
109 pub name: String,
110 #[doc = "If specified, deletes all the cookies with the given name where domain and path match\nprovided URL."]
111 #[serde(rename = "url")]
112 #[serde(skip_serializing_if = "Option::is_none")]
113 #[serde(default)]
114 pub url: Option<String>,
115 #[doc = "If specified, deletes only cookies with the exact domain."]
116 #[serde(rename = "domain")]
117 #[serde(skip_serializing_if = "Option::is_none")]
118 #[serde(default)]
119 pub domain: Option<String>,
120 #[doc = "If specified, deletes only cookies with the exact path."]
121 #[serde(rename = "path")]
122 #[serde(skip_serializing_if = "Option::is_none")]
123 #[serde(default)]
124 pub path: Option<String>,
125 #[doc = "If specified, deletes only cookies with the the given name and partitionKey where\nall partition key attributes match the cookie partition key attribute."]
126 #[serde(rename = "partitionKey")]
127 #[serde(skip_serializing_if = "Option::is_none")]
128 #[serde(default)]
129 pub partition_key: Option<super::types::CookiePartitionKey>,
130}
131impl DeleteCookiesParams {
132 pub fn new(name: impl Into<String>) -> Self {
133 Self {
134 name: name.into(),
135 url: None,
136 domain: None,
137 path: None,
138 partition_key: None,
139 }
140 }
141}
142impl<T: Into<String>> From<T> for DeleteCookiesParams {
143 fn from(url: T) -> Self {
144 DeleteCookiesParams::new(url)
145 }
146}
147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
148pub enum DeleteCookiesMethod {
149 #[serde(rename = "Network.deleteCookies")]
150 DeleteCookies,
151}
152#[doc = "Deletes browser cookies with matching name and url or domain/path/partitionKey pair.\n[deleteCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-deleteCookies)"]
153#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
154pub struct DeleteCookies {
155 pub method: DeleteCookiesMethod,
156 pub params: DeleteCookiesParams,
157}
158impl DeleteCookies {
159 pub const IDENTIFIER: &'static str = "Network.deleteCookies";
160 pub fn identifier(&self) -> &'static str {
161 Self::IDENTIFIER
162 }
163}
164impl crate::CommandResult for DeleteCookies {
165 type Result = super::results::DeleteCookiesResult;
166}
167#[doc = "Disables network tracking, prevents network events from being sent to the client.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-disable)"]
168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
169pub struct DisableParams {}
170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
171pub enum DisableMethod {
172 #[serde(rename = "Network.disable")]
173 Disable,
174}
175#[doc = "Disables network tracking, prevents network events from being sent to the client.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-disable)"]
176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
177pub struct Disable {
178 pub method: DisableMethod,
179 pub params: DisableParams,
180}
181impl Disable {
182 pub const IDENTIFIER: &'static str = "Network.disable";
183 pub fn identifier(&self) -> &'static str {
184 Self::IDENTIFIER
185 }
186}
187impl crate::CommandResult for Disable {
188 type Result = super::results::DisableResult;
189}
190#[doc = "Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated\nNetwork.emulateNetworkConditions this method does not affect `navigator` state. Use Network.overrideNetworkState to\nexplicitly modify `navigator` behavior.\n[emulateNetworkConditionsByRule](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-emulateNetworkConditionsByRule)"]
191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
192pub struct EmulateNetworkConditionsByRuleParams {
193 #[doc = "True to emulate internet disconnection."]
194 #[serde(rename = "offline")]
195 pub offline: bool,
196 #[doc = "Configure conditions for matching requests. If multiple entries match a request, the first entry wins. Global\nconditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are\nalso applied for throttling of p2p connections."]
197 #[serde(rename = "matchedNetworkConditions")]
198 #[serde(skip_serializing_if = "Vec::is_empty")]
199 pub matched_network_conditions: Vec<super::types::NetworkConditions>,
200}
201impl EmulateNetworkConditionsByRuleParams {
202 pub fn new(
203 offline: impl Into<bool>,
204 matched_network_conditions: Vec<super::types::NetworkConditions>,
205 ) -> Self {
206 Self {
207 offline: offline.into(),
208 matched_network_conditions,
209 }
210 }
211}
212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
213pub enum EmulateNetworkConditionsByRuleMethod {
214 #[serde(rename = "Network.emulateNetworkConditionsByRule")]
215 EmulateNetworkConditionsByRule,
216}
217#[doc = "Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated\nNetwork.emulateNetworkConditions this method does not affect `navigator` state. Use Network.overrideNetworkState to\nexplicitly modify `navigator` behavior.\n[emulateNetworkConditionsByRule](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-emulateNetworkConditionsByRule)"]
218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
219pub struct EmulateNetworkConditionsByRule {
220 pub method: EmulateNetworkConditionsByRuleMethod,
221 pub params: EmulateNetworkConditionsByRuleParams,
222}
223impl EmulateNetworkConditionsByRule {
224 pub const IDENTIFIER: &'static str = "Network.emulateNetworkConditionsByRule";
225 pub fn identifier(&self) -> &'static str {
226 Self::IDENTIFIER
227 }
228}
229impl crate::CommandResult for EmulateNetworkConditionsByRule {
230 type Result = super::results::EmulateNetworkConditionsByRuleResult;
231}
232#[doc = "Override the state of navigator.onLine and navigator.connection.\n[overrideNetworkState](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-overrideNetworkState)"]
233#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
234pub struct OverrideNetworkStateParams {
235 #[doc = "True to emulate internet disconnection."]
236 #[serde(rename = "offline")]
237 pub offline: bool,
238 #[doc = "Minimum latency from request sent to response headers received (ms)."]
239 #[serde(rename = "latency")]
240 pub latency: f64,
241 #[doc = "Maximal aggregated download throughput (bytes/sec). -1 disables download throttling."]
242 #[serde(rename = "downloadThroughput")]
243 pub download_throughput: f64,
244 #[doc = "Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling."]
245 #[serde(rename = "uploadThroughput")]
246 pub upload_throughput: f64,
247 #[doc = "Connection type if known."]
248 #[serde(rename = "connectionType")]
249 #[serde(skip_serializing_if = "Option::is_none")]
250 #[serde(default)]
251 pub connection_type: Option<super::types::ConnectionType>,
252}
253impl OverrideNetworkStateParams {
254 pub fn new(
255 offline: impl Into<bool>,
256 latency: impl Into<f64>,
257 download_throughput: impl Into<f64>,
258 upload_throughput: impl Into<f64>,
259 ) -> Self {
260 Self {
261 offline: offline.into(),
262 latency: latency.into(),
263 download_throughput: download_throughput.into(),
264 upload_throughput: upload_throughput.into(),
265 connection_type: None,
266 }
267 }
268}
269#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
270pub enum OverrideNetworkStateMethod {
271 #[serde(rename = "Network.overrideNetworkState")]
272 OverrideNetworkState,
273}
274#[doc = "Override the state of navigator.onLine and navigator.connection.\n[overrideNetworkState](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-overrideNetworkState)"]
275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
276pub struct OverrideNetworkState {
277 pub method: OverrideNetworkStateMethod,
278 pub params: OverrideNetworkStateParams,
279}
280impl OverrideNetworkState {
281 pub const IDENTIFIER: &'static str = "Network.overrideNetworkState";
282 pub fn identifier(&self) -> &'static str {
283 Self::IDENTIFIER
284 }
285}
286impl crate::CommandResult for OverrideNetworkState {
287 type Result = super::results::OverrideNetworkStateResult;
288}
289#[doc = "Enables network tracking, network events will now be delivered to the client.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enable)"]
290#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
291pub struct EnableParams {
292 #[doc = "Buffer size in bytes to use when preserving network payloads (XHRs, etc).\nThis is the maximum number of bytes that will be collected by this\nDevTools session."]
293 #[serde(rename = "maxTotalBufferSize")]
294 #[serde(skip_serializing_if = "Option::is_none")]
295 #[serde(default)]
296 pub max_total_buffer_size: Option<i64>,
297 #[doc = "Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc)."]
298 #[serde(rename = "maxResourceBufferSize")]
299 #[serde(skip_serializing_if = "Option::is_none")]
300 #[serde(default)]
301 pub max_resource_buffer_size: Option<i64>,
302 #[doc = "Longest post body size (in bytes) that would be included in requestWillBeSent notification"]
303 #[serde(rename = "maxPostDataSize")]
304 #[serde(skip_serializing_if = "Option::is_none")]
305 #[serde(default)]
306 pub max_post_data_size: Option<i64>,
307 #[doc = "Whether DirectSocket chunk send/receive events should be reported."]
308 #[serde(rename = "reportDirectSocketTraffic")]
309 #[serde(skip_serializing_if = "Option::is_none")]
310 #[serde(default)]
311 pub report_direct_socket_traffic: Option<bool>,
312 #[doc = "Enable storing response bodies outside of renderer, so that these survive\na cross-process navigation. Requires maxTotalBufferSize to be set.\nCurrently defaults to false. This field is being deprecated in favor of the dedicated\nconfigureDurableMessages command, due to the possibility of deadlocks when awaiting\nNetwork.enable before issuing Runtime.runIfWaitingForDebugger."]
313 #[serde(rename = "enableDurableMessages")]
314 #[serde(skip_serializing_if = "Option::is_none")]
315 #[serde(default)]
316 pub enable_durable_messages: Option<bool>,
317}
318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
319pub enum EnableMethod {
320 #[serde(rename = "Network.enable")]
321 Enable,
322}
323#[doc = "Enables network tracking, network events will now be delivered to the client.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enable)"]
324#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
325pub struct Enable {
326 pub method: EnableMethod,
327 pub params: EnableParams,
328}
329impl Enable {
330 pub const IDENTIFIER: &'static str = "Network.enable";
331 pub fn identifier(&self) -> &'static str {
332 Self::IDENTIFIER
333 }
334}
335impl crate::CommandResult for Enable {
336 type Result = super::results::EnableResult;
337}
338#[doc = "Configures storing response bodies outside of renderer, so that these survive\na cross-process navigation.\nIf maxTotalBufferSize is not set, durable messages are disabled.\n[configureDurableMessages](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-configureDurableMessages)"]
339#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
340pub struct ConfigureDurableMessagesParams {
341 #[doc = "Buffer size in bytes to use when preserving network payloads (XHRs, etc)."]
342 #[serde(rename = "maxTotalBufferSize")]
343 #[serde(skip_serializing_if = "Option::is_none")]
344 #[serde(default)]
345 pub max_total_buffer_size: Option<i64>,
346 #[doc = "Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc)."]
347 #[serde(rename = "maxResourceBufferSize")]
348 #[serde(skip_serializing_if = "Option::is_none")]
349 #[serde(default)]
350 pub max_resource_buffer_size: Option<i64>,
351}
352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
353pub enum ConfigureDurableMessagesMethod {
354 #[serde(rename = "Network.configureDurableMessages")]
355 ConfigureDurableMessages,
356}
357#[doc = "Configures storing response bodies outside of renderer, so that these survive\na cross-process navigation.\nIf maxTotalBufferSize is not set, durable messages are disabled.\n[configureDurableMessages](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-configureDurableMessages)"]
358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
359pub struct ConfigureDurableMessages {
360 pub method: ConfigureDurableMessagesMethod,
361 pub params: ConfigureDurableMessagesParams,
362}
363impl ConfigureDurableMessages {
364 pub const IDENTIFIER: &'static str = "Network.configureDurableMessages";
365 pub fn identifier(&self) -> &'static str {
366 Self::IDENTIFIER
367 }
368}
369impl crate::CommandResult for ConfigureDurableMessages {
370 type Result = super::results::ConfigureDurableMessagesResult;
371}
372#[doc = "Returns the DER-encoded certificate.\n[getCertificate](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getCertificate)"]
373#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
374pub struct GetCertificateParams {
375 #[doc = "Origin to get certificate for."]
376 #[serde(rename = "origin")]
377 pub origin: String,
378}
379impl GetCertificateParams {
380 pub fn new(origin: impl Into<String>) -> Self {
381 Self {
382 origin: origin.into(),
383 }
384 }
385}
386impl<T: Into<String>> From<T> for GetCertificateParams {
387 fn from(url: T) -> Self {
388 GetCertificateParams::new(url)
389 }
390}
391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
392pub enum GetCertificateMethod {
393 #[serde(rename = "Network.getCertificate")]
394 GetCertificate,
395}
396#[doc = "Returns the DER-encoded certificate.\n[getCertificate](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getCertificate)"]
397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
398pub struct GetCertificate {
399 pub method: GetCertificateMethod,
400 pub params: GetCertificateParams,
401}
402impl GetCertificate {
403 pub const IDENTIFIER: &'static str = "Network.getCertificate";
404 pub fn identifier(&self) -> &'static str {
405 Self::IDENTIFIER
406 }
407}
408impl crate::CommandResult for GetCertificate {
409 type Result = super::results::GetCertificateResult;
410}
411#[doc = "Returns all browser cookies for the current URL. Depending on the backend support, will return\ndetailed cookie information in the `cookies` field.\n[getCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getCookies)"]
412#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
413pub struct GetCookiesParams {
414 #[doc = "The list of URLs for which applicable cookies will be fetched.\nIf not specified, it's assumed to be set to the list containing\nthe URLs of the page and all of its subframes."]
415 #[serde(rename = "urls")]
416 #[serde(skip_serializing_if = "Option::is_none")]
417 #[serde(default)]
418 pub urls: Option<Vec<String>>,
419}
420#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
421pub enum GetCookiesMethod {
422 #[serde(rename = "Network.getCookies")]
423 GetCookies,
424}
425#[doc = "Returns all browser cookies for the current URL. Depending on the backend support, will return\ndetailed cookie information in the `cookies` field.\n[getCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getCookies)"]
426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
427pub struct GetCookies {
428 pub method: GetCookiesMethod,
429 pub params: GetCookiesParams,
430}
431impl GetCookies {
432 pub const IDENTIFIER: &'static str = "Network.getCookies";
433 pub fn identifier(&self) -> &'static str {
434 Self::IDENTIFIER
435 }
436}
437impl crate::CommandResult for GetCookies {
438 type Result = super::results::GetCookiesResult;
439}
440#[doc = "Returns content served for the given request.\n[getResponseBody](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBody)"]
441#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
442pub struct GetResponseBodyParams {
443 #[doc = "Identifier of the network request to get content for."]
444 #[serde(rename = "requestId")]
445 pub request_id: super::types::RequestId,
446}
447impl GetResponseBodyParams {
448 pub fn new(request_id: impl Into<super::types::RequestId>) -> Self {
449 Self {
450 request_id: request_id.into(),
451 }
452 }
453}
454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
455pub enum GetResponseBodyMethod {
456 #[serde(rename = "Network.getResponseBody")]
457 GetResponseBody,
458}
459#[doc = "Returns content served for the given request.\n[getResponseBody](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBody)"]
460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
461pub struct GetResponseBody {
462 pub method: GetResponseBodyMethod,
463 pub params: GetResponseBodyParams,
464}
465impl GetResponseBody {
466 pub const IDENTIFIER: &'static str = "Network.getResponseBody";
467 pub fn identifier(&self) -> &'static str {
468 Self::IDENTIFIER
469 }
470}
471impl crate::CommandResult for GetResponseBody {
472 type Result = super::results::GetResponseBodyResult;
473}
474#[doc = "Returns post data sent with the request. Returns an error when no data was sent with the request.\n[getRequestPostData](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getRequestPostData)"]
475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
476pub struct GetRequestPostDataParams {
477 #[doc = "Identifier of the network request to get content for."]
478 #[serde(rename = "requestId")]
479 pub request_id: super::types::RequestId,
480}
481impl GetRequestPostDataParams {
482 pub fn new(request_id: impl Into<super::types::RequestId>) -> Self {
483 Self {
484 request_id: request_id.into(),
485 }
486 }
487}
488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
489pub enum GetRequestPostDataMethod {
490 #[serde(rename = "Network.getRequestPostData")]
491 GetRequestPostData,
492}
493#[doc = "Returns post data sent with the request. Returns an error when no data was sent with the request.\n[getRequestPostData](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getRequestPostData)"]
494#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
495pub struct GetRequestPostData {
496 pub method: GetRequestPostDataMethod,
497 pub params: GetRequestPostDataParams,
498}
499impl GetRequestPostData {
500 pub const IDENTIFIER: &'static str = "Network.getRequestPostData";
501 pub fn identifier(&self) -> &'static str {
502 Self::IDENTIFIER
503 }
504}
505impl crate::CommandResult for GetRequestPostData {
506 type Result = super::results::GetRequestPostDataResult;
507}
508#[doc = "Returns content served for the given currently intercepted request.\n[getResponseBodyForInterception](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBodyForInterception)"]
509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
510pub struct GetResponseBodyForInterceptionParams {
511 #[doc = "Identifier for the intercepted request to get body for."]
512 #[serde(rename = "interceptionId")]
513 pub interception_id: super::types::InterceptionId,
514}
515impl GetResponseBodyForInterceptionParams {
516 pub fn new(interception_id: impl Into<super::types::InterceptionId>) -> Self {
517 Self {
518 interception_id: interception_id.into(),
519 }
520 }
521}
522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
523pub enum GetResponseBodyForInterceptionMethod {
524 #[serde(rename = "Network.getResponseBodyForInterception")]
525 GetResponseBodyForInterception,
526}
527#[doc = "Returns content served for the given currently intercepted request.\n[getResponseBodyForInterception](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getResponseBodyForInterception)"]
528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
529pub struct GetResponseBodyForInterception {
530 pub method: GetResponseBodyForInterceptionMethod,
531 pub params: GetResponseBodyForInterceptionParams,
532}
533impl GetResponseBodyForInterception {
534 pub const IDENTIFIER: &'static str = "Network.getResponseBodyForInterception";
535 pub fn identifier(&self) -> &'static str {
536 Self::IDENTIFIER
537 }
538}
539impl crate::CommandResult for GetResponseBodyForInterception {
540 type Result = super::results::GetResponseBodyForInterceptionResult;
541}
542#[doc = "Returns a handle to the stream representing the response body. Note that after this command,\nthe intercepted request can't be continued as is -- you either need to cancel it or to provide\nthe response body. The stream only supports sequential read, IO.read will fail if the position\nis specified.\n[takeResponseBodyForInterceptionAsStream](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-takeResponseBodyForInterceptionAsStream)"]
543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
544pub struct TakeResponseBodyForInterceptionAsStreamParams {
545 #[serde(rename = "interceptionId")]
546 pub interception_id: super::types::InterceptionId,
547}
548impl TakeResponseBodyForInterceptionAsStreamParams {
549 pub fn new(interception_id: impl Into<super::types::InterceptionId>) -> Self {
550 Self {
551 interception_id: interception_id.into(),
552 }
553 }
554}
555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
556pub enum TakeResponseBodyForInterceptionAsStreamMethod {
557 #[serde(rename = "Network.takeResponseBodyForInterceptionAsStream")]
558 TakeResponseBodyForInterceptionAsStream,
559}
560#[doc = "Returns a handle to the stream representing the response body. Note that after this command,\nthe intercepted request can't be continued as is -- you either need to cancel it or to provide\nthe response body. The stream only supports sequential read, IO.read will fail if the position\nis specified.\n[takeResponseBodyForInterceptionAsStream](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-takeResponseBodyForInterceptionAsStream)"]
561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
562pub struct TakeResponseBodyForInterceptionAsStream {
563 pub method: TakeResponseBodyForInterceptionAsStreamMethod,
564 pub params: TakeResponseBodyForInterceptionAsStreamParams,
565}
566impl TakeResponseBodyForInterceptionAsStream {
567 pub const IDENTIFIER: &'static str = "Network.takeResponseBodyForInterceptionAsStream";
568 pub fn identifier(&self) -> &'static str {
569 Self::IDENTIFIER
570 }
571}
572impl crate::CommandResult for TakeResponseBodyForInterceptionAsStream {
573 type Result = super::results::TakeResponseBodyForInterceptionAsStreamResult;
574}
575#[doc = "This method sends a new XMLHttpRequest which is identical to the original one. The following\nparameters should be identical: method, url, async, request body, extra headers, withCredentials\nattribute, user, password.\n[replayXHR](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-replayXHR)"]
576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
577pub struct ReplayXhrParams {
578 #[doc = "Identifier of XHR to replay."]
579 #[serde(rename = "requestId")]
580 pub request_id: super::types::RequestId,
581}
582impl ReplayXhrParams {
583 pub fn new(request_id: impl Into<super::types::RequestId>) -> Self {
584 Self {
585 request_id: request_id.into(),
586 }
587 }
588}
589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
590pub enum ReplayXhrMethod {
591 #[serde(rename = "Network.replayXHR")]
592 ReplayXhr,
593}
594#[doc = "This method sends a new XMLHttpRequest which is identical to the original one. The following\nparameters should be identical: method, url, async, request body, extra headers, withCredentials\nattribute, user, password.\n[replayXHR](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-replayXHR)"]
595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
596pub struct ReplayXhr {
597 pub method: ReplayXhrMethod,
598 pub params: ReplayXhrParams,
599}
600impl ReplayXhr {
601 pub const IDENTIFIER: &'static str = "Network.replayXHR";
602 pub fn identifier(&self) -> &'static str {
603 Self::IDENTIFIER
604 }
605}
606impl crate::CommandResult for ReplayXhr {
607 type Result = super::results::ReplayXhrResult;
608}
609#[doc = "Searches for given string in response content.\n[searchInResponseBody](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-searchInResponseBody)"]
610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
611pub struct SearchInResponseBodyParams {
612 #[doc = "Identifier of the network response to search."]
613 #[serde(rename = "requestId")]
614 pub request_id: super::types::RequestId,
615 #[doc = "String to search for."]
616 #[serde(rename = "query")]
617 pub query: String,
618 #[doc = "If true, search is case sensitive."]
619 #[serde(rename = "caseSensitive")]
620 #[serde(skip_serializing_if = "Option::is_none")]
621 #[serde(default)]
622 pub case_sensitive: Option<bool>,
623 #[doc = "If true, treats string parameter as regex."]
624 #[serde(rename = "isRegex")]
625 #[serde(skip_serializing_if = "Option::is_none")]
626 #[serde(default)]
627 pub is_regex: Option<bool>,
628}
629impl SearchInResponseBodyParams {
630 pub fn new(request_id: impl Into<super::types::RequestId>, query: impl Into<String>) -> Self {
631 Self {
632 request_id: request_id.into(),
633 query: query.into(),
634 case_sensitive: None,
635 is_regex: None,
636 }
637 }
638}
639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
640pub enum SearchInResponseBodyMethod {
641 #[serde(rename = "Network.searchInResponseBody")]
642 SearchInResponseBody,
643}
644#[doc = "Searches for given string in response content.\n[searchInResponseBody](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-searchInResponseBody)"]
645#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
646pub struct SearchInResponseBody {
647 pub method: SearchInResponseBodyMethod,
648 pub params: SearchInResponseBodyParams,
649}
650impl SearchInResponseBody {
651 pub const IDENTIFIER: &'static str = "Network.searchInResponseBody";
652 pub fn identifier(&self) -> &'static str {
653 Self::IDENTIFIER
654 }
655}
656impl crate::CommandResult for SearchInResponseBody {
657 type Result = super::results::SearchInResponseBodyResult;
658}
659#[doc = "Blocks URLs from loading.\n[setBlockedURLs](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setBlockedURLs)"]
660#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
661pub struct SetBlockedUrLsParams {
662 #[doc = "Patterns to match in the order in which they are given. These patterns\nalso take precedence over any wildcard patterns defined in `urls`."]
663 #[serde(rename = "urlPatterns")]
664 #[serde(skip_serializing_if = "Option::is_none")]
665 #[serde(default)]
666 pub url_patterns: Option<Vec<super::types::BlockPattern>>,
667}
668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
669pub enum SetBlockedUrLsMethod {
670 #[serde(rename = "Network.setBlockedURLs")]
671 SetBlockedUrLs,
672}
673#[doc = "Blocks URLs from loading.\n[setBlockedURLs](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setBlockedURLs)"]
674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
675pub struct SetBlockedUrLs {
676 pub method: SetBlockedUrLsMethod,
677 pub params: SetBlockedUrLsParams,
678}
679impl SetBlockedUrLs {
680 pub const IDENTIFIER: &'static str = "Network.setBlockedURLs";
681 pub fn identifier(&self) -> &'static str {
682 Self::IDENTIFIER
683 }
684}
685impl crate::CommandResult for SetBlockedUrLs {
686 type Result = super::results::SetBlockedUrLsResult;
687}
688#[doc = "Toggles ignoring of service worker for each request.\n[setBypassServiceWorker](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setBypassServiceWorker)"]
689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
690pub struct SetBypassServiceWorkerParams {
691 #[doc = "Bypass service worker and load from network."]
692 #[serde(rename = "bypass")]
693 pub bypass: bool,
694}
695impl SetBypassServiceWorkerParams {
696 pub fn new(bypass: impl Into<bool>) -> Self {
697 Self {
698 bypass: bypass.into(),
699 }
700 }
701}
702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
703pub enum SetBypassServiceWorkerMethod {
704 #[serde(rename = "Network.setBypassServiceWorker")]
705 SetBypassServiceWorker,
706}
707#[doc = "Toggles ignoring of service worker for each request.\n[setBypassServiceWorker](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setBypassServiceWorker)"]
708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
709pub struct SetBypassServiceWorker {
710 pub method: SetBypassServiceWorkerMethod,
711 pub params: SetBypassServiceWorkerParams,
712}
713impl SetBypassServiceWorker {
714 pub const IDENTIFIER: &'static str = "Network.setBypassServiceWorker";
715 pub fn identifier(&self) -> &'static str {
716 Self::IDENTIFIER
717 }
718}
719impl crate::CommandResult for SetBypassServiceWorker {
720 type Result = super::results::SetBypassServiceWorkerResult;
721}
722#[doc = "Toggles ignoring cache for each request. If `true`, cache will not be used.\n[setCacheDisabled](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCacheDisabled)"]
723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
724pub struct SetCacheDisabledParams {
725 #[doc = "Cache disabled state."]
726 #[serde(rename = "cacheDisabled")]
727 pub cache_disabled: bool,
728}
729impl SetCacheDisabledParams {
730 pub fn new(cache_disabled: impl Into<bool>) -> Self {
731 Self {
732 cache_disabled: cache_disabled.into(),
733 }
734 }
735}
736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
737pub enum SetCacheDisabledMethod {
738 #[serde(rename = "Network.setCacheDisabled")]
739 SetCacheDisabled,
740}
741#[doc = "Toggles ignoring cache for each request. If `true`, cache will not be used.\n[setCacheDisabled](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCacheDisabled)"]
742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
743pub struct SetCacheDisabled {
744 pub method: SetCacheDisabledMethod,
745 pub params: SetCacheDisabledParams,
746}
747impl SetCacheDisabled {
748 pub const IDENTIFIER: &'static str = "Network.setCacheDisabled";
749 pub fn identifier(&self) -> &'static str {
750 Self::IDENTIFIER
751 }
752}
753impl crate::CommandResult for SetCacheDisabled {
754 type Result = super::results::SetCacheDisabledResult;
755}
756#[doc = "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.\n[setCookie](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookie)"]
757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
758pub struct SetCookieParams {
759 #[doc = "Cookie name."]
760 #[serde(rename = "name")]
761 pub name: String,
762 #[doc = "Cookie value."]
763 #[serde(rename = "value")]
764 pub value: String,
765 #[doc = "The request-URI to associate with the setting of the cookie. This value can affect the\ndefault domain, path, source port, and source scheme values of the created cookie."]
766 #[serde(rename = "url")]
767 #[serde(skip_serializing_if = "Option::is_none")]
768 #[serde(default)]
769 pub url: Option<String>,
770 #[doc = "Cookie domain."]
771 #[serde(rename = "domain")]
772 #[serde(skip_serializing_if = "Option::is_none")]
773 #[serde(default)]
774 pub domain: Option<String>,
775 #[doc = "Cookie path."]
776 #[serde(rename = "path")]
777 #[serde(skip_serializing_if = "Option::is_none")]
778 #[serde(default)]
779 pub path: Option<String>,
780 #[doc = "True if cookie is secure."]
781 #[serde(rename = "secure")]
782 #[serde(skip_serializing_if = "Option::is_none")]
783 #[serde(default)]
784 pub secure: Option<bool>,
785 #[doc = "True if cookie is http-only."]
786 #[serde(rename = "httpOnly")]
787 #[serde(skip_serializing_if = "Option::is_none")]
788 #[serde(default)]
789 pub http_only: Option<bool>,
790 #[doc = "Cookie SameSite type."]
791 #[serde(rename = "sameSite")]
792 #[serde(skip_serializing_if = "Option::is_none")]
793 #[serde(default)]
794 pub same_site: Option<super::types::CookieSameSite>,
795 #[doc = "Cookie expiration date, session cookie if not set"]
796 #[serde(rename = "expires")]
797 #[serde(skip_serializing_if = "Option::is_none")]
798 #[serde(default)]
799 pub expires: Option<super::types::TimeSinceEpoch>,
800 #[doc = "Cookie Priority type."]
801 #[serde(rename = "priority")]
802 #[serde(skip_serializing_if = "Option::is_none")]
803 #[serde(default)]
804 pub priority: Option<super::types::CookiePriority>,
805 #[doc = "Cookie source scheme type."]
806 #[serde(rename = "sourceScheme")]
807 #[serde(skip_serializing_if = "Option::is_none")]
808 #[serde(default)]
809 pub source_scheme: Option<super::types::CookieSourceScheme>,
810 #[doc = "Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.\nAn unspecified port value allows protocol clients to emulate legacy cookie scope for the port.\nThis is a temporary ability and it will be removed in the future."]
811 #[serde(rename = "sourcePort")]
812 #[serde(skip_serializing_if = "Option::is_none")]
813 #[serde(default)]
814 pub source_port: Option<i64>,
815 #[doc = "Cookie partition key. If not set, the cookie will be set as not partitioned."]
816 #[serde(rename = "partitionKey")]
817 #[serde(skip_serializing_if = "Option::is_none")]
818 #[serde(default)]
819 pub partition_key: Option<super::types::CookiePartitionKey>,
820}
821impl SetCookieParams {
822 pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
823 Self {
824 name: name.into(),
825 value: value.into(),
826 url: None,
827 domain: None,
828 path: None,
829 secure: None,
830 http_only: None,
831 same_site: None,
832 expires: None,
833 priority: None,
834 source_scheme: None,
835 source_port: None,
836 partition_key: None,
837 }
838 }
839}
840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
841pub enum SetCookieMethod {
842 #[serde(rename = "Network.setCookie")]
843 SetCookie,
844}
845#[doc = "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.\n[setCookie](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookie)"]
846#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
847pub struct SetCookie {
848 pub method: SetCookieMethod,
849 pub params: SetCookieParams,
850}
851impl SetCookie {
852 pub const IDENTIFIER: &'static str = "Network.setCookie";
853 pub fn identifier(&self) -> &'static str {
854 Self::IDENTIFIER
855 }
856}
857impl crate::CommandResult for SetCookie {
858 type Result = super::results::SetCookieResult;
859}
860#[doc = "Sets given cookies.\n[setCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookies)"]
861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
862pub struct SetCookiesParams {
863 #[doc = "Cookies to be set."]
864 #[serde(rename = "cookies")]
865 #[serde(skip_serializing_if = "Vec::is_empty")]
866 pub cookies: Vec<super::types::CookieParam>,
867}
868impl SetCookiesParams {
869 pub fn new(cookies: Vec<super::types::CookieParam>) -> Self {
870 Self { cookies }
871 }
872}
873#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
874pub enum SetCookiesMethod {
875 #[serde(rename = "Network.setCookies")]
876 SetCookies,
877}
878#[doc = "Sets given cookies.\n[setCookies](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookies)"]
879#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
880pub struct SetCookies {
881 pub method: SetCookiesMethod,
882 pub params: SetCookiesParams,
883}
884impl SetCookies {
885 pub const IDENTIFIER: &'static str = "Network.setCookies";
886 pub fn identifier(&self) -> &'static str {
887 Self::IDENTIFIER
888 }
889}
890impl crate::CommandResult for SetCookies {
891 type Result = super::results::SetCookiesResult;
892}
893#[doc = "Specifies whether to always send extra HTTP headers with the requests from this page.\n[setExtraHTTPHeaders](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setExtraHTTPHeaders)"]
894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
895pub struct SetExtraHttpHeadersParams {
896 #[doc = "Map with extra HTTP headers."]
897 #[serde(rename = "headers")]
898 pub headers: super::types::Headers,
899}
900impl SetExtraHttpHeadersParams {
901 pub fn new(headers: impl Into<super::types::Headers>) -> Self {
902 Self {
903 headers: headers.into(),
904 }
905 }
906}
907#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
908pub enum SetExtraHttpHeadersMethod {
909 #[serde(rename = "Network.setExtraHTTPHeaders")]
910 SetExtraHttpHeaders,
911}
912#[doc = "Specifies whether to always send extra HTTP headers with the requests from this page.\n[setExtraHTTPHeaders](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setExtraHTTPHeaders)"]
913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
914pub struct SetExtraHttpHeaders {
915 pub method: SetExtraHttpHeadersMethod,
916 pub params: SetExtraHttpHeadersParams,
917}
918impl SetExtraHttpHeaders {
919 pub const IDENTIFIER: &'static str = "Network.setExtraHTTPHeaders";
920 pub fn identifier(&self) -> &'static str {
921 Self::IDENTIFIER
922 }
923}
924impl crate::CommandResult for SetExtraHttpHeaders {
925 type Result = super::results::SetExtraHttpHeadersResult;
926}
927#[doc = "Specifies whether to attach a page script stack id in requests\n[setAttachDebugStack](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setAttachDebugStack)"]
928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
929pub struct SetAttachDebugStackParams {
930 #[doc = "Whether to attach a page script stack for debugging purpose."]
931 #[serde(rename = "enabled")]
932 pub enabled: bool,
933}
934impl SetAttachDebugStackParams {
935 pub fn new(enabled: impl Into<bool>) -> Self {
936 Self {
937 enabled: enabled.into(),
938 }
939 }
940}
941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
942pub enum SetAttachDebugStackMethod {
943 #[serde(rename = "Network.setAttachDebugStack")]
944 SetAttachDebugStack,
945}
946#[doc = "Specifies whether to attach a page script stack id in requests\n[setAttachDebugStack](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setAttachDebugStack)"]
947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
948pub struct SetAttachDebugStack {
949 pub method: SetAttachDebugStackMethod,
950 pub params: SetAttachDebugStackParams,
951}
952impl SetAttachDebugStack {
953 pub const IDENTIFIER: &'static str = "Network.setAttachDebugStack";
954 pub fn identifier(&self) -> &'static str {
955 Self::IDENTIFIER
956 }
957}
958impl crate::CommandResult for SetAttachDebugStack {
959 type Result = super::results::SetAttachDebugStackResult;
960}
961#[doc = "Allows overriding user agent with the given string.\n[setUserAgentOverride](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setUserAgentOverride)"]
962#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
963pub struct SetUserAgentOverrideParams {
964 #[doc = "User agent to use."]
965 #[serde(rename = "userAgent")]
966 pub user_agent: String,
967 #[doc = "Browser language to emulate."]
968 #[serde(rename = "acceptLanguage")]
969 #[serde(skip_serializing_if = "Option::is_none")]
970 #[serde(default)]
971 pub accept_language: Option<String>,
972 #[doc = "The platform navigator.platform should return."]
973 #[serde(rename = "platform")]
974 #[serde(skip_serializing_if = "Option::is_none")]
975 #[serde(default)]
976 pub platform: Option<String>,
977 #[doc = "To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData"]
978 #[serde(rename = "userAgentMetadata")]
979 #[serde(skip_serializing_if = "Option::is_none")]
980 #[serde(default)]
981 pub user_agent_metadata: Option<crate::browser_protocol::emulation::types::UserAgentMetadata>,
982}
983impl SetUserAgentOverrideParams {
984 pub fn new(user_agent: impl Into<String>) -> Self {
985 Self {
986 user_agent: user_agent.into(),
987 accept_language: None,
988 platform: None,
989 user_agent_metadata: None,
990 }
991 }
992}
993impl<T: Into<String>> From<T> for SetUserAgentOverrideParams {
994 fn from(url: T) -> Self {
995 SetUserAgentOverrideParams::new(url)
996 }
997}
998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
999pub enum SetUserAgentOverrideMethod {
1000 #[serde(rename = "Network.setUserAgentOverride")]
1001 SetUserAgentOverride,
1002}
1003#[doc = "Allows overriding user agent with the given string.\n[setUserAgentOverride](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setUserAgentOverride)"]
1004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1005pub struct SetUserAgentOverride {
1006 pub method: SetUserAgentOverrideMethod,
1007 pub params: SetUserAgentOverrideParams,
1008}
1009impl SetUserAgentOverride {
1010 pub const IDENTIFIER: &'static str = "Network.setUserAgentOverride";
1011 pub fn identifier(&self) -> &'static str {
1012 Self::IDENTIFIER
1013 }
1014}
1015impl crate::CommandResult for SetUserAgentOverride {
1016 type Result = super::results::SetUserAgentOverrideResult;
1017}
1018#[doc = "Enables streaming of the response for the given requestId.\nIf enabled, the dataReceived event contains the data that was received during streaming.\n[streamResourceContent](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-streamResourceContent)"]
1019#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1020pub struct StreamResourceContentParams {
1021 #[doc = "Identifier of the request to stream."]
1022 #[serde(rename = "requestId")]
1023 pub request_id: super::types::RequestId,
1024}
1025impl StreamResourceContentParams {
1026 pub fn new(request_id: impl Into<super::types::RequestId>) -> Self {
1027 Self {
1028 request_id: request_id.into(),
1029 }
1030 }
1031}
1032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1033pub enum StreamResourceContentMethod {
1034 #[serde(rename = "Network.streamResourceContent")]
1035 StreamResourceContent,
1036}
1037#[doc = "Enables streaming of the response for the given requestId.\nIf enabled, the dataReceived event contains the data that was received during streaming.\n[streamResourceContent](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-streamResourceContent)"]
1038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1039pub struct StreamResourceContent {
1040 pub method: StreamResourceContentMethod,
1041 pub params: StreamResourceContentParams,
1042}
1043impl StreamResourceContent {
1044 pub const IDENTIFIER: &'static str = "Network.streamResourceContent";
1045 pub fn identifier(&self) -> &'static str {
1046 Self::IDENTIFIER
1047 }
1048}
1049impl crate::CommandResult for StreamResourceContent {
1050 type Result = super::results::StreamResourceContentResult;
1051}
1052#[doc = "Returns information about the COEP/COOP isolation status.\n[getSecurityIsolationStatus](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getSecurityIsolationStatus)"]
1053#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
1054pub struct GetSecurityIsolationStatusParams {
1055 #[doc = "If no frameId is provided, the status of the target is provided."]
1056 #[serde(rename = "frameId")]
1057 #[serde(skip_serializing_if = "Option::is_none")]
1058 #[serde(default)]
1059 pub frame_id: Option<crate::browser_protocol::page::types::FrameId>,
1060}
1061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1062pub enum GetSecurityIsolationStatusMethod {
1063 #[serde(rename = "Network.getSecurityIsolationStatus")]
1064 GetSecurityIsolationStatus,
1065}
1066#[doc = "Returns information about the COEP/COOP isolation status.\n[getSecurityIsolationStatus](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-getSecurityIsolationStatus)"]
1067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1068pub struct GetSecurityIsolationStatus {
1069 pub method: GetSecurityIsolationStatusMethod,
1070 pub params: GetSecurityIsolationStatusParams,
1071}
1072impl GetSecurityIsolationStatus {
1073 pub const IDENTIFIER: &'static str = "Network.getSecurityIsolationStatus";
1074 pub fn identifier(&self) -> &'static str {
1075 Self::IDENTIFIER
1076 }
1077}
1078impl crate::CommandResult for GetSecurityIsolationStatus {
1079 type Result = super::results::GetSecurityIsolationStatusResult;
1080}
1081#[doc = "Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.\nEnabling triggers 'reportingApiReportAdded' for all existing reports.\n[enableReportingApi](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enableReportingApi)"]
1082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1083pub struct EnableReportingApiParams {
1084 #[doc = "Whether to enable or disable events for the Reporting API"]
1085 #[serde(rename = "enable")]
1086 pub enable: bool,
1087}
1088impl EnableReportingApiParams {
1089 pub fn new(enable: impl Into<bool>) -> Self {
1090 Self {
1091 enable: enable.into(),
1092 }
1093 }
1094}
1095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1096pub enum EnableReportingApiMethod {
1097 #[serde(rename = "Network.enableReportingApi")]
1098 EnableReportingApi,
1099}
1100#[doc = "Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.\nEnabling triggers 'reportingApiReportAdded' for all existing reports.\n[enableReportingApi](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enableReportingApi)"]
1101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1102pub struct EnableReportingApi {
1103 pub method: EnableReportingApiMethod,
1104 pub params: EnableReportingApiParams,
1105}
1106impl EnableReportingApi {
1107 pub const IDENTIFIER: &'static str = "Network.enableReportingApi";
1108 pub fn identifier(&self) -> &'static str {
1109 Self::IDENTIFIER
1110 }
1111}
1112impl crate::CommandResult for EnableReportingApi {
1113 type Result = super::results::EnableReportingApiResult;
1114}
1115#[doc = "Sets up tracking device bound sessions and fetching of initial set of sessions.\n[enableDeviceBoundSessions](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enableDeviceBoundSessions)"]
1116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1117pub struct EnableDeviceBoundSessionsParams {
1118 #[doc = "Whether to enable or disable events."]
1119 #[serde(rename = "enable")]
1120 pub enable: bool,
1121}
1122impl EnableDeviceBoundSessionsParams {
1123 pub fn new(enable: impl Into<bool>) -> Self {
1124 Self {
1125 enable: enable.into(),
1126 }
1127 }
1128}
1129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1130pub enum EnableDeviceBoundSessionsMethod {
1131 #[serde(rename = "Network.enableDeviceBoundSessions")]
1132 EnableDeviceBoundSessions,
1133}
1134#[doc = "Sets up tracking device bound sessions and fetching of initial set of sessions.\n[enableDeviceBoundSessions](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-enableDeviceBoundSessions)"]
1135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1136pub struct EnableDeviceBoundSessions {
1137 pub method: EnableDeviceBoundSessionsMethod,
1138 pub params: EnableDeviceBoundSessionsParams,
1139}
1140impl EnableDeviceBoundSessions {
1141 pub const IDENTIFIER: &'static str = "Network.enableDeviceBoundSessions";
1142 pub fn identifier(&self) -> &'static str {
1143 Self::IDENTIFIER
1144 }
1145}
1146impl crate::CommandResult for EnableDeviceBoundSessions {
1147 type Result = super::results::EnableDeviceBoundSessionsResult;
1148}
1149#[doc = "Fetches the schemeful site for a specific origin.\n[fetchSchemefulSite](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-fetchSchemefulSite)"]
1150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1151pub struct FetchSchemefulSiteParams {
1152 #[doc = "The URL origin."]
1153 #[serde(rename = "origin")]
1154 pub origin: String,
1155}
1156impl FetchSchemefulSiteParams {
1157 pub fn new(origin: impl Into<String>) -> Self {
1158 Self {
1159 origin: origin.into(),
1160 }
1161 }
1162}
1163impl<T: Into<String>> From<T> for FetchSchemefulSiteParams {
1164 fn from(url: T) -> Self {
1165 FetchSchemefulSiteParams::new(url)
1166 }
1167}
1168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1169pub enum FetchSchemefulSiteMethod {
1170 #[serde(rename = "Network.fetchSchemefulSite")]
1171 FetchSchemefulSite,
1172}
1173#[doc = "Fetches the schemeful site for a specific origin.\n[fetchSchemefulSite](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-fetchSchemefulSite)"]
1174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1175pub struct FetchSchemefulSite {
1176 pub method: FetchSchemefulSiteMethod,
1177 pub params: FetchSchemefulSiteParams,
1178}
1179impl FetchSchemefulSite {
1180 pub const IDENTIFIER: &'static str = "Network.fetchSchemefulSite";
1181 pub fn identifier(&self) -> &'static str {
1182 Self::IDENTIFIER
1183 }
1184}
1185impl crate::CommandResult for FetchSchemefulSite {
1186 type Result = super::results::FetchSchemefulSiteResult;
1187}
1188#[doc = "Fetches the resource and returns the content.\n[loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)"]
1189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1190pub struct LoadNetworkResourceParams {
1191 #[doc = "Frame id to get the resource for. Mandatory for frame targets, and\nshould be omitted for worker targets."]
1192 #[serde(rename = "frameId")]
1193 #[serde(skip_serializing_if = "Option::is_none")]
1194 #[serde(default)]
1195 pub frame_id: Option<crate::browser_protocol::page::types::FrameId>,
1196 #[doc = "URL of the resource to get content for."]
1197 #[serde(rename = "url")]
1198 pub url: String,
1199 #[doc = "Options for the request."]
1200 #[serde(rename = "options")]
1201 pub options: super::types::LoadNetworkResourceOptions,
1202}
1203impl LoadNetworkResourceParams {
1204 pub fn new(
1205 url: impl Into<String>,
1206 options: impl Into<super::types::LoadNetworkResourceOptions>,
1207 ) -> Self {
1208 Self {
1209 url: url.into(),
1210 options: options.into(),
1211 frame_id: None,
1212 }
1213 }
1214}
1215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1216pub enum LoadNetworkResourceMethod {
1217 #[serde(rename = "Network.loadNetworkResource")]
1218 LoadNetworkResource,
1219}
1220#[doc = "Fetches the resource and returns the content.\n[loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)"]
1221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1222pub struct LoadNetworkResource {
1223 pub method: LoadNetworkResourceMethod,
1224 pub params: LoadNetworkResourceParams,
1225}
1226impl LoadNetworkResource {
1227 pub const IDENTIFIER: &'static str = "Network.loadNetworkResource";
1228 pub fn identifier(&self) -> &'static str {
1229 Self::IDENTIFIER
1230 }
1231}
1232impl crate::CommandResult for LoadNetworkResource {
1233 type Result = super::results::LoadNetworkResourceResult;
1234}
1235#[doc = "Sets Controls for third-party cookie access\nPage reload is required before the new cookie behavior will be observed\n[setCookieControls](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookieControls)"]
1236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1237pub struct SetCookieControlsParams {
1238 #[doc = "Whether 3pc restriction is enabled."]
1239 #[serde(rename = "enableThirdPartyCookieRestriction")]
1240 pub enable_third_party_cookie_restriction: bool,
1241 #[doc = "Whether 3pc grace period exception should be enabled; false by default."]
1242 #[serde(rename = "disableThirdPartyCookieMetadata")]
1243 pub disable_third_party_cookie_metadata: bool,
1244 #[doc = "Whether 3pc heuristics exceptions should be enabled; false by default."]
1245 #[serde(rename = "disableThirdPartyCookieHeuristics")]
1246 pub disable_third_party_cookie_heuristics: bool,
1247}
1248impl SetCookieControlsParams {
1249 pub fn new(
1250 enable_third_party_cookie_restriction: impl Into<bool>,
1251 disable_third_party_cookie_metadata: impl Into<bool>,
1252 disable_third_party_cookie_heuristics: impl Into<bool>,
1253 ) -> Self {
1254 Self {
1255 enable_third_party_cookie_restriction: enable_third_party_cookie_restriction.into(),
1256 disable_third_party_cookie_metadata: disable_third_party_cookie_metadata.into(),
1257 disable_third_party_cookie_heuristics: disable_third_party_cookie_heuristics.into(),
1258 }
1259 }
1260}
1261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1262pub enum SetCookieControlsMethod {
1263 #[serde(rename = "Network.setCookieControls")]
1264 SetCookieControls,
1265}
1266#[doc = "Sets Controls for third-party cookie access\nPage reload is required before the new cookie behavior will be observed\n[setCookieControls](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-setCookieControls)"]
1267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1268pub struct SetCookieControls {
1269 pub method: SetCookieControlsMethod,
1270 pub params: SetCookieControlsParams,
1271}
1272impl SetCookieControls {
1273 pub const IDENTIFIER: &'static str = "Network.setCookieControls";
1274 pub fn identifier(&self) -> &'static str {
1275 Self::IDENTIFIER
1276 }
1277}
1278impl crate::CommandResult for SetCookieControls {
1279 type Result = super::results::SetCookieControlsResult;
1280}
1281group_enum ! (NetworkCommands { SetAcceptedEncodings (SetAcceptedEncodings) , ClearAcceptedEncodingsOverride (ClearAcceptedEncodingsOverride) , ClearBrowserCache (ClearBrowserCache) , ClearBrowserCookies (ClearBrowserCookies) , DeleteCookies (DeleteCookies) , Disable (Disable) , EmulateNetworkConditionsByRule (EmulateNetworkConditionsByRule) , OverrideNetworkState (OverrideNetworkState) , Enable (Enable) , ConfigureDurableMessages (ConfigureDurableMessages) , GetCertificate (GetCertificate) , GetCookies (GetCookies) , GetResponseBody (GetResponseBody) , GetRequestPostData (GetRequestPostData) , GetResponseBodyForInterception (GetResponseBodyForInterception) , TakeResponseBodyForInterceptionAsStream (TakeResponseBodyForInterceptionAsStream) , ReplayXhr (ReplayXhr) , SearchInResponseBody (SearchInResponseBody) , SetBlockedUrLs (SetBlockedUrLs) , SetBypassServiceWorker (SetBypassServiceWorker) , SetCacheDisabled (SetCacheDisabled) , SetCookie (SetCookie) , SetCookies (SetCookies) , SetExtraHttpHeaders (SetExtraHttpHeaders) , SetAttachDebugStack (SetAttachDebugStack) , SetUserAgentOverride (SetUserAgentOverride) , StreamResourceContent (StreamResourceContent) , GetSecurityIsolationStatus (GetSecurityIsolationStatus) , EnableReportingApi (EnableReportingApi) , EnableDeviceBoundSessions (EnableDeviceBoundSessions) , FetchSchemefulSite (FetchSchemefulSite) , LoadNetworkResource (LoadNetworkResource) , SetCookieControls (SetCookieControls) } + identifiable);