Skip to main content

browser_protocol/network/
mod.rs

1//! Network domain allows tracking network activities of the page. It exposes information about http,
2//! file, data and other requests and responses, their headers, bodies, timing, etc.
3
4
5use serde::{Serialize, Deserialize};
6use serde_json::Value as JsonValue;
7use std::borrow::Cow;
8
9/// Resource type as it was perceived by the rendering engine.
10
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
12pub enum ResourceType {
13    #[default]
14    #[serde(rename = "Document")]
15    Document,
16    #[serde(rename = "Stylesheet")]
17    Stylesheet,
18    #[serde(rename = "Image")]
19    Image,
20    #[serde(rename = "Media")]
21    Media,
22    #[serde(rename = "Font")]
23    Font,
24    #[serde(rename = "Script")]
25    Script,
26    #[serde(rename = "TextTrack")]
27    TextTrack,
28    #[serde(rename = "XHR")]
29    XHR,
30    #[serde(rename = "Fetch")]
31    Fetch,
32    #[serde(rename = "Prefetch")]
33    Prefetch,
34    #[serde(rename = "EventSource")]
35    EventSource,
36    #[serde(rename = "WebSocket")]
37    WebSocket,
38    #[serde(rename = "Manifest")]
39    Manifest,
40    #[serde(rename = "SignedExchange")]
41    SignedExchange,
42    #[serde(rename = "Ping")]
43    Ping,
44    #[serde(rename = "CSPViolationReport")]
45    CSPViolationReport,
46    #[serde(rename = "Preflight")]
47    Preflight,
48    #[serde(rename = "FedCM")]
49    FedCM,
50    #[serde(rename = "Other")]
51    Other,
52}
53
54/// Unique loader identifier.
55
56pub type LoaderId<'a> = Cow<'a, str>;
57
58/// Unique network request identifier.
59/// Note that this does not identify individual HTTP requests that are part of
60/// a network request.
61
62pub type RequestId<'a> = Cow<'a, str>;
63
64/// Unique intercepted request identifier.
65
66pub type InterceptionId<'a> = Cow<'a, str>;
67
68/// Network level fetch failure reason.
69
70#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
71pub enum ErrorReason {
72    #[default]
73    #[serde(rename = "Failed")]
74    Failed,
75    #[serde(rename = "Aborted")]
76    Aborted,
77    #[serde(rename = "TimedOut")]
78    TimedOut,
79    #[serde(rename = "AccessDenied")]
80    AccessDenied,
81    #[serde(rename = "ConnectionClosed")]
82    ConnectionClosed,
83    #[serde(rename = "ConnectionReset")]
84    ConnectionReset,
85    #[serde(rename = "ConnectionRefused")]
86    ConnectionRefused,
87    #[serde(rename = "ConnectionAborted")]
88    ConnectionAborted,
89    #[serde(rename = "ConnectionFailed")]
90    ConnectionFailed,
91    #[serde(rename = "NameNotResolved")]
92    NameNotResolved,
93    #[serde(rename = "InternetDisconnected")]
94    InternetDisconnected,
95    #[serde(rename = "AddressUnreachable")]
96    AddressUnreachable,
97    #[serde(rename = "BlockedByClient")]
98    BlockedByClient,
99    #[serde(rename = "BlockedByResponse")]
100    BlockedByResponse,
101}
102
103/// UTC time in seconds, counted from January 1, 1970.
104
105pub type TimeSinceEpoch = f64;
106
107/// Monotonically increasing time in seconds since an arbitrary point in the past.
108
109pub type MonotonicTime = f64;
110
111/// Request / response headers as keys / values of JSON object.
112
113pub type Headers = serde_json::Map<String, JsonValue>;
114
115/// The underlying connection technology that the browser is supposedly using.
116
117#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
118pub enum ConnectionType {
119    #[default]
120    #[serde(rename = "none")]
121    None,
122    #[serde(rename = "cellular2g")]
123    Cellular2g,
124    #[serde(rename = "cellular3g")]
125    Cellular3g,
126    #[serde(rename = "cellular4g")]
127    Cellular4g,
128    #[serde(rename = "bluetooth")]
129    Bluetooth,
130    #[serde(rename = "ethernet")]
131    Ethernet,
132    #[serde(rename = "wifi")]
133    Wifi,
134    #[serde(rename = "wimax")]
135    Wimax,
136    #[serde(rename = "other")]
137    Other,
138}
139
140/// Represents the cookie's 'SameSite' status:
141/// <https://tools.ietf.org/html/draft-west-first-party-cookies>
142
143#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
144pub enum CookieSameSite {
145    #[default]
146    #[serde(rename = "Strict")]
147    Strict,
148    #[serde(rename = "Lax")]
149    Lax,
150    #[serde(rename = "None")]
151    None,
152}
153
154/// Represents the cookie's 'Priority' status:
155/// <https://tools.ietf.org/html/draft-west-cookie-priority-00>
156
157#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
158pub enum CookiePriority {
159    #[default]
160    #[serde(rename = "Low")]
161    Low,
162    #[serde(rename = "Medium")]
163    Medium,
164    #[serde(rename = "High")]
165    High,
166}
167
168/// Represents the source scheme of the origin that originally set the cookie.
169/// A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme.
170/// This is a temporary ability and it will be removed in the future.
171
172#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
173pub enum CookieSourceScheme {
174    #[default]
175    #[serde(rename = "Unset")]
176    Unset,
177    #[serde(rename = "NonSecure")]
178    NonSecure,
179    #[serde(rename = "Secure")]
180    Secure,
181}
182
183/// Timing information for the request.
184
185#[derive(Debug, Clone, Serialize, Deserialize, Default)]
186#[serde(rename_all = "camelCase")]
187pub struct ResourceTiming {
188    /// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in
189    /// milliseconds relatively to this requestTime.
190    #[serde(rename = "requestTime")]
191    request_time: f64,
192    /// Started resolving proxy.
193    #[serde(rename = "proxyStart")]
194    proxy_start: f64,
195    /// Finished resolving proxy.
196    #[serde(rename = "proxyEnd")]
197    proxy_end: f64,
198    /// Started DNS address resolve.
199    #[serde(rename = "dnsStart")]
200    dns_start: f64,
201    /// Finished DNS address resolve.
202    #[serde(rename = "dnsEnd")]
203    dns_end: f64,
204    /// Started connecting to the remote host.
205    #[serde(rename = "connectStart")]
206    connect_start: f64,
207    /// Connected to the remote host.
208    #[serde(rename = "connectEnd")]
209    connect_end: f64,
210    /// Started SSL handshake.
211    #[serde(rename = "sslStart")]
212    ssl_start: f64,
213    /// Finished SSL handshake.
214    #[serde(rename = "sslEnd")]
215    ssl_end: f64,
216    /// Started running ServiceWorker.
217    #[serde(rename = "workerStart")]
218    worker_start: f64,
219    /// Finished Starting ServiceWorker.
220    #[serde(rename = "workerReady")]
221    worker_ready: f64,
222    /// Started fetch event.
223    #[serde(rename = "workerFetchStart")]
224    worker_fetch_start: f64,
225    /// Settled fetch event respondWith promise.
226    #[serde(rename = "workerRespondWithSettled")]
227    worker_respond_with_settled: f64,
228    /// Started ServiceWorker static routing source evaluation.
229    #[serde(skip_serializing_if = "Option::is_none", rename = "workerRouterEvaluationStart")]
230    worker_router_evaluation_start: Option<f64>,
231    /// Started cache lookup when the source was evaluated to 'cache'.
232    #[serde(skip_serializing_if = "Option::is_none", rename = "workerCacheLookupStart")]
233    worker_cache_lookup_start: Option<f64>,
234    /// Started sending request.
235    #[serde(rename = "sendStart")]
236    send_start: f64,
237    /// Finished sending request.
238    #[serde(rename = "sendEnd")]
239    send_end: f64,
240    /// Time the server started pushing request.
241    #[serde(rename = "pushStart")]
242    push_start: f64,
243    /// Time the server finished pushing request.
244    #[serde(rename = "pushEnd")]
245    push_end: f64,
246    /// Started receiving response headers.
247    #[serde(rename = "receiveHeadersStart")]
248    receive_headers_start: f64,
249    /// Finished receiving response headers.
250    #[serde(rename = "receiveHeadersEnd")]
251    receive_headers_end: f64,
252}
253
254impl ResourceTiming {
255    /// Creates a builder for this type with the required parameters:
256    /// * `request_time`: Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime.
257    /// * `proxy_start`: Started resolving proxy.
258    /// * `proxy_end`: Finished resolving proxy.
259    /// * `dns_start`: Started DNS address resolve.
260    /// * `dns_end`: Finished DNS address resolve.
261    /// * `connect_start`: Started connecting to the remote host.
262    /// * `connect_end`: Connected to the remote host.
263    /// * `ssl_start`: Started SSL handshake.
264    /// * `ssl_end`: Finished SSL handshake.
265    /// * `worker_start`: Started running ServiceWorker.
266    /// * `worker_ready`: Finished Starting ServiceWorker.
267    /// * `worker_fetch_start`: Started fetch event.
268    /// * `worker_respond_with_settled`: Settled fetch event respondWith promise.
269    /// * `send_start`: Started sending request.
270    /// * `send_end`: Finished sending request.
271    /// * `push_start`: Time the server started pushing request.
272    /// * `push_end`: Time the server finished pushing request.
273    /// * `receive_headers_start`: Started receiving response headers.
274    /// * `receive_headers_end`: Finished receiving response headers.
275    pub fn builder(request_time: f64, proxy_start: f64, proxy_end: f64, dns_start: f64, dns_end: f64, connect_start: f64, connect_end: f64, ssl_start: f64, ssl_end: f64, worker_start: f64, worker_ready: f64, worker_fetch_start: f64, worker_respond_with_settled: f64, send_start: f64, send_end: f64, push_start: f64, push_end: f64, receive_headers_start: f64, receive_headers_end: f64) -> ResourceTimingBuilder {
276        ResourceTimingBuilder {
277            request_time: request_time,
278            proxy_start: proxy_start,
279            proxy_end: proxy_end,
280            dns_start: dns_start,
281            dns_end: dns_end,
282            connect_start: connect_start,
283            connect_end: connect_end,
284            ssl_start: ssl_start,
285            ssl_end: ssl_end,
286            worker_start: worker_start,
287            worker_ready: worker_ready,
288            worker_fetch_start: worker_fetch_start,
289            worker_respond_with_settled: worker_respond_with_settled,
290            worker_router_evaluation_start: None,
291            worker_cache_lookup_start: None,
292            send_start: send_start,
293            send_end: send_end,
294            push_start: push_start,
295            push_end: push_end,
296            receive_headers_start: receive_headers_start,
297            receive_headers_end: receive_headers_end,
298        }
299    }
300    /// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in
301    /// milliseconds relatively to this requestTime.
302    pub fn request_time(&self) -> f64 { self.request_time }
303    /// Started resolving proxy.
304    pub fn proxy_start(&self) -> f64 { self.proxy_start }
305    /// Finished resolving proxy.
306    pub fn proxy_end(&self) -> f64 { self.proxy_end }
307    /// Started DNS address resolve.
308    pub fn dns_start(&self) -> f64 { self.dns_start }
309    /// Finished DNS address resolve.
310    pub fn dns_end(&self) -> f64 { self.dns_end }
311    /// Started connecting to the remote host.
312    pub fn connect_start(&self) -> f64 { self.connect_start }
313    /// Connected to the remote host.
314    pub fn connect_end(&self) -> f64 { self.connect_end }
315    /// Started SSL handshake.
316    pub fn ssl_start(&self) -> f64 { self.ssl_start }
317    /// Finished SSL handshake.
318    pub fn ssl_end(&self) -> f64 { self.ssl_end }
319    /// Started running ServiceWorker.
320    pub fn worker_start(&self) -> f64 { self.worker_start }
321    /// Finished Starting ServiceWorker.
322    pub fn worker_ready(&self) -> f64 { self.worker_ready }
323    /// Started fetch event.
324    pub fn worker_fetch_start(&self) -> f64 { self.worker_fetch_start }
325    /// Settled fetch event respondWith promise.
326    pub fn worker_respond_with_settled(&self) -> f64 { self.worker_respond_with_settled }
327    /// Started ServiceWorker static routing source evaluation.
328    pub fn worker_router_evaluation_start(&self) -> Option<f64> { self.worker_router_evaluation_start }
329    /// Started cache lookup when the source was evaluated to 'cache'.
330    pub fn worker_cache_lookup_start(&self) -> Option<f64> { self.worker_cache_lookup_start }
331    /// Started sending request.
332    pub fn send_start(&self) -> f64 { self.send_start }
333    /// Finished sending request.
334    pub fn send_end(&self) -> f64 { self.send_end }
335    /// Time the server started pushing request.
336    pub fn push_start(&self) -> f64 { self.push_start }
337    /// Time the server finished pushing request.
338    pub fn push_end(&self) -> f64 { self.push_end }
339    /// Started receiving response headers.
340    pub fn receive_headers_start(&self) -> f64 { self.receive_headers_start }
341    /// Finished receiving response headers.
342    pub fn receive_headers_end(&self) -> f64 { self.receive_headers_end }
343}
344
345
346pub struct ResourceTimingBuilder {
347    request_time: f64,
348    proxy_start: f64,
349    proxy_end: f64,
350    dns_start: f64,
351    dns_end: f64,
352    connect_start: f64,
353    connect_end: f64,
354    ssl_start: f64,
355    ssl_end: f64,
356    worker_start: f64,
357    worker_ready: f64,
358    worker_fetch_start: f64,
359    worker_respond_with_settled: f64,
360    worker_router_evaluation_start: Option<f64>,
361    worker_cache_lookup_start: Option<f64>,
362    send_start: f64,
363    send_end: f64,
364    push_start: f64,
365    push_end: f64,
366    receive_headers_start: f64,
367    receive_headers_end: f64,
368}
369
370impl ResourceTimingBuilder {
371    /// Started ServiceWorker static routing source evaluation.
372    pub fn worker_router_evaluation_start(mut self, worker_router_evaluation_start: f64) -> Self { self.worker_router_evaluation_start = Some(worker_router_evaluation_start); self }
373    /// Started cache lookup when the source was evaluated to 'cache'.
374    pub fn worker_cache_lookup_start(mut self, worker_cache_lookup_start: f64) -> Self { self.worker_cache_lookup_start = Some(worker_cache_lookup_start); self }
375    pub fn build(self) -> ResourceTiming {
376        ResourceTiming {
377            request_time: self.request_time,
378            proxy_start: self.proxy_start,
379            proxy_end: self.proxy_end,
380            dns_start: self.dns_start,
381            dns_end: self.dns_end,
382            connect_start: self.connect_start,
383            connect_end: self.connect_end,
384            ssl_start: self.ssl_start,
385            ssl_end: self.ssl_end,
386            worker_start: self.worker_start,
387            worker_ready: self.worker_ready,
388            worker_fetch_start: self.worker_fetch_start,
389            worker_respond_with_settled: self.worker_respond_with_settled,
390            worker_router_evaluation_start: self.worker_router_evaluation_start,
391            worker_cache_lookup_start: self.worker_cache_lookup_start,
392            send_start: self.send_start,
393            send_end: self.send_end,
394            push_start: self.push_start,
395            push_end: self.push_end,
396            receive_headers_start: self.receive_headers_start,
397            receive_headers_end: self.receive_headers_end,
398        }
399    }
400}
401
402/// Loading priority of a resource request.
403
404#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
405pub enum ResourcePriority {
406    #[default]
407    #[serde(rename = "VeryLow")]
408    VeryLow,
409    #[serde(rename = "Low")]
410    Low,
411    #[serde(rename = "Medium")]
412    Medium,
413    #[serde(rename = "High")]
414    High,
415    #[serde(rename = "VeryHigh")]
416    VeryHigh,
417}
418
419/// The render-blocking behavior of a resource request.
420
421#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
422pub enum RenderBlockingBehavior {
423    #[default]
424    #[serde(rename = "Blocking")]
425    Blocking,
426    #[serde(rename = "InBodyParserBlocking")]
427    InBodyParserBlocking,
428    #[serde(rename = "NonBlocking")]
429    NonBlocking,
430    #[serde(rename = "NonBlockingDynamic")]
431    NonBlockingDynamic,
432    #[serde(rename = "PotentiallyBlocking")]
433    PotentiallyBlocking,
434}
435
436/// Post data entry for HTTP request
437
438#[derive(Debug, Clone, Serialize, Deserialize, Default)]
439#[serde(rename_all = "camelCase")]
440pub struct PostDataEntry<'a> {
441    #[serde(skip_serializing_if = "Option::is_none")]
442    bytes: Option<Cow<'a, str>>,
443}
444
445impl<'a> PostDataEntry<'a> {
446    /// Creates a builder for this type.
447    pub fn builder() -> PostDataEntryBuilder<'a> {
448        PostDataEntryBuilder {
449            bytes: None,
450        }
451    }
452    pub fn bytes(&self) -> Option<&str> { self.bytes.as_deref() }
453}
454
455#[derive(Default)]
456pub struct PostDataEntryBuilder<'a> {
457    bytes: Option<Cow<'a, str>>,
458}
459
460impl<'a> PostDataEntryBuilder<'a> {
461    pub fn bytes(mut self, bytes: impl Into<Cow<'a, str>>) -> Self { self.bytes = Some(bytes.into()); self }
462    pub fn build(self) -> PostDataEntry<'a> {
463        PostDataEntry {
464            bytes: self.bytes,
465        }
466    }
467}
468
469/// HTTP request data.
470
471#[derive(Debug, Clone, Serialize, Deserialize, Default)]
472#[serde(rename_all = "camelCase")]
473pub struct Request<'a> {
474    /// Request URL (without fragment).
475    url: Cow<'a, str>,
476    /// Fragment of the requested URL starting with hash, if present.
477    #[serde(skip_serializing_if = "Option::is_none", rename = "urlFragment")]
478    url_fragment: Option<Cow<'a, str>>,
479    /// HTTP request method.
480    method: Cow<'a, str>,
481    /// HTTP request headers.
482    headers: Headers,
483    /// HTTP POST request data.
484    /// Use postDataEntries instead.
485    #[serde(skip_serializing_if = "Option::is_none", rename = "postData")]
486    post_data: Option<Cow<'a, str>>,
487    /// True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.
488    #[serde(skip_serializing_if = "Option::is_none", rename = "hasPostData")]
489    has_post_data: Option<bool>,
490    /// Request body elements (post data broken into individual entries).
491    #[serde(skip_serializing_if = "Option::is_none", rename = "postDataEntries")]
492    post_data_entries: Option<Vec<PostDataEntry<'a>>>,
493    /// The mixed content type of the request.
494    #[serde(skip_serializing_if = "Option::is_none", rename = "mixedContentType")]
495    mixed_content_type: Option<crate::security::MixedContentType>,
496    /// Priority of the resource request at the time request is sent.
497    #[serde(rename = "initialPriority")]
498    initial_priority: ResourcePriority,
499    /// The referrer policy of the request, as defined in <https://www.w3.org/TR/referrer-policy/>
500    #[serde(rename = "referrerPolicy")]
501    referrer_policy: Cow<'a, str>,
502    /// Whether is loaded via link preload.
503    #[serde(skip_serializing_if = "Option::is_none", rename = "isLinkPreload")]
504    is_link_preload: Option<bool>,
505    /// Set for requests when the TrustToken API is used. Contains the parameters
506    /// passed by the developer (e.g. via "fetch") as understood by the backend.
507    #[serde(skip_serializing_if = "Option::is_none", rename = "trustTokenParams")]
508    trust_token_params: Option<TrustTokenParams<'a>>,
509    /// True if this resource request is considered to be the 'same site' as the
510    /// request corresponding to the main frame.
511    #[serde(skip_serializing_if = "Option::is_none", rename = "isSameSite")]
512    is_same_site: Option<bool>,
513    /// True when the resource request is ad-related.
514    #[serde(skip_serializing_if = "Option::is_none", rename = "isAdRelated")]
515    is_ad_related: Option<bool>,
516}
517
518impl<'a> Request<'a> {
519    /// Creates a builder for this type with the required parameters:
520    /// * `url`: Request URL (without fragment).
521    /// * `method`: HTTP request method.
522    /// * `headers`: HTTP request headers.
523    /// * `initial_priority`: Priority of the resource request at the time request is sent.
524    /// * `referrer_policy`: The referrer policy of the request, as defined in <https://www.w3.org/TR/referrer-policy/>
525    pub fn builder(url: impl Into<Cow<'a, str>>, method: impl Into<Cow<'a, str>>, headers: Headers, initial_priority: impl Into<ResourcePriority>, referrer_policy: impl Into<Cow<'a, str>>) -> RequestBuilder<'a> {
526        RequestBuilder {
527            url: url.into(),
528            url_fragment: None,
529            method: method.into(),
530            headers: headers,
531            post_data: None,
532            has_post_data: None,
533            post_data_entries: None,
534            mixed_content_type: None,
535            initial_priority: initial_priority.into(),
536            referrer_policy: referrer_policy.into(),
537            is_link_preload: None,
538            trust_token_params: None,
539            is_same_site: None,
540            is_ad_related: None,
541        }
542    }
543    /// Request URL (without fragment).
544    pub fn url(&self) -> &str { self.url.as_ref() }
545    /// Fragment of the requested URL starting with hash, if present.
546    pub fn url_fragment(&self) -> Option<&str> { self.url_fragment.as_deref() }
547    /// HTTP request method.
548    pub fn method(&self) -> &str { self.method.as_ref() }
549    /// HTTP request headers.
550    pub fn headers(&self) -> &Headers { &self.headers }
551    /// HTTP POST request data.
552    /// Use postDataEntries instead.
553    pub fn post_data(&self) -> Option<&str> { self.post_data.as_deref() }
554    /// True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.
555    pub fn has_post_data(&self) -> Option<bool> { self.has_post_data }
556    /// Request body elements (post data broken into individual entries).
557    pub fn post_data_entries(&self) -> Option<&[PostDataEntry<'a>]> { self.post_data_entries.as_deref() }
558    /// The mixed content type of the request.
559    pub fn mixed_content_type(&self) -> Option<&crate::security::MixedContentType> { self.mixed_content_type.as_ref() }
560    /// Priority of the resource request at the time request is sent.
561    pub fn initial_priority(&self) -> &ResourcePriority { &self.initial_priority }
562    /// The referrer policy of the request, as defined in <https://www.w3.org/TR/referrer-policy/>
563    pub fn referrer_policy(&self) -> &str { self.referrer_policy.as_ref() }
564    /// Whether is loaded via link preload.
565    pub fn is_link_preload(&self) -> Option<bool> { self.is_link_preload }
566    /// Set for requests when the TrustToken API is used. Contains the parameters
567    /// passed by the developer (e.g. via "fetch") as understood by the backend.
568    pub fn trust_token_params(&self) -> Option<&TrustTokenParams<'a>> { self.trust_token_params.as_ref() }
569    /// True if this resource request is considered to be the 'same site' as the
570    /// request corresponding to the main frame.
571    pub fn is_same_site(&self) -> Option<bool> { self.is_same_site }
572    /// True when the resource request is ad-related.
573    pub fn is_ad_related(&self) -> Option<bool> { self.is_ad_related }
574}
575
576
577pub struct RequestBuilder<'a> {
578    url: Cow<'a, str>,
579    url_fragment: Option<Cow<'a, str>>,
580    method: Cow<'a, str>,
581    headers: Headers,
582    post_data: Option<Cow<'a, str>>,
583    has_post_data: Option<bool>,
584    post_data_entries: Option<Vec<PostDataEntry<'a>>>,
585    mixed_content_type: Option<crate::security::MixedContentType>,
586    initial_priority: ResourcePriority,
587    referrer_policy: Cow<'a, str>,
588    is_link_preload: Option<bool>,
589    trust_token_params: Option<TrustTokenParams<'a>>,
590    is_same_site: Option<bool>,
591    is_ad_related: Option<bool>,
592}
593
594impl<'a> RequestBuilder<'a> {
595    /// Fragment of the requested URL starting with hash, if present.
596    pub fn url_fragment(mut self, url_fragment: impl Into<Cow<'a, str>>) -> Self { self.url_fragment = Some(url_fragment.into()); self }
597    /// HTTP POST request data.
598    /// Use postDataEntries instead.
599    pub fn post_data(mut self, post_data: impl Into<Cow<'a, str>>) -> Self { self.post_data = Some(post_data.into()); self }
600    /// True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.
601    pub fn has_post_data(mut self, has_post_data: bool) -> Self { self.has_post_data = Some(has_post_data); self }
602    /// Request body elements (post data broken into individual entries).
603    pub fn post_data_entries(mut self, post_data_entries: Vec<PostDataEntry<'a>>) -> Self { self.post_data_entries = Some(post_data_entries); self }
604    /// The mixed content type of the request.
605    pub fn mixed_content_type(mut self, mixed_content_type: crate::security::MixedContentType) -> Self { self.mixed_content_type = Some(mixed_content_type); self }
606    /// Whether is loaded via link preload.
607    pub fn is_link_preload(mut self, is_link_preload: bool) -> Self { self.is_link_preload = Some(is_link_preload); self }
608    /// Set for requests when the TrustToken API is used. Contains the parameters
609    /// passed by the developer (e.g. via "fetch") as understood by the backend.
610    pub fn trust_token_params(mut self, trust_token_params: TrustTokenParams<'a>) -> Self { self.trust_token_params = Some(trust_token_params); self }
611    /// True if this resource request is considered to be the 'same site' as the
612    /// request corresponding to the main frame.
613    pub fn is_same_site(mut self, is_same_site: bool) -> Self { self.is_same_site = Some(is_same_site); self }
614    /// True when the resource request is ad-related.
615    pub fn is_ad_related(mut self, is_ad_related: bool) -> Self { self.is_ad_related = Some(is_ad_related); self }
616    pub fn build(self) -> Request<'a> {
617        Request {
618            url: self.url,
619            url_fragment: self.url_fragment,
620            method: self.method,
621            headers: self.headers,
622            post_data: self.post_data,
623            has_post_data: self.has_post_data,
624            post_data_entries: self.post_data_entries,
625            mixed_content_type: self.mixed_content_type,
626            initial_priority: self.initial_priority,
627            referrer_policy: self.referrer_policy,
628            is_link_preload: self.is_link_preload,
629            trust_token_params: self.trust_token_params,
630            is_same_site: self.is_same_site,
631            is_ad_related: self.is_ad_related,
632        }
633    }
634}
635
636/// Details of a signed certificate timestamp (SCT).
637
638#[derive(Debug, Clone, Serialize, Deserialize, Default)]
639#[serde(rename_all = "camelCase")]
640pub struct SignedCertificateTimestamp<'a> {
641    /// Validation status.
642    status: Cow<'a, str>,
643    /// Origin.
644    origin: Cow<'a, str>,
645    /// Log name / description.
646    #[serde(rename = "logDescription")]
647    log_description: Cow<'a, str>,
648    /// Log ID.
649    #[serde(rename = "logId")]
650    log_id: Cow<'a, str>,
651    /// Issuance date. Unlike TimeSinceEpoch, this contains the number of
652    /// milliseconds since January 1, 1970, UTC, not the number of seconds.
653    timestamp: f64,
654    /// Hash algorithm.
655    #[serde(rename = "hashAlgorithm")]
656    hash_algorithm: Cow<'a, str>,
657    /// Signature algorithm.
658    #[serde(rename = "signatureAlgorithm")]
659    signature_algorithm: Cow<'a, str>,
660    /// Signature data.
661    #[serde(rename = "signatureData")]
662    signature_data: Cow<'a, str>,
663}
664
665impl<'a> SignedCertificateTimestamp<'a> {
666    /// Creates a builder for this type with the required parameters:
667    /// * `status`: Validation status.
668    /// * `origin`: Origin.
669    /// * `log_description`: Log name / description.
670    /// * `log_id`: Log ID.
671    /// * `timestamp`: Issuance date. Unlike TimeSinceEpoch, this contains the number of milliseconds since January 1, 1970, UTC, not the number of seconds.
672    /// * `hash_algorithm`: Hash algorithm.
673    /// * `signature_algorithm`: Signature algorithm.
674    /// * `signature_data`: Signature data.
675    pub fn builder(status: impl Into<Cow<'a, str>>, origin: impl Into<Cow<'a, str>>, log_description: impl Into<Cow<'a, str>>, log_id: impl Into<Cow<'a, str>>, timestamp: f64, hash_algorithm: impl Into<Cow<'a, str>>, signature_algorithm: impl Into<Cow<'a, str>>, signature_data: impl Into<Cow<'a, str>>) -> SignedCertificateTimestampBuilder<'a> {
676        SignedCertificateTimestampBuilder {
677            status: status.into(),
678            origin: origin.into(),
679            log_description: log_description.into(),
680            log_id: log_id.into(),
681            timestamp: timestamp,
682            hash_algorithm: hash_algorithm.into(),
683            signature_algorithm: signature_algorithm.into(),
684            signature_data: signature_data.into(),
685        }
686    }
687    /// Validation status.
688    pub fn status(&self) -> &str { self.status.as_ref() }
689    /// Origin.
690    pub fn origin(&self) -> &str { self.origin.as_ref() }
691    /// Log name / description.
692    pub fn log_description(&self) -> &str { self.log_description.as_ref() }
693    /// Log ID.
694    pub fn log_id(&self) -> &str { self.log_id.as_ref() }
695    /// Issuance date. Unlike TimeSinceEpoch, this contains the number of
696    /// milliseconds since January 1, 1970, UTC, not the number of seconds.
697    pub fn timestamp(&self) -> f64 { self.timestamp }
698    /// Hash algorithm.
699    pub fn hash_algorithm(&self) -> &str { self.hash_algorithm.as_ref() }
700    /// Signature algorithm.
701    pub fn signature_algorithm(&self) -> &str { self.signature_algorithm.as_ref() }
702    /// Signature data.
703    pub fn signature_data(&self) -> &str { self.signature_data.as_ref() }
704}
705
706
707pub struct SignedCertificateTimestampBuilder<'a> {
708    status: Cow<'a, str>,
709    origin: Cow<'a, str>,
710    log_description: Cow<'a, str>,
711    log_id: Cow<'a, str>,
712    timestamp: f64,
713    hash_algorithm: Cow<'a, str>,
714    signature_algorithm: Cow<'a, str>,
715    signature_data: Cow<'a, str>,
716}
717
718impl<'a> SignedCertificateTimestampBuilder<'a> {
719    pub fn build(self) -> SignedCertificateTimestamp<'a> {
720        SignedCertificateTimestamp {
721            status: self.status,
722            origin: self.origin,
723            log_description: self.log_description,
724            log_id: self.log_id,
725            timestamp: self.timestamp,
726            hash_algorithm: self.hash_algorithm,
727            signature_algorithm: self.signature_algorithm,
728            signature_data: self.signature_data,
729        }
730    }
731}
732
733/// Security details about a request.
734
735#[derive(Debug, Clone, Serialize, Deserialize, Default)]
736#[serde(rename_all = "camelCase")]
737pub struct SecurityDetails<'a> {
738    /// Protocol name (e.g. "TLS 1.2" or "QUIC").
739    protocol: Cow<'a, str>,
740    /// Key Exchange used by the connection, or the empty string if not applicable.
741    #[serde(rename = "keyExchange")]
742    key_exchange: Cow<'a, str>,
743    /// (EC)DH group used by the connection, if applicable.
744    #[serde(skip_serializing_if = "Option::is_none", rename = "keyExchangeGroup")]
745    key_exchange_group: Option<Cow<'a, str>>,
746    /// Cipher name.
747    cipher: Cow<'a, str>,
748    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
749    #[serde(skip_serializing_if = "Option::is_none")]
750    mac: Option<Cow<'a, str>>,
751    /// Certificate ID value.
752    #[serde(rename = "certificateId")]
753    certificate_id: crate::security::CertificateId,
754    /// Certificate subject name.
755    #[serde(rename = "subjectName")]
756    subject_name: Cow<'a, str>,
757    /// Subject Alternative Name (SAN) DNS names and IP addresses.
758    #[serde(rename = "sanList")]
759    san_list: Vec<Cow<'a, str>>,
760    /// Name of the issuing CA.
761    issuer: Cow<'a, str>,
762    /// Certificate valid from date.
763    #[serde(rename = "validFrom")]
764    valid_from: TimeSinceEpoch,
765    /// Certificate valid to (expiration) date
766    #[serde(rename = "validTo")]
767    valid_to: TimeSinceEpoch,
768    /// List of signed certificate timestamps (SCTs).
769    #[serde(rename = "signedCertificateTimestampList")]
770    signed_certificate_timestamp_list: Vec<SignedCertificateTimestamp<'a>>,
771    /// Whether the request complied with Certificate Transparency policy
772    #[serde(rename = "certificateTransparencyCompliance")]
773    certificate_transparency_compliance: CertificateTransparencyCompliance,
774    /// The signature algorithm used by the server in the TLS server signature,
775    /// represented as a TLS SignatureScheme code point. Omitted if not
776    /// applicable or not known.
777    #[serde(skip_serializing_if = "Option::is_none", rename = "serverSignatureAlgorithm")]
778    server_signature_algorithm: Option<i64>,
779    /// Whether the connection used Encrypted ClientHello
780    #[serde(rename = "encryptedClientHello")]
781    encrypted_client_hello: bool,
782}
783
784impl<'a> SecurityDetails<'a> {
785    /// Creates a builder for this type with the required parameters:
786    /// * `protocol`: Protocol name (e.g. "TLS 1.2" or "QUIC").
787    /// * `key_exchange`: Key Exchange used by the connection, or the empty string if not applicable.
788    /// * `cipher`: Cipher name.
789    /// * `certificate_id`: Certificate ID value.
790    /// * `subject_name`: Certificate subject name.
791    /// * `san_list`: Subject Alternative Name (SAN) DNS names and IP addresses.
792    /// * `issuer`: Name of the issuing CA.
793    /// * `valid_from`: Certificate valid from date.
794    /// * `valid_to`: Certificate valid to (expiration) date
795    /// * `signed_certificate_timestamp_list`: List of signed certificate timestamps (SCTs).
796    /// * `certificate_transparency_compliance`: Whether the request complied with Certificate Transparency policy
797    /// * `encrypted_client_hello`: Whether the connection used Encrypted ClientHello
798    pub fn builder(protocol: impl Into<Cow<'a, str>>, key_exchange: impl Into<Cow<'a, str>>, cipher: impl Into<Cow<'a, str>>, certificate_id: crate::security::CertificateId, subject_name: impl Into<Cow<'a, str>>, san_list: Vec<Cow<'a, str>>, issuer: impl Into<Cow<'a, str>>, valid_from: TimeSinceEpoch, valid_to: TimeSinceEpoch, signed_certificate_timestamp_list: Vec<SignedCertificateTimestamp<'a>>, certificate_transparency_compliance: impl Into<CertificateTransparencyCompliance>, encrypted_client_hello: bool) -> SecurityDetailsBuilder<'a> {
799        SecurityDetailsBuilder {
800            protocol: protocol.into(),
801            key_exchange: key_exchange.into(),
802            key_exchange_group: None,
803            cipher: cipher.into(),
804            mac: None,
805            certificate_id: certificate_id,
806            subject_name: subject_name.into(),
807            san_list: san_list,
808            issuer: issuer.into(),
809            valid_from: valid_from,
810            valid_to: valid_to,
811            signed_certificate_timestamp_list: signed_certificate_timestamp_list,
812            certificate_transparency_compliance: certificate_transparency_compliance.into(),
813            server_signature_algorithm: None,
814            encrypted_client_hello: encrypted_client_hello,
815        }
816    }
817    /// Protocol name (e.g. "TLS 1.2" or "QUIC").
818    pub fn protocol(&self) -> &str { self.protocol.as_ref() }
819    /// Key Exchange used by the connection, or the empty string if not applicable.
820    pub fn key_exchange(&self) -> &str { self.key_exchange.as_ref() }
821    /// (EC)DH group used by the connection, if applicable.
822    pub fn key_exchange_group(&self) -> Option<&str> { self.key_exchange_group.as_deref() }
823    /// Cipher name.
824    pub fn cipher(&self) -> &str { self.cipher.as_ref() }
825    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
826    pub fn mac(&self) -> Option<&str> { self.mac.as_deref() }
827    /// Certificate ID value.
828    pub fn certificate_id(&self) -> &crate::security::CertificateId { &self.certificate_id }
829    /// Certificate subject name.
830    pub fn subject_name(&self) -> &str { self.subject_name.as_ref() }
831    /// Subject Alternative Name (SAN) DNS names and IP addresses.
832    pub fn san_list(&self) -> &[Cow<'a, str>] { &self.san_list }
833    /// Name of the issuing CA.
834    pub fn issuer(&self) -> &str { self.issuer.as_ref() }
835    /// Certificate valid from date.
836    pub fn valid_from(&self) -> &TimeSinceEpoch { &self.valid_from }
837    /// Certificate valid to (expiration) date
838    pub fn valid_to(&self) -> &TimeSinceEpoch { &self.valid_to }
839    /// List of signed certificate timestamps (SCTs).
840    pub fn signed_certificate_timestamp_list(&self) -> &[SignedCertificateTimestamp<'a>] { &self.signed_certificate_timestamp_list }
841    /// Whether the request complied with Certificate Transparency policy
842    pub fn certificate_transparency_compliance(&self) -> &CertificateTransparencyCompliance { &self.certificate_transparency_compliance }
843    /// The signature algorithm used by the server in the TLS server signature,
844    /// represented as a TLS SignatureScheme code point. Omitted if not
845    /// applicable or not known.
846    pub fn server_signature_algorithm(&self) -> Option<i64> { self.server_signature_algorithm }
847    /// Whether the connection used Encrypted ClientHello
848    pub fn encrypted_client_hello(&self) -> bool { self.encrypted_client_hello }
849}
850
851
852pub struct SecurityDetailsBuilder<'a> {
853    protocol: Cow<'a, str>,
854    key_exchange: Cow<'a, str>,
855    key_exchange_group: Option<Cow<'a, str>>,
856    cipher: Cow<'a, str>,
857    mac: Option<Cow<'a, str>>,
858    certificate_id: crate::security::CertificateId,
859    subject_name: Cow<'a, str>,
860    san_list: Vec<Cow<'a, str>>,
861    issuer: Cow<'a, str>,
862    valid_from: TimeSinceEpoch,
863    valid_to: TimeSinceEpoch,
864    signed_certificate_timestamp_list: Vec<SignedCertificateTimestamp<'a>>,
865    certificate_transparency_compliance: CertificateTransparencyCompliance,
866    server_signature_algorithm: Option<i64>,
867    encrypted_client_hello: bool,
868}
869
870impl<'a> SecurityDetailsBuilder<'a> {
871    /// (EC)DH group used by the connection, if applicable.
872    pub fn key_exchange_group(mut self, key_exchange_group: impl Into<Cow<'a, str>>) -> Self { self.key_exchange_group = Some(key_exchange_group.into()); self }
873    /// TLS MAC. Note that AEAD ciphers do not have separate MACs.
874    pub fn mac(mut self, mac: impl Into<Cow<'a, str>>) -> Self { self.mac = Some(mac.into()); self }
875    /// The signature algorithm used by the server in the TLS server signature,
876    /// represented as a TLS SignatureScheme code point. Omitted if not
877    /// applicable or not known.
878    pub fn server_signature_algorithm(mut self, server_signature_algorithm: i64) -> Self { self.server_signature_algorithm = Some(server_signature_algorithm); self }
879    pub fn build(self) -> SecurityDetails<'a> {
880        SecurityDetails {
881            protocol: self.protocol,
882            key_exchange: self.key_exchange,
883            key_exchange_group: self.key_exchange_group,
884            cipher: self.cipher,
885            mac: self.mac,
886            certificate_id: self.certificate_id,
887            subject_name: self.subject_name,
888            san_list: self.san_list,
889            issuer: self.issuer,
890            valid_from: self.valid_from,
891            valid_to: self.valid_to,
892            signed_certificate_timestamp_list: self.signed_certificate_timestamp_list,
893            certificate_transparency_compliance: self.certificate_transparency_compliance,
894            server_signature_algorithm: self.server_signature_algorithm,
895            encrypted_client_hello: self.encrypted_client_hello,
896        }
897    }
898}
899
900/// Whether the request complied with Certificate Transparency policy.
901
902#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
903pub enum CertificateTransparencyCompliance {
904    #[default]
905    #[serde(rename = "unknown")]
906    Unknown,
907    #[serde(rename = "not-compliant")]
908    NotCompliant,
909    #[serde(rename = "compliant")]
910    Compliant,
911}
912
913/// The reason why request was blocked.
914
915#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
916pub enum BlockedReason {
917    #[default]
918    #[serde(rename = "other")]
919    Other,
920    #[serde(rename = "csp")]
921    Csp,
922    #[serde(rename = "mixed-content")]
923    MixedContent,
924    #[serde(rename = "origin")]
925    Origin,
926    #[serde(rename = "inspector")]
927    Inspector,
928    #[serde(rename = "integrity")]
929    Integrity,
930    #[serde(rename = "subresource-filter")]
931    SubresourceFilter,
932    #[serde(rename = "content-type")]
933    ContentType,
934    #[serde(rename = "coep-frame-resource-needs-coep-header")]
935    CoepFrameResourceNeedsCoepHeader,
936    #[serde(rename = "coop-sandboxed-iframe-cannot-navigate-to-coop-page")]
937    CoopSandboxedIframeCannotNavigateToCoopPage,
938    #[serde(rename = "corp-not-same-origin")]
939    CorpNotSameOrigin,
940    #[serde(rename = "corp-not-same-origin-after-defaulted-to-same-origin-by-coep")]
941    CorpNotSameOriginAfterDefaultedToSameOriginByCoep,
942    #[serde(rename = "corp-not-same-origin-after-defaulted-to-same-origin-by-dip")]
943    CorpNotSameOriginAfterDefaultedToSameOriginByDip,
944    #[serde(rename = "corp-not-same-origin-after-defaulted-to-same-origin-by-coep-and-dip")]
945    CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip,
946    #[serde(rename = "corp-not-same-site")]
947    CorpNotSameSite,
948    #[serde(rename = "sri-message-signature-mismatch")]
949    SriMessageSignatureMismatch,
950}
951
952/// The reason why request was blocked.
953
954#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
955pub enum CorsError {
956    #[default]
957    #[serde(rename = "DisallowedByMode")]
958    DisallowedByMode,
959    #[serde(rename = "InvalidResponse")]
960    InvalidResponse,
961    #[serde(rename = "WildcardOriginNotAllowed")]
962    WildcardOriginNotAllowed,
963    #[serde(rename = "MissingAllowOriginHeader")]
964    MissingAllowOriginHeader,
965    #[serde(rename = "MultipleAllowOriginValues")]
966    MultipleAllowOriginValues,
967    #[serde(rename = "InvalidAllowOriginValue")]
968    InvalidAllowOriginValue,
969    #[serde(rename = "AllowOriginMismatch")]
970    AllowOriginMismatch,
971    #[serde(rename = "InvalidAllowCredentials")]
972    InvalidAllowCredentials,
973    #[serde(rename = "CorsDisabledScheme")]
974    CorsDisabledScheme,
975    #[serde(rename = "PreflightInvalidStatus")]
976    PreflightInvalidStatus,
977    #[serde(rename = "PreflightDisallowedRedirect")]
978    PreflightDisallowedRedirect,
979    #[serde(rename = "PreflightWildcardOriginNotAllowed")]
980    PreflightWildcardOriginNotAllowed,
981    #[serde(rename = "PreflightMissingAllowOriginHeader")]
982    PreflightMissingAllowOriginHeader,
983    #[serde(rename = "PreflightMultipleAllowOriginValues")]
984    PreflightMultipleAllowOriginValues,
985    #[serde(rename = "PreflightInvalidAllowOriginValue")]
986    PreflightInvalidAllowOriginValue,
987    #[serde(rename = "PreflightAllowOriginMismatch")]
988    PreflightAllowOriginMismatch,
989    #[serde(rename = "PreflightInvalidAllowCredentials")]
990    PreflightInvalidAllowCredentials,
991    #[serde(rename = "PreflightMissingAllowExternal")]
992    PreflightMissingAllowExternal,
993    #[serde(rename = "PreflightInvalidAllowExternal")]
994    PreflightInvalidAllowExternal,
995    #[serde(rename = "InvalidAllowMethodsPreflightResponse")]
996    InvalidAllowMethodsPreflightResponse,
997    #[serde(rename = "InvalidAllowHeadersPreflightResponse")]
998    InvalidAllowHeadersPreflightResponse,
999    #[serde(rename = "MethodDisallowedByPreflightResponse")]
1000    MethodDisallowedByPreflightResponse,
1001    #[serde(rename = "HeaderDisallowedByPreflightResponse")]
1002    HeaderDisallowedByPreflightResponse,
1003    #[serde(rename = "RedirectContainsCredentials")]
1004    RedirectContainsCredentials,
1005    #[serde(rename = "InsecureLocalNetwork")]
1006    InsecureLocalNetwork,
1007    #[serde(rename = "InvalidLocalNetworkAccess")]
1008    InvalidLocalNetworkAccess,
1009    #[serde(rename = "NoCorsRedirectModeNotFollow")]
1010    NoCorsRedirectModeNotFollow,
1011    #[serde(rename = "LocalNetworkAccessPermissionDenied")]
1012    LocalNetworkAccessPermissionDenied,
1013}
1014
1015
1016#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1017#[serde(rename_all = "camelCase")]
1018pub struct CorsErrorStatus<'a> {
1019    #[serde(rename = "corsError")]
1020    cors_error: CorsError,
1021    #[serde(rename = "failedParameter")]
1022    failed_parameter: Cow<'a, str>,
1023}
1024
1025impl<'a> CorsErrorStatus<'a> {
1026    /// Creates a builder for this type with the required parameters:
1027    /// * `cors_error`: 
1028    /// * `failed_parameter`: 
1029    pub fn builder(cors_error: impl Into<CorsError>, failed_parameter: impl Into<Cow<'a, str>>) -> CorsErrorStatusBuilder<'a> {
1030        CorsErrorStatusBuilder {
1031            cors_error: cors_error.into(),
1032            failed_parameter: failed_parameter.into(),
1033        }
1034    }
1035    pub fn cors_error(&self) -> &CorsError { &self.cors_error }
1036    pub fn failed_parameter(&self) -> &str { self.failed_parameter.as_ref() }
1037}
1038
1039
1040pub struct CorsErrorStatusBuilder<'a> {
1041    cors_error: CorsError,
1042    failed_parameter: Cow<'a, str>,
1043}
1044
1045impl<'a> CorsErrorStatusBuilder<'a> {
1046    pub fn build(self) -> CorsErrorStatus<'a> {
1047        CorsErrorStatus {
1048            cors_error: self.cors_error,
1049            failed_parameter: self.failed_parameter,
1050        }
1051    }
1052}
1053
1054/// Source of serviceworker response.
1055
1056#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1057pub enum ServiceWorkerResponseSource {
1058    #[default]
1059    #[serde(rename = "cache-storage")]
1060    CacheStorage,
1061    #[serde(rename = "http-cache")]
1062    HttpCache,
1063    #[serde(rename = "fallback-code")]
1064    FallbackCode,
1065    #[serde(rename = "network")]
1066    Network,
1067}
1068
1069/// Determines what type of Trust Token operation is executed and
1070/// depending on the type, some additional parameters. The values
1071/// are specified in third_party/blink/renderer/core/fetch/trust_token.idl.
1072
1073#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1074#[serde(rename_all = "camelCase")]
1075pub struct TrustTokenParams<'a> {
1076    operation: TrustTokenOperationType,
1077    /// Only set for "token-redemption" operation and determine whether
1078    /// to request a fresh SRR or use a still valid cached SRR.
1079    #[serde(rename = "refreshPolicy")]
1080    refresh_policy: Cow<'a, str>,
1081    /// Origins of issuers from whom to request tokens or redemption
1082    /// records.
1083    #[serde(skip_serializing_if = "Option::is_none")]
1084    issuers: Option<Vec<Cow<'a, str>>>,
1085}
1086
1087impl<'a> TrustTokenParams<'a> {
1088    /// Creates a builder for this type with the required parameters:
1089    /// * `operation`: 
1090    /// * `refresh_policy`: Only set for "token-redemption" operation and determine whether to request a fresh SRR or use a still valid cached SRR.
1091    pub fn builder(operation: impl Into<TrustTokenOperationType>, refresh_policy: impl Into<Cow<'a, str>>) -> TrustTokenParamsBuilder<'a> {
1092        TrustTokenParamsBuilder {
1093            operation: operation.into(),
1094            refresh_policy: refresh_policy.into(),
1095            issuers: None,
1096        }
1097    }
1098    pub fn operation(&self) -> &TrustTokenOperationType { &self.operation }
1099    /// Only set for "token-redemption" operation and determine whether
1100    /// to request a fresh SRR or use a still valid cached SRR.
1101    pub fn refresh_policy(&self) -> &str { self.refresh_policy.as_ref() }
1102    /// Origins of issuers from whom to request tokens or redemption
1103    /// records.
1104    pub fn issuers(&self) -> Option<&[Cow<'a, str>]> { self.issuers.as_deref() }
1105}
1106
1107
1108pub struct TrustTokenParamsBuilder<'a> {
1109    operation: TrustTokenOperationType,
1110    refresh_policy: Cow<'a, str>,
1111    issuers: Option<Vec<Cow<'a, str>>>,
1112}
1113
1114impl<'a> TrustTokenParamsBuilder<'a> {
1115    /// Origins of issuers from whom to request tokens or redemption
1116    /// records.
1117    pub fn issuers(mut self, issuers: Vec<Cow<'a, str>>) -> Self { self.issuers = Some(issuers); self }
1118    pub fn build(self) -> TrustTokenParams<'a> {
1119        TrustTokenParams {
1120            operation: self.operation,
1121            refresh_policy: self.refresh_policy,
1122            issuers: self.issuers,
1123        }
1124    }
1125}
1126
1127
1128#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1129pub enum TrustTokenOperationType {
1130    #[default]
1131    #[serde(rename = "Issuance")]
1132    Issuance,
1133    #[serde(rename = "Redemption")]
1134    Redemption,
1135    #[serde(rename = "Signing")]
1136    Signing,
1137}
1138
1139/// The reason why Chrome uses a specific transport protocol for HTTP semantics.
1140
1141#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1142pub enum AlternateProtocolUsage {
1143    #[default]
1144    #[serde(rename = "alternativeJobWonWithoutRace")]
1145    AlternativeJobWonWithoutRace,
1146    #[serde(rename = "alternativeJobWonRace")]
1147    AlternativeJobWonRace,
1148    #[serde(rename = "mainJobWonRace")]
1149    MainJobWonRace,
1150    #[serde(rename = "mappingMissing")]
1151    MappingMissing,
1152    #[serde(rename = "broken")]
1153    Broken,
1154    #[serde(rename = "dnsAlpnH3JobWonWithoutRace")]
1155    DnsAlpnH3JobWonWithoutRace,
1156    #[serde(rename = "dnsAlpnH3JobWonRace")]
1157    DnsAlpnH3JobWonRace,
1158    #[serde(rename = "unspecifiedReason")]
1159    UnspecifiedReason,
1160}
1161
1162/// Source of service worker router.
1163
1164#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
1165pub enum ServiceWorkerRouterSource {
1166    #[default]
1167    #[serde(rename = "network")]
1168    Network,
1169    #[serde(rename = "cache")]
1170    Cache,
1171    #[serde(rename = "fetch-event")]
1172    FetchEvent,
1173    #[serde(rename = "race-network-and-fetch-handler")]
1174    RaceNetworkAndFetchHandler,
1175    #[serde(rename = "race-network-and-cache")]
1176    RaceNetworkAndCache,
1177}
1178
1179
1180#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1181#[serde(rename_all = "camelCase")]
1182pub struct ServiceWorkerRouterInfo {
1183    /// ID of the rule matched. If there is a matched rule, this field will
1184    /// be set, otherwiser no value will be set.
1185    #[serde(skip_serializing_if = "Option::is_none", rename = "ruleIdMatched")]
1186    rule_id_matched: Option<u64>,
1187    /// The router source of the matched rule. If there is a matched rule, this
1188    /// field will be set, otherwise no value will be set.
1189    #[serde(skip_serializing_if = "Option::is_none", rename = "matchedSourceType")]
1190    matched_source_type: Option<ServiceWorkerRouterSource>,
1191    /// The actual router source used.
1192    #[serde(skip_serializing_if = "Option::is_none", rename = "actualSourceType")]
1193    actual_source_type: Option<ServiceWorkerRouterSource>,
1194}
1195
1196impl ServiceWorkerRouterInfo {
1197    /// Creates a builder for this type.
1198    pub fn builder() -> ServiceWorkerRouterInfoBuilder {
1199        ServiceWorkerRouterInfoBuilder {
1200            rule_id_matched: None,
1201            matched_source_type: None,
1202            actual_source_type: None,
1203        }
1204    }
1205    /// ID of the rule matched. If there is a matched rule, this field will
1206    /// be set, otherwiser no value will be set.
1207    pub fn rule_id_matched(&self) -> Option<u64> { self.rule_id_matched }
1208    /// The router source of the matched rule. If there is a matched rule, this
1209    /// field will be set, otherwise no value will be set.
1210    pub fn matched_source_type(&self) -> Option<&ServiceWorkerRouterSource> { self.matched_source_type.as_ref() }
1211    /// The actual router source used.
1212    pub fn actual_source_type(&self) -> Option<&ServiceWorkerRouterSource> { self.actual_source_type.as_ref() }
1213}
1214
1215#[derive(Default)]
1216pub struct ServiceWorkerRouterInfoBuilder {
1217    rule_id_matched: Option<u64>,
1218    matched_source_type: Option<ServiceWorkerRouterSource>,
1219    actual_source_type: Option<ServiceWorkerRouterSource>,
1220}
1221
1222impl ServiceWorkerRouterInfoBuilder {
1223    /// ID of the rule matched. If there is a matched rule, this field will
1224    /// be set, otherwiser no value will be set.
1225    pub fn rule_id_matched(mut self, rule_id_matched: u64) -> Self { self.rule_id_matched = Some(rule_id_matched); self }
1226    /// The router source of the matched rule. If there is a matched rule, this
1227    /// field will be set, otherwise no value will be set.
1228    pub fn matched_source_type(mut self, matched_source_type: impl Into<ServiceWorkerRouterSource>) -> Self { self.matched_source_type = Some(matched_source_type.into()); self }
1229    /// The actual router source used.
1230    pub fn actual_source_type(mut self, actual_source_type: impl Into<ServiceWorkerRouterSource>) -> Self { self.actual_source_type = Some(actual_source_type.into()); self }
1231    pub fn build(self) -> ServiceWorkerRouterInfo {
1232        ServiceWorkerRouterInfo {
1233            rule_id_matched: self.rule_id_matched,
1234            matched_source_type: self.matched_source_type,
1235            actual_source_type: self.actual_source_type,
1236        }
1237    }
1238}
1239
1240/// HTTP response data.
1241
1242#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1243#[serde(rename_all = "camelCase")]
1244pub struct Response<'a> {
1245    /// Response URL. This URL can be different from CachedResource.url in case of redirect.
1246    url: Cow<'a, str>,
1247    /// HTTP response status code.
1248    status: i64,
1249    /// HTTP response status text.
1250    #[serde(rename = "statusText")]
1251    status_text: Cow<'a, str>,
1252    /// HTTP response headers.
1253    headers: Headers,
1254    /// HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo.
1255    #[serde(skip_serializing_if = "Option::is_none", rename = "headersText")]
1256    headers_text: Option<Cow<'a, str>>,
1257    /// Resource mimeType as determined by the browser.
1258    #[serde(rename = "mimeType")]
1259    mime_type: Cow<'a, str>,
1260    /// Resource charset as determined by the browser (if applicable).
1261    charset: Cow<'a, str>,
1262    /// Refined HTTP request headers that were actually transmitted over the network.
1263    #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeaders")]
1264    request_headers: Option<Headers>,
1265    /// HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo.
1266    #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeadersText")]
1267    request_headers_text: Option<Cow<'a, str>>,
1268    /// Specifies whether physical connection was actually reused for this request.
1269    #[serde(rename = "connectionReused")]
1270    connection_reused: bool,
1271    /// Physical connection id that was actually used for this request.
1272    #[serde(rename = "connectionId")]
1273    connection_id: f64,
1274    /// Remote IP address.
1275    #[serde(skip_serializing_if = "Option::is_none", rename = "remoteIPAddress")]
1276    remote_ip_address: Option<Cow<'a, str>>,
1277    /// Remote port.
1278    #[serde(skip_serializing_if = "Option::is_none", rename = "remotePort")]
1279    remote_port: Option<i64>,
1280    /// Specifies that the request was served from the disk cache.
1281    #[serde(skip_serializing_if = "Option::is_none", rename = "fromDiskCache")]
1282    from_disk_cache: Option<bool>,
1283    /// Specifies that the request was served from the ServiceWorker.
1284    #[serde(skip_serializing_if = "Option::is_none", rename = "fromServiceWorker")]
1285    from_service_worker: Option<bool>,
1286    /// Specifies that the request was served from the prefetch cache.
1287    #[serde(skip_serializing_if = "Option::is_none", rename = "fromPrefetchCache")]
1288    from_prefetch_cache: Option<bool>,
1289    /// Specifies that the request was served from the prefetch cache.
1290    #[serde(skip_serializing_if = "Option::is_none", rename = "fromEarlyHints")]
1291    from_early_hints: Option<bool>,
1292    /// Information about how ServiceWorker Static Router API was used. If this
1293    /// field is set with 'matchedSourceType' field, a matching rule is found.
1294    /// If this field is set without 'matchedSource', no matching rule is found.
1295    /// Otherwise, the API is not used.
1296    #[serde(skip_serializing_if = "Option::is_none", rename = "serviceWorkerRouterInfo")]
1297    service_worker_router_info: Option<ServiceWorkerRouterInfo>,
1298    /// Total number of bytes received for this request so far.
1299    #[serde(rename = "encodedDataLength")]
1300    encoded_data_length: f64,
1301    /// Timing information for the given request.
1302    #[serde(skip_serializing_if = "Option::is_none")]
1303    timing: Option<ResourceTiming>,
1304    /// Response source of response from ServiceWorker.
1305    #[serde(skip_serializing_if = "Option::is_none", rename = "serviceWorkerResponseSource")]
1306    service_worker_response_source: Option<ServiceWorkerResponseSource>,
1307    /// The time at which the returned response was generated.
1308    #[serde(skip_serializing_if = "Option::is_none", rename = "responseTime")]
1309    response_time: Option<TimeSinceEpoch>,
1310    /// Cache Storage Cache Name.
1311    #[serde(skip_serializing_if = "Option::is_none", rename = "cacheStorageCacheName")]
1312    cache_storage_cache_name: Option<Cow<'a, str>>,
1313    /// Protocol used to fetch this request.
1314    #[serde(skip_serializing_if = "Option::is_none")]
1315    protocol: Option<Cow<'a, str>>,
1316    /// The reason why Chrome uses a specific transport protocol for HTTP semantics.
1317    #[serde(skip_serializing_if = "Option::is_none", rename = "alternateProtocolUsage")]
1318    alternate_protocol_usage: Option<AlternateProtocolUsage>,
1319    /// Security state of the request resource.
1320    #[serde(rename = "securityState")]
1321    security_state: crate::security::SecurityState,
1322    /// Security details for the request.
1323    #[serde(skip_serializing_if = "Option::is_none", rename = "securityDetails")]
1324    security_details: Option<SecurityDetails<'a>>,
1325}
1326
1327impl<'a> Response<'a> {
1328    /// Creates a builder for this type with the required parameters:
1329    /// * `url`: Response URL. This URL can be different from CachedResource.url in case of redirect.
1330    /// * `status`: HTTP response status code.
1331    /// * `status_text`: HTTP response status text.
1332    /// * `headers`: HTTP response headers.
1333    /// * `mime_type`: Resource mimeType as determined by the browser.
1334    /// * `charset`: Resource charset as determined by the browser (if applicable).
1335    /// * `connection_reused`: Specifies whether physical connection was actually reused for this request.
1336    /// * `connection_id`: Physical connection id that was actually used for this request.
1337    /// * `encoded_data_length`: Total number of bytes received for this request so far.
1338    /// * `security_state`: Security state of the request resource.
1339    pub fn builder(url: impl Into<Cow<'a, str>>, status: i64, status_text: impl Into<Cow<'a, str>>, headers: Headers, mime_type: impl Into<Cow<'a, str>>, charset: impl Into<Cow<'a, str>>, connection_reused: bool, connection_id: f64, encoded_data_length: f64, security_state: crate::security::SecurityState) -> ResponseBuilder<'a> {
1340        ResponseBuilder {
1341            url: url.into(),
1342            status: status,
1343            status_text: status_text.into(),
1344            headers: headers,
1345            headers_text: None,
1346            mime_type: mime_type.into(),
1347            charset: charset.into(),
1348            request_headers: None,
1349            request_headers_text: None,
1350            connection_reused: connection_reused,
1351            connection_id: connection_id,
1352            remote_ip_address: None,
1353            remote_port: None,
1354            from_disk_cache: None,
1355            from_service_worker: None,
1356            from_prefetch_cache: None,
1357            from_early_hints: None,
1358            service_worker_router_info: None,
1359            encoded_data_length: encoded_data_length,
1360            timing: None,
1361            service_worker_response_source: None,
1362            response_time: None,
1363            cache_storage_cache_name: None,
1364            protocol: None,
1365            alternate_protocol_usage: None,
1366            security_state: security_state,
1367            security_details: None,
1368        }
1369    }
1370    /// Response URL. This URL can be different from CachedResource.url in case of redirect.
1371    pub fn url(&self) -> &str { self.url.as_ref() }
1372    /// HTTP response status code.
1373    pub fn status(&self) -> i64 { self.status }
1374    /// HTTP response status text.
1375    pub fn status_text(&self) -> &str { self.status_text.as_ref() }
1376    /// HTTP response headers.
1377    pub fn headers(&self) -> &Headers { &self.headers }
1378    /// HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo.
1379    pub fn headers_text(&self) -> Option<&str> { self.headers_text.as_deref() }
1380    /// Resource mimeType as determined by the browser.
1381    pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
1382    /// Resource charset as determined by the browser (if applicable).
1383    pub fn charset(&self) -> &str { self.charset.as_ref() }
1384    /// Refined HTTP request headers that were actually transmitted over the network.
1385    pub fn request_headers(&self) -> Option<&Headers> { self.request_headers.as_ref() }
1386    /// HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo.
1387    pub fn request_headers_text(&self) -> Option<&str> { self.request_headers_text.as_deref() }
1388    /// Specifies whether physical connection was actually reused for this request.
1389    pub fn connection_reused(&self) -> bool { self.connection_reused }
1390    /// Physical connection id that was actually used for this request.
1391    pub fn connection_id(&self) -> f64 { self.connection_id }
1392    /// Remote IP address.
1393    pub fn remote_ip_address(&self) -> Option<&str> { self.remote_ip_address.as_deref() }
1394    /// Remote port.
1395    pub fn remote_port(&self) -> Option<i64> { self.remote_port }
1396    /// Specifies that the request was served from the disk cache.
1397    pub fn from_disk_cache(&self) -> Option<bool> { self.from_disk_cache }
1398    /// Specifies that the request was served from the ServiceWorker.
1399    pub fn from_service_worker(&self) -> Option<bool> { self.from_service_worker }
1400    /// Specifies that the request was served from the prefetch cache.
1401    pub fn from_prefetch_cache(&self) -> Option<bool> { self.from_prefetch_cache }
1402    /// Specifies that the request was served from the prefetch cache.
1403    pub fn from_early_hints(&self) -> Option<bool> { self.from_early_hints }
1404    /// Information about how ServiceWorker Static Router API was used. If this
1405    /// field is set with 'matchedSourceType' field, a matching rule is found.
1406    /// If this field is set without 'matchedSource', no matching rule is found.
1407    /// Otherwise, the API is not used.
1408    pub fn service_worker_router_info(&self) -> Option<&ServiceWorkerRouterInfo> { self.service_worker_router_info.as_ref() }
1409    /// Total number of bytes received for this request so far.
1410    pub fn encoded_data_length(&self) -> f64 { self.encoded_data_length }
1411    /// Timing information for the given request.
1412    pub fn timing(&self) -> Option<&ResourceTiming> { self.timing.as_ref() }
1413    /// Response source of response from ServiceWorker.
1414    pub fn service_worker_response_source(&self) -> Option<&ServiceWorkerResponseSource> { self.service_worker_response_source.as_ref() }
1415    /// The time at which the returned response was generated.
1416    pub fn response_time(&self) -> Option<&TimeSinceEpoch> { self.response_time.as_ref() }
1417    /// Cache Storage Cache Name.
1418    pub fn cache_storage_cache_name(&self) -> Option<&str> { self.cache_storage_cache_name.as_deref() }
1419    /// Protocol used to fetch this request.
1420    pub fn protocol(&self) -> Option<&str> { self.protocol.as_deref() }
1421    /// The reason why Chrome uses a specific transport protocol for HTTP semantics.
1422    pub fn alternate_protocol_usage(&self) -> Option<&AlternateProtocolUsage> { self.alternate_protocol_usage.as_ref() }
1423    /// Security state of the request resource.
1424    pub fn security_state(&self) -> &crate::security::SecurityState { &self.security_state }
1425    /// Security details for the request.
1426    pub fn security_details(&self) -> Option<&SecurityDetails<'a>> { self.security_details.as_ref() }
1427}
1428
1429
1430pub struct ResponseBuilder<'a> {
1431    url: Cow<'a, str>,
1432    status: i64,
1433    status_text: Cow<'a, str>,
1434    headers: Headers,
1435    headers_text: Option<Cow<'a, str>>,
1436    mime_type: Cow<'a, str>,
1437    charset: Cow<'a, str>,
1438    request_headers: Option<Headers>,
1439    request_headers_text: Option<Cow<'a, str>>,
1440    connection_reused: bool,
1441    connection_id: f64,
1442    remote_ip_address: Option<Cow<'a, str>>,
1443    remote_port: Option<i64>,
1444    from_disk_cache: Option<bool>,
1445    from_service_worker: Option<bool>,
1446    from_prefetch_cache: Option<bool>,
1447    from_early_hints: Option<bool>,
1448    service_worker_router_info: Option<ServiceWorkerRouterInfo>,
1449    encoded_data_length: f64,
1450    timing: Option<ResourceTiming>,
1451    service_worker_response_source: Option<ServiceWorkerResponseSource>,
1452    response_time: Option<TimeSinceEpoch>,
1453    cache_storage_cache_name: Option<Cow<'a, str>>,
1454    protocol: Option<Cow<'a, str>>,
1455    alternate_protocol_usage: Option<AlternateProtocolUsage>,
1456    security_state: crate::security::SecurityState,
1457    security_details: Option<SecurityDetails<'a>>,
1458}
1459
1460impl<'a> ResponseBuilder<'a> {
1461    /// HTTP response headers text. This has been replaced by the headers in Network.responseReceivedExtraInfo.
1462    pub fn headers_text(mut self, headers_text: impl Into<Cow<'a, str>>) -> Self { self.headers_text = Some(headers_text.into()); self }
1463    /// Refined HTTP request headers that were actually transmitted over the network.
1464    pub fn request_headers(mut self, request_headers: Headers) -> Self { self.request_headers = Some(request_headers); self }
1465    /// HTTP request headers text. This has been replaced by the headers in Network.requestWillBeSentExtraInfo.
1466    pub fn request_headers_text(mut self, request_headers_text: impl Into<Cow<'a, str>>) -> Self { self.request_headers_text = Some(request_headers_text.into()); self }
1467    /// Remote IP address.
1468    pub fn remote_ip_address(mut self, remote_ip_address: impl Into<Cow<'a, str>>) -> Self { self.remote_ip_address = Some(remote_ip_address.into()); self }
1469    /// Remote port.
1470    pub fn remote_port(mut self, remote_port: i64) -> Self { self.remote_port = Some(remote_port); self }
1471    /// Specifies that the request was served from the disk cache.
1472    pub fn from_disk_cache(mut self, from_disk_cache: bool) -> Self { self.from_disk_cache = Some(from_disk_cache); self }
1473    /// Specifies that the request was served from the ServiceWorker.
1474    pub fn from_service_worker(mut self, from_service_worker: bool) -> Self { self.from_service_worker = Some(from_service_worker); self }
1475    /// Specifies that the request was served from the prefetch cache.
1476    pub fn from_prefetch_cache(mut self, from_prefetch_cache: bool) -> Self { self.from_prefetch_cache = Some(from_prefetch_cache); self }
1477    /// Specifies that the request was served from the prefetch cache.
1478    pub fn from_early_hints(mut self, from_early_hints: bool) -> Self { self.from_early_hints = Some(from_early_hints); self }
1479    /// Information about how ServiceWorker Static Router API was used. If this
1480    /// field is set with 'matchedSourceType' field, a matching rule is found.
1481    /// If this field is set without 'matchedSource', no matching rule is found.
1482    /// Otherwise, the API is not used.
1483    pub fn service_worker_router_info(mut self, service_worker_router_info: ServiceWorkerRouterInfo) -> Self { self.service_worker_router_info = Some(service_worker_router_info); self }
1484    /// Timing information for the given request.
1485    pub fn timing(mut self, timing: ResourceTiming) -> Self { self.timing = Some(timing); self }
1486    /// Response source of response from ServiceWorker.
1487    pub fn service_worker_response_source(mut self, service_worker_response_source: impl Into<ServiceWorkerResponseSource>) -> Self { self.service_worker_response_source = Some(service_worker_response_source.into()); self }
1488    /// The time at which the returned response was generated.
1489    pub fn response_time(mut self, response_time: TimeSinceEpoch) -> Self { self.response_time = Some(response_time); self }
1490    /// Cache Storage Cache Name.
1491    pub fn cache_storage_cache_name(mut self, cache_storage_cache_name: impl Into<Cow<'a, str>>) -> Self { self.cache_storage_cache_name = Some(cache_storage_cache_name.into()); self }
1492    /// Protocol used to fetch this request.
1493    pub fn protocol(mut self, protocol: impl Into<Cow<'a, str>>) -> Self { self.protocol = Some(protocol.into()); self }
1494    /// The reason why Chrome uses a specific transport protocol for HTTP semantics.
1495    pub fn alternate_protocol_usage(mut self, alternate_protocol_usage: impl Into<AlternateProtocolUsage>) -> Self { self.alternate_protocol_usage = Some(alternate_protocol_usage.into()); self }
1496    /// Security details for the request.
1497    pub fn security_details(mut self, security_details: SecurityDetails<'a>) -> Self { self.security_details = Some(security_details); self }
1498    pub fn build(self) -> Response<'a> {
1499        Response {
1500            url: self.url,
1501            status: self.status,
1502            status_text: self.status_text,
1503            headers: self.headers,
1504            headers_text: self.headers_text,
1505            mime_type: self.mime_type,
1506            charset: self.charset,
1507            request_headers: self.request_headers,
1508            request_headers_text: self.request_headers_text,
1509            connection_reused: self.connection_reused,
1510            connection_id: self.connection_id,
1511            remote_ip_address: self.remote_ip_address,
1512            remote_port: self.remote_port,
1513            from_disk_cache: self.from_disk_cache,
1514            from_service_worker: self.from_service_worker,
1515            from_prefetch_cache: self.from_prefetch_cache,
1516            from_early_hints: self.from_early_hints,
1517            service_worker_router_info: self.service_worker_router_info,
1518            encoded_data_length: self.encoded_data_length,
1519            timing: self.timing,
1520            service_worker_response_source: self.service_worker_response_source,
1521            response_time: self.response_time,
1522            cache_storage_cache_name: self.cache_storage_cache_name,
1523            protocol: self.protocol,
1524            alternate_protocol_usage: self.alternate_protocol_usage,
1525            security_state: self.security_state,
1526            security_details: self.security_details,
1527        }
1528    }
1529}
1530
1531/// WebSocket request data.
1532
1533#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1534#[serde(rename_all = "camelCase")]
1535pub struct WebSocketRequest {
1536    /// HTTP request headers.
1537    headers: Headers,
1538}
1539
1540impl WebSocketRequest {
1541    /// Creates a builder for this type with the required parameters:
1542    /// * `headers`: HTTP request headers.
1543    pub fn builder(headers: Headers) -> WebSocketRequestBuilder {
1544        WebSocketRequestBuilder {
1545            headers: headers,
1546        }
1547    }
1548    /// HTTP request headers.
1549    pub fn headers(&self) -> &Headers { &self.headers }
1550}
1551
1552
1553pub struct WebSocketRequestBuilder {
1554    headers: Headers,
1555}
1556
1557impl WebSocketRequestBuilder {
1558    pub fn build(self) -> WebSocketRequest {
1559        WebSocketRequest {
1560            headers: self.headers,
1561        }
1562    }
1563}
1564
1565/// WebSocket response data.
1566
1567#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1568#[serde(rename_all = "camelCase")]
1569pub struct WebSocketResponse<'a> {
1570    /// HTTP response status code.
1571    status: i64,
1572    /// HTTP response status text.
1573    #[serde(rename = "statusText")]
1574    status_text: Cow<'a, str>,
1575    /// HTTP response headers.
1576    headers: Headers,
1577    /// HTTP response headers text.
1578    #[serde(skip_serializing_if = "Option::is_none", rename = "headersText")]
1579    headers_text: Option<Cow<'a, str>>,
1580    /// HTTP request headers.
1581    #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeaders")]
1582    request_headers: Option<Headers>,
1583    /// HTTP request headers text.
1584    #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeadersText")]
1585    request_headers_text: Option<Cow<'a, str>>,
1586}
1587
1588impl<'a> WebSocketResponse<'a> {
1589    /// Creates a builder for this type with the required parameters:
1590    /// * `status`: HTTP response status code.
1591    /// * `status_text`: HTTP response status text.
1592    /// * `headers`: HTTP response headers.
1593    pub fn builder(status: i64, status_text: impl Into<Cow<'a, str>>, headers: Headers) -> WebSocketResponseBuilder<'a> {
1594        WebSocketResponseBuilder {
1595            status: status,
1596            status_text: status_text.into(),
1597            headers: headers,
1598            headers_text: None,
1599            request_headers: None,
1600            request_headers_text: None,
1601        }
1602    }
1603    /// HTTP response status code.
1604    pub fn status(&self) -> i64 { self.status }
1605    /// HTTP response status text.
1606    pub fn status_text(&self) -> &str { self.status_text.as_ref() }
1607    /// HTTP response headers.
1608    pub fn headers(&self) -> &Headers { &self.headers }
1609    /// HTTP response headers text.
1610    pub fn headers_text(&self) -> Option<&str> { self.headers_text.as_deref() }
1611    /// HTTP request headers.
1612    pub fn request_headers(&self) -> Option<&Headers> { self.request_headers.as_ref() }
1613    /// HTTP request headers text.
1614    pub fn request_headers_text(&self) -> Option<&str> { self.request_headers_text.as_deref() }
1615}
1616
1617
1618pub struct WebSocketResponseBuilder<'a> {
1619    status: i64,
1620    status_text: Cow<'a, str>,
1621    headers: Headers,
1622    headers_text: Option<Cow<'a, str>>,
1623    request_headers: Option<Headers>,
1624    request_headers_text: Option<Cow<'a, str>>,
1625}
1626
1627impl<'a> WebSocketResponseBuilder<'a> {
1628    /// HTTP response headers text.
1629    pub fn headers_text(mut self, headers_text: impl Into<Cow<'a, str>>) -> Self { self.headers_text = Some(headers_text.into()); self }
1630    /// HTTP request headers.
1631    pub fn request_headers(mut self, request_headers: Headers) -> Self { self.request_headers = Some(request_headers); self }
1632    /// HTTP request headers text.
1633    pub fn request_headers_text(mut self, request_headers_text: impl Into<Cow<'a, str>>) -> Self { self.request_headers_text = Some(request_headers_text.into()); self }
1634    pub fn build(self) -> WebSocketResponse<'a> {
1635        WebSocketResponse {
1636            status: self.status,
1637            status_text: self.status_text,
1638            headers: self.headers,
1639            headers_text: self.headers_text,
1640            request_headers: self.request_headers,
1641            request_headers_text: self.request_headers_text,
1642        }
1643    }
1644}
1645
1646/// WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests.
1647
1648#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1649#[serde(rename_all = "camelCase")]
1650pub struct WebSocketFrame<'a> {
1651    /// WebSocket message opcode.
1652    opcode: f64,
1653    /// WebSocket message mask.
1654    mask: bool,
1655    /// WebSocket message payload data.
1656    /// If the opcode is 1, this is a text message and payloadData is a UTF-8 string.
1657    /// If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.
1658    #[serde(rename = "payloadData")]
1659    payload_data: Cow<'a, str>,
1660}
1661
1662impl<'a> WebSocketFrame<'a> {
1663    /// Creates a builder for this type with the required parameters:
1664    /// * `opcode`: WebSocket message opcode.
1665    /// * `mask`: WebSocket message mask.
1666    /// * `payload_data`: WebSocket message payload data. If the opcode is 1, this is a text message and payloadData is a UTF-8 string. If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.
1667    pub fn builder(opcode: f64, mask: bool, payload_data: impl Into<Cow<'a, str>>) -> WebSocketFrameBuilder<'a> {
1668        WebSocketFrameBuilder {
1669            opcode: opcode,
1670            mask: mask,
1671            payload_data: payload_data.into(),
1672        }
1673    }
1674    /// WebSocket message opcode.
1675    pub fn opcode(&self) -> f64 { self.opcode }
1676    /// WebSocket message mask.
1677    pub fn mask(&self) -> bool { self.mask }
1678    /// WebSocket message payload data.
1679    /// If the opcode is 1, this is a text message and payloadData is a UTF-8 string.
1680    /// If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data.
1681    pub fn payload_data(&self) -> &str { self.payload_data.as_ref() }
1682}
1683
1684
1685pub struct WebSocketFrameBuilder<'a> {
1686    opcode: f64,
1687    mask: bool,
1688    payload_data: Cow<'a, str>,
1689}
1690
1691impl<'a> WebSocketFrameBuilder<'a> {
1692    pub fn build(self) -> WebSocketFrame<'a> {
1693        WebSocketFrame {
1694            opcode: self.opcode,
1695            mask: self.mask,
1696            payload_data: self.payload_data,
1697        }
1698    }
1699}
1700
1701/// Information about the cached resource.
1702
1703#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1704#[serde(rename_all = "camelCase")]
1705pub struct CachedResource<'a> {
1706    /// Resource URL. This is the url of the original network request.
1707    url: Cow<'a, str>,
1708    /// Type of this resource.
1709    #[serde(rename = "type")]
1710    type_: ResourceType,
1711    /// Cached response data.
1712    #[serde(skip_serializing_if = "Option::is_none")]
1713    response: Option<Response<'a>>,
1714    /// Cached response body size.
1715    #[serde(rename = "bodySize")]
1716    body_size: f64,
1717}
1718
1719impl<'a> CachedResource<'a> {
1720    /// Creates a builder for this type with the required parameters:
1721    /// * `url`: Resource URL. This is the url of the original network request.
1722    /// * `type_`: Type of this resource.
1723    /// * `body_size`: Cached response body size.
1724    pub fn builder(url: impl Into<Cow<'a, str>>, type_: impl Into<ResourceType>, body_size: f64) -> CachedResourceBuilder<'a> {
1725        CachedResourceBuilder {
1726            url: url.into(),
1727            type_: type_.into(),
1728            response: None,
1729            body_size: body_size,
1730        }
1731    }
1732    /// Resource URL. This is the url of the original network request.
1733    pub fn url(&self) -> &str { self.url.as_ref() }
1734    /// Type of this resource.
1735    pub fn type_(&self) -> &ResourceType { &self.type_ }
1736    /// Cached response data.
1737    pub fn response(&self) -> Option<&Response<'a>> { self.response.as_ref() }
1738    /// Cached response body size.
1739    pub fn body_size(&self) -> f64 { self.body_size }
1740}
1741
1742
1743pub struct CachedResourceBuilder<'a> {
1744    url: Cow<'a, str>,
1745    type_: ResourceType,
1746    response: Option<Response<'a>>,
1747    body_size: f64,
1748}
1749
1750impl<'a> CachedResourceBuilder<'a> {
1751    /// Cached response data.
1752    pub fn response(mut self, response: Response<'a>) -> Self { self.response = Some(response); self }
1753    pub fn build(self) -> CachedResource<'a> {
1754        CachedResource {
1755            url: self.url,
1756            type_: self.type_,
1757            response: self.response,
1758            body_size: self.body_size,
1759        }
1760    }
1761}
1762
1763/// Information about the request initiator.
1764
1765#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1766#[serde(rename_all = "camelCase")]
1767pub struct Initiator<'a> {
1768    /// Type of this initiator.
1769    #[serde(rename = "type")]
1770    type_: Cow<'a, str>,
1771    /// Initiator JavaScript stack trace, set for Script only.
1772    /// Requires the Debugger domain to be enabled.
1773    #[serde(skip_serializing_if = "Option::is_none")]
1774    stack: Option<crate::runtime::StackTrace>,
1775    /// Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.
1776    #[serde(skip_serializing_if = "Option::is_none")]
1777    url: Option<Cow<'a, str>>,
1778    /// Initiator line number, set for Parser type or for Script type (when script is importing
1779    /// module) (0-based).
1780    #[serde(skip_serializing_if = "Option::is_none", rename = "lineNumber")]
1781    line_number: Option<f64>,
1782    /// Initiator column number, set for Parser type or for Script type (when script is importing
1783    /// module) (0-based).
1784    #[serde(skip_serializing_if = "Option::is_none", rename = "columnNumber")]
1785    column_number: Option<f64>,
1786    /// Set if another request triggered this request (e.g. preflight).
1787    #[serde(skip_serializing_if = "Option::is_none", rename = "requestId")]
1788    request_id: Option<RequestId<'a>>,
1789}
1790
1791impl<'a> Initiator<'a> {
1792    /// Creates a builder for this type with the required parameters:
1793    /// * `type_`: Type of this initiator.
1794    pub fn builder(type_: impl Into<Cow<'a, str>>) -> InitiatorBuilder<'a> {
1795        InitiatorBuilder {
1796            type_: type_.into(),
1797            stack: None,
1798            url: None,
1799            line_number: None,
1800            column_number: None,
1801            request_id: None,
1802        }
1803    }
1804    /// Type of this initiator.
1805    pub fn type_(&self) -> &str { self.type_.as_ref() }
1806    /// Initiator JavaScript stack trace, set for Script only.
1807    /// Requires the Debugger domain to be enabled.
1808    pub fn stack(&self) -> Option<&crate::runtime::StackTrace> { self.stack.as_ref() }
1809    /// Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.
1810    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
1811    /// Initiator line number, set for Parser type or for Script type (when script is importing
1812    /// module) (0-based).
1813    pub fn line_number(&self) -> Option<f64> { self.line_number }
1814    /// Initiator column number, set for Parser type or for Script type (when script is importing
1815    /// module) (0-based).
1816    pub fn column_number(&self) -> Option<f64> { self.column_number }
1817    /// Set if another request triggered this request (e.g. preflight).
1818    pub fn request_id(&self) -> Option<&RequestId<'a>> { self.request_id.as_ref() }
1819}
1820
1821
1822pub struct InitiatorBuilder<'a> {
1823    type_: Cow<'a, str>,
1824    stack: Option<crate::runtime::StackTrace>,
1825    url: Option<Cow<'a, str>>,
1826    line_number: Option<f64>,
1827    column_number: Option<f64>,
1828    request_id: Option<RequestId<'a>>,
1829}
1830
1831impl<'a> InitiatorBuilder<'a> {
1832    /// Initiator JavaScript stack trace, set for Script only.
1833    /// Requires the Debugger domain to be enabled.
1834    pub fn stack(mut self, stack: crate::runtime::StackTrace) -> Self { self.stack = Some(stack); self }
1835    /// Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type.
1836    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
1837    /// Initiator line number, set for Parser type or for Script type (when script is importing
1838    /// module) (0-based).
1839    pub fn line_number(mut self, line_number: f64) -> Self { self.line_number = Some(line_number); self }
1840    /// Initiator column number, set for Parser type or for Script type (when script is importing
1841    /// module) (0-based).
1842    pub fn column_number(mut self, column_number: f64) -> Self { self.column_number = Some(column_number); self }
1843    /// Set if another request triggered this request (e.g. preflight).
1844    pub fn request_id(mut self, request_id: impl Into<RequestId<'a>>) -> Self { self.request_id = Some(request_id.into()); self }
1845    pub fn build(self) -> Initiator<'a> {
1846        Initiator {
1847            type_: self.type_,
1848            stack: self.stack,
1849            url: self.url,
1850            line_number: self.line_number,
1851            column_number: self.column_number,
1852            request_id: self.request_id,
1853        }
1854    }
1855}
1856
1857/// cookiePartitionKey object
1858/// The representation of the components of the key that are created by the cookiePartitionKey class contained in net/cookies/cookie_partition_key.h.
1859
1860#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1861#[serde(rename_all = "camelCase")]
1862pub struct CookiePartitionKey<'a> {
1863    /// The site of the top-level URL the browser was visiting at the start
1864    /// of the request to the endpoint that set the cookie.
1865    #[serde(rename = "topLevelSite")]
1866    top_level_site: Cow<'a, str>,
1867    /// Indicates if the cookie has any ancestors that are cross-site to the topLevelSite.
1868    #[serde(rename = "hasCrossSiteAncestor")]
1869    has_cross_site_ancestor: bool,
1870}
1871
1872impl<'a> CookiePartitionKey<'a> {
1873    /// Creates a builder for this type with the required parameters:
1874    /// * `top_level_site`: The site of the top-level URL the browser was visiting at the start of the request to the endpoint that set the cookie.
1875    /// * `has_cross_site_ancestor`: Indicates if the cookie has any ancestors that are cross-site to the topLevelSite.
1876    pub fn builder(top_level_site: impl Into<Cow<'a, str>>, has_cross_site_ancestor: bool) -> CookiePartitionKeyBuilder<'a> {
1877        CookiePartitionKeyBuilder {
1878            top_level_site: top_level_site.into(),
1879            has_cross_site_ancestor: has_cross_site_ancestor,
1880        }
1881    }
1882    /// The site of the top-level URL the browser was visiting at the start
1883    /// of the request to the endpoint that set the cookie.
1884    pub fn top_level_site(&self) -> &str { self.top_level_site.as_ref() }
1885    /// Indicates if the cookie has any ancestors that are cross-site to the topLevelSite.
1886    pub fn has_cross_site_ancestor(&self) -> bool { self.has_cross_site_ancestor }
1887}
1888
1889
1890pub struct CookiePartitionKeyBuilder<'a> {
1891    top_level_site: Cow<'a, str>,
1892    has_cross_site_ancestor: bool,
1893}
1894
1895impl<'a> CookiePartitionKeyBuilder<'a> {
1896    pub fn build(self) -> CookiePartitionKey<'a> {
1897        CookiePartitionKey {
1898            top_level_site: self.top_level_site,
1899            has_cross_site_ancestor: self.has_cross_site_ancestor,
1900        }
1901    }
1902}
1903
1904/// Cookie object
1905
1906#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1907#[serde(rename_all = "camelCase")]
1908pub struct Cookie<'a> {
1909    /// Cookie name.
1910    name: Cow<'a, str>,
1911    /// Cookie value.
1912    value: Cow<'a, str>,
1913    /// Cookie domain.
1914    domain: Cow<'a, str>,
1915    /// Cookie path.
1916    path: Cow<'a, str>,
1917    /// Cookie expiration date as the number of seconds since the UNIX epoch.
1918    /// The value is set to -1 if the expiry date is not set.
1919    /// The value can be null for values that cannot be represented in
1920    /// JSON (±Inf).
1921    expires: f64,
1922    /// Cookie size.
1923    size: u64,
1924    /// True if cookie is http-only.
1925    #[serde(rename = "httpOnly")]
1926    http_only: bool,
1927    /// True if cookie is secure.
1928    secure: bool,
1929    /// True in case of session cookie.
1930    session: bool,
1931    /// Cookie SameSite type.
1932    #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
1933    same_site: Option<CookieSameSite>,
1934    /// Cookie Priority
1935    priority: CookiePriority,
1936    /// Cookie source scheme type.
1937    #[serde(rename = "sourceScheme")]
1938    source_scheme: CookieSourceScheme,
1939    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
1940    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
1941    /// This is a temporary ability and it will be removed in the future.
1942    #[serde(rename = "sourcePort")]
1943    source_port: i64,
1944    /// Cookie partition key.
1945    #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
1946    partition_key: Option<CookiePartitionKey<'a>>,
1947    /// True if cookie partition key is opaque.
1948    #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKeyOpaque")]
1949    partition_key_opaque: Option<bool>,
1950}
1951
1952impl<'a> Cookie<'a> {
1953    /// Creates a builder for this type with the required parameters:
1954    /// * `name`: Cookie name.
1955    /// * `value`: Cookie value.
1956    /// * `domain`: Cookie domain.
1957    /// * `path`: Cookie path.
1958    /// * `expires`: Cookie expiration date as the number of seconds since the UNIX epoch. The value is set to -1 if the expiry date is not set. The value can be null for values that cannot be represented in JSON (±Inf).
1959    /// * `size`: Cookie size.
1960    /// * `http_only`: True if cookie is http-only.
1961    /// * `secure`: True if cookie is secure.
1962    /// * `session`: True in case of session cookie.
1963    /// * `priority`: Cookie Priority
1964    /// * `source_scheme`: Cookie source scheme type.
1965    /// * `source_port`: Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port. An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. This is a temporary ability and it will be removed in the future.
1966    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>, domain: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, expires: f64, size: u64, http_only: bool, secure: bool, session: bool, priority: impl Into<CookiePriority>, source_scheme: impl Into<CookieSourceScheme>, source_port: i64) -> CookieBuilder<'a> {
1967        CookieBuilder {
1968            name: name.into(),
1969            value: value.into(),
1970            domain: domain.into(),
1971            path: path.into(),
1972            expires: expires,
1973            size: size,
1974            http_only: http_only,
1975            secure: secure,
1976            session: session,
1977            same_site: None,
1978            priority: priority.into(),
1979            source_scheme: source_scheme.into(),
1980            source_port: source_port,
1981            partition_key: None,
1982            partition_key_opaque: None,
1983        }
1984    }
1985    /// Cookie name.
1986    pub fn name(&self) -> &str { self.name.as_ref() }
1987    /// Cookie value.
1988    pub fn value(&self) -> &str { self.value.as_ref() }
1989    /// Cookie domain.
1990    pub fn domain(&self) -> &str { self.domain.as_ref() }
1991    /// Cookie path.
1992    pub fn path(&self) -> &str { self.path.as_ref() }
1993    /// Cookie expiration date as the number of seconds since the UNIX epoch.
1994    /// The value is set to -1 if the expiry date is not set.
1995    /// The value can be null for values that cannot be represented in
1996    /// JSON (±Inf).
1997    pub fn expires(&self) -> f64 { self.expires }
1998    /// Cookie size.
1999    pub fn size(&self) -> u64 { self.size }
2000    /// True if cookie is http-only.
2001    pub fn http_only(&self) -> bool { self.http_only }
2002    /// True if cookie is secure.
2003    pub fn secure(&self) -> bool { self.secure }
2004    /// True in case of session cookie.
2005    pub fn session(&self) -> bool { self.session }
2006    /// Cookie SameSite type.
2007    pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
2008    /// Cookie Priority
2009    pub fn priority(&self) -> &CookiePriority { &self.priority }
2010    /// Cookie source scheme type.
2011    pub fn source_scheme(&self) -> &CookieSourceScheme { &self.source_scheme }
2012    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
2013    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
2014    /// This is a temporary ability and it will be removed in the future.
2015    pub fn source_port(&self) -> i64 { self.source_port }
2016    /// Cookie partition key.
2017    pub fn partition_key(&self) -> Option<&CookiePartitionKey<'a>> { self.partition_key.as_ref() }
2018    /// True if cookie partition key is opaque.
2019    pub fn partition_key_opaque(&self) -> Option<bool> { self.partition_key_opaque }
2020}
2021
2022
2023pub struct CookieBuilder<'a> {
2024    name: Cow<'a, str>,
2025    value: Cow<'a, str>,
2026    domain: Cow<'a, str>,
2027    path: Cow<'a, str>,
2028    expires: f64,
2029    size: u64,
2030    http_only: bool,
2031    secure: bool,
2032    session: bool,
2033    same_site: Option<CookieSameSite>,
2034    priority: CookiePriority,
2035    source_scheme: CookieSourceScheme,
2036    source_port: i64,
2037    partition_key: Option<CookiePartitionKey<'a>>,
2038    partition_key_opaque: Option<bool>,
2039}
2040
2041impl<'a> CookieBuilder<'a> {
2042    /// Cookie SameSite type.
2043    pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
2044    /// Cookie partition key.
2045    pub fn partition_key(mut self, partition_key: CookiePartitionKey<'a>) -> Self { self.partition_key = Some(partition_key); self }
2046    /// True if cookie partition key is opaque.
2047    pub fn partition_key_opaque(mut self, partition_key_opaque: bool) -> Self { self.partition_key_opaque = Some(partition_key_opaque); self }
2048    pub fn build(self) -> Cookie<'a> {
2049        Cookie {
2050            name: self.name,
2051            value: self.value,
2052            domain: self.domain,
2053            path: self.path,
2054            expires: self.expires,
2055            size: self.size,
2056            http_only: self.http_only,
2057            secure: self.secure,
2058            session: self.session,
2059            same_site: self.same_site,
2060            priority: self.priority,
2061            source_scheme: self.source_scheme,
2062            source_port: self.source_port,
2063            partition_key: self.partition_key,
2064            partition_key_opaque: self.partition_key_opaque,
2065        }
2066    }
2067}
2068
2069/// Types of reasons why a cookie may not be stored from a response.
2070
2071#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2072pub enum SetCookieBlockedReason {
2073    #[default]
2074    #[serde(rename = "SecureOnly")]
2075    SecureOnly,
2076    #[serde(rename = "SameSiteStrict")]
2077    SameSiteStrict,
2078    #[serde(rename = "SameSiteLax")]
2079    SameSiteLax,
2080    #[serde(rename = "SameSiteUnspecifiedTreatedAsLax")]
2081    SameSiteUnspecifiedTreatedAsLax,
2082    #[serde(rename = "SameSiteNoneInsecure")]
2083    SameSiteNoneInsecure,
2084    #[serde(rename = "UserPreferences")]
2085    UserPreferences,
2086    #[serde(rename = "ThirdPartyPhaseout")]
2087    ThirdPartyPhaseout,
2088    #[serde(rename = "ThirdPartyBlockedInFirstPartySet")]
2089    ThirdPartyBlockedInFirstPartySet,
2090    #[serde(rename = "SyntaxError")]
2091    SyntaxError,
2092    #[serde(rename = "SchemeNotSupported")]
2093    SchemeNotSupported,
2094    #[serde(rename = "OverwriteSecure")]
2095    OverwriteSecure,
2096    #[serde(rename = "InvalidDomain")]
2097    InvalidDomain,
2098    #[serde(rename = "InvalidPrefix")]
2099    InvalidPrefix,
2100    #[serde(rename = "UnknownError")]
2101    UnknownError,
2102    #[serde(rename = "SchemefulSameSiteStrict")]
2103    SchemefulSameSiteStrict,
2104    #[serde(rename = "SchemefulSameSiteLax")]
2105    SchemefulSameSiteLax,
2106    #[serde(rename = "SchemefulSameSiteUnspecifiedTreatedAsLax")]
2107    SchemefulSameSiteUnspecifiedTreatedAsLax,
2108    #[serde(rename = "NameValuePairExceedsMaxSize")]
2109    NameValuePairExceedsMaxSize,
2110    #[serde(rename = "DisallowedCharacter")]
2111    DisallowedCharacter,
2112    #[serde(rename = "NoCookieContent")]
2113    NoCookieContent,
2114}
2115
2116/// Types of reasons why a cookie may not be sent with a request.
2117
2118#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2119pub enum CookieBlockedReason {
2120    #[default]
2121    #[serde(rename = "SecureOnly")]
2122    SecureOnly,
2123    #[serde(rename = "NotOnPath")]
2124    NotOnPath,
2125    #[serde(rename = "DomainMismatch")]
2126    DomainMismatch,
2127    #[serde(rename = "SameSiteStrict")]
2128    SameSiteStrict,
2129    #[serde(rename = "SameSiteLax")]
2130    SameSiteLax,
2131    #[serde(rename = "SameSiteUnspecifiedTreatedAsLax")]
2132    SameSiteUnspecifiedTreatedAsLax,
2133    #[serde(rename = "SameSiteNoneInsecure")]
2134    SameSiteNoneInsecure,
2135    #[serde(rename = "UserPreferences")]
2136    UserPreferences,
2137    #[serde(rename = "ThirdPartyPhaseout")]
2138    ThirdPartyPhaseout,
2139    #[serde(rename = "ThirdPartyBlockedInFirstPartySet")]
2140    ThirdPartyBlockedInFirstPartySet,
2141    #[serde(rename = "UnknownError")]
2142    UnknownError,
2143    #[serde(rename = "SchemefulSameSiteStrict")]
2144    SchemefulSameSiteStrict,
2145    #[serde(rename = "SchemefulSameSiteLax")]
2146    SchemefulSameSiteLax,
2147    #[serde(rename = "SchemefulSameSiteUnspecifiedTreatedAsLax")]
2148    SchemefulSameSiteUnspecifiedTreatedAsLax,
2149    #[serde(rename = "NameValuePairExceedsMaxSize")]
2150    NameValuePairExceedsMaxSize,
2151    #[serde(rename = "PortMismatch")]
2152    PortMismatch,
2153    #[serde(rename = "SchemeMismatch")]
2154    SchemeMismatch,
2155    #[serde(rename = "AnonymousContext")]
2156    AnonymousContext,
2157}
2158
2159/// Types of reasons why a cookie should have been blocked by 3PCD but is exempted for the request.
2160
2161#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2162pub enum CookieExemptionReason {
2163    #[default]
2164    #[serde(rename = "None")]
2165    None,
2166    #[serde(rename = "UserSetting")]
2167    UserSetting,
2168    #[serde(rename = "TPCDMetadata")]
2169    TPCDMetadata,
2170    #[serde(rename = "TPCDDeprecationTrial")]
2171    TPCDDeprecationTrial,
2172    #[serde(rename = "TopLevelTPCDDeprecationTrial")]
2173    TopLevelTPCDDeprecationTrial,
2174    #[serde(rename = "TPCDHeuristics")]
2175    TPCDHeuristics,
2176    #[serde(rename = "EnterprisePolicy")]
2177    EnterprisePolicy,
2178    #[serde(rename = "StorageAccess")]
2179    StorageAccess,
2180    #[serde(rename = "TopLevelStorageAccess")]
2181    TopLevelStorageAccess,
2182    #[serde(rename = "Scheme")]
2183    Scheme,
2184    #[serde(rename = "SameSiteNoneCookiesInSandbox")]
2185    SameSiteNoneCookiesInSandbox,
2186}
2187
2188/// A cookie which was not stored from a response with the corresponding reason.
2189
2190#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2191#[serde(rename_all = "camelCase")]
2192pub struct BlockedSetCookieWithReason<'a> {
2193    /// The reason(s) this cookie was blocked.
2194    #[serde(rename = "blockedReasons")]
2195    blocked_reasons: Vec<SetCookieBlockedReason>,
2196    /// The string representing this individual cookie as it would appear in the header.
2197    /// This is not the entire "cookie" or "set-cookie" header which could have multiple cookies.
2198    #[serde(rename = "cookieLine")]
2199    cookie_line: Cow<'a, str>,
2200    /// The cookie object which represents the cookie which was not stored. It is optional because
2201    /// sometimes complete cookie information is not available, such as in the case of parsing
2202    /// errors.
2203    #[serde(skip_serializing_if = "Option::is_none")]
2204    cookie: Option<Cookie<'a>>,
2205}
2206
2207impl<'a> BlockedSetCookieWithReason<'a> {
2208    /// Creates a builder for this type with the required parameters:
2209    /// * `blocked_reasons`: The reason(s) this cookie was blocked.
2210    /// * `cookie_line`: The string representing this individual cookie as it would appear in the header. This is not the entire "cookie" or "set-cookie" header which could have multiple cookies.
2211    pub fn builder(blocked_reasons: Vec<SetCookieBlockedReason>, cookie_line: impl Into<Cow<'a, str>>) -> BlockedSetCookieWithReasonBuilder<'a> {
2212        BlockedSetCookieWithReasonBuilder {
2213            blocked_reasons: blocked_reasons,
2214            cookie_line: cookie_line.into(),
2215            cookie: None,
2216        }
2217    }
2218    /// The reason(s) this cookie was blocked.
2219    pub fn blocked_reasons(&self) -> &[SetCookieBlockedReason] { &self.blocked_reasons }
2220    /// The string representing this individual cookie as it would appear in the header.
2221    /// This is not the entire "cookie" or "set-cookie" header which could have multiple cookies.
2222    pub fn cookie_line(&self) -> &str { self.cookie_line.as_ref() }
2223    /// The cookie object which represents the cookie which was not stored. It is optional because
2224    /// sometimes complete cookie information is not available, such as in the case of parsing
2225    /// errors.
2226    pub fn cookie(&self) -> Option<&Cookie<'a>> { self.cookie.as_ref() }
2227}
2228
2229
2230pub struct BlockedSetCookieWithReasonBuilder<'a> {
2231    blocked_reasons: Vec<SetCookieBlockedReason>,
2232    cookie_line: Cow<'a, str>,
2233    cookie: Option<Cookie<'a>>,
2234}
2235
2236impl<'a> BlockedSetCookieWithReasonBuilder<'a> {
2237    /// The cookie object which represents the cookie which was not stored. It is optional because
2238    /// sometimes complete cookie information is not available, such as in the case of parsing
2239    /// errors.
2240    pub fn cookie(mut self, cookie: Cookie<'a>) -> Self { self.cookie = Some(cookie); self }
2241    pub fn build(self) -> BlockedSetCookieWithReason<'a> {
2242        BlockedSetCookieWithReason {
2243            blocked_reasons: self.blocked_reasons,
2244            cookie_line: self.cookie_line,
2245            cookie: self.cookie,
2246        }
2247    }
2248}
2249
2250/// A cookie should have been blocked by 3PCD but is exempted and stored from a response with the
2251/// corresponding reason. A cookie could only have at most one exemption reason.
2252
2253#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2254#[serde(rename_all = "camelCase")]
2255pub struct ExemptedSetCookieWithReason<'a> {
2256    /// The reason the cookie was exempted.
2257    #[serde(rename = "exemptionReason")]
2258    exemption_reason: CookieExemptionReason,
2259    /// The string representing this individual cookie as it would appear in the header.
2260    #[serde(rename = "cookieLine")]
2261    cookie_line: Cow<'a, str>,
2262    /// The cookie object representing the cookie.
2263    cookie: Cookie<'a>,
2264}
2265
2266impl<'a> ExemptedSetCookieWithReason<'a> {
2267    /// Creates a builder for this type with the required parameters:
2268    /// * `exemption_reason`: The reason the cookie was exempted.
2269    /// * `cookie_line`: The string representing this individual cookie as it would appear in the header.
2270    /// * `cookie`: The cookie object representing the cookie.
2271    pub fn builder(exemption_reason: impl Into<CookieExemptionReason>, cookie_line: impl Into<Cow<'a, str>>, cookie: Cookie<'a>) -> ExemptedSetCookieWithReasonBuilder<'a> {
2272        ExemptedSetCookieWithReasonBuilder {
2273            exemption_reason: exemption_reason.into(),
2274            cookie_line: cookie_line.into(),
2275            cookie: cookie,
2276        }
2277    }
2278    /// The reason the cookie was exempted.
2279    pub fn exemption_reason(&self) -> &CookieExemptionReason { &self.exemption_reason }
2280    /// The string representing this individual cookie as it would appear in the header.
2281    pub fn cookie_line(&self) -> &str { self.cookie_line.as_ref() }
2282    /// The cookie object representing the cookie.
2283    pub fn cookie(&self) -> &Cookie<'a> { &self.cookie }
2284}
2285
2286
2287pub struct ExemptedSetCookieWithReasonBuilder<'a> {
2288    exemption_reason: CookieExemptionReason,
2289    cookie_line: Cow<'a, str>,
2290    cookie: Cookie<'a>,
2291}
2292
2293impl<'a> ExemptedSetCookieWithReasonBuilder<'a> {
2294    pub fn build(self) -> ExemptedSetCookieWithReason<'a> {
2295        ExemptedSetCookieWithReason {
2296            exemption_reason: self.exemption_reason,
2297            cookie_line: self.cookie_line,
2298            cookie: self.cookie,
2299        }
2300    }
2301}
2302
2303/// A cookie associated with the request which may or may not be sent with it.
2304/// Includes the cookies itself and reasons for blocking or exemption.
2305
2306#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2307#[serde(rename_all = "camelCase")]
2308pub struct AssociatedCookie<'a> {
2309    /// The cookie object representing the cookie which was not sent.
2310    cookie: Cookie<'a>,
2311    /// The reason(s) the cookie was blocked. If empty means the cookie is included.
2312    #[serde(rename = "blockedReasons")]
2313    blocked_reasons: Vec<CookieBlockedReason>,
2314    /// The reason the cookie should have been blocked by 3PCD but is exempted. A cookie could
2315    /// only have at most one exemption reason.
2316    #[serde(skip_serializing_if = "Option::is_none", rename = "exemptionReason")]
2317    exemption_reason: Option<CookieExemptionReason>,
2318}
2319
2320impl<'a> AssociatedCookie<'a> {
2321    /// Creates a builder for this type with the required parameters:
2322    /// * `cookie`: The cookie object representing the cookie which was not sent.
2323    /// * `blocked_reasons`: The reason(s) the cookie was blocked. If empty means the cookie is included.
2324    pub fn builder(cookie: Cookie<'a>, blocked_reasons: Vec<CookieBlockedReason>) -> AssociatedCookieBuilder<'a> {
2325        AssociatedCookieBuilder {
2326            cookie: cookie,
2327            blocked_reasons: blocked_reasons,
2328            exemption_reason: None,
2329        }
2330    }
2331    /// The cookie object representing the cookie which was not sent.
2332    pub fn cookie(&self) -> &Cookie<'a> { &self.cookie }
2333    /// The reason(s) the cookie was blocked. If empty means the cookie is included.
2334    pub fn blocked_reasons(&self) -> &[CookieBlockedReason] { &self.blocked_reasons }
2335    /// The reason the cookie should have been blocked by 3PCD but is exempted. A cookie could
2336    /// only have at most one exemption reason.
2337    pub fn exemption_reason(&self) -> Option<&CookieExemptionReason> { self.exemption_reason.as_ref() }
2338}
2339
2340
2341pub struct AssociatedCookieBuilder<'a> {
2342    cookie: Cookie<'a>,
2343    blocked_reasons: Vec<CookieBlockedReason>,
2344    exemption_reason: Option<CookieExemptionReason>,
2345}
2346
2347impl<'a> AssociatedCookieBuilder<'a> {
2348    /// The reason the cookie should have been blocked by 3PCD but is exempted. A cookie could
2349    /// only have at most one exemption reason.
2350    pub fn exemption_reason(mut self, exemption_reason: impl Into<CookieExemptionReason>) -> Self { self.exemption_reason = Some(exemption_reason.into()); self }
2351    pub fn build(self) -> AssociatedCookie<'a> {
2352        AssociatedCookie {
2353            cookie: self.cookie,
2354            blocked_reasons: self.blocked_reasons,
2355            exemption_reason: self.exemption_reason,
2356        }
2357    }
2358}
2359
2360/// Cookie parameter object
2361
2362#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2363#[serde(rename_all = "camelCase")]
2364pub struct CookieParam<'a> {
2365    /// Cookie name.
2366    name: Cow<'a, str>,
2367    /// Cookie value.
2368    value: Cow<'a, str>,
2369    /// The request-URI to associate with the setting of the cookie. This value can affect the
2370    /// default domain, path, source port, and source scheme values of the created cookie.
2371    #[serde(skip_serializing_if = "Option::is_none")]
2372    url: Option<Cow<'a, str>>,
2373    /// Cookie domain.
2374    #[serde(skip_serializing_if = "Option::is_none")]
2375    domain: Option<Cow<'a, str>>,
2376    /// Cookie path.
2377    #[serde(skip_serializing_if = "Option::is_none")]
2378    path: Option<Cow<'a, str>>,
2379    /// True if cookie is secure.
2380    #[serde(skip_serializing_if = "Option::is_none")]
2381    secure: Option<bool>,
2382    /// True if cookie is http-only.
2383    #[serde(skip_serializing_if = "Option::is_none", rename = "httpOnly")]
2384    http_only: Option<bool>,
2385    /// Cookie SameSite type.
2386    #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
2387    same_site: Option<CookieSameSite>,
2388    /// Cookie expiration date, session cookie if not set
2389    #[serde(skip_serializing_if = "Option::is_none")]
2390    expires: Option<TimeSinceEpoch>,
2391    /// Cookie Priority.
2392    #[serde(skip_serializing_if = "Option::is_none")]
2393    priority: Option<CookiePriority>,
2394    /// Cookie source scheme type.
2395    #[serde(skip_serializing_if = "Option::is_none", rename = "sourceScheme")]
2396    source_scheme: Option<CookieSourceScheme>,
2397    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
2398    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
2399    /// This is a temporary ability and it will be removed in the future.
2400    #[serde(skip_serializing_if = "Option::is_none", rename = "sourcePort")]
2401    source_port: Option<i64>,
2402    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
2403    #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
2404    partition_key: Option<CookiePartitionKey<'a>>,
2405}
2406
2407impl<'a> CookieParam<'a> {
2408    /// Creates a builder for this type with the required parameters:
2409    /// * `name`: Cookie name.
2410    /// * `value`: Cookie value.
2411    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> CookieParamBuilder<'a> {
2412        CookieParamBuilder {
2413            name: name.into(),
2414            value: value.into(),
2415            url: None,
2416            domain: None,
2417            path: None,
2418            secure: None,
2419            http_only: None,
2420            same_site: None,
2421            expires: None,
2422            priority: None,
2423            source_scheme: None,
2424            source_port: None,
2425            partition_key: None,
2426        }
2427    }
2428    /// Cookie name.
2429    pub fn name(&self) -> &str { self.name.as_ref() }
2430    /// Cookie value.
2431    pub fn value(&self) -> &str { self.value.as_ref() }
2432    /// The request-URI to associate with the setting of the cookie. This value can affect the
2433    /// default domain, path, source port, and source scheme values of the created cookie.
2434    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
2435    /// Cookie domain.
2436    pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
2437    /// Cookie path.
2438    pub fn path(&self) -> Option<&str> { self.path.as_deref() }
2439    /// True if cookie is secure.
2440    pub fn secure(&self) -> Option<bool> { self.secure }
2441    /// True if cookie is http-only.
2442    pub fn http_only(&self) -> Option<bool> { self.http_only }
2443    /// Cookie SameSite type.
2444    pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
2445    /// Cookie expiration date, session cookie if not set
2446    pub fn expires(&self) -> Option<&TimeSinceEpoch> { self.expires.as_ref() }
2447    /// Cookie Priority.
2448    pub fn priority(&self) -> Option<&CookiePriority> { self.priority.as_ref() }
2449    /// Cookie source scheme type.
2450    pub fn source_scheme(&self) -> Option<&CookieSourceScheme> { self.source_scheme.as_ref() }
2451    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
2452    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
2453    /// This is a temporary ability and it will be removed in the future.
2454    pub fn source_port(&self) -> Option<i64> { self.source_port }
2455    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
2456    pub fn partition_key(&self) -> Option<&CookiePartitionKey<'a>> { self.partition_key.as_ref() }
2457}
2458
2459
2460pub struct CookieParamBuilder<'a> {
2461    name: Cow<'a, str>,
2462    value: Cow<'a, str>,
2463    url: Option<Cow<'a, str>>,
2464    domain: Option<Cow<'a, str>>,
2465    path: Option<Cow<'a, str>>,
2466    secure: Option<bool>,
2467    http_only: Option<bool>,
2468    same_site: Option<CookieSameSite>,
2469    expires: Option<TimeSinceEpoch>,
2470    priority: Option<CookiePriority>,
2471    source_scheme: Option<CookieSourceScheme>,
2472    source_port: Option<i64>,
2473    partition_key: Option<CookiePartitionKey<'a>>,
2474}
2475
2476impl<'a> CookieParamBuilder<'a> {
2477    /// The request-URI to associate with the setting of the cookie. This value can affect the
2478    /// default domain, path, source port, and source scheme values of the created cookie.
2479    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
2480    /// Cookie domain.
2481    pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
2482    /// Cookie path.
2483    pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
2484    /// True if cookie is secure.
2485    pub fn secure(mut self, secure: bool) -> Self { self.secure = Some(secure); self }
2486    /// True if cookie is http-only.
2487    pub fn http_only(mut self, http_only: bool) -> Self { self.http_only = Some(http_only); self }
2488    /// Cookie SameSite type.
2489    pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
2490    /// Cookie expiration date, session cookie if not set
2491    pub fn expires(mut self, expires: TimeSinceEpoch) -> Self { self.expires = Some(expires); self }
2492    /// Cookie Priority.
2493    pub fn priority(mut self, priority: impl Into<CookiePriority>) -> Self { self.priority = Some(priority.into()); self }
2494    /// Cookie source scheme type.
2495    pub fn source_scheme(mut self, source_scheme: impl Into<CookieSourceScheme>) -> Self { self.source_scheme = Some(source_scheme.into()); self }
2496    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
2497    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
2498    /// This is a temporary ability and it will be removed in the future.
2499    pub fn source_port(mut self, source_port: i64) -> Self { self.source_port = Some(source_port); self }
2500    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
2501    pub fn partition_key(mut self, partition_key: CookiePartitionKey<'a>) -> Self { self.partition_key = Some(partition_key); self }
2502    pub fn build(self) -> CookieParam<'a> {
2503        CookieParam {
2504            name: self.name,
2505            value: self.value,
2506            url: self.url,
2507            domain: self.domain,
2508            path: self.path,
2509            secure: self.secure,
2510            http_only: self.http_only,
2511            same_site: self.same_site,
2512            expires: self.expires,
2513            priority: self.priority,
2514            source_scheme: self.source_scheme,
2515            source_port: self.source_port,
2516            partition_key: self.partition_key,
2517        }
2518    }
2519}
2520
2521/// Authorization challenge for HTTP status code 401 or 407.
2522
2523#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2524#[serde(rename_all = "camelCase")]
2525pub struct AuthChallenge<'a> {
2526    /// Source of the authentication challenge.
2527    #[serde(skip_serializing_if = "Option::is_none")]
2528    source: Option<Cow<'a, str>>,
2529    /// Origin of the challenger.
2530    origin: Cow<'a, str>,
2531    /// The authentication scheme used, such as basic or digest
2532    scheme: Cow<'a, str>,
2533    /// The realm of the challenge. May be empty.
2534    realm: Cow<'a, str>,
2535}
2536
2537impl<'a> AuthChallenge<'a> {
2538    /// Creates a builder for this type with the required parameters:
2539    /// * `origin`: Origin of the challenger.
2540    /// * `scheme`: The authentication scheme used, such as basic or digest
2541    /// * `realm`: The realm of the challenge. May be empty.
2542    pub fn builder(origin: impl Into<Cow<'a, str>>, scheme: impl Into<Cow<'a, str>>, realm: impl Into<Cow<'a, str>>) -> AuthChallengeBuilder<'a> {
2543        AuthChallengeBuilder {
2544            source: None,
2545            origin: origin.into(),
2546            scheme: scheme.into(),
2547            realm: realm.into(),
2548        }
2549    }
2550    /// Source of the authentication challenge.
2551    pub fn source(&self) -> Option<&str> { self.source.as_deref() }
2552    /// Origin of the challenger.
2553    pub fn origin(&self) -> &str { self.origin.as_ref() }
2554    /// The authentication scheme used, such as basic or digest
2555    pub fn scheme(&self) -> &str { self.scheme.as_ref() }
2556    /// The realm of the challenge. May be empty.
2557    pub fn realm(&self) -> &str { self.realm.as_ref() }
2558}
2559
2560
2561pub struct AuthChallengeBuilder<'a> {
2562    source: Option<Cow<'a, str>>,
2563    origin: Cow<'a, str>,
2564    scheme: Cow<'a, str>,
2565    realm: Cow<'a, str>,
2566}
2567
2568impl<'a> AuthChallengeBuilder<'a> {
2569    /// Source of the authentication challenge.
2570    pub fn source(mut self, source: impl Into<Cow<'a, str>>) -> Self { self.source = Some(source.into()); self }
2571    pub fn build(self) -> AuthChallenge<'a> {
2572        AuthChallenge {
2573            source: self.source,
2574            origin: self.origin,
2575            scheme: self.scheme,
2576            realm: self.realm,
2577        }
2578    }
2579}
2580
2581/// Response to an AuthChallenge.
2582
2583#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2584#[serde(rename_all = "camelCase")]
2585pub struct AuthChallengeResponse<'a> {
2586    /// The decision on what to do in response to the authorization challenge.  Default means
2587    /// deferring to the default behavior of the net stack, which will likely either the Cancel
2588    /// authentication or display a popup dialog box.
2589    response: Cow<'a, str>,
2590    /// The username to provide, possibly empty. Should only be set if response is
2591    /// ProvideCredentials.
2592    #[serde(skip_serializing_if = "Option::is_none")]
2593    username: Option<Cow<'a, str>>,
2594    /// The password to provide, possibly empty. Should only be set if response is
2595    /// ProvideCredentials.
2596    #[serde(skip_serializing_if = "Option::is_none")]
2597    password: Option<Cow<'a, str>>,
2598}
2599
2600impl<'a> AuthChallengeResponse<'a> {
2601    /// Creates a builder for this type with the required parameters:
2602    /// * `response`: The decision on what to do in response to the authorization challenge.  Default means deferring to the default behavior of the net stack, which will likely either the Cancel authentication or display a popup dialog box.
2603    pub fn builder(response: impl Into<Cow<'a, str>>) -> AuthChallengeResponseBuilder<'a> {
2604        AuthChallengeResponseBuilder {
2605            response: response.into(),
2606            username: None,
2607            password: None,
2608        }
2609    }
2610    /// The decision on what to do in response to the authorization challenge.  Default means
2611    /// deferring to the default behavior of the net stack, which will likely either the Cancel
2612    /// authentication or display a popup dialog box.
2613    pub fn response(&self) -> &str { self.response.as_ref() }
2614    /// The username to provide, possibly empty. Should only be set if response is
2615    /// ProvideCredentials.
2616    pub fn username(&self) -> Option<&str> { self.username.as_deref() }
2617    /// The password to provide, possibly empty. Should only be set if response is
2618    /// ProvideCredentials.
2619    pub fn password(&self) -> Option<&str> { self.password.as_deref() }
2620}
2621
2622
2623pub struct AuthChallengeResponseBuilder<'a> {
2624    response: Cow<'a, str>,
2625    username: Option<Cow<'a, str>>,
2626    password: Option<Cow<'a, str>>,
2627}
2628
2629impl<'a> AuthChallengeResponseBuilder<'a> {
2630    /// The username to provide, possibly empty. Should only be set if response is
2631    /// ProvideCredentials.
2632    pub fn username(mut self, username: impl Into<Cow<'a, str>>) -> Self { self.username = Some(username.into()); self }
2633    /// The password to provide, possibly empty. Should only be set if response is
2634    /// ProvideCredentials.
2635    pub fn password(mut self, password: impl Into<Cow<'a, str>>) -> Self { self.password = Some(password.into()); self }
2636    pub fn build(self) -> AuthChallengeResponse<'a> {
2637        AuthChallengeResponse {
2638            response: self.response,
2639            username: self.username,
2640            password: self.password,
2641        }
2642    }
2643}
2644
2645/// Stages of the interception to begin intercepting. Request will intercept before the request is
2646/// sent. Response will intercept after the response is received.
2647
2648#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2649pub enum InterceptionStage {
2650    #[default]
2651    #[serde(rename = "Request")]
2652    Request,
2653    #[serde(rename = "HeadersReceived")]
2654    HeadersReceived,
2655}
2656
2657/// Request pattern for interception.
2658
2659#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2660#[serde(rename_all = "camelCase")]
2661pub struct RequestPattern<'a> {
2662    /// Wildcards (''*'' -\> zero or more, ''?'' -\> exactly one) are allowed. Escape character is
2663    /// backslash. Omitting is equivalent to '"*"'.
2664    #[serde(skip_serializing_if = "Option::is_none", rename = "urlPattern")]
2665    url_pattern: Option<Cow<'a, str>>,
2666    /// If set, only requests for matching resource types will be intercepted.
2667    #[serde(skip_serializing_if = "Option::is_none", rename = "resourceType")]
2668    resource_type: Option<ResourceType>,
2669    /// Stage at which to begin intercepting requests. Default is Request.
2670    #[serde(skip_serializing_if = "Option::is_none", rename = "interceptionStage")]
2671    interception_stage: Option<InterceptionStage>,
2672}
2673
2674impl<'a> RequestPattern<'a> {
2675    /// Creates a builder for this type.
2676    pub fn builder() -> RequestPatternBuilder<'a> {
2677        RequestPatternBuilder {
2678            url_pattern: None,
2679            resource_type: None,
2680            interception_stage: None,
2681        }
2682    }
2683    /// Wildcards (''*'' -\> zero or more, ''?'' -\> exactly one) are allowed. Escape character is
2684    /// backslash. Omitting is equivalent to '"*"'.
2685    pub fn url_pattern(&self) -> Option<&str> { self.url_pattern.as_deref() }
2686    /// If set, only requests for matching resource types will be intercepted.
2687    pub fn resource_type(&self) -> Option<&ResourceType> { self.resource_type.as_ref() }
2688    /// Stage at which to begin intercepting requests. Default is Request.
2689    pub fn interception_stage(&self) -> Option<&InterceptionStage> { self.interception_stage.as_ref() }
2690}
2691
2692#[derive(Default)]
2693pub struct RequestPatternBuilder<'a> {
2694    url_pattern: Option<Cow<'a, str>>,
2695    resource_type: Option<ResourceType>,
2696    interception_stage: Option<InterceptionStage>,
2697}
2698
2699impl<'a> RequestPatternBuilder<'a> {
2700    /// Wildcards (''*'' -\> zero or more, ''?'' -\> exactly one) are allowed. Escape character is
2701    /// backslash. Omitting is equivalent to '"*"'.
2702    pub fn url_pattern(mut self, url_pattern: impl Into<Cow<'a, str>>) -> Self { self.url_pattern = Some(url_pattern.into()); self }
2703    /// If set, only requests for matching resource types will be intercepted.
2704    pub fn resource_type(mut self, resource_type: impl Into<ResourceType>) -> Self { self.resource_type = Some(resource_type.into()); self }
2705    /// Stage at which to begin intercepting requests. Default is Request.
2706    pub fn interception_stage(mut self, interception_stage: impl Into<InterceptionStage>) -> Self { self.interception_stage = Some(interception_stage.into()); self }
2707    pub fn build(self) -> RequestPattern<'a> {
2708        RequestPattern {
2709            url_pattern: self.url_pattern,
2710            resource_type: self.resource_type,
2711            interception_stage: self.interception_stage,
2712        }
2713    }
2714}
2715
2716/// Information about a signed exchange signature.
2717/// <https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1>
2718
2719#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2720#[serde(rename_all = "camelCase")]
2721pub struct SignedExchangeSignature<'a> {
2722    /// Signed exchange signature label.
2723    label: Cow<'a, str>,
2724    /// The hex string of signed exchange signature.
2725    signature: Cow<'a, str>,
2726    /// Signed exchange signature integrity.
2727    integrity: Cow<'a, str>,
2728    /// Signed exchange signature cert Url.
2729    #[serde(skip_serializing_if = "Option::is_none", rename = "certUrl")]
2730    cert_url: Option<Cow<'a, str>>,
2731    /// The hex string of signed exchange signature cert sha256.
2732    #[serde(skip_serializing_if = "Option::is_none", rename = "certSha256")]
2733    cert_sha256: Option<Cow<'a, str>>,
2734    /// Signed exchange signature validity Url.
2735    #[serde(rename = "validityUrl")]
2736    validity_url: Cow<'a, str>,
2737    /// Signed exchange signature date.
2738    date: i64,
2739    /// Signed exchange signature expires.
2740    expires: i64,
2741    /// The encoded certificates.
2742    #[serde(skip_serializing_if = "Option::is_none")]
2743    certificates: Option<Vec<Cow<'a, str>>>,
2744}
2745
2746impl<'a> SignedExchangeSignature<'a> {
2747    /// Creates a builder for this type with the required parameters:
2748    /// * `label`: Signed exchange signature label.
2749    /// * `signature`: The hex string of signed exchange signature.
2750    /// * `integrity`: Signed exchange signature integrity.
2751    /// * `validity_url`: Signed exchange signature validity Url.
2752    /// * `date`: Signed exchange signature date.
2753    /// * `expires`: Signed exchange signature expires.
2754    pub fn builder(label: impl Into<Cow<'a, str>>, signature: impl Into<Cow<'a, str>>, integrity: impl Into<Cow<'a, str>>, validity_url: impl Into<Cow<'a, str>>, date: i64, expires: i64) -> SignedExchangeSignatureBuilder<'a> {
2755        SignedExchangeSignatureBuilder {
2756            label: label.into(),
2757            signature: signature.into(),
2758            integrity: integrity.into(),
2759            cert_url: None,
2760            cert_sha256: None,
2761            validity_url: validity_url.into(),
2762            date: date,
2763            expires: expires,
2764            certificates: None,
2765        }
2766    }
2767    /// Signed exchange signature label.
2768    pub fn label(&self) -> &str { self.label.as_ref() }
2769    /// The hex string of signed exchange signature.
2770    pub fn signature(&self) -> &str { self.signature.as_ref() }
2771    /// Signed exchange signature integrity.
2772    pub fn integrity(&self) -> &str { self.integrity.as_ref() }
2773    /// Signed exchange signature cert Url.
2774    pub fn cert_url(&self) -> Option<&str> { self.cert_url.as_deref() }
2775    /// The hex string of signed exchange signature cert sha256.
2776    pub fn cert_sha256(&self) -> Option<&str> { self.cert_sha256.as_deref() }
2777    /// Signed exchange signature validity Url.
2778    pub fn validity_url(&self) -> &str { self.validity_url.as_ref() }
2779    /// Signed exchange signature date.
2780    pub fn date(&self) -> i64 { self.date }
2781    /// Signed exchange signature expires.
2782    pub fn expires(&self) -> i64 { self.expires }
2783    /// The encoded certificates.
2784    pub fn certificates(&self) -> Option<&[Cow<'a, str>]> { self.certificates.as_deref() }
2785}
2786
2787
2788pub struct SignedExchangeSignatureBuilder<'a> {
2789    label: Cow<'a, str>,
2790    signature: Cow<'a, str>,
2791    integrity: Cow<'a, str>,
2792    cert_url: Option<Cow<'a, str>>,
2793    cert_sha256: Option<Cow<'a, str>>,
2794    validity_url: Cow<'a, str>,
2795    date: i64,
2796    expires: i64,
2797    certificates: Option<Vec<Cow<'a, str>>>,
2798}
2799
2800impl<'a> SignedExchangeSignatureBuilder<'a> {
2801    /// Signed exchange signature cert Url.
2802    pub fn cert_url(mut self, cert_url: impl Into<Cow<'a, str>>) -> Self { self.cert_url = Some(cert_url.into()); self }
2803    /// The hex string of signed exchange signature cert sha256.
2804    pub fn cert_sha256(mut self, cert_sha256: impl Into<Cow<'a, str>>) -> Self { self.cert_sha256 = Some(cert_sha256.into()); self }
2805    /// The encoded certificates.
2806    pub fn certificates(mut self, certificates: Vec<Cow<'a, str>>) -> Self { self.certificates = Some(certificates); self }
2807    pub fn build(self) -> SignedExchangeSignature<'a> {
2808        SignedExchangeSignature {
2809            label: self.label,
2810            signature: self.signature,
2811            integrity: self.integrity,
2812            cert_url: self.cert_url,
2813            cert_sha256: self.cert_sha256,
2814            validity_url: self.validity_url,
2815            date: self.date,
2816            expires: self.expires,
2817            certificates: self.certificates,
2818        }
2819    }
2820}
2821
2822/// Information about a signed exchange header.
2823/// <https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation>
2824
2825#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2826#[serde(rename_all = "camelCase")]
2827pub struct SignedExchangeHeader<'a> {
2828    /// Signed exchange request URL.
2829    #[serde(rename = "requestUrl")]
2830    request_url: Cow<'a, str>,
2831    /// Signed exchange response code.
2832    #[serde(rename = "responseCode")]
2833    response_code: i64,
2834    /// Signed exchange response headers.
2835    #[serde(rename = "responseHeaders")]
2836    response_headers: Headers,
2837    /// Signed exchange response signature.
2838    signatures: Vec<SignedExchangeSignature<'a>>,
2839    /// Signed exchange header integrity hash in the form of 'sha256-\<base64-hash-value\>'.
2840    #[serde(rename = "headerIntegrity")]
2841    header_integrity: Cow<'a, str>,
2842}
2843
2844impl<'a> SignedExchangeHeader<'a> {
2845    /// Creates a builder for this type with the required parameters:
2846    /// * `request_url`: Signed exchange request URL.
2847    /// * `response_code`: Signed exchange response code.
2848    /// * `response_headers`: Signed exchange response headers.
2849    /// * `signatures`: Signed exchange response signature.
2850    /// * `header_integrity`: Signed exchange header integrity hash in the form of `sha256-\<base64-hash-value\>`.
2851    pub fn builder(request_url: impl Into<Cow<'a, str>>, response_code: i64, response_headers: Headers, signatures: Vec<SignedExchangeSignature<'a>>, header_integrity: impl Into<Cow<'a, str>>) -> SignedExchangeHeaderBuilder<'a> {
2852        SignedExchangeHeaderBuilder {
2853            request_url: request_url.into(),
2854            response_code: response_code,
2855            response_headers: response_headers,
2856            signatures: signatures,
2857            header_integrity: header_integrity.into(),
2858        }
2859    }
2860    /// Signed exchange request URL.
2861    pub fn request_url(&self) -> &str { self.request_url.as_ref() }
2862    /// Signed exchange response code.
2863    pub fn response_code(&self) -> i64 { self.response_code }
2864    /// Signed exchange response headers.
2865    pub fn response_headers(&self) -> &Headers { &self.response_headers }
2866    /// Signed exchange response signature.
2867    pub fn signatures(&self) -> &[SignedExchangeSignature<'a>] { &self.signatures }
2868    /// Signed exchange header integrity hash in the form of 'sha256-\<base64-hash-value\>'.
2869    pub fn header_integrity(&self) -> &str { self.header_integrity.as_ref() }
2870}
2871
2872
2873pub struct SignedExchangeHeaderBuilder<'a> {
2874    request_url: Cow<'a, str>,
2875    response_code: i64,
2876    response_headers: Headers,
2877    signatures: Vec<SignedExchangeSignature<'a>>,
2878    header_integrity: Cow<'a, str>,
2879}
2880
2881impl<'a> SignedExchangeHeaderBuilder<'a> {
2882    pub fn build(self) -> SignedExchangeHeader<'a> {
2883        SignedExchangeHeader {
2884            request_url: self.request_url,
2885            response_code: self.response_code,
2886            response_headers: self.response_headers,
2887            signatures: self.signatures,
2888            header_integrity: self.header_integrity,
2889        }
2890    }
2891}
2892
2893/// Field type for a signed exchange related error.
2894
2895#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
2896pub enum SignedExchangeErrorField {
2897    #[default]
2898    #[serde(rename = "signatureSig")]
2899    SignatureSig,
2900    #[serde(rename = "signatureIntegrity")]
2901    SignatureIntegrity,
2902    #[serde(rename = "signatureCertUrl")]
2903    SignatureCertUrl,
2904    #[serde(rename = "signatureCertSha256")]
2905    SignatureCertSha256,
2906    #[serde(rename = "signatureValidityUrl")]
2907    SignatureValidityUrl,
2908    #[serde(rename = "signatureTimestamps")]
2909    SignatureTimestamps,
2910}
2911
2912/// Information about a signed exchange response.
2913
2914#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2915#[serde(rename_all = "camelCase")]
2916pub struct SignedExchangeError<'a> {
2917    /// Error message.
2918    message: Cow<'a, str>,
2919    /// The index of the signature which caused the error.
2920    #[serde(skip_serializing_if = "Option::is_none", rename = "signatureIndex")]
2921    signature_index: Option<u64>,
2922    /// The field which caused the error.
2923    #[serde(skip_serializing_if = "Option::is_none", rename = "errorField")]
2924    error_field: Option<SignedExchangeErrorField>,
2925}
2926
2927impl<'a> SignedExchangeError<'a> {
2928    /// Creates a builder for this type with the required parameters:
2929    /// * `message`: Error message.
2930    pub fn builder(message: impl Into<Cow<'a, str>>) -> SignedExchangeErrorBuilder<'a> {
2931        SignedExchangeErrorBuilder {
2932            message: message.into(),
2933            signature_index: None,
2934            error_field: None,
2935        }
2936    }
2937    /// Error message.
2938    pub fn message(&self) -> &str { self.message.as_ref() }
2939    /// The index of the signature which caused the error.
2940    pub fn signature_index(&self) -> Option<u64> { self.signature_index }
2941    /// The field which caused the error.
2942    pub fn error_field(&self) -> Option<&SignedExchangeErrorField> { self.error_field.as_ref() }
2943}
2944
2945
2946pub struct SignedExchangeErrorBuilder<'a> {
2947    message: Cow<'a, str>,
2948    signature_index: Option<u64>,
2949    error_field: Option<SignedExchangeErrorField>,
2950}
2951
2952impl<'a> SignedExchangeErrorBuilder<'a> {
2953    /// The index of the signature which caused the error.
2954    pub fn signature_index(mut self, signature_index: u64) -> Self { self.signature_index = Some(signature_index); self }
2955    /// The field which caused the error.
2956    pub fn error_field(mut self, error_field: impl Into<SignedExchangeErrorField>) -> Self { self.error_field = Some(error_field.into()); self }
2957    pub fn build(self) -> SignedExchangeError<'a> {
2958        SignedExchangeError {
2959            message: self.message,
2960            signature_index: self.signature_index,
2961            error_field: self.error_field,
2962        }
2963    }
2964}
2965
2966/// Information about a signed exchange response.
2967
2968#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2969#[serde(rename_all = "camelCase")]
2970pub struct SignedExchangeInfo<'a> {
2971    /// The outer response of signed HTTP exchange which was received from network.
2972    #[serde(rename = "outerResponse")]
2973    outer_response: Response<'a>,
2974    /// Whether network response for the signed exchange was accompanied by
2975    /// extra headers.
2976    #[serde(rename = "hasExtraInfo")]
2977    has_extra_info: bool,
2978    /// Information about the signed exchange header.
2979    #[serde(skip_serializing_if = "Option::is_none")]
2980    header: Option<SignedExchangeHeader<'a>>,
2981    /// Security details for the signed exchange header.
2982    #[serde(skip_serializing_if = "Option::is_none", rename = "securityDetails")]
2983    security_details: Option<SecurityDetails<'a>>,
2984    /// Errors occurred while handling the signed exchange.
2985    #[serde(skip_serializing_if = "Option::is_none")]
2986    errors: Option<Vec<SignedExchangeError<'a>>>,
2987}
2988
2989impl<'a> SignedExchangeInfo<'a> {
2990    /// Creates a builder for this type with the required parameters:
2991    /// * `outer_response`: The outer response of signed HTTP exchange which was received from network.
2992    /// * `has_extra_info`: Whether network response for the signed exchange was accompanied by extra headers.
2993    pub fn builder(outer_response: Response<'a>, has_extra_info: bool) -> SignedExchangeInfoBuilder<'a> {
2994        SignedExchangeInfoBuilder {
2995            outer_response: outer_response,
2996            has_extra_info: has_extra_info,
2997            header: None,
2998            security_details: None,
2999            errors: None,
3000        }
3001    }
3002    /// The outer response of signed HTTP exchange which was received from network.
3003    pub fn outer_response(&self) -> &Response<'a> { &self.outer_response }
3004    /// Whether network response for the signed exchange was accompanied by
3005    /// extra headers.
3006    pub fn has_extra_info(&self) -> bool { self.has_extra_info }
3007    /// Information about the signed exchange header.
3008    pub fn header(&self) -> Option<&SignedExchangeHeader<'a>> { self.header.as_ref() }
3009    /// Security details for the signed exchange header.
3010    pub fn security_details(&self) -> Option<&SecurityDetails<'a>> { self.security_details.as_ref() }
3011    /// Errors occurred while handling the signed exchange.
3012    pub fn errors(&self) -> Option<&[SignedExchangeError<'a>]> { self.errors.as_deref() }
3013}
3014
3015
3016pub struct SignedExchangeInfoBuilder<'a> {
3017    outer_response: Response<'a>,
3018    has_extra_info: bool,
3019    header: Option<SignedExchangeHeader<'a>>,
3020    security_details: Option<SecurityDetails<'a>>,
3021    errors: Option<Vec<SignedExchangeError<'a>>>,
3022}
3023
3024impl<'a> SignedExchangeInfoBuilder<'a> {
3025    /// Information about the signed exchange header.
3026    pub fn header(mut self, header: SignedExchangeHeader<'a>) -> Self { self.header = Some(header); self }
3027    /// Security details for the signed exchange header.
3028    pub fn security_details(mut self, security_details: SecurityDetails<'a>) -> Self { self.security_details = Some(security_details); self }
3029    /// Errors occurred while handling the signed exchange.
3030    pub fn errors(mut self, errors: Vec<SignedExchangeError<'a>>) -> Self { self.errors = Some(errors); self }
3031    pub fn build(self) -> SignedExchangeInfo<'a> {
3032        SignedExchangeInfo {
3033            outer_response: self.outer_response,
3034            has_extra_info: self.has_extra_info,
3035            header: self.header,
3036            security_details: self.security_details,
3037            errors: self.errors,
3038        }
3039    }
3040}
3041
3042/// List of content encodings supported by the backend.
3043
3044#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3045pub enum ContentEncoding {
3046    #[default]
3047    #[serde(rename = "deflate")]
3048    Deflate,
3049    #[serde(rename = "gzip")]
3050    Gzip,
3051    #[serde(rename = "br")]
3052    Br,
3053    #[serde(rename = "zstd")]
3054    Zstd,
3055}
3056
3057
3058#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3059#[serde(rename_all = "camelCase")]
3060pub struct NetworkConditions<'a> {
3061    /// Only matching requests will be affected by these conditions. Patterns use the URLPattern constructor string
3062    /// syntax (<https://urlpattern.spec.whatwg.org/>) and must be absolute. If the pattern is empty, all requests are
3063    /// matched (including p2p connections).
3064    #[serde(rename = "urlPattern")]
3065    url_pattern: Cow<'a, str>,
3066    /// Minimum latency from request sent to response headers received (ms).
3067    latency: f64,
3068    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
3069    #[serde(rename = "downloadThroughput")]
3070    download_throughput: f64,
3071    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
3072    #[serde(rename = "uploadThroughput")]
3073    upload_throughput: f64,
3074    /// Connection type if known.
3075    #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
3076    connection_type: Option<ConnectionType>,
3077    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
3078    #[serde(skip_serializing_if = "Option::is_none", rename = "packetLoss")]
3079    packet_loss: Option<f64>,
3080    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
3081    #[serde(skip_serializing_if = "Option::is_none", rename = "packetQueueLength")]
3082    packet_queue_length: Option<u64>,
3083    /// WebRTC packetReordering feature.
3084    #[serde(skip_serializing_if = "Option::is_none", rename = "packetReordering")]
3085    packet_reordering: Option<bool>,
3086    /// True to emulate internet disconnection.
3087    #[serde(skip_serializing_if = "Option::is_none")]
3088    offline: Option<bool>,
3089}
3090
3091impl<'a> NetworkConditions<'a> {
3092    /// Creates a builder for this type with the required parameters:
3093    /// * `url_pattern`: Only matching requests will be affected by these conditions. Patterns use the URLPattern constructor string syntax (<https://urlpattern.spec.whatwg.org/>) and must be absolute. If the pattern is empty, all requests are matched (including p2p connections).
3094    /// * `latency`: Minimum latency from request sent to response headers received (ms).
3095    /// * `download_throughput`: Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
3096    /// * `upload_throughput`: Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
3097    pub fn builder(url_pattern: impl Into<Cow<'a, str>>, latency: f64, download_throughput: f64, upload_throughput: f64) -> NetworkConditionsBuilder<'a> {
3098        NetworkConditionsBuilder {
3099            url_pattern: url_pattern.into(),
3100            latency: latency,
3101            download_throughput: download_throughput,
3102            upload_throughput: upload_throughput,
3103            connection_type: None,
3104            packet_loss: None,
3105            packet_queue_length: None,
3106            packet_reordering: None,
3107            offline: None,
3108        }
3109    }
3110    /// Only matching requests will be affected by these conditions. Patterns use the URLPattern constructor string
3111    /// syntax (<https://urlpattern.spec.whatwg.org/>) and must be absolute. If the pattern is empty, all requests are
3112    /// matched (including p2p connections).
3113    pub fn url_pattern(&self) -> &str { self.url_pattern.as_ref() }
3114    /// Minimum latency from request sent to response headers received (ms).
3115    pub fn latency(&self) -> f64 { self.latency }
3116    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
3117    pub fn download_throughput(&self) -> f64 { self.download_throughput }
3118    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
3119    pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
3120    /// Connection type if known.
3121    pub fn connection_type(&self) -> Option<&ConnectionType> { self.connection_type.as_ref() }
3122    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
3123    pub fn packet_loss(&self) -> Option<f64> { self.packet_loss }
3124    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
3125    pub fn packet_queue_length(&self) -> Option<u64> { self.packet_queue_length }
3126    /// WebRTC packetReordering feature.
3127    pub fn packet_reordering(&self) -> Option<bool> { self.packet_reordering }
3128    /// True to emulate internet disconnection.
3129    pub fn offline(&self) -> Option<bool> { self.offline }
3130}
3131
3132
3133pub struct NetworkConditionsBuilder<'a> {
3134    url_pattern: Cow<'a, str>,
3135    latency: f64,
3136    download_throughput: f64,
3137    upload_throughput: f64,
3138    connection_type: Option<ConnectionType>,
3139    packet_loss: Option<f64>,
3140    packet_queue_length: Option<u64>,
3141    packet_reordering: Option<bool>,
3142    offline: Option<bool>,
3143}
3144
3145impl<'a> NetworkConditionsBuilder<'a> {
3146    /// Connection type if known.
3147    pub fn connection_type(mut self, connection_type: impl Into<ConnectionType>) -> Self { self.connection_type = Some(connection_type.into()); self }
3148    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
3149    pub fn packet_loss(mut self, packet_loss: f64) -> Self { self.packet_loss = Some(packet_loss); self }
3150    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
3151    pub fn packet_queue_length(mut self, packet_queue_length: u64) -> Self { self.packet_queue_length = Some(packet_queue_length); self }
3152    /// WebRTC packetReordering feature.
3153    pub fn packet_reordering(mut self, packet_reordering: bool) -> Self { self.packet_reordering = Some(packet_reordering); self }
3154    /// True to emulate internet disconnection.
3155    pub fn offline(mut self, offline: bool) -> Self { self.offline = Some(offline); self }
3156    pub fn build(self) -> NetworkConditions<'a> {
3157        NetworkConditions {
3158            url_pattern: self.url_pattern,
3159            latency: self.latency,
3160            download_throughput: self.download_throughput,
3161            upload_throughput: self.upload_throughput,
3162            connection_type: self.connection_type,
3163            packet_loss: self.packet_loss,
3164            packet_queue_length: self.packet_queue_length,
3165            packet_reordering: self.packet_reordering,
3166            offline: self.offline,
3167        }
3168    }
3169}
3170
3171
3172#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3173#[serde(rename_all = "camelCase")]
3174pub struct BlockPattern<'a> {
3175    /// URL pattern to match. Patterns use the URLPattern constructor string syntax
3176    /// (<https://urlpattern.spec.whatwg.org/>) and must be absolute. Example: '*://*:*/*.css'.
3177    #[serde(rename = "urlPattern")]
3178    url_pattern: Cow<'a, str>,
3179    /// Whether or not to block the pattern. If false, a matching request will not be blocked even if it matches a later
3180    /// 'BlockPattern'.
3181    block: bool,
3182}
3183
3184impl<'a> BlockPattern<'a> {
3185    /// Creates a builder for this type with the required parameters:
3186    /// * `url_pattern`: URL pattern to match. Patterns use the URLPattern constructor string syntax (<https://urlpattern.spec.whatwg.org/>) and must be absolute. Example: `*://*:*/*.css`.
3187    /// * `block`: Whether or not to block the pattern. If false, a matching request will not be blocked even if it matches a later `BlockPattern`.
3188    pub fn builder(url_pattern: impl Into<Cow<'a, str>>, block: bool) -> BlockPatternBuilder<'a> {
3189        BlockPatternBuilder {
3190            url_pattern: url_pattern.into(),
3191            block: block,
3192        }
3193    }
3194    /// URL pattern to match. Patterns use the URLPattern constructor string syntax
3195    /// (<https://urlpattern.spec.whatwg.org/>) and must be absolute. Example: '*://*:*/*.css'.
3196    pub fn url_pattern(&self) -> &str { self.url_pattern.as_ref() }
3197    /// Whether or not to block the pattern. If false, a matching request will not be blocked even if it matches a later
3198    /// 'BlockPattern'.
3199    pub fn block(&self) -> bool { self.block }
3200}
3201
3202
3203pub struct BlockPatternBuilder<'a> {
3204    url_pattern: Cow<'a, str>,
3205    block: bool,
3206}
3207
3208impl<'a> BlockPatternBuilder<'a> {
3209    pub fn build(self) -> BlockPattern<'a> {
3210        BlockPattern {
3211            url_pattern: self.url_pattern,
3212            block: self.block,
3213        }
3214    }
3215}
3216
3217
3218#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3219pub enum DirectSocketDnsQueryType {
3220    #[default]
3221    #[serde(rename = "ipv4")]
3222    Ipv4,
3223    #[serde(rename = "ipv6")]
3224    Ipv6,
3225}
3226
3227
3228#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3229#[serde(rename_all = "camelCase")]
3230pub struct DirectTCPSocketOptions {
3231    /// TCP_NODELAY option
3232    #[serde(rename = "noDelay")]
3233    no_delay: bool,
3234    /// Expected to be unsigned integer.
3235    #[serde(skip_serializing_if = "Option::is_none", rename = "keepAliveDelay")]
3236    keep_alive_delay: Option<f64>,
3237    /// Expected to be unsigned integer.
3238    #[serde(skip_serializing_if = "Option::is_none", rename = "sendBufferSize")]
3239    send_buffer_size: Option<f64>,
3240    /// Expected to be unsigned integer.
3241    #[serde(skip_serializing_if = "Option::is_none", rename = "receiveBufferSize")]
3242    receive_buffer_size: Option<f64>,
3243    #[serde(skip_serializing_if = "Option::is_none", rename = "dnsQueryType")]
3244    dns_query_type: Option<DirectSocketDnsQueryType>,
3245}
3246
3247impl DirectTCPSocketOptions {
3248    /// Creates a builder for this type with the required parameters:
3249    /// * `no_delay`: TCP_NODELAY option
3250    pub fn builder(no_delay: bool) -> DirectTCPSocketOptionsBuilder {
3251        DirectTCPSocketOptionsBuilder {
3252            no_delay: no_delay,
3253            keep_alive_delay: None,
3254            send_buffer_size: None,
3255            receive_buffer_size: None,
3256            dns_query_type: None,
3257        }
3258    }
3259    /// TCP_NODELAY option
3260    pub fn no_delay(&self) -> bool { self.no_delay }
3261    /// Expected to be unsigned integer.
3262    pub fn keep_alive_delay(&self) -> Option<f64> { self.keep_alive_delay }
3263    /// Expected to be unsigned integer.
3264    pub fn send_buffer_size(&self) -> Option<f64> { self.send_buffer_size }
3265    /// Expected to be unsigned integer.
3266    pub fn receive_buffer_size(&self) -> Option<f64> { self.receive_buffer_size }
3267    pub fn dns_query_type(&self) -> Option<&DirectSocketDnsQueryType> { self.dns_query_type.as_ref() }
3268}
3269
3270
3271pub struct DirectTCPSocketOptionsBuilder {
3272    no_delay: bool,
3273    keep_alive_delay: Option<f64>,
3274    send_buffer_size: Option<f64>,
3275    receive_buffer_size: Option<f64>,
3276    dns_query_type: Option<DirectSocketDnsQueryType>,
3277}
3278
3279impl DirectTCPSocketOptionsBuilder {
3280    /// Expected to be unsigned integer.
3281    pub fn keep_alive_delay(mut self, keep_alive_delay: f64) -> Self { self.keep_alive_delay = Some(keep_alive_delay); self }
3282    /// Expected to be unsigned integer.
3283    pub fn send_buffer_size(mut self, send_buffer_size: f64) -> Self { self.send_buffer_size = Some(send_buffer_size); self }
3284    /// Expected to be unsigned integer.
3285    pub fn receive_buffer_size(mut self, receive_buffer_size: f64) -> Self { self.receive_buffer_size = Some(receive_buffer_size); self }
3286    pub fn dns_query_type(mut self, dns_query_type: impl Into<DirectSocketDnsQueryType>) -> Self { self.dns_query_type = Some(dns_query_type.into()); self }
3287    pub fn build(self) -> DirectTCPSocketOptions {
3288        DirectTCPSocketOptions {
3289            no_delay: self.no_delay,
3290            keep_alive_delay: self.keep_alive_delay,
3291            send_buffer_size: self.send_buffer_size,
3292            receive_buffer_size: self.receive_buffer_size,
3293            dns_query_type: self.dns_query_type,
3294        }
3295    }
3296}
3297
3298
3299#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3300#[serde(rename_all = "camelCase")]
3301pub struct DirectUDPSocketOptions<'a> {
3302    #[serde(skip_serializing_if = "Option::is_none", rename = "remoteAddr")]
3303    remote_addr: Option<Cow<'a, str>>,
3304    /// Unsigned int 16.
3305    #[serde(skip_serializing_if = "Option::is_none", rename = "remotePort")]
3306    remote_port: Option<i64>,
3307    #[serde(skip_serializing_if = "Option::is_none", rename = "localAddr")]
3308    local_addr: Option<Cow<'a, str>>,
3309    /// Unsigned int 16.
3310    #[serde(skip_serializing_if = "Option::is_none", rename = "localPort")]
3311    local_port: Option<i64>,
3312    #[serde(skip_serializing_if = "Option::is_none", rename = "dnsQueryType")]
3313    dns_query_type: Option<DirectSocketDnsQueryType>,
3314    /// Expected to be unsigned integer.
3315    #[serde(skip_serializing_if = "Option::is_none", rename = "sendBufferSize")]
3316    send_buffer_size: Option<f64>,
3317    /// Expected to be unsigned integer.
3318    #[serde(skip_serializing_if = "Option::is_none", rename = "receiveBufferSize")]
3319    receive_buffer_size: Option<f64>,
3320    #[serde(skip_serializing_if = "Option::is_none", rename = "multicastLoopback")]
3321    multicast_loopback: Option<bool>,
3322    /// Unsigned int 8.
3323    #[serde(skip_serializing_if = "Option::is_none", rename = "multicastTimeToLive")]
3324    multicast_time_to_live: Option<i64>,
3325    #[serde(skip_serializing_if = "Option::is_none", rename = "multicastAllowAddressSharing")]
3326    multicast_allow_address_sharing: Option<bool>,
3327}
3328
3329impl<'a> DirectUDPSocketOptions<'a> {
3330    /// Creates a builder for this type.
3331    pub fn builder() -> DirectUDPSocketOptionsBuilder<'a> {
3332        DirectUDPSocketOptionsBuilder {
3333            remote_addr: None,
3334            remote_port: None,
3335            local_addr: None,
3336            local_port: None,
3337            dns_query_type: None,
3338            send_buffer_size: None,
3339            receive_buffer_size: None,
3340            multicast_loopback: None,
3341            multicast_time_to_live: None,
3342            multicast_allow_address_sharing: None,
3343        }
3344    }
3345    pub fn remote_addr(&self) -> Option<&str> { self.remote_addr.as_deref() }
3346    /// Unsigned int 16.
3347    pub fn remote_port(&self) -> Option<i64> { self.remote_port }
3348    pub fn local_addr(&self) -> Option<&str> { self.local_addr.as_deref() }
3349    /// Unsigned int 16.
3350    pub fn local_port(&self) -> Option<i64> { self.local_port }
3351    pub fn dns_query_type(&self) -> Option<&DirectSocketDnsQueryType> { self.dns_query_type.as_ref() }
3352    /// Expected to be unsigned integer.
3353    pub fn send_buffer_size(&self) -> Option<f64> { self.send_buffer_size }
3354    /// Expected to be unsigned integer.
3355    pub fn receive_buffer_size(&self) -> Option<f64> { self.receive_buffer_size }
3356    pub fn multicast_loopback(&self) -> Option<bool> { self.multicast_loopback }
3357    /// Unsigned int 8.
3358    pub fn multicast_time_to_live(&self) -> Option<i64> { self.multicast_time_to_live }
3359    pub fn multicast_allow_address_sharing(&self) -> Option<bool> { self.multicast_allow_address_sharing }
3360}
3361
3362#[derive(Default)]
3363pub struct DirectUDPSocketOptionsBuilder<'a> {
3364    remote_addr: Option<Cow<'a, str>>,
3365    remote_port: Option<i64>,
3366    local_addr: Option<Cow<'a, str>>,
3367    local_port: Option<i64>,
3368    dns_query_type: Option<DirectSocketDnsQueryType>,
3369    send_buffer_size: Option<f64>,
3370    receive_buffer_size: Option<f64>,
3371    multicast_loopback: Option<bool>,
3372    multicast_time_to_live: Option<i64>,
3373    multicast_allow_address_sharing: Option<bool>,
3374}
3375
3376impl<'a> DirectUDPSocketOptionsBuilder<'a> {
3377    pub fn remote_addr(mut self, remote_addr: impl Into<Cow<'a, str>>) -> Self { self.remote_addr = Some(remote_addr.into()); self }
3378    /// Unsigned int 16.
3379    pub fn remote_port(mut self, remote_port: i64) -> Self { self.remote_port = Some(remote_port); self }
3380    pub fn local_addr(mut self, local_addr: impl Into<Cow<'a, str>>) -> Self { self.local_addr = Some(local_addr.into()); self }
3381    /// Unsigned int 16.
3382    pub fn local_port(mut self, local_port: i64) -> Self { self.local_port = Some(local_port); self }
3383    pub fn dns_query_type(mut self, dns_query_type: impl Into<DirectSocketDnsQueryType>) -> Self { self.dns_query_type = Some(dns_query_type.into()); self }
3384    /// Expected to be unsigned integer.
3385    pub fn send_buffer_size(mut self, send_buffer_size: f64) -> Self { self.send_buffer_size = Some(send_buffer_size); self }
3386    /// Expected to be unsigned integer.
3387    pub fn receive_buffer_size(mut self, receive_buffer_size: f64) -> Self { self.receive_buffer_size = Some(receive_buffer_size); self }
3388    pub fn multicast_loopback(mut self, multicast_loopback: bool) -> Self { self.multicast_loopback = Some(multicast_loopback); self }
3389    /// Unsigned int 8.
3390    pub fn multicast_time_to_live(mut self, multicast_time_to_live: i64) -> Self { self.multicast_time_to_live = Some(multicast_time_to_live); self }
3391    pub fn multicast_allow_address_sharing(mut self, multicast_allow_address_sharing: bool) -> Self { self.multicast_allow_address_sharing = Some(multicast_allow_address_sharing); self }
3392    pub fn build(self) -> DirectUDPSocketOptions<'a> {
3393        DirectUDPSocketOptions {
3394            remote_addr: self.remote_addr,
3395            remote_port: self.remote_port,
3396            local_addr: self.local_addr,
3397            local_port: self.local_port,
3398            dns_query_type: self.dns_query_type,
3399            send_buffer_size: self.send_buffer_size,
3400            receive_buffer_size: self.receive_buffer_size,
3401            multicast_loopback: self.multicast_loopback,
3402            multicast_time_to_live: self.multicast_time_to_live,
3403            multicast_allow_address_sharing: self.multicast_allow_address_sharing,
3404        }
3405    }
3406}
3407
3408
3409#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3410#[serde(rename_all = "camelCase")]
3411pub struct DirectUDPMessage<'a> {
3412    data: Cow<'a, str>,
3413    /// Null for connected mode.
3414    #[serde(skip_serializing_if = "Option::is_none", rename = "remoteAddr")]
3415    remote_addr: Option<Cow<'a, str>>,
3416    /// Null for connected mode.
3417    /// Expected to be unsigned integer.
3418    #[serde(skip_serializing_if = "Option::is_none", rename = "remotePort")]
3419    remote_port: Option<i64>,
3420}
3421
3422impl<'a> DirectUDPMessage<'a> {
3423    /// Creates a builder for this type with the required parameters:
3424    /// * `data`: 
3425    pub fn builder(data: impl Into<Cow<'a, str>>) -> DirectUDPMessageBuilder<'a> {
3426        DirectUDPMessageBuilder {
3427            data: data.into(),
3428            remote_addr: None,
3429            remote_port: None,
3430        }
3431    }
3432    pub fn data(&self) -> &str { self.data.as_ref() }
3433    /// Null for connected mode.
3434    pub fn remote_addr(&self) -> Option<&str> { self.remote_addr.as_deref() }
3435    /// Null for connected mode.
3436    /// Expected to be unsigned integer.
3437    pub fn remote_port(&self) -> Option<i64> { self.remote_port }
3438}
3439
3440
3441pub struct DirectUDPMessageBuilder<'a> {
3442    data: Cow<'a, str>,
3443    remote_addr: Option<Cow<'a, str>>,
3444    remote_port: Option<i64>,
3445}
3446
3447impl<'a> DirectUDPMessageBuilder<'a> {
3448    /// Null for connected mode.
3449    pub fn remote_addr(mut self, remote_addr: impl Into<Cow<'a, str>>) -> Self { self.remote_addr = Some(remote_addr.into()); self }
3450    /// Null for connected mode.
3451    /// Expected to be unsigned integer.
3452    pub fn remote_port(mut self, remote_port: i64) -> Self { self.remote_port = Some(remote_port); self }
3453    pub fn build(self) -> DirectUDPMessage<'a> {
3454        DirectUDPMessage {
3455            data: self.data,
3456            remote_addr: self.remote_addr,
3457            remote_port: self.remote_port,
3458        }
3459    }
3460}
3461
3462
3463#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3464pub enum LocalNetworkAccessRequestPolicy {
3465    #[default]
3466    #[serde(rename = "Allow")]
3467    Allow,
3468    #[serde(rename = "BlockFromInsecureToMorePrivate")]
3469    BlockFromInsecureToMorePrivate,
3470    #[serde(rename = "WarnFromInsecureToMorePrivate")]
3471    WarnFromInsecureToMorePrivate,
3472    #[serde(rename = "PermissionBlock")]
3473    PermissionBlock,
3474    #[serde(rename = "PermissionWarn")]
3475    PermissionWarn,
3476}
3477
3478
3479#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3480pub enum IPAddressSpace {
3481    #[default]
3482    #[serde(rename = "Loopback")]
3483    Loopback,
3484    #[serde(rename = "Local")]
3485    Local,
3486    #[serde(rename = "Public")]
3487    Public,
3488    #[serde(rename = "Unknown")]
3489    Unknown,
3490}
3491
3492
3493#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3494#[serde(rename_all = "camelCase")]
3495pub struct ConnectTiming {
3496    /// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in
3497    /// milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for
3498    /// the same request (but not for redirected requests).
3499    #[serde(rename = "requestTime")]
3500    request_time: f64,
3501}
3502
3503impl ConnectTiming {
3504    /// Creates a builder for this type with the required parameters:
3505    /// * `request_time`: Timing's requestTime is a baseline in seconds, while the other numbers are ticks in milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for the same request (but not for redirected requests).
3506    pub fn builder(request_time: f64) -> ConnectTimingBuilder {
3507        ConnectTimingBuilder {
3508            request_time: request_time,
3509        }
3510    }
3511    /// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in
3512    /// milliseconds relatively to this requestTime. Matches ResourceTiming's requestTime for
3513    /// the same request (but not for redirected requests).
3514    pub fn request_time(&self) -> f64 { self.request_time }
3515}
3516
3517
3518pub struct ConnectTimingBuilder {
3519    request_time: f64,
3520}
3521
3522impl ConnectTimingBuilder {
3523    pub fn build(self) -> ConnectTiming {
3524        ConnectTiming {
3525            request_time: self.request_time,
3526        }
3527    }
3528}
3529
3530
3531#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3532#[serde(rename_all = "camelCase")]
3533pub struct ClientSecurityState {
3534    #[serde(rename = "initiatorIsSecureContext")]
3535    initiator_is_secure_context: bool,
3536    #[serde(rename = "initiatorIPAddressSpace")]
3537    initiator_ip_address_space: IPAddressSpace,
3538    #[serde(rename = "localNetworkAccessRequestPolicy")]
3539    local_network_access_request_policy: LocalNetworkAccessRequestPolicy,
3540}
3541
3542impl ClientSecurityState {
3543    /// Creates a builder for this type with the required parameters:
3544    /// * `initiator_is_secure_context`: 
3545    /// * `initiator_ip_address_space`: 
3546    /// * `local_network_access_request_policy`: 
3547    pub fn builder(initiator_is_secure_context: bool, initiator_ip_address_space: impl Into<IPAddressSpace>, local_network_access_request_policy: impl Into<LocalNetworkAccessRequestPolicy>) -> ClientSecurityStateBuilder {
3548        ClientSecurityStateBuilder {
3549            initiator_is_secure_context: initiator_is_secure_context,
3550            initiator_ip_address_space: initiator_ip_address_space.into(),
3551            local_network_access_request_policy: local_network_access_request_policy.into(),
3552        }
3553    }
3554    pub fn initiator_is_secure_context(&self) -> bool { self.initiator_is_secure_context }
3555    pub fn initiator_ip_address_space(&self) -> &IPAddressSpace { &self.initiator_ip_address_space }
3556    pub fn local_network_access_request_policy(&self) -> &LocalNetworkAccessRequestPolicy { &self.local_network_access_request_policy }
3557}
3558
3559
3560pub struct ClientSecurityStateBuilder {
3561    initiator_is_secure_context: bool,
3562    initiator_ip_address_space: IPAddressSpace,
3563    local_network_access_request_policy: LocalNetworkAccessRequestPolicy,
3564}
3565
3566impl ClientSecurityStateBuilder {
3567    pub fn build(self) -> ClientSecurityState {
3568        ClientSecurityState {
3569            initiator_is_secure_context: self.initiator_is_secure_context,
3570            initiator_ip_address_space: self.initiator_ip_address_space,
3571            local_network_access_request_policy: self.local_network_access_request_policy,
3572        }
3573    }
3574}
3575
3576/// Identifies the script on the stack that caused a resource or element to be
3577/// labeled as an ad. For resources, this indicates the context that triggered
3578/// the fetch. For elements, this indicates the context that caused the element
3579/// to be appended to the DOM.
3580
3581#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3582#[serde(rename_all = "camelCase")]
3583pub struct AdScriptIdentifier<'a> {
3584    /// The script's V8 identifier.
3585    #[serde(rename = "scriptId")]
3586    script_id: crate::runtime::ScriptId<'a>,
3587    /// V8's debugging ID for the v8::Context.
3588    #[serde(rename = "debuggerId")]
3589    debugger_id: crate::runtime::UniqueDebuggerId<'a>,
3590    /// The script's url (or generated name based on id if inline script).
3591    name: Cow<'a, str>,
3592}
3593
3594impl<'a> AdScriptIdentifier<'a> {
3595    /// Creates a builder for this type with the required parameters:
3596    /// * `script_id`: The script's V8 identifier.
3597    /// * `debugger_id`: V8's debugging ID for the v8::Context.
3598    /// * `name`: The script's url (or generated name based on id if inline script).
3599    pub fn builder(script_id: crate::runtime::ScriptId<'a>, debugger_id: crate::runtime::UniqueDebuggerId<'a>, name: impl Into<Cow<'a, str>>) -> AdScriptIdentifierBuilder<'a> {
3600        AdScriptIdentifierBuilder {
3601            script_id: script_id,
3602            debugger_id: debugger_id,
3603            name: name.into(),
3604        }
3605    }
3606    /// The script's V8 identifier.
3607    pub fn script_id(&self) -> &crate::runtime::ScriptId<'a> { &self.script_id }
3608    /// V8's debugging ID for the v8::Context.
3609    pub fn debugger_id(&self) -> &crate::runtime::UniqueDebuggerId<'a> { &self.debugger_id }
3610    /// The script's url (or generated name based on id if inline script).
3611    pub fn name(&self) -> &str { self.name.as_ref() }
3612}
3613
3614
3615pub struct AdScriptIdentifierBuilder<'a> {
3616    script_id: crate::runtime::ScriptId<'a>,
3617    debugger_id: crate::runtime::UniqueDebuggerId<'a>,
3618    name: Cow<'a, str>,
3619}
3620
3621impl<'a> AdScriptIdentifierBuilder<'a> {
3622    pub fn build(self) -> AdScriptIdentifier<'a> {
3623        AdScriptIdentifier {
3624            script_id: self.script_id,
3625            debugger_id: self.debugger_id,
3626            name: self.name,
3627        }
3628    }
3629}
3630
3631/// Encapsulates the script ancestry and the root script filter list rule that
3632/// caused the resource or element to be labeled as an ad.
3633
3634#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3635#[serde(rename_all = "camelCase")]
3636pub struct AdAncestry<'a> {
3637    /// A chain of 'AdScriptIdentifier's representing the ancestry of an ad
3638    /// script that led to the creation of a resource or element. The chain is
3639    /// ordered from the script itself (lowest level) up to its root ancestor
3640    /// that was flagged by a filter list.
3641    #[serde(rename = "ancestryChain")]
3642    ancestry_chain: Vec<AdScriptIdentifier<'a>>,
3643    /// The filter list rule that caused the root (last) script in
3644    /// 'ancestryChain' to be tagged as an ad.
3645    #[serde(skip_serializing_if = "Option::is_none", rename = "rootScriptFilterlistRule")]
3646    root_script_filterlist_rule: Option<Cow<'a, str>>,
3647}
3648
3649impl<'a> AdAncestry<'a> {
3650    /// Creates a builder for this type with the required parameters:
3651    /// * `ancestry_chain`: A chain of `AdScriptIdentifier`s representing the ancestry of an ad script that led to the creation of a resource or element. The chain is ordered from the script itself (lowest level) up to its root ancestor that was flagged by a filter list.
3652    pub fn builder(ancestry_chain: Vec<AdScriptIdentifier<'a>>) -> AdAncestryBuilder<'a> {
3653        AdAncestryBuilder {
3654            ancestry_chain: ancestry_chain,
3655            root_script_filterlist_rule: None,
3656        }
3657    }
3658    /// A chain of 'AdScriptIdentifier's representing the ancestry of an ad
3659    /// script that led to the creation of a resource or element. The chain is
3660    /// ordered from the script itself (lowest level) up to its root ancestor
3661    /// that was flagged by a filter list.
3662    pub fn ancestry_chain(&self) -> &[AdScriptIdentifier<'a>] { &self.ancestry_chain }
3663    /// The filter list rule that caused the root (last) script in
3664    /// 'ancestryChain' to be tagged as an ad.
3665    pub fn root_script_filterlist_rule(&self) -> Option<&str> { self.root_script_filterlist_rule.as_deref() }
3666}
3667
3668
3669pub struct AdAncestryBuilder<'a> {
3670    ancestry_chain: Vec<AdScriptIdentifier<'a>>,
3671    root_script_filterlist_rule: Option<Cow<'a, str>>,
3672}
3673
3674impl<'a> AdAncestryBuilder<'a> {
3675    /// The filter list rule that caused the root (last) script in
3676    /// 'ancestryChain' to be tagged as an ad.
3677    pub fn root_script_filterlist_rule(mut self, root_script_filterlist_rule: impl Into<Cow<'a, str>>) -> Self { self.root_script_filterlist_rule = Some(root_script_filterlist_rule.into()); self }
3678    pub fn build(self) -> AdAncestry<'a> {
3679        AdAncestry {
3680            ancestry_chain: self.ancestry_chain,
3681            root_script_filterlist_rule: self.root_script_filterlist_rule,
3682        }
3683    }
3684}
3685
3686/// Represents the provenance of an ad resource or element. Only one of
3687/// 'filterlistRule' or 'adScriptAncestry' can be set. If 'filterlistRule'
3688/// is provided, the resource URL directly matches a filter list rule. If
3689/// 'adScriptAncestry' is provided, an ad script initiated the resource fetch or
3690/// appended the element to the DOM. If neither is provided, the entity is
3691/// known to be an ad, but provenance tracking information is unavailable.
3692
3693#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3694#[serde(rename_all = "camelCase")]
3695pub struct AdProvenance<'a> {
3696    /// The filterlist rule that matched, if any.
3697    #[serde(skip_serializing_if = "Option::is_none", rename = "filterlistRule")]
3698    filterlist_rule: Option<Cow<'a, str>>,
3699    /// The script ancestry that created the ad, if any.
3700    #[serde(skip_serializing_if = "Option::is_none", rename = "adScriptAncestry")]
3701    ad_script_ancestry: Option<AdAncestry<'a>>,
3702}
3703
3704impl<'a> AdProvenance<'a> {
3705    /// Creates a builder for this type.
3706    pub fn builder() -> AdProvenanceBuilder<'a> {
3707        AdProvenanceBuilder {
3708            filterlist_rule: None,
3709            ad_script_ancestry: None,
3710        }
3711    }
3712    /// The filterlist rule that matched, if any.
3713    pub fn filterlist_rule(&self) -> Option<&str> { self.filterlist_rule.as_deref() }
3714    /// The script ancestry that created the ad, if any.
3715    pub fn ad_script_ancestry(&self) -> Option<&AdAncestry<'a>> { self.ad_script_ancestry.as_ref() }
3716}
3717
3718#[derive(Default)]
3719pub struct AdProvenanceBuilder<'a> {
3720    filterlist_rule: Option<Cow<'a, str>>,
3721    ad_script_ancestry: Option<AdAncestry<'a>>,
3722}
3723
3724impl<'a> AdProvenanceBuilder<'a> {
3725    /// The filterlist rule that matched, if any.
3726    pub fn filterlist_rule(mut self, filterlist_rule: impl Into<Cow<'a, str>>) -> Self { self.filterlist_rule = Some(filterlist_rule.into()); self }
3727    /// The script ancestry that created the ad, if any.
3728    pub fn ad_script_ancestry(mut self, ad_script_ancestry: AdAncestry<'a>) -> Self { self.ad_script_ancestry = Some(ad_script_ancestry); self }
3729    pub fn build(self) -> AdProvenance<'a> {
3730        AdProvenance {
3731            filterlist_rule: self.filterlist_rule,
3732            ad_script_ancestry: self.ad_script_ancestry,
3733        }
3734    }
3735}
3736
3737
3738#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3739pub enum CrossOriginOpenerPolicyValue {
3740    #[default]
3741    #[serde(rename = "SameOrigin")]
3742    SameOrigin,
3743    #[serde(rename = "SameOriginAllowPopups")]
3744    SameOriginAllowPopups,
3745    #[serde(rename = "RestrictProperties")]
3746    RestrictProperties,
3747    #[serde(rename = "UnsafeNone")]
3748    UnsafeNone,
3749    #[serde(rename = "SameOriginPlusCoep")]
3750    SameOriginPlusCoep,
3751    #[serde(rename = "RestrictPropertiesPlusCoep")]
3752    RestrictPropertiesPlusCoep,
3753    #[serde(rename = "NoopenerAllowPopups")]
3754    NoopenerAllowPopups,
3755}
3756
3757
3758#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3759#[serde(rename_all = "camelCase")]
3760pub struct CrossOriginOpenerPolicyStatus<'a> {
3761    value: CrossOriginOpenerPolicyValue,
3762    #[serde(rename = "reportOnlyValue")]
3763    report_only_value: CrossOriginOpenerPolicyValue,
3764    #[serde(skip_serializing_if = "Option::is_none", rename = "reportingEndpoint")]
3765    reporting_endpoint: Option<Cow<'a, str>>,
3766    #[serde(skip_serializing_if = "Option::is_none", rename = "reportOnlyReportingEndpoint")]
3767    report_only_reporting_endpoint: Option<Cow<'a, str>>,
3768}
3769
3770impl<'a> CrossOriginOpenerPolicyStatus<'a> {
3771    /// Creates a builder for this type with the required parameters:
3772    /// * `value`: 
3773    /// * `report_only_value`: 
3774    pub fn builder(value: impl Into<CrossOriginOpenerPolicyValue>, report_only_value: impl Into<CrossOriginOpenerPolicyValue>) -> CrossOriginOpenerPolicyStatusBuilder<'a> {
3775        CrossOriginOpenerPolicyStatusBuilder {
3776            value: value.into(),
3777            report_only_value: report_only_value.into(),
3778            reporting_endpoint: None,
3779            report_only_reporting_endpoint: None,
3780        }
3781    }
3782    pub fn value(&self) -> &CrossOriginOpenerPolicyValue { &self.value }
3783    pub fn report_only_value(&self) -> &CrossOriginOpenerPolicyValue { &self.report_only_value }
3784    pub fn reporting_endpoint(&self) -> Option<&str> { self.reporting_endpoint.as_deref() }
3785    pub fn report_only_reporting_endpoint(&self) -> Option<&str> { self.report_only_reporting_endpoint.as_deref() }
3786}
3787
3788
3789pub struct CrossOriginOpenerPolicyStatusBuilder<'a> {
3790    value: CrossOriginOpenerPolicyValue,
3791    report_only_value: CrossOriginOpenerPolicyValue,
3792    reporting_endpoint: Option<Cow<'a, str>>,
3793    report_only_reporting_endpoint: Option<Cow<'a, str>>,
3794}
3795
3796impl<'a> CrossOriginOpenerPolicyStatusBuilder<'a> {
3797    pub fn reporting_endpoint(mut self, reporting_endpoint: impl Into<Cow<'a, str>>) -> Self { self.reporting_endpoint = Some(reporting_endpoint.into()); self }
3798    pub fn report_only_reporting_endpoint(mut self, report_only_reporting_endpoint: impl Into<Cow<'a, str>>) -> Self { self.report_only_reporting_endpoint = Some(report_only_reporting_endpoint.into()); self }
3799    pub fn build(self) -> CrossOriginOpenerPolicyStatus<'a> {
3800        CrossOriginOpenerPolicyStatus {
3801            value: self.value,
3802            report_only_value: self.report_only_value,
3803            reporting_endpoint: self.reporting_endpoint,
3804            report_only_reporting_endpoint: self.report_only_reporting_endpoint,
3805        }
3806    }
3807}
3808
3809
3810#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3811pub enum CrossOriginEmbedderPolicyValue {
3812    #[default]
3813    #[serde(rename = "None")]
3814    None,
3815    #[serde(rename = "Credentialless")]
3816    Credentialless,
3817    #[serde(rename = "RequireCorp")]
3818    RequireCorp,
3819}
3820
3821
3822#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3823#[serde(rename_all = "camelCase")]
3824pub struct CrossOriginEmbedderPolicyStatus<'a> {
3825    value: CrossOriginEmbedderPolicyValue,
3826    #[serde(rename = "reportOnlyValue")]
3827    report_only_value: CrossOriginEmbedderPolicyValue,
3828    #[serde(skip_serializing_if = "Option::is_none", rename = "reportingEndpoint")]
3829    reporting_endpoint: Option<Cow<'a, str>>,
3830    #[serde(skip_serializing_if = "Option::is_none", rename = "reportOnlyReportingEndpoint")]
3831    report_only_reporting_endpoint: Option<Cow<'a, str>>,
3832}
3833
3834impl<'a> CrossOriginEmbedderPolicyStatus<'a> {
3835    /// Creates a builder for this type with the required parameters:
3836    /// * `value`: 
3837    /// * `report_only_value`: 
3838    pub fn builder(value: impl Into<CrossOriginEmbedderPolicyValue>, report_only_value: impl Into<CrossOriginEmbedderPolicyValue>) -> CrossOriginEmbedderPolicyStatusBuilder<'a> {
3839        CrossOriginEmbedderPolicyStatusBuilder {
3840            value: value.into(),
3841            report_only_value: report_only_value.into(),
3842            reporting_endpoint: None,
3843            report_only_reporting_endpoint: None,
3844        }
3845    }
3846    pub fn value(&self) -> &CrossOriginEmbedderPolicyValue { &self.value }
3847    pub fn report_only_value(&self) -> &CrossOriginEmbedderPolicyValue { &self.report_only_value }
3848    pub fn reporting_endpoint(&self) -> Option<&str> { self.reporting_endpoint.as_deref() }
3849    pub fn report_only_reporting_endpoint(&self) -> Option<&str> { self.report_only_reporting_endpoint.as_deref() }
3850}
3851
3852
3853pub struct CrossOriginEmbedderPolicyStatusBuilder<'a> {
3854    value: CrossOriginEmbedderPolicyValue,
3855    report_only_value: CrossOriginEmbedderPolicyValue,
3856    reporting_endpoint: Option<Cow<'a, str>>,
3857    report_only_reporting_endpoint: Option<Cow<'a, str>>,
3858}
3859
3860impl<'a> CrossOriginEmbedderPolicyStatusBuilder<'a> {
3861    pub fn reporting_endpoint(mut self, reporting_endpoint: impl Into<Cow<'a, str>>) -> Self { self.reporting_endpoint = Some(reporting_endpoint.into()); self }
3862    pub fn report_only_reporting_endpoint(mut self, report_only_reporting_endpoint: impl Into<Cow<'a, str>>) -> Self { self.report_only_reporting_endpoint = Some(report_only_reporting_endpoint.into()); self }
3863    pub fn build(self) -> CrossOriginEmbedderPolicyStatus<'a> {
3864        CrossOriginEmbedderPolicyStatus {
3865            value: self.value,
3866            report_only_value: self.report_only_value,
3867            reporting_endpoint: self.reporting_endpoint,
3868            report_only_reporting_endpoint: self.report_only_reporting_endpoint,
3869        }
3870    }
3871}
3872
3873
3874#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3875pub enum ContentSecurityPolicySource {
3876    #[default]
3877    #[serde(rename = "HTTP")]
3878    HTTP,
3879    #[serde(rename = "Meta")]
3880    Meta,
3881}
3882
3883
3884#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3885#[serde(rename_all = "camelCase")]
3886pub struct ContentSecurityPolicyStatus<'a> {
3887    #[serde(rename = "effectiveDirectives")]
3888    effective_directives: Cow<'a, str>,
3889    #[serde(rename = "isEnforced")]
3890    is_enforced: bool,
3891    source: ContentSecurityPolicySource,
3892}
3893
3894impl<'a> ContentSecurityPolicyStatus<'a> {
3895    /// Creates a builder for this type with the required parameters:
3896    /// * `effective_directives`: 
3897    /// * `is_enforced`: 
3898    /// * `source`: 
3899    pub fn builder(effective_directives: impl Into<Cow<'a, str>>, is_enforced: bool, source: impl Into<ContentSecurityPolicySource>) -> ContentSecurityPolicyStatusBuilder<'a> {
3900        ContentSecurityPolicyStatusBuilder {
3901            effective_directives: effective_directives.into(),
3902            is_enforced: is_enforced,
3903            source: source.into(),
3904        }
3905    }
3906    pub fn effective_directives(&self) -> &str { self.effective_directives.as_ref() }
3907    pub fn is_enforced(&self) -> bool { self.is_enforced }
3908    pub fn source(&self) -> &ContentSecurityPolicySource { &self.source }
3909}
3910
3911
3912pub struct ContentSecurityPolicyStatusBuilder<'a> {
3913    effective_directives: Cow<'a, str>,
3914    is_enforced: bool,
3915    source: ContentSecurityPolicySource,
3916}
3917
3918impl<'a> ContentSecurityPolicyStatusBuilder<'a> {
3919    pub fn build(self) -> ContentSecurityPolicyStatus<'a> {
3920        ContentSecurityPolicyStatus {
3921            effective_directives: self.effective_directives,
3922            is_enforced: self.is_enforced,
3923            source: self.source,
3924        }
3925    }
3926}
3927
3928
3929#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3930#[serde(rename_all = "camelCase")]
3931pub struct SecurityIsolationStatus<'a> {
3932    #[serde(skip_serializing_if = "Option::is_none")]
3933    coop: Option<CrossOriginOpenerPolicyStatus<'a>>,
3934    #[serde(skip_serializing_if = "Option::is_none")]
3935    coep: Option<CrossOriginEmbedderPolicyStatus<'a>>,
3936    #[serde(skip_serializing_if = "Option::is_none")]
3937    csp: Option<Vec<ContentSecurityPolicyStatus<'a>>>,
3938}
3939
3940impl<'a> SecurityIsolationStatus<'a> {
3941    /// Creates a builder for this type.
3942    pub fn builder() -> SecurityIsolationStatusBuilder<'a> {
3943        SecurityIsolationStatusBuilder {
3944            coop: None,
3945            coep: None,
3946            csp: None,
3947        }
3948    }
3949    pub fn coop(&self) -> Option<&CrossOriginOpenerPolicyStatus<'a>> { self.coop.as_ref() }
3950    pub fn coep(&self) -> Option<&CrossOriginEmbedderPolicyStatus<'a>> { self.coep.as_ref() }
3951    pub fn csp(&self) -> Option<&[ContentSecurityPolicyStatus<'a>]> { self.csp.as_deref() }
3952}
3953
3954#[derive(Default)]
3955pub struct SecurityIsolationStatusBuilder<'a> {
3956    coop: Option<CrossOriginOpenerPolicyStatus<'a>>,
3957    coep: Option<CrossOriginEmbedderPolicyStatus<'a>>,
3958    csp: Option<Vec<ContentSecurityPolicyStatus<'a>>>,
3959}
3960
3961impl<'a> SecurityIsolationStatusBuilder<'a> {
3962    pub fn coop(mut self, coop: CrossOriginOpenerPolicyStatus<'a>) -> Self { self.coop = Some(coop); self }
3963    pub fn coep(mut self, coep: CrossOriginEmbedderPolicyStatus<'a>) -> Self { self.coep = Some(coep); self }
3964    pub fn csp(mut self, csp: Vec<ContentSecurityPolicyStatus<'a>>) -> Self { self.csp = Some(csp); self }
3965    pub fn build(self) -> SecurityIsolationStatus<'a> {
3966        SecurityIsolationStatus {
3967            coop: self.coop,
3968            coep: self.coep,
3969            csp: self.csp,
3970        }
3971    }
3972}
3973
3974/// The status of a Reporting API report.
3975
3976#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
3977pub enum ReportStatus {
3978    #[default]
3979    #[serde(rename = "Queued")]
3980    Queued,
3981    #[serde(rename = "Pending")]
3982    Pending,
3983    #[serde(rename = "MarkedForRemoval")]
3984    MarkedForRemoval,
3985    #[serde(rename = "Success")]
3986    Success,
3987}
3988
3989
3990pub type ReportId<'a> = Cow<'a, str>;
3991
3992/// An object representing a report generated by the Reporting API.
3993
3994#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3995#[serde(rename_all = "camelCase")]
3996pub struct ReportingApiReport<'a> {
3997    id: ReportId<'a>,
3998    /// The URL of the document that triggered the report.
3999    #[serde(rename = "initiatorUrl")]
4000    initiator_url: Cow<'a, str>,
4001    /// The name of the endpoint group that should be used to deliver the report.
4002    destination: Cow<'a, str>,
4003    /// The type of the report (specifies the set of data that is contained in the report body).
4004    #[serde(rename = "type")]
4005    type_: Cow<'a, str>,
4006    /// When the report was generated.
4007    timestamp: crate::network::TimeSinceEpoch,
4008    /// How many uploads deep the related request was.
4009    depth: i64,
4010    /// The number of delivery attempts made so far, not including an active attempt.
4011    #[serde(rename = "completedAttempts")]
4012    completed_attempts: i64,
4013    body: serde_json::Map<String, JsonValue>,
4014    status: ReportStatus,
4015}
4016
4017impl<'a> ReportingApiReport<'a> {
4018    /// Creates a builder for this type with the required parameters:
4019    /// * `id`: 
4020    /// * `initiator_url`: The URL of the document that triggered the report.
4021    /// * `destination`: The name of the endpoint group that should be used to deliver the report.
4022    /// * `type_`: The type of the report (specifies the set of data that is contained in the report body).
4023    /// * `timestamp`: When the report was generated.
4024    /// * `depth`: How many uploads deep the related request was.
4025    /// * `completed_attempts`: The number of delivery attempts made so far, not including an active attempt.
4026    /// * `body`: 
4027    /// * `status`: 
4028    pub fn builder(id: impl Into<ReportId<'a>>, initiator_url: impl Into<Cow<'a, str>>, destination: impl Into<Cow<'a, str>>, type_: impl Into<Cow<'a, str>>, timestamp: crate::network::TimeSinceEpoch, depth: i64, completed_attempts: i64, body: serde_json::Map<String, JsonValue>, status: impl Into<ReportStatus>) -> ReportingApiReportBuilder<'a> {
4029        ReportingApiReportBuilder {
4030            id: id.into(),
4031            initiator_url: initiator_url.into(),
4032            destination: destination.into(),
4033            type_: type_.into(),
4034            timestamp: timestamp,
4035            depth: depth,
4036            completed_attempts: completed_attempts,
4037            body: body,
4038            status: status.into(),
4039        }
4040    }
4041    pub fn id(&self) -> &ReportId<'a> { &self.id }
4042    /// The URL of the document that triggered the report.
4043    pub fn initiator_url(&self) -> &str { self.initiator_url.as_ref() }
4044    /// The name of the endpoint group that should be used to deliver the report.
4045    pub fn destination(&self) -> &str { self.destination.as_ref() }
4046    /// The type of the report (specifies the set of data that is contained in the report body).
4047    pub fn type_(&self) -> &str { self.type_.as_ref() }
4048    /// When the report was generated.
4049    pub fn timestamp(&self) -> &crate::network::TimeSinceEpoch { &self.timestamp }
4050    /// How many uploads deep the related request was.
4051    pub fn depth(&self) -> i64 { self.depth }
4052    /// The number of delivery attempts made so far, not including an active attempt.
4053    pub fn completed_attempts(&self) -> i64 { self.completed_attempts }
4054    pub fn body(&self) -> &serde_json::Map<String, JsonValue> { &self.body }
4055    pub fn status(&self) -> &ReportStatus { &self.status }
4056}
4057
4058
4059pub struct ReportingApiReportBuilder<'a> {
4060    id: ReportId<'a>,
4061    initiator_url: Cow<'a, str>,
4062    destination: Cow<'a, str>,
4063    type_: Cow<'a, str>,
4064    timestamp: crate::network::TimeSinceEpoch,
4065    depth: i64,
4066    completed_attempts: i64,
4067    body: serde_json::Map<String, JsonValue>,
4068    status: ReportStatus,
4069}
4070
4071impl<'a> ReportingApiReportBuilder<'a> {
4072    pub fn build(self) -> ReportingApiReport<'a> {
4073        ReportingApiReport {
4074            id: self.id,
4075            initiator_url: self.initiator_url,
4076            destination: self.destination,
4077            type_: self.type_,
4078            timestamp: self.timestamp,
4079            depth: self.depth,
4080            completed_attempts: self.completed_attempts,
4081            body: self.body,
4082            status: self.status,
4083        }
4084    }
4085}
4086
4087
4088#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4089#[serde(rename_all = "camelCase")]
4090pub struct ReportingApiEndpoint<'a> {
4091    /// The URL of the endpoint to which reports may be delivered.
4092    url: Cow<'a, str>,
4093    /// Name of the endpoint group.
4094    #[serde(rename = "groupName")]
4095    group_name: Cow<'a, str>,
4096}
4097
4098impl<'a> ReportingApiEndpoint<'a> {
4099    /// Creates a builder for this type with the required parameters:
4100    /// * `url`: The URL of the endpoint to which reports may be delivered.
4101    /// * `group_name`: Name of the endpoint group.
4102    pub fn builder(url: impl Into<Cow<'a, str>>, group_name: impl Into<Cow<'a, str>>) -> ReportingApiEndpointBuilder<'a> {
4103        ReportingApiEndpointBuilder {
4104            url: url.into(),
4105            group_name: group_name.into(),
4106        }
4107    }
4108    /// The URL of the endpoint to which reports may be delivered.
4109    pub fn url(&self) -> &str { self.url.as_ref() }
4110    /// Name of the endpoint group.
4111    pub fn group_name(&self) -> &str { self.group_name.as_ref() }
4112}
4113
4114
4115pub struct ReportingApiEndpointBuilder<'a> {
4116    url: Cow<'a, str>,
4117    group_name: Cow<'a, str>,
4118}
4119
4120impl<'a> ReportingApiEndpointBuilder<'a> {
4121    pub fn build(self) -> ReportingApiEndpoint<'a> {
4122        ReportingApiEndpoint {
4123            url: self.url,
4124            group_name: self.group_name,
4125        }
4126    }
4127}
4128
4129/// Unique identifier for a device bound session.
4130
4131#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4132#[serde(rename_all = "camelCase")]
4133pub struct DeviceBoundSessionKey<'a> {
4134    /// The site the session is set up for.
4135    site: Cow<'a, str>,
4136    /// The id of the session.
4137    id: Cow<'a, str>,
4138}
4139
4140impl<'a> DeviceBoundSessionKey<'a> {
4141    /// Creates a builder for this type with the required parameters:
4142    /// * `site`: The site the session is set up for.
4143    /// * `id`: The id of the session.
4144    pub fn builder(site: impl Into<Cow<'a, str>>, id: impl Into<Cow<'a, str>>) -> DeviceBoundSessionKeyBuilder<'a> {
4145        DeviceBoundSessionKeyBuilder {
4146            site: site.into(),
4147            id: id.into(),
4148        }
4149    }
4150    /// The site the session is set up for.
4151    pub fn site(&self) -> &str { self.site.as_ref() }
4152    /// The id of the session.
4153    pub fn id(&self) -> &str { self.id.as_ref() }
4154}
4155
4156
4157pub struct DeviceBoundSessionKeyBuilder<'a> {
4158    site: Cow<'a, str>,
4159    id: Cow<'a, str>,
4160}
4161
4162impl<'a> DeviceBoundSessionKeyBuilder<'a> {
4163    pub fn build(self) -> DeviceBoundSessionKey<'a> {
4164        DeviceBoundSessionKey {
4165            site: self.site,
4166            id: self.id,
4167        }
4168    }
4169}
4170
4171/// How a device bound session was used during a request.
4172
4173#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4174#[serde(rename_all = "camelCase")]
4175pub struct DeviceBoundSessionWithUsage<'a> {
4176    /// The key for the session.
4177    #[serde(rename = "sessionKey")]
4178    session_key: DeviceBoundSessionKey<'a>,
4179    /// How the session was used (or not used).
4180    usage: Cow<'a, str>,
4181}
4182
4183impl<'a> DeviceBoundSessionWithUsage<'a> {
4184    /// Creates a builder for this type with the required parameters:
4185    /// * `session_key`: The key for the session.
4186    /// * `usage`: How the session was used (or not used).
4187    pub fn builder(session_key: DeviceBoundSessionKey<'a>, usage: impl Into<Cow<'a, str>>) -> DeviceBoundSessionWithUsageBuilder<'a> {
4188        DeviceBoundSessionWithUsageBuilder {
4189            session_key: session_key,
4190            usage: usage.into(),
4191        }
4192    }
4193    /// The key for the session.
4194    pub fn session_key(&self) -> &DeviceBoundSessionKey<'a> { &self.session_key }
4195    /// How the session was used (or not used).
4196    pub fn usage(&self) -> &str { self.usage.as_ref() }
4197}
4198
4199
4200pub struct DeviceBoundSessionWithUsageBuilder<'a> {
4201    session_key: DeviceBoundSessionKey<'a>,
4202    usage: Cow<'a, str>,
4203}
4204
4205impl<'a> DeviceBoundSessionWithUsageBuilder<'a> {
4206    pub fn build(self) -> DeviceBoundSessionWithUsage<'a> {
4207        DeviceBoundSessionWithUsage {
4208            session_key: self.session_key,
4209            usage: self.usage,
4210        }
4211    }
4212}
4213
4214/// A device bound session's cookie craving.
4215
4216#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4217#[serde(rename_all = "camelCase")]
4218pub struct DeviceBoundSessionCookieCraving<'a> {
4219    /// The name of the craving.
4220    name: Cow<'a, str>,
4221    /// The domain of the craving.
4222    domain: Cow<'a, str>,
4223    /// The path of the craving.
4224    path: Cow<'a, str>,
4225    /// The 'Secure' attribute of the craving attributes.
4226    secure: bool,
4227    /// The 'HttpOnly' attribute of the craving attributes.
4228    #[serde(rename = "httpOnly")]
4229    http_only: bool,
4230    /// The 'SameSite' attribute of the craving attributes.
4231    #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
4232    same_site: Option<CookieSameSite>,
4233}
4234
4235impl<'a> DeviceBoundSessionCookieCraving<'a> {
4236    /// Creates a builder for this type with the required parameters:
4237    /// * `name`: The name of the craving.
4238    /// * `domain`: The domain of the craving.
4239    /// * `path`: The path of the craving.
4240    /// * `secure`: The `Secure` attribute of the craving attributes.
4241    /// * `http_only`: The `HttpOnly` attribute of the craving attributes.
4242    pub fn builder(name: impl Into<Cow<'a, str>>, domain: impl Into<Cow<'a, str>>, path: impl Into<Cow<'a, str>>, secure: bool, http_only: bool) -> DeviceBoundSessionCookieCravingBuilder<'a> {
4243        DeviceBoundSessionCookieCravingBuilder {
4244            name: name.into(),
4245            domain: domain.into(),
4246            path: path.into(),
4247            secure: secure,
4248            http_only: http_only,
4249            same_site: None,
4250        }
4251    }
4252    /// The name of the craving.
4253    pub fn name(&self) -> &str { self.name.as_ref() }
4254    /// The domain of the craving.
4255    pub fn domain(&self) -> &str { self.domain.as_ref() }
4256    /// The path of the craving.
4257    pub fn path(&self) -> &str { self.path.as_ref() }
4258    /// The 'Secure' attribute of the craving attributes.
4259    pub fn secure(&self) -> bool { self.secure }
4260    /// The 'HttpOnly' attribute of the craving attributes.
4261    pub fn http_only(&self) -> bool { self.http_only }
4262    /// The 'SameSite' attribute of the craving attributes.
4263    pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
4264}
4265
4266
4267pub struct DeviceBoundSessionCookieCravingBuilder<'a> {
4268    name: Cow<'a, str>,
4269    domain: Cow<'a, str>,
4270    path: Cow<'a, str>,
4271    secure: bool,
4272    http_only: bool,
4273    same_site: Option<CookieSameSite>,
4274}
4275
4276impl<'a> DeviceBoundSessionCookieCravingBuilder<'a> {
4277    /// The 'SameSite' attribute of the craving attributes.
4278    pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
4279    pub fn build(self) -> DeviceBoundSessionCookieCraving<'a> {
4280        DeviceBoundSessionCookieCraving {
4281            name: self.name,
4282            domain: self.domain,
4283            path: self.path,
4284            secure: self.secure,
4285            http_only: self.http_only,
4286            same_site: self.same_site,
4287        }
4288    }
4289}
4290
4291/// A device bound session's inclusion URL rule.
4292
4293#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4294#[serde(rename_all = "camelCase")]
4295pub struct DeviceBoundSessionUrlRule<'a> {
4296    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::rule_type'.
4297    #[serde(rename = "ruleType")]
4298    rule_type: Cow<'a, str>,
4299    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::host_pattern'.
4300    #[serde(rename = "hostPattern")]
4301    host_pattern: Cow<'a, str>,
4302    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::path_prefix'.
4303    #[serde(rename = "pathPrefix")]
4304    path_prefix: Cow<'a, str>,
4305}
4306
4307impl<'a> DeviceBoundSessionUrlRule<'a> {
4308    /// Creates a builder for this type with the required parameters:
4309    /// * `rule_type`: See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::rule_type`.
4310    /// * `host_pattern`: See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::host_pattern`.
4311    /// * `path_prefix`: See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::path_prefix`.
4312    pub fn builder(rule_type: impl Into<Cow<'a, str>>, host_pattern: impl Into<Cow<'a, str>>, path_prefix: impl Into<Cow<'a, str>>) -> DeviceBoundSessionUrlRuleBuilder<'a> {
4313        DeviceBoundSessionUrlRuleBuilder {
4314            rule_type: rule_type.into(),
4315            host_pattern: host_pattern.into(),
4316            path_prefix: path_prefix.into(),
4317        }
4318    }
4319    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::rule_type'.
4320    pub fn rule_type(&self) -> &str { self.rule_type.as_ref() }
4321    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::host_pattern'.
4322    pub fn host_pattern(&self) -> &str { self.host_pattern.as_ref() }
4323    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::UrlRule::path_prefix'.
4324    pub fn path_prefix(&self) -> &str { self.path_prefix.as_ref() }
4325}
4326
4327
4328pub struct DeviceBoundSessionUrlRuleBuilder<'a> {
4329    rule_type: Cow<'a, str>,
4330    host_pattern: Cow<'a, str>,
4331    path_prefix: Cow<'a, str>,
4332}
4333
4334impl<'a> DeviceBoundSessionUrlRuleBuilder<'a> {
4335    pub fn build(self) -> DeviceBoundSessionUrlRule<'a> {
4336        DeviceBoundSessionUrlRule {
4337            rule_type: self.rule_type,
4338            host_pattern: self.host_pattern,
4339            path_prefix: self.path_prefix,
4340        }
4341    }
4342}
4343
4344/// A device bound session's inclusion rules.
4345
4346#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4347#[serde(rename_all = "camelCase")]
4348pub struct DeviceBoundSessionInclusionRules<'a> {
4349    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::origin_'.
4350    origin: Cow<'a, str>,
4351    /// Whether the whole site is included. See comments on
4352    /// 'net::device_bound_sessions::SessionInclusionRules::include_site_' for more
4353    /// details; this boolean is true if that value is populated.
4354    #[serde(rename = "includeSite")]
4355    include_site: bool,
4356    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::url_rules_'.
4357    #[serde(rename = "urlRules")]
4358    url_rules: Vec<DeviceBoundSessionUrlRule<'a>>,
4359}
4360
4361impl<'a> DeviceBoundSessionInclusionRules<'a> {
4362    /// Creates a builder for this type with the required parameters:
4363    /// * `origin`: See comments on `net::device_bound_sessions::SessionInclusionRules::origin_`.
4364    /// * `include_site`: Whether the whole site is included. See comments on `net::device_bound_sessions::SessionInclusionRules::include_site_` for more details; this boolean is true if that value is populated.
4365    /// * `url_rules`: See comments on `net::device_bound_sessions::SessionInclusionRules::url_rules_`.
4366    pub fn builder(origin: impl Into<Cow<'a, str>>, include_site: bool, url_rules: Vec<DeviceBoundSessionUrlRule<'a>>) -> DeviceBoundSessionInclusionRulesBuilder<'a> {
4367        DeviceBoundSessionInclusionRulesBuilder {
4368            origin: origin.into(),
4369            include_site: include_site,
4370            url_rules: url_rules,
4371        }
4372    }
4373    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::origin_'.
4374    pub fn origin(&self) -> &str { self.origin.as_ref() }
4375    /// Whether the whole site is included. See comments on
4376    /// 'net::device_bound_sessions::SessionInclusionRules::include_site_' for more
4377    /// details; this boolean is true if that value is populated.
4378    pub fn include_site(&self) -> bool { self.include_site }
4379    /// See comments on 'net::device_bound_sessions::SessionInclusionRules::url_rules_'.
4380    pub fn url_rules(&self) -> &[DeviceBoundSessionUrlRule<'a>] { &self.url_rules }
4381}
4382
4383
4384pub struct DeviceBoundSessionInclusionRulesBuilder<'a> {
4385    origin: Cow<'a, str>,
4386    include_site: bool,
4387    url_rules: Vec<DeviceBoundSessionUrlRule<'a>>,
4388}
4389
4390impl<'a> DeviceBoundSessionInclusionRulesBuilder<'a> {
4391    pub fn build(self) -> DeviceBoundSessionInclusionRules<'a> {
4392        DeviceBoundSessionInclusionRules {
4393            origin: self.origin,
4394            include_site: self.include_site,
4395            url_rules: self.url_rules,
4396        }
4397    }
4398}
4399
4400/// A device bound session.
4401
4402#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4403#[serde(rename_all = "camelCase")]
4404pub struct DeviceBoundSession<'a> {
4405    /// The site and session ID of the session.
4406    key: DeviceBoundSessionKey<'a>,
4407    /// See comments on 'net::device_bound_sessions::Session::refresh_url_'.
4408    #[serde(rename = "refreshUrl")]
4409    refresh_url: Cow<'a, str>,
4410    /// See comments on 'net::device_bound_sessions::Session::inclusion_rules_'.
4411    #[serde(rename = "inclusionRules")]
4412    inclusion_rules: DeviceBoundSessionInclusionRules<'a>,
4413    /// See comments on 'net::device_bound_sessions::Session::cookie_cravings_'.
4414    #[serde(rename = "cookieCravings")]
4415    cookie_cravings: Vec<DeviceBoundSessionCookieCraving<'a>>,
4416    /// See comments on 'net::device_bound_sessions::Session::expiry_date_'.
4417    #[serde(rename = "expiryDate")]
4418    expiry_date: crate::network::TimeSinceEpoch,
4419    /// See comments on 'net::device_bound_sessions::Session::cached_challenge__'.
4420    #[serde(skip_serializing_if = "Option::is_none", rename = "cachedChallenge")]
4421    cached_challenge: Option<Cow<'a, str>>,
4422    /// See comments on 'net::device_bound_sessions::Session::allowed_refresh_initiators_'.
4423    #[serde(rename = "allowedRefreshInitiators")]
4424    allowed_refresh_initiators: Vec<Cow<'a, str>>,
4425}
4426
4427impl<'a> DeviceBoundSession<'a> {
4428    /// Creates a builder for this type with the required parameters:
4429    /// * `key`: The site and session ID of the session.
4430    /// * `refresh_url`: See comments on `net::device_bound_sessions::Session::refresh_url_`.
4431    /// * `inclusion_rules`: See comments on `net::device_bound_sessions::Session::inclusion_rules_`.
4432    /// * `cookie_cravings`: See comments on `net::device_bound_sessions::Session::cookie_cravings_`.
4433    /// * `expiry_date`: See comments on `net::device_bound_sessions::Session::expiry_date_`.
4434    /// * `allowed_refresh_initiators`: See comments on `net::device_bound_sessions::Session::allowed_refresh_initiators_`.
4435    pub fn builder(key: DeviceBoundSessionKey<'a>, refresh_url: impl Into<Cow<'a, str>>, inclusion_rules: DeviceBoundSessionInclusionRules<'a>, cookie_cravings: Vec<DeviceBoundSessionCookieCraving<'a>>, expiry_date: crate::network::TimeSinceEpoch, allowed_refresh_initiators: Vec<Cow<'a, str>>) -> DeviceBoundSessionBuilder<'a> {
4436        DeviceBoundSessionBuilder {
4437            key: key,
4438            refresh_url: refresh_url.into(),
4439            inclusion_rules: inclusion_rules,
4440            cookie_cravings: cookie_cravings,
4441            expiry_date: expiry_date,
4442            cached_challenge: None,
4443            allowed_refresh_initiators: allowed_refresh_initiators,
4444        }
4445    }
4446    /// The site and session ID of the session.
4447    pub fn key(&self) -> &DeviceBoundSessionKey<'a> { &self.key }
4448    /// See comments on 'net::device_bound_sessions::Session::refresh_url_'.
4449    pub fn refresh_url(&self) -> &str { self.refresh_url.as_ref() }
4450    /// See comments on 'net::device_bound_sessions::Session::inclusion_rules_'.
4451    pub fn inclusion_rules(&self) -> &DeviceBoundSessionInclusionRules<'a> { &self.inclusion_rules }
4452    /// See comments on 'net::device_bound_sessions::Session::cookie_cravings_'.
4453    pub fn cookie_cravings(&self) -> &[DeviceBoundSessionCookieCraving<'a>] { &self.cookie_cravings }
4454    /// See comments on 'net::device_bound_sessions::Session::expiry_date_'.
4455    pub fn expiry_date(&self) -> &crate::network::TimeSinceEpoch { &self.expiry_date }
4456    /// See comments on 'net::device_bound_sessions::Session::cached_challenge__'.
4457    pub fn cached_challenge(&self) -> Option<&str> { self.cached_challenge.as_deref() }
4458    /// See comments on 'net::device_bound_sessions::Session::allowed_refresh_initiators_'.
4459    pub fn allowed_refresh_initiators(&self) -> &[Cow<'a, str>] { &self.allowed_refresh_initiators }
4460}
4461
4462
4463pub struct DeviceBoundSessionBuilder<'a> {
4464    key: DeviceBoundSessionKey<'a>,
4465    refresh_url: Cow<'a, str>,
4466    inclusion_rules: DeviceBoundSessionInclusionRules<'a>,
4467    cookie_cravings: Vec<DeviceBoundSessionCookieCraving<'a>>,
4468    expiry_date: crate::network::TimeSinceEpoch,
4469    cached_challenge: Option<Cow<'a, str>>,
4470    allowed_refresh_initiators: Vec<Cow<'a, str>>,
4471}
4472
4473impl<'a> DeviceBoundSessionBuilder<'a> {
4474    /// See comments on 'net::device_bound_sessions::Session::cached_challenge__'.
4475    pub fn cached_challenge(mut self, cached_challenge: impl Into<Cow<'a, str>>) -> Self { self.cached_challenge = Some(cached_challenge.into()); self }
4476    pub fn build(self) -> DeviceBoundSession<'a> {
4477        DeviceBoundSession {
4478            key: self.key,
4479            refresh_url: self.refresh_url,
4480            inclusion_rules: self.inclusion_rules,
4481            cookie_cravings: self.cookie_cravings,
4482            expiry_date: self.expiry_date,
4483            cached_challenge: self.cached_challenge,
4484            allowed_refresh_initiators: self.allowed_refresh_initiators,
4485        }
4486    }
4487}
4488
4489/// A unique identifier for a device bound session event.
4490
4491pub type DeviceBoundSessionEventId<'a> = Cow<'a, str>;
4492
4493/// A fetch result for a device bound session creation or refresh.
4494
4495#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
4496pub enum DeviceBoundSessionFetchResult {
4497    #[default]
4498    #[serde(rename = "Success")]
4499    Success,
4500    #[serde(rename = "KeyError")]
4501    KeyError,
4502    #[serde(rename = "SigningError")]
4503    SigningError,
4504    #[serde(rename = "TransientSigningError")]
4505    TransientSigningError,
4506    #[serde(rename = "ServerRequestedTermination")]
4507    ServerRequestedTermination,
4508    #[serde(rename = "InvalidSessionId")]
4509    InvalidSessionId,
4510    #[serde(rename = "InvalidChallenge")]
4511    InvalidChallenge,
4512    #[serde(rename = "TooManyChallenges")]
4513    TooManyChallenges,
4514    #[serde(rename = "InvalidFetcherUrl")]
4515    InvalidFetcherUrl,
4516    #[serde(rename = "InvalidRefreshUrl")]
4517    InvalidRefreshUrl,
4518    #[serde(rename = "TransientHttpError")]
4519    TransientHttpError,
4520    #[serde(rename = "ScopeOriginSameSiteMismatch")]
4521    ScopeOriginSameSiteMismatch,
4522    #[serde(rename = "RefreshUrlSameSiteMismatch")]
4523    RefreshUrlSameSiteMismatch,
4524    #[serde(rename = "MismatchedSessionId")]
4525    MismatchedSessionId,
4526    #[serde(rename = "MissingScope")]
4527    MissingScope,
4528    #[serde(rename = "NoCredentials")]
4529    NoCredentials,
4530    #[serde(rename = "SubdomainRegistrationWellKnownUnavailable")]
4531    SubdomainRegistrationWellKnownUnavailable,
4532    #[serde(rename = "SubdomainRegistrationUnauthorized")]
4533    SubdomainRegistrationUnauthorized,
4534    #[serde(rename = "SubdomainRegistrationWellKnownMalformed")]
4535    SubdomainRegistrationWellKnownMalformed,
4536    #[serde(rename = "SessionProviderWellKnownUnavailable")]
4537    SessionProviderWellKnownUnavailable,
4538    #[serde(rename = "RelyingPartyWellKnownUnavailable")]
4539    RelyingPartyWellKnownUnavailable,
4540    #[serde(rename = "FederatedKeyThumbprintMismatch")]
4541    FederatedKeyThumbprintMismatch,
4542    #[serde(rename = "InvalidFederatedSessionUrl")]
4543    InvalidFederatedSessionUrl,
4544    #[serde(rename = "InvalidFederatedKey")]
4545    InvalidFederatedKey,
4546    #[serde(rename = "TooManyRelyingOriginLabels")]
4547    TooManyRelyingOriginLabels,
4548    #[serde(rename = "BoundCookieSetForbidden")]
4549    BoundCookieSetForbidden,
4550    #[serde(rename = "NetError")]
4551    NetError,
4552    #[serde(rename = "ProxyError")]
4553    ProxyError,
4554    #[serde(rename = "EmptySessionConfig")]
4555    EmptySessionConfig,
4556    #[serde(rename = "InvalidCredentialsConfig")]
4557    InvalidCredentialsConfig,
4558    #[serde(rename = "InvalidCredentialsType")]
4559    InvalidCredentialsType,
4560    #[serde(rename = "InvalidCredentialsEmptyName")]
4561    InvalidCredentialsEmptyName,
4562    #[serde(rename = "InvalidCredentialsCookie")]
4563    InvalidCredentialsCookie,
4564    #[serde(rename = "PersistentHttpError")]
4565    PersistentHttpError,
4566    #[serde(rename = "RegistrationAttemptedChallenge")]
4567    RegistrationAttemptedChallenge,
4568    #[serde(rename = "InvalidScopeOrigin")]
4569    InvalidScopeOrigin,
4570    #[serde(rename = "ScopeOriginContainsPath")]
4571    ScopeOriginContainsPath,
4572    #[serde(rename = "RefreshInitiatorNotString")]
4573    RefreshInitiatorNotString,
4574    #[serde(rename = "RefreshInitiatorInvalidHostPattern")]
4575    RefreshInitiatorInvalidHostPattern,
4576    #[serde(rename = "InvalidScopeSpecification")]
4577    InvalidScopeSpecification,
4578    #[serde(rename = "MissingScopeSpecificationType")]
4579    MissingScopeSpecificationType,
4580    #[serde(rename = "EmptyScopeSpecificationDomain")]
4581    EmptyScopeSpecificationDomain,
4582    #[serde(rename = "EmptyScopeSpecificationPath")]
4583    EmptyScopeSpecificationPath,
4584    #[serde(rename = "InvalidScopeSpecificationType")]
4585    InvalidScopeSpecificationType,
4586    #[serde(rename = "InvalidScopeIncludeSite")]
4587    InvalidScopeIncludeSite,
4588    #[serde(rename = "MissingScopeIncludeSite")]
4589    MissingScopeIncludeSite,
4590    #[serde(rename = "FederatedNotAuthorizedByProvider")]
4591    FederatedNotAuthorizedByProvider,
4592    #[serde(rename = "FederatedNotAuthorizedByRelyingParty")]
4593    FederatedNotAuthorizedByRelyingParty,
4594    #[serde(rename = "SessionProviderWellKnownMalformed")]
4595    SessionProviderWellKnownMalformed,
4596    #[serde(rename = "SessionProviderWellKnownHasProviderOrigin")]
4597    SessionProviderWellKnownHasProviderOrigin,
4598    #[serde(rename = "RelyingPartyWellKnownMalformed")]
4599    RelyingPartyWellKnownMalformed,
4600    #[serde(rename = "RelyingPartyWellKnownHasRelyingOrigins")]
4601    RelyingPartyWellKnownHasRelyingOrigins,
4602    #[serde(rename = "InvalidFederatedSessionProviderSessionMissing")]
4603    InvalidFederatedSessionProviderSessionMissing,
4604    #[serde(rename = "InvalidFederatedSessionWrongProviderOrigin")]
4605    InvalidFederatedSessionWrongProviderOrigin,
4606    #[serde(rename = "InvalidCredentialsCookieCreationTime")]
4607    InvalidCredentialsCookieCreationTime,
4608    #[serde(rename = "InvalidCredentialsCookieName")]
4609    InvalidCredentialsCookieName,
4610    #[serde(rename = "InvalidCredentialsCookieParsing")]
4611    InvalidCredentialsCookieParsing,
4612    #[serde(rename = "InvalidCredentialsCookieUnpermittedAttribute")]
4613    InvalidCredentialsCookieUnpermittedAttribute,
4614    #[serde(rename = "InvalidCredentialsCookieInvalidDomain")]
4615    InvalidCredentialsCookieInvalidDomain,
4616    #[serde(rename = "InvalidCredentialsCookiePrefix")]
4617    InvalidCredentialsCookiePrefix,
4618    #[serde(rename = "InvalidScopeRulePath")]
4619    InvalidScopeRulePath,
4620    #[serde(rename = "InvalidScopeRuleHostPattern")]
4621    InvalidScopeRuleHostPattern,
4622    #[serde(rename = "ScopeRuleOriginScopedHostPatternMismatch")]
4623    ScopeRuleOriginScopedHostPatternMismatch,
4624    #[serde(rename = "ScopeRuleSiteScopedHostPatternMismatch")]
4625    ScopeRuleSiteScopedHostPatternMismatch,
4626    #[serde(rename = "SigningQuotaExceeded")]
4627    SigningQuotaExceeded,
4628    #[serde(rename = "InvalidConfigJson")]
4629    InvalidConfigJson,
4630    #[serde(rename = "InvalidFederatedSessionProviderFailedToRestoreKey")]
4631    InvalidFederatedSessionProviderFailedToRestoreKey,
4632    #[serde(rename = "FailedToUnwrapKey")]
4633    FailedToUnwrapKey,
4634    #[serde(rename = "SessionDeletedDuringRefresh")]
4635    SessionDeletedDuringRefresh,
4636}
4637
4638/// Details about a failed device bound session network request.
4639
4640#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4641#[serde(rename_all = "camelCase")]
4642pub struct DeviceBoundSessionFailedRequest<'a> {
4643    /// The failed request URL.
4644    #[serde(rename = "requestUrl")]
4645    request_url: Cow<'a, str>,
4646    /// The net error of the response if it was not OK.
4647    #[serde(skip_serializing_if = "Option::is_none", rename = "netError")]
4648    net_error: Option<Cow<'a, str>>,
4649    /// The response code if the net error was OK and the response code was not
4650    /// 200.
4651    #[serde(skip_serializing_if = "Option::is_none", rename = "responseError")]
4652    response_error: Option<i64>,
4653    /// The body of the response if the net error was OK, the response code was
4654    /// not 200, and the response body was not empty.
4655    #[serde(skip_serializing_if = "Option::is_none", rename = "responseErrorBody")]
4656    response_error_body: Option<Cow<'a, str>>,
4657}
4658
4659impl<'a> DeviceBoundSessionFailedRequest<'a> {
4660    /// Creates a builder for this type with the required parameters:
4661    /// * `request_url`: The failed request URL.
4662    pub fn builder(request_url: impl Into<Cow<'a, str>>) -> DeviceBoundSessionFailedRequestBuilder<'a> {
4663        DeviceBoundSessionFailedRequestBuilder {
4664            request_url: request_url.into(),
4665            net_error: None,
4666            response_error: None,
4667            response_error_body: None,
4668        }
4669    }
4670    /// The failed request URL.
4671    pub fn request_url(&self) -> &str { self.request_url.as_ref() }
4672    /// The net error of the response if it was not OK.
4673    pub fn net_error(&self) -> Option<&str> { self.net_error.as_deref() }
4674    /// The response code if the net error was OK and the response code was not
4675    /// 200.
4676    pub fn response_error(&self) -> Option<i64> { self.response_error }
4677    /// The body of the response if the net error was OK, the response code was
4678    /// not 200, and the response body was not empty.
4679    pub fn response_error_body(&self) -> Option<&str> { self.response_error_body.as_deref() }
4680}
4681
4682
4683pub struct DeviceBoundSessionFailedRequestBuilder<'a> {
4684    request_url: Cow<'a, str>,
4685    net_error: Option<Cow<'a, str>>,
4686    response_error: Option<i64>,
4687    response_error_body: Option<Cow<'a, str>>,
4688}
4689
4690impl<'a> DeviceBoundSessionFailedRequestBuilder<'a> {
4691    /// The net error of the response if it was not OK.
4692    pub fn net_error(mut self, net_error: impl Into<Cow<'a, str>>) -> Self { self.net_error = Some(net_error.into()); self }
4693    /// The response code if the net error was OK and the response code was not
4694    /// 200.
4695    pub fn response_error(mut self, response_error: i64) -> Self { self.response_error = Some(response_error); self }
4696    /// The body of the response if the net error was OK, the response code was
4697    /// not 200, and the response body was not empty.
4698    pub fn response_error_body(mut self, response_error_body: impl Into<Cow<'a, str>>) -> Self { self.response_error_body = Some(response_error_body.into()); self }
4699    pub fn build(self) -> DeviceBoundSessionFailedRequest<'a> {
4700        DeviceBoundSessionFailedRequest {
4701            request_url: self.request_url,
4702            net_error: self.net_error,
4703            response_error: self.response_error,
4704            response_error_body: self.response_error_body,
4705        }
4706    }
4707}
4708
4709/// Session event details specific to creation.
4710
4711#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4712#[serde(rename_all = "camelCase")]
4713pub struct CreationEventDetails<'a> {
4714    /// The result of the fetch attempt.
4715    #[serde(rename = "fetchResult")]
4716    fetch_result: DeviceBoundSessionFetchResult,
4717    /// The session if there was a newly created session. This is populated for
4718    /// all successful creation events.
4719    #[serde(skip_serializing_if = "Option::is_none", rename = "newSession")]
4720    new_session: Option<DeviceBoundSession<'a>>,
4721    /// Details about a failed device bound session network request if there was
4722    /// one.
4723    #[serde(skip_serializing_if = "Option::is_none", rename = "failedRequest")]
4724    failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4725}
4726
4727impl<'a> CreationEventDetails<'a> {
4728    /// Creates a builder for this type with the required parameters:
4729    /// * `fetch_result`: The result of the fetch attempt.
4730    pub fn builder(fetch_result: impl Into<DeviceBoundSessionFetchResult>) -> CreationEventDetailsBuilder<'a> {
4731        CreationEventDetailsBuilder {
4732            fetch_result: fetch_result.into(),
4733            new_session: None,
4734            failed_request: None,
4735        }
4736    }
4737    /// The result of the fetch attempt.
4738    pub fn fetch_result(&self) -> &DeviceBoundSessionFetchResult { &self.fetch_result }
4739    /// The session if there was a newly created session. This is populated for
4740    /// all successful creation events.
4741    pub fn new_session(&self) -> Option<&DeviceBoundSession<'a>> { self.new_session.as_ref() }
4742    /// Details about a failed device bound session network request if there was
4743    /// one.
4744    pub fn failed_request(&self) -> Option<&DeviceBoundSessionFailedRequest<'a>> { self.failed_request.as_ref() }
4745}
4746
4747
4748pub struct CreationEventDetailsBuilder<'a> {
4749    fetch_result: DeviceBoundSessionFetchResult,
4750    new_session: Option<DeviceBoundSession<'a>>,
4751    failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4752}
4753
4754impl<'a> CreationEventDetailsBuilder<'a> {
4755    /// The session if there was a newly created session. This is populated for
4756    /// all successful creation events.
4757    pub fn new_session(mut self, new_session: DeviceBoundSession<'a>) -> Self { self.new_session = Some(new_session); self }
4758    /// Details about a failed device bound session network request if there was
4759    /// one.
4760    pub fn failed_request(mut self, failed_request: DeviceBoundSessionFailedRequest<'a>) -> Self { self.failed_request = Some(failed_request); self }
4761    pub fn build(self) -> CreationEventDetails<'a> {
4762        CreationEventDetails {
4763            fetch_result: self.fetch_result,
4764            new_session: self.new_session,
4765            failed_request: self.failed_request,
4766        }
4767    }
4768}
4769
4770/// Session event details specific to refresh.
4771
4772#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4773#[serde(rename_all = "camelCase")]
4774pub struct RefreshEventDetails<'a> {
4775    /// The result of a refresh.
4776    #[serde(rename = "refreshResult")]
4777    refresh_result: Cow<'a, str>,
4778    /// If there was a fetch attempt, the result of that.
4779    #[serde(skip_serializing_if = "Option::is_none", rename = "fetchResult")]
4780    fetch_result: Option<DeviceBoundSessionFetchResult>,
4781    /// The session display if there was a newly created session. This is populated
4782    /// for any refresh event that modifies the session config.
4783    #[serde(skip_serializing_if = "Option::is_none", rename = "newSession")]
4784    new_session: Option<DeviceBoundSession<'a>>,
4785    /// See comments on 'net::device_bound_sessions::RefreshEventResult::was_fully_proactive_refresh'.
4786    #[serde(rename = "wasFullyProactiveRefresh")]
4787    was_fully_proactive_refresh: bool,
4788    /// Details about a failed device bound session network request if there was
4789    /// one.
4790    #[serde(skip_serializing_if = "Option::is_none", rename = "failedRequest")]
4791    failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4792}
4793
4794impl<'a> RefreshEventDetails<'a> {
4795    /// Creates a builder for this type with the required parameters:
4796    /// * `refresh_result`: The result of a refresh.
4797    /// * `was_fully_proactive_refresh`: See comments on `net::device_bound_sessions::RefreshEventResult::was_fully_proactive_refresh`.
4798    pub fn builder(refresh_result: impl Into<Cow<'a, str>>, was_fully_proactive_refresh: bool) -> RefreshEventDetailsBuilder<'a> {
4799        RefreshEventDetailsBuilder {
4800            refresh_result: refresh_result.into(),
4801            fetch_result: None,
4802            new_session: None,
4803            was_fully_proactive_refresh: was_fully_proactive_refresh,
4804            failed_request: None,
4805        }
4806    }
4807    /// The result of a refresh.
4808    pub fn refresh_result(&self) -> &str { self.refresh_result.as_ref() }
4809    /// If there was a fetch attempt, the result of that.
4810    pub fn fetch_result(&self) -> Option<&DeviceBoundSessionFetchResult> { self.fetch_result.as_ref() }
4811    /// The session display if there was a newly created session. This is populated
4812    /// for any refresh event that modifies the session config.
4813    pub fn new_session(&self) -> Option<&DeviceBoundSession<'a>> { self.new_session.as_ref() }
4814    /// See comments on 'net::device_bound_sessions::RefreshEventResult::was_fully_proactive_refresh'.
4815    pub fn was_fully_proactive_refresh(&self) -> bool { self.was_fully_proactive_refresh }
4816    /// Details about a failed device bound session network request if there was
4817    /// one.
4818    pub fn failed_request(&self) -> Option<&DeviceBoundSessionFailedRequest<'a>> { self.failed_request.as_ref() }
4819}
4820
4821
4822pub struct RefreshEventDetailsBuilder<'a> {
4823    refresh_result: Cow<'a, str>,
4824    fetch_result: Option<DeviceBoundSessionFetchResult>,
4825    new_session: Option<DeviceBoundSession<'a>>,
4826    was_fully_proactive_refresh: bool,
4827    failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4828}
4829
4830impl<'a> RefreshEventDetailsBuilder<'a> {
4831    /// If there was a fetch attempt, the result of that.
4832    pub fn fetch_result(mut self, fetch_result: impl Into<DeviceBoundSessionFetchResult>) -> Self { self.fetch_result = Some(fetch_result.into()); self }
4833    /// The session display if there was a newly created session. This is populated
4834    /// for any refresh event that modifies the session config.
4835    pub fn new_session(mut self, new_session: DeviceBoundSession<'a>) -> Self { self.new_session = Some(new_session); self }
4836    /// Details about a failed device bound session network request if there was
4837    /// one.
4838    pub fn failed_request(mut self, failed_request: DeviceBoundSessionFailedRequest<'a>) -> Self { self.failed_request = Some(failed_request); self }
4839    pub fn build(self) -> RefreshEventDetails<'a> {
4840        RefreshEventDetails {
4841            refresh_result: self.refresh_result,
4842            fetch_result: self.fetch_result,
4843            new_session: self.new_session,
4844            was_fully_proactive_refresh: self.was_fully_proactive_refresh,
4845            failed_request: self.failed_request,
4846        }
4847    }
4848}
4849
4850/// Session event details specific to termination.
4851
4852#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4853#[serde(rename_all = "camelCase")]
4854pub struct TerminationEventDetails<'a> {
4855    /// The reason for a session being deleted.
4856    #[serde(rename = "deletionReason")]
4857    deletion_reason: Cow<'a, str>,
4858}
4859
4860impl<'a> TerminationEventDetails<'a> {
4861    /// Creates a builder for this type with the required parameters:
4862    /// * `deletion_reason`: The reason for a session being deleted.
4863    pub fn builder(deletion_reason: impl Into<Cow<'a, str>>) -> TerminationEventDetailsBuilder<'a> {
4864        TerminationEventDetailsBuilder {
4865            deletion_reason: deletion_reason.into(),
4866        }
4867    }
4868    /// The reason for a session being deleted.
4869    pub fn deletion_reason(&self) -> &str { self.deletion_reason.as_ref() }
4870}
4871
4872
4873pub struct TerminationEventDetailsBuilder<'a> {
4874    deletion_reason: Cow<'a, str>,
4875}
4876
4877impl<'a> TerminationEventDetailsBuilder<'a> {
4878    pub fn build(self) -> TerminationEventDetails<'a> {
4879        TerminationEventDetails {
4880            deletion_reason: self.deletion_reason,
4881        }
4882    }
4883}
4884
4885/// Session event details specific to challenges.
4886
4887#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4888#[serde(rename_all = "camelCase")]
4889pub struct ChallengeEventDetails<'a> {
4890    /// The result of a challenge.
4891    #[serde(rename = "challengeResult")]
4892    challenge_result: Cow<'a, str>,
4893    /// The challenge set.
4894    challenge: Cow<'a, str>,
4895}
4896
4897impl<'a> ChallengeEventDetails<'a> {
4898    /// Creates a builder for this type with the required parameters:
4899    /// * `challenge_result`: The result of a challenge.
4900    /// * `challenge`: The challenge set.
4901    pub fn builder(challenge_result: impl Into<Cow<'a, str>>, challenge: impl Into<Cow<'a, str>>) -> ChallengeEventDetailsBuilder<'a> {
4902        ChallengeEventDetailsBuilder {
4903            challenge_result: challenge_result.into(),
4904            challenge: challenge.into(),
4905        }
4906    }
4907    /// The result of a challenge.
4908    pub fn challenge_result(&self) -> &str { self.challenge_result.as_ref() }
4909    /// The challenge set.
4910    pub fn challenge(&self) -> &str { self.challenge.as_ref() }
4911}
4912
4913
4914pub struct ChallengeEventDetailsBuilder<'a> {
4915    challenge_result: Cow<'a, str>,
4916    challenge: Cow<'a, str>,
4917}
4918
4919impl<'a> ChallengeEventDetailsBuilder<'a> {
4920    pub fn build(self) -> ChallengeEventDetails<'a> {
4921        ChallengeEventDetails {
4922            challenge_result: self.challenge_result,
4923            challenge: self.challenge,
4924        }
4925    }
4926}
4927
4928/// An object providing the result of a network resource load.
4929
4930#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4931#[serde(rename_all = "camelCase")]
4932pub struct LoadNetworkResourcePageResult<'a> {
4933    success: bool,
4934    /// Optional values used for error reporting.
4935    #[serde(skip_serializing_if = "Option::is_none", rename = "netError")]
4936    net_error: Option<f64>,
4937    #[serde(skip_serializing_if = "Option::is_none", rename = "netErrorName")]
4938    net_error_name: Option<Cow<'a, str>>,
4939    #[serde(skip_serializing_if = "Option::is_none", rename = "httpStatusCode")]
4940    http_status_code: Option<f64>,
4941    /// If successful, one of the following two fields holds the result.
4942    #[serde(skip_serializing_if = "Option::is_none")]
4943    stream: Option<crate::io::StreamHandle<'a>>,
4944    /// Response headers.
4945    #[serde(skip_serializing_if = "Option::is_none")]
4946    headers: Option<crate::network::Headers>,
4947}
4948
4949impl<'a> LoadNetworkResourcePageResult<'a> {
4950    /// Creates a builder for this type with the required parameters:
4951    /// * `success`: 
4952    pub fn builder(success: bool) -> LoadNetworkResourcePageResultBuilder<'a> {
4953        LoadNetworkResourcePageResultBuilder {
4954            success: success,
4955            net_error: None,
4956            net_error_name: None,
4957            http_status_code: None,
4958            stream: None,
4959            headers: None,
4960        }
4961    }
4962    pub fn success(&self) -> bool { self.success }
4963    /// Optional values used for error reporting.
4964    pub fn net_error(&self) -> Option<f64> { self.net_error }
4965    pub fn net_error_name(&self) -> Option<&str> { self.net_error_name.as_deref() }
4966    pub fn http_status_code(&self) -> Option<f64> { self.http_status_code }
4967    /// If successful, one of the following two fields holds the result.
4968    pub fn stream(&self) -> Option<&crate::io::StreamHandle<'a>> { self.stream.as_ref() }
4969    /// Response headers.
4970    pub fn headers(&self) -> Option<&crate::network::Headers> { self.headers.as_ref() }
4971}
4972
4973
4974pub struct LoadNetworkResourcePageResultBuilder<'a> {
4975    success: bool,
4976    net_error: Option<f64>,
4977    net_error_name: Option<Cow<'a, str>>,
4978    http_status_code: Option<f64>,
4979    stream: Option<crate::io::StreamHandle<'a>>,
4980    headers: Option<crate::network::Headers>,
4981}
4982
4983impl<'a> LoadNetworkResourcePageResultBuilder<'a> {
4984    /// Optional values used for error reporting.
4985    pub fn net_error(mut self, net_error: f64) -> Self { self.net_error = Some(net_error); self }
4986    pub fn net_error_name(mut self, net_error_name: impl Into<Cow<'a, str>>) -> Self { self.net_error_name = Some(net_error_name.into()); self }
4987    pub fn http_status_code(mut self, http_status_code: f64) -> Self { self.http_status_code = Some(http_status_code); self }
4988    /// If successful, one of the following two fields holds the result.
4989    pub fn stream(mut self, stream: crate::io::StreamHandle<'a>) -> Self { self.stream = Some(stream); self }
4990    /// Response headers.
4991    pub fn headers(mut self, headers: crate::network::Headers) -> Self { self.headers = Some(headers); self }
4992    pub fn build(self) -> LoadNetworkResourcePageResult<'a> {
4993        LoadNetworkResourcePageResult {
4994            success: self.success,
4995            net_error: self.net_error,
4996            net_error_name: self.net_error_name,
4997            http_status_code: self.http_status_code,
4998            stream: self.stream,
4999            headers: self.headers,
5000        }
5001    }
5002}
5003
5004/// An options object that may be extended later to better support CORS,
5005/// CORB and streaming.
5006
5007#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5008#[serde(rename_all = "camelCase")]
5009pub struct LoadNetworkResourceOptions {
5010    #[serde(rename = "disableCache")]
5011    disable_cache: bool,
5012    #[serde(rename = "includeCredentials")]
5013    include_credentials: bool,
5014}
5015
5016impl LoadNetworkResourceOptions {
5017    /// Creates a builder for this type with the required parameters:
5018    /// * `disable_cache`: 
5019    /// * `include_credentials`: 
5020    pub fn builder(disable_cache: bool, include_credentials: bool) -> LoadNetworkResourceOptionsBuilder {
5021        LoadNetworkResourceOptionsBuilder {
5022            disable_cache: disable_cache,
5023            include_credentials: include_credentials,
5024        }
5025    }
5026    pub fn disable_cache(&self) -> bool { self.disable_cache }
5027    pub fn include_credentials(&self) -> bool { self.include_credentials }
5028}
5029
5030
5031pub struct LoadNetworkResourceOptionsBuilder {
5032    disable_cache: bool,
5033    include_credentials: bool,
5034}
5035
5036impl LoadNetworkResourceOptionsBuilder {
5037    pub fn build(self) -> LoadNetworkResourceOptions {
5038        LoadNetworkResourceOptions {
5039            disable_cache: self.disable_cache,
5040            include_credentials: self.include_credentials,
5041        }
5042    }
5043}
5044
5045/// Sets a list of content encodings that will be accepted. Empty list means no encoding is accepted.
5046
5047#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5048#[serde(rename_all = "camelCase")]
5049pub struct SetAcceptedEncodingsParams {
5050    /// List of accepted content encodings.
5051    encodings: Vec<ContentEncoding>,
5052}
5053
5054impl SetAcceptedEncodingsParams {
5055    /// Creates a builder for this type with the required parameters:
5056    /// * `encodings`: List of accepted content encodings.
5057    pub fn builder(encodings: Vec<ContentEncoding>) -> SetAcceptedEncodingsParamsBuilder {
5058        SetAcceptedEncodingsParamsBuilder {
5059            encodings: encodings,
5060        }
5061    }
5062    /// List of accepted content encodings.
5063    pub fn encodings(&self) -> &[ContentEncoding] { &self.encodings }
5064}
5065
5066
5067pub struct SetAcceptedEncodingsParamsBuilder {
5068    encodings: Vec<ContentEncoding>,
5069}
5070
5071impl SetAcceptedEncodingsParamsBuilder {
5072    pub fn build(self) -> SetAcceptedEncodingsParams {
5073        SetAcceptedEncodingsParams {
5074            encodings: self.encodings,
5075        }
5076    }
5077}
5078
5079impl SetAcceptedEncodingsParams { pub const METHOD: &'static str = "Network.setAcceptedEncodings"; }
5080
5081impl<'a> crate::CdpCommand<'a> for SetAcceptedEncodingsParams {
5082    const METHOD: &'static str = "Network.setAcceptedEncodings";
5083    type Response = crate::EmptyReturns;
5084}
5085
5086#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5087pub struct ClearAcceptedEncodingsOverrideParams {}
5088
5089impl ClearAcceptedEncodingsOverrideParams { pub const METHOD: &'static str = "Network.clearAcceptedEncodingsOverride"; }
5090
5091impl<'a> crate::CdpCommand<'a> for ClearAcceptedEncodingsOverrideParams {
5092    const METHOD: &'static str = "Network.clearAcceptedEncodingsOverride";
5093    type Response = crate::EmptyReturns;
5094}
5095
5096/// Tells whether clearing browser cache is supported.
5097
5098#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5099#[serde(rename_all = "camelCase")]
5100pub struct CanClearBrowserCacheReturns {
5101    /// True if browser cache can be cleared.
5102    result: bool,
5103}
5104
5105impl CanClearBrowserCacheReturns {
5106    /// Creates a builder for this type with the required parameters:
5107    /// * `result`: True if browser cache can be cleared.
5108    pub fn builder(result: bool) -> CanClearBrowserCacheReturnsBuilder {
5109        CanClearBrowserCacheReturnsBuilder {
5110            result: result,
5111        }
5112    }
5113    /// True if browser cache can be cleared.
5114    pub fn result(&self) -> bool { self.result }
5115}
5116
5117
5118pub struct CanClearBrowserCacheReturnsBuilder {
5119    result: bool,
5120}
5121
5122impl CanClearBrowserCacheReturnsBuilder {
5123    pub fn build(self) -> CanClearBrowserCacheReturns {
5124        CanClearBrowserCacheReturns {
5125            result: self.result,
5126        }
5127    }
5128}
5129
5130#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5131pub struct CanClearBrowserCacheParams {}
5132
5133impl CanClearBrowserCacheParams { pub const METHOD: &'static str = "Network.canClearBrowserCache"; }
5134
5135impl<'a> crate::CdpCommand<'a> for CanClearBrowserCacheParams {
5136    const METHOD: &'static str = "Network.canClearBrowserCache";
5137    type Response = CanClearBrowserCacheReturns;
5138}
5139
5140/// Tells whether clearing browser cookies is supported.
5141
5142#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5143#[serde(rename_all = "camelCase")]
5144pub struct CanClearBrowserCookiesReturns {
5145    /// True if browser cookies can be cleared.
5146    result: bool,
5147}
5148
5149impl CanClearBrowserCookiesReturns {
5150    /// Creates a builder for this type with the required parameters:
5151    /// * `result`: True if browser cookies can be cleared.
5152    pub fn builder(result: bool) -> CanClearBrowserCookiesReturnsBuilder {
5153        CanClearBrowserCookiesReturnsBuilder {
5154            result: result,
5155        }
5156    }
5157    /// True if browser cookies can be cleared.
5158    pub fn result(&self) -> bool { self.result }
5159}
5160
5161
5162pub struct CanClearBrowserCookiesReturnsBuilder {
5163    result: bool,
5164}
5165
5166impl CanClearBrowserCookiesReturnsBuilder {
5167    pub fn build(self) -> CanClearBrowserCookiesReturns {
5168        CanClearBrowserCookiesReturns {
5169            result: self.result,
5170        }
5171    }
5172}
5173
5174#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5175pub struct CanClearBrowserCookiesParams {}
5176
5177impl CanClearBrowserCookiesParams { pub const METHOD: &'static str = "Network.canClearBrowserCookies"; }
5178
5179impl<'a> crate::CdpCommand<'a> for CanClearBrowserCookiesParams {
5180    const METHOD: &'static str = "Network.canClearBrowserCookies";
5181    type Response = CanClearBrowserCookiesReturns;
5182}
5183
5184/// Tells whether emulation of network conditions is supported.
5185
5186#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5187#[serde(rename_all = "camelCase")]
5188pub struct CanEmulateNetworkConditionsReturns {
5189    /// True if emulation of network conditions is supported.
5190    result: bool,
5191}
5192
5193impl CanEmulateNetworkConditionsReturns {
5194    /// Creates a builder for this type with the required parameters:
5195    /// * `result`: True if emulation of network conditions is supported.
5196    pub fn builder(result: bool) -> CanEmulateNetworkConditionsReturnsBuilder {
5197        CanEmulateNetworkConditionsReturnsBuilder {
5198            result: result,
5199        }
5200    }
5201    /// True if emulation of network conditions is supported.
5202    pub fn result(&self) -> bool { self.result }
5203}
5204
5205
5206pub struct CanEmulateNetworkConditionsReturnsBuilder {
5207    result: bool,
5208}
5209
5210impl CanEmulateNetworkConditionsReturnsBuilder {
5211    pub fn build(self) -> CanEmulateNetworkConditionsReturns {
5212        CanEmulateNetworkConditionsReturns {
5213            result: self.result,
5214        }
5215    }
5216}
5217
5218#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5219pub struct CanEmulateNetworkConditionsParams {}
5220
5221impl CanEmulateNetworkConditionsParams { pub const METHOD: &'static str = "Network.canEmulateNetworkConditions"; }
5222
5223impl<'a> crate::CdpCommand<'a> for CanEmulateNetworkConditionsParams {
5224    const METHOD: &'static str = "Network.canEmulateNetworkConditions";
5225    type Response = CanEmulateNetworkConditionsReturns;
5226}
5227
5228#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5229pub struct ClearBrowserCacheParams {}
5230
5231impl ClearBrowserCacheParams { pub const METHOD: &'static str = "Network.clearBrowserCache"; }
5232
5233impl<'a> crate::CdpCommand<'a> for ClearBrowserCacheParams {
5234    const METHOD: &'static str = "Network.clearBrowserCache";
5235    type Response = crate::EmptyReturns;
5236}
5237
5238#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5239pub struct ClearBrowserCookiesParams {}
5240
5241impl ClearBrowserCookiesParams { pub const METHOD: &'static str = "Network.clearBrowserCookies"; }
5242
5243impl<'a> crate::CdpCommand<'a> for ClearBrowserCookiesParams {
5244    const METHOD: &'static str = "Network.clearBrowserCookies";
5245    type Response = crate::EmptyReturns;
5246}
5247
5248/// Response to Network.requestIntercepted which either modifies the request to continue with any
5249/// modifications, or blocks it, or completes it with the provided response bytes. If a network
5250/// fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted
5251/// event will be sent with the same InterceptionId.
5252/// Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead.
5253
5254#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5255#[serde(rename_all = "camelCase")]
5256pub struct ContinueInterceptedRequestParams<'a> {
5257    #[serde(rename = "interceptionId")]
5258    interception_id: InterceptionId<'a>,
5259    /// If set this causes the request to fail with the given reason. Passing 'Aborted' for requests
5260    /// marked with 'isNavigationRequest' also cancels the navigation. Must not be set in response
5261    /// to an authChallenge.
5262    #[serde(skip_serializing_if = "Option::is_none", rename = "errorReason")]
5263    error_reason: Option<ErrorReason>,
5264    /// If set the requests completes using with the provided base64 encoded raw response, including
5265    /// HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON)
5266    #[serde(skip_serializing_if = "Option::is_none", rename = "rawResponse")]
5267    raw_response: Option<Cow<'a, str>>,
5268    /// If set the request url will be modified in a way that's not observable by page. Must not be
5269    /// set in response to an authChallenge.
5270    #[serde(skip_serializing_if = "Option::is_none")]
5271    url: Option<Cow<'a, str>>,
5272    /// If set this allows the request method to be overridden. Must not be set in response to an
5273    /// authChallenge.
5274    #[serde(skip_serializing_if = "Option::is_none")]
5275    method: Option<Cow<'a, str>>,
5276    /// If set this allows postData to be set. Must not be set in response to an authChallenge.
5277    #[serde(skip_serializing_if = "Option::is_none", rename = "postData")]
5278    post_data: Option<Cow<'a, str>>,
5279    /// If set this allows the request headers to be changed. Must not be set in response to an
5280    /// authChallenge.
5281    #[serde(skip_serializing_if = "Option::is_none")]
5282    headers: Option<Headers>,
5283    /// Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
5284    #[serde(skip_serializing_if = "Option::is_none", rename = "authChallengeResponse")]
5285    auth_challenge_response: Option<AuthChallengeResponse<'a>>,
5286}
5287
5288impl<'a> ContinueInterceptedRequestParams<'a> {
5289    /// Creates a builder for this type with the required parameters:
5290    /// * `interception_id`: 
5291    pub fn builder(interception_id: impl Into<InterceptionId<'a>>) -> ContinueInterceptedRequestParamsBuilder<'a> {
5292        ContinueInterceptedRequestParamsBuilder {
5293            interception_id: interception_id.into(),
5294            error_reason: None,
5295            raw_response: None,
5296            url: None,
5297            method: None,
5298            post_data: None,
5299            headers: None,
5300            auth_challenge_response: None,
5301        }
5302    }
5303    pub fn interception_id(&self) -> &InterceptionId<'a> { &self.interception_id }
5304    /// If set this causes the request to fail with the given reason. Passing 'Aborted' for requests
5305    /// marked with 'isNavigationRequest' also cancels the navigation. Must not be set in response
5306    /// to an authChallenge.
5307    pub fn error_reason(&self) -> Option<&ErrorReason> { self.error_reason.as_ref() }
5308    /// If set the requests completes using with the provided base64 encoded raw response, including
5309    /// HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON)
5310    pub fn raw_response(&self) -> Option<&str> { self.raw_response.as_deref() }
5311    /// If set the request url will be modified in a way that's not observable by page. Must not be
5312    /// set in response to an authChallenge.
5313    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
5314    /// If set this allows the request method to be overridden. Must not be set in response to an
5315    /// authChallenge.
5316    pub fn method(&self) -> Option<&str> { self.method.as_deref() }
5317    /// If set this allows postData to be set. Must not be set in response to an authChallenge.
5318    pub fn post_data(&self) -> Option<&str> { self.post_data.as_deref() }
5319    /// If set this allows the request headers to be changed. Must not be set in response to an
5320    /// authChallenge.
5321    pub fn headers(&self) -> Option<&Headers> { self.headers.as_ref() }
5322    /// Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
5323    pub fn auth_challenge_response(&self) -> Option<&AuthChallengeResponse<'a>> { self.auth_challenge_response.as_ref() }
5324}
5325
5326
5327pub struct ContinueInterceptedRequestParamsBuilder<'a> {
5328    interception_id: InterceptionId<'a>,
5329    error_reason: Option<ErrorReason>,
5330    raw_response: Option<Cow<'a, str>>,
5331    url: Option<Cow<'a, str>>,
5332    method: Option<Cow<'a, str>>,
5333    post_data: Option<Cow<'a, str>>,
5334    headers: Option<Headers>,
5335    auth_challenge_response: Option<AuthChallengeResponse<'a>>,
5336}
5337
5338impl<'a> ContinueInterceptedRequestParamsBuilder<'a> {
5339    /// If set this causes the request to fail with the given reason. Passing 'Aborted' for requests
5340    /// marked with 'isNavigationRequest' also cancels the navigation. Must not be set in response
5341    /// to an authChallenge.
5342    pub fn error_reason(mut self, error_reason: impl Into<ErrorReason>) -> Self { self.error_reason = Some(error_reason.into()); self }
5343    /// If set the requests completes using with the provided base64 encoded raw response, including
5344    /// HTTP status line and headers etc... Must not be set in response to an authChallenge. (Encoded as a base64 string when passed over JSON)
5345    pub fn raw_response(mut self, raw_response: impl Into<Cow<'a, str>>) -> Self { self.raw_response = Some(raw_response.into()); self }
5346    /// If set the request url will be modified in a way that's not observable by page. Must not be
5347    /// set in response to an authChallenge.
5348    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
5349    /// If set this allows the request method to be overridden. Must not be set in response to an
5350    /// authChallenge.
5351    pub fn method(mut self, method: impl Into<Cow<'a, str>>) -> Self { self.method = Some(method.into()); self }
5352    /// If set this allows postData to be set. Must not be set in response to an authChallenge.
5353    pub fn post_data(mut self, post_data: impl Into<Cow<'a, str>>) -> Self { self.post_data = Some(post_data.into()); self }
5354    /// If set this allows the request headers to be changed. Must not be set in response to an
5355    /// authChallenge.
5356    pub fn headers(mut self, headers: Headers) -> Self { self.headers = Some(headers); self }
5357    /// Response to a requestIntercepted with an authChallenge. Must not be set otherwise.
5358    pub fn auth_challenge_response(mut self, auth_challenge_response: AuthChallengeResponse<'a>) -> Self { self.auth_challenge_response = Some(auth_challenge_response); self }
5359    pub fn build(self) -> ContinueInterceptedRequestParams<'a> {
5360        ContinueInterceptedRequestParams {
5361            interception_id: self.interception_id,
5362            error_reason: self.error_reason,
5363            raw_response: self.raw_response,
5364            url: self.url,
5365            method: self.method,
5366            post_data: self.post_data,
5367            headers: self.headers,
5368            auth_challenge_response: self.auth_challenge_response,
5369        }
5370    }
5371}
5372
5373impl<'a> ContinueInterceptedRequestParams<'a> { pub const METHOD: &'static str = "Network.continueInterceptedRequest"; }
5374
5375impl<'a> crate::CdpCommand<'a> for ContinueInterceptedRequestParams<'a> {
5376    const METHOD: &'static str = "Network.continueInterceptedRequest";
5377    type Response = crate::EmptyReturns;
5378}
5379
5380/// Deletes browser cookies with matching name and url or domain/path/partitionKey pair.
5381
5382#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5383#[serde(rename_all = "camelCase")]
5384pub struct DeleteCookiesParams<'a> {
5385    /// Name of the cookies to remove.
5386    name: Cow<'a, str>,
5387    /// If specified, deletes all the cookies with the given name where domain and path match
5388    /// provided URL.
5389    #[serde(skip_serializing_if = "Option::is_none")]
5390    url: Option<Cow<'a, str>>,
5391    /// If specified, deletes only cookies with the exact domain.
5392    #[serde(skip_serializing_if = "Option::is_none")]
5393    domain: Option<Cow<'a, str>>,
5394    /// If specified, deletes only cookies with the exact path.
5395    #[serde(skip_serializing_if = "Option::is_none")]
5396    path: Option<Cow<'a, str>>,
5397    /// If specified, deletes only cookies with the the given name and partitionKey where
5398    /// all partition key attributes match the cookie partition key attribute.
5399    #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
5400    partition_key: Option<CookiePartitionKey<'a>>,
5401}
5402
5403impl<'a> DeleteCookiesParams<'a> {
5404    /// Creates a builder for this type with the required parameters:
5405    /// * `name`: Name of the cookies to remove.
5406    pub fn builder(name: impl Into<Cow<'a, str>>) -> DeleteCookiesParamsBuilder<'a> {
5407        DeleteCookiesParamsBuilder {
5408            name: name.into(),
5409            url: None,
5410            domain: None,
5411            path: None,
5412            partition_key: None,
5413        }
5414    }
5415    /// Name of the cookies to remove.
5416    pub fn name(&self) -> &str { self.name.as_ref() }
5417    /// If specified, deletes all the cookies with the given name where domain and path match
5418    /// provided URL.
5419    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
5420    /// If specified, deletes only cookies with the exact domain.
5421    pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
5422    /// If specified, deletes only cookies with the exact path.
5423    pub fn path(&self) -> Option<&str> { self.path.as_deref() }
5424    /// If specified, deletes only cookies with the the given name and partitionKey where
5425    /// all partition key attributes match the cookie partition key attribute.
5426    pub fn partition_key(&self) -> Option<&CookiePartitionKey<'a>> { self.partition_key.as_ref() }
5427}
5428
5429
5430pub struct DeleteCookiesParamsBuilder<'a> {
5431    name: Cow<'a, str>,
5432    url: Option<Cow<'a, str>>,
5433    domain: Option<Cow<'a, str>>,
5434    path: Option<Cow<'a, str>>,
5435    partition_key: Option<CookiePartitionKey<'a>>,
5436}
5437
5438impl<'a> DeleteCookiesParamsBuilder<'a> {
5439    /// If specified, deletes all the cookies with the given name where domain and path match
5440    /// provided URL.
5441    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
5442    /// If specified, deletes only cookies with the exact domain.
5443    pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
5444    /// If specified, deletes only cookies with the exact path.
5445    pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
5446    /// If specified, deletes only cookies with the the given name and partitionKey where
5447    /// all partition key attributes match the cookie partition key attribute.
5448    pub fn partition_key(mut self, partition_key: CookiePartitionKey<'a>) -> Self { self.partition_key = Some(partition_key); self }
5449    pub fn build(self) -> DeleteCookiesParams<'a> {
5450        DeleteCookiesParams {
5451            name: self.name,
5452            url: self.url,
5453            domain: self.domain,
5454            path: self.path,
5455            partition_key: self.partition_key,
5456        }
5457    }
5458}
5459
5460impl<'a> DeleteCookiesParams<'a> { pub const METHOD: &'static str = "Network.deleteCookies"; }
5461
5462impl<'a> crate::CdpCommand<'a> for DeleteCookiesParams<'a> {
5463    const METHOD: &'static str = "Network.deleteCookies";
5464    type Response = crate::EmptyReturns;
5465}
5466
5467#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5468pub struct DisableParams {}
5469
5470impl DisableParams { pub const METHOD: &'static str = "Network.disable"; }
5471
5472impl<'a> crate::CdpCommand<'a> for DisableParams {
5473    const METHOD: &'static str = "Network.disable";
5474    type Response = crate::EmptyReturns;
5475}
5476
5477/// Activates emulation of network conditions. This command is deprecated in favor of the emulateNetworkConditionsByRule
5478/// and overrideNetworkState commands, which can be used together to the same effect.
5479
5480#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5481#[serde(rename_all = "camelCase")]
5482pub struct EmulateNetworkConditionsParams {
5483    /// True to emulate internet disconnection.
5484    offline: bool,
5485    /// Minimum latency from request sent to response headers received (ms).
5486    latency: f64,
5487    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5488    #[serde(rename = "downloadThroughput")]
5489    download_throughput: f64,
5490    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5491    #[serde(rename = "uploadThroughput")]
5492    upload_throughput: f64,
5493    /// Connection type if known.
5494    #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
5495    connection_type: Option<ConnectionType>,
5496    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
5497    #[serde(skip_serializing_if = "Option::is_none", rename = "packetLoss")]
5498    packet_loss: Option<f64>,
5499    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
5500    #[serde(skip_serializing_if = "Option::is_none", rename = "packetQueueLength")]
5501    packet_queue_length: Option<u64>,
5502    /// WebRTC packetReordering feature.
5503    #[serde(skip_serializing_if = "Option::is_none", rename = "packetReordering")]
5504    packet_reordering: Option<bool>,
5505}
5506
5507impl EmulateNetworkConditionsParams {
5508    /// Creates a builder for this type with the required parameters:
5509    /// * `offline`: True to emulate internet disconnection.
5510    /// * `latency`: Minimum latency from request sent to response headers received (ms).
5511    /// * `download_throughput`: Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5512    /// * `upload_throughput`: Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5513    pub fn builder(offline: bool, latency: f64, download_throughput: f64, upload_throughput: f64) -> EmulateNetworkConditionsParamsBuilder {
5514        EmulateNetworkConditionsParamsBuilder {
5515            offline: offline,
5516            latency: latency,
5517            download_throughput: download_throughput,
5518            upload_throughput: upload_throughput,
5519            connection_type: None,
5520            packet_loss: None,
5521            packet_queue_length: None,
5522            packet_reordering: None,
5523        }
5524    }
5525    /// True to emulate internet disconnection.
5526    pub fn offline(&self) -> bool { self.offline }
5527    /// Minimum latency from request sent to response headers received (ms).
5528    pub fn latency(&self) -> f64 { self.latency }
5529    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5530    pub fn download_throughput(&self) -> f64 { self.download_throughput }
5531    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5532    pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
5533    /// Connection type if known.
5534    pub fn connection_type(&self) -> Option<&ConnectionType> { self.connection_type.as_ref() }
5535    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
5536    pub fn packet_loss(&self) -> Option<f64> { self.packet_loss }
5537    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
5538    pub fn packet_queue_length(&self) -> Option<u64> { self.packet_queue_length }
5539    /// WebRTC packetReordering feature.
5540    pub fn packet_reordering(&self) -> Option<bool> { self.packet_reordering }
5541}
5542
5543
5544pub struct EmulateNetworkConditionsParamsBuilder {
5545    offline: bool,
5546    latency: f64,
5547    download_throughput: f64,
5548    upload_throughput: f64,
5549    connection_type: Option<ConnectionType>,
5550    packet_loss: Option<f64>,
5551    packet_queue_length: Option<u64>,
5552    packet_reordering: Option<bool>,
5553}
5554
5555impl EmulateNetworkConditionsParamsBuilder {
5556    /// Connection type if known.
5557    pub fn connection_type(mut self, connection_type: impl Into<ConnectionType>) -> Self { self.connection_type = Some(connection_type.into()); self }
5558    /// WebRTC packet loss (percent, 0-100). 0 disables packet loss emulation, 100 drops all the packets.
5559    pub fn packet_loss(mut self, packet_loss: f64) -> Self { self.packet_loss = Some(packet_loss); self }
5560    /// WebRTC packet queue length (packet). 0 removes any queue length limitations.
5561    pub fn packet_queue_length(mut self, packet_queue_length: u64) -> Self { self.packet_queue_length = Some(packet_queue_length); self }
5562    /// WebRTC packetReordering feature.
5563    pub fn packet_reordering(mut self, packet_reordering: bool) -> Self { self.packet_reordering = Some(packet_reordering); self }
5564    pub fn build(self) -> EmulateNetworkConditionsParams {
5565        EmulateNetworkConditionsParams {
5566            offline: self.offline,
5567            latency: self.latency,
5568            download_throughput: self.download_throughput,
5569            upload_throughput: self.upload_throughput,
5570            connection_type: self.connection_type,
5571            packet_loss: self.packet_loss,
5572            packet_queue_length: self.packet_queue_length,
5573            packet_reordering: self.packet_reordering,
5574        }
5575    }
5576}
5577
5578impl EmulateNetworkConditionsParams { pub const METHOD: &'static str = "Network.emulateNetworkConditions"; }
5579
5580impl<'a> crate::CdpCommand<'a> for EmulateNetworkConditionsParams {
5581    const METHOD: &'static str = "Network.emulateNetworkConditions";
5582    type Response = crate::EmptyReturns;
5583}
5584
5585/// Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated
5586/// Network.emulateNetworkConditions this method does not affect 'navigator' state. Use Network.overrideNetworkState to
5587/// explicitly modify 'navigator' behavior.
5588
5589#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5590#[serde(rename_all = "camelCase")]
5591pub struct EmulateNetworkConditionsByRuleParams<'a> {
5592    /// True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions
5593    /// or emulateOfflineServiceWorker instead.
5594    #[serde(skip_serializing_if = "Option::is_none")]
5595    offline: Option<bool>,
5596    /// True to emulate offline service worker.
5597    #[serde(skip_serializing_if = "Option::is_none", rename = "emulateOfflineServiceWorker")]
5598    emulate_offline_service_worker: Option<bool>,
5599    /// Configure conditions for matching requests. If multiple entries match a request, the first entry wins.  Global
5600    /// conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are
5601    /// also applied for throttling of p2p connections.
5602    #[serde(rename = "matchedNetworkConditions")]
5603    matched_network_conditions: Vec<NetworkConditions<'a>>,
5604}
5605
5606impl<'a> EmulateNetworkConditionsByRuleParams<'a> {
5607    /// Creates a builder for this type with the required parameters:
5608    /// * `matched_network_conditions`: Configure conditions for matching requests. If multiple entries match a request, the first entry wins.  Global conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are also applied for throttling of p2p connections.
5609    pub fn builder(matched_network_conditions: Vec<NetworkConditions<'a>>) -> EmulateNetworkConditionsByRuleParamsBuilder<'a> {
5610        EmulateNetworkConditionsByRuleParamsBuilder {
5611            offline: None,
5612            emulate_offline_service_worker: None,
5613            matched_network_conditions: matched_network_conditions,
5614        }
5615    }
5616    /// True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions
5617    /// or emulateOfflineServiceWorker instead.
5618    pub fn offline(&self) -> Option<bool> { self.offline }
5619    /// True to emulate offline service worker.
5620    pub fn emulate_offline_service_worker(&self) -> Option<bool> { self.emulate_offline_service_worker }
5621    /// Configure conditions for matching requests. If multiple entries match a request, the first entry wins.  Global
5622    /// conditions can be configured by leaving the urlPattern for the conditions empty. These global conditions are
5623    /// also applied for throttling of p2p connections.
5624    pub fn matched_network_conditions(&self) -> &[NetworkConditions<'a>] { &self.matched_network_conditions }
5625}
5626
5627
5628pub struct EmulateNetworkConditionsByRuleParamsBuilder<'a> {
5629    offline: Option<bool>,
5630    emulate_offline_service_worker: Option<bool>,
5631    matched_network_conditions: Vec<NetworkConditions<'a>>,
5632}
5633
5634impl<'a> EmulateNetworkConditionsByRuleParamsBuilder<'a> {
5635    /// True to emulate internet disconnection. Deprecated, use the offline property in matchedNetworkConditions
5636    /// or emulateOfflineServiceWorker instead.
5637    pub fn offline(mut self, offline: bool) -> Self { self.offline = Some(offline); self }
5638    /// True to emulate offline service worker.
5639    pub fn emulate_offline_service_worker(mut self, emulate_offline_service_worker: bool) -> Self { self.emulate_offline_service_worker = Some(emulate_offline_service_worker); self }
5640    pub fn build(self) -> EmulateNetworkConditionsByRuleParams<'a> {
5641        EmulateNetworkConditionsByRuleParams {
5642            offline: self.offline,
5643            emulate_offline_service_worker: self.emulate_offline_service_worker,
5644            matched_network_conditions: self.matched_network_conditions,
5645        }
5646    }
5647}
5648
5649/// Activates emulation of network conditions for individual requests using URL match patterns. Unlike the deprecated
5650/// Network.emulateNetworkConditions this method does not affect 'navigator' state. Use Network.overrideNetworkState to
5651/// explicitly modify 'navigator' behavior.
5652
5653#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5654#[serde(rename_all = "camelCase")]
5655pub struct EmulateNetworkConditionsByRuleReturns<'a> {
5656    /// An id for each entry in matchedNetworkConditions. The id will be included in the requestWillBeSentExtraInfo for
5657    /// requests affected by a rule.
5658    #[serde(rename = "ruleIds")]
5659    rule_ids: Vec<Cow<'a, str>>,
5660}
5661
5662impl<'a> EmulateNetworkConditionsByRuleReturns<'a> {
5663    /// Creates a builder for this type with the required parameters:
5664    /// * `rule_ids`: An id for each entry in matchedNetworkConditions. The id will be included in the requestWillBeSentExtraInfo for requests affected by a rule.
5665    pub fn builder(rule_ids: Vec<Cow<'a, str>>) -> EmulateNetworkConditionsByRuleReturnsBuilder<'a> {
5666        EmulateNetworkConditionsByRuleReturnsBuilder {
5667            rule_ids: rule_ids,
5668        }
5669    }
5670    /// An id for each entry in matchedNetworkConditions. The id will be included in the requestWillBeSentExtraInfo for
5671    /// requests affected by a rule.
5672    pub fn rule_ids(&self) -> &[Cow<'a, str>] { &self.rule_ids }
5673}
5674
5675
5676pub struct EmulateNetworkConditionsByRuleReturnsBuilder<'a> {
5677    rule_ids: Vec<Cow<'a, str>>,
5678}
5679
5680impl<'a> EmulateNetworkConditionsByRuleReturnsBuilder<'a> {
5681    pub fn build(self) -> EmulateNetworkConditionsByRuleReturns<'a> {
5682        EmulateNetworkConditionsByRuleReturns {
5683            rule_ids: self.rule_ids,
5684        }
5685    }
5686}
5687
5688impl<'a> EmulateNetworkConditionsByRuleParams<'a> { pub const METHOD: &'static str = "Network.emulateNetworkConditionsByRule"; }
5689
5690impl<'a> crate::CdpCommand<'a> for EmulateNetworkConditionsByRuleParams<'a> {
5691    const METHOD: &'static str = "Network.emulateNetworkConditionsByRule";
5692    type Response = EmulateNetworkConditionsByRuleReturns<'a>;
5693}
5694
5695/// Override the state of navigator.onLine and navigator.connection.
5696
5697#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5698#[serde(rename_all = "camelCase")]
5699pub struct OverrideNetworkStateParams {
5700    /// True to emulate internet disconnection.
5701    offline: bool,
5702    /// Minimum latency from request sent to response headers received (ms).
5703    latency: f64,
5704    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5705    #[serde(rename = "downloadThroughput")]
5706    download_throughput: f64,
5707    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5708    #[serde(rename = "uploadThroughput")]
5709    upload_throughput: f64,
5710    /// Connection type if known.
5711    #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
5712    connection_type: Option<ConnectionType>,
5713}
5714
5715impl OverrideNetworkStateParams {
5716    /// Creates a builder for this type with the required parameters:
5717    /// * `offline`: True to emulate internet disconnection.
5718    /// * `latency`: Minimum latency from request sent to response headers received (ms).
5719    /// * `download_throughput`: Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5720    /// * `upload_throughput`: Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5721    pub fn builder(offline: bool, latency: f64, download_throughput: f64, upload_throughput: f64) -> OverrideNetworkStateParamsBuilder {
5722        OverrideNetworkStateParamsBuilder {
5723            offline: offline,
5724            latency: latency,
5725            download_throughput: download_throughput,
5726            upload_throughput: upload_throughput,
5727            connection_type: None,
5728        }
5729    }
5730    /// True to emulate internet disconnection.
5731    pub fn offline(&self) -> bool { self.offline }
5732    /// Minimum latency from request sent to response headers received (ms).
5733    pub fn latency(&self) -> f64 { self.latency }
5734    /// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling.
5735    pub fn download_throughput(&self) -> f64 { self.download_throughput }
5736    /// Maximal aggregated upload throughput (bytes/sec).  -1 disables upload throttling.
5737    pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
5738    /// Connection type if known.
5739    pub fn connection_type(&self) -> Option<&ConnectionType> { self.connection_type.as_ref() }
5740}
5741
5742
5743pub struct OverrideNetworkStateParamsBuilder {
5744    offline: bool,
5745    latency: f64,
5746    download_throughput: f64,
5747    upload_throughput: f64,
5748    connection_type: Option<ConnectionType>,
5749}
5750
5751impl OverrideNetworkStateParamsBuilder {
5752    /// Connection type if known.
5753    pub fn connection_type(mut self, connection_type: impl Into<ConnectionType>) -> Self { self.connection_type = Some(connection_type.into()); self }
5754    pub fn build(self) -> OverrideNetworkStateParams {
5755        OverrideNetworkStateParams {
5756            offline: self.offline,
5757            latency: self.latency,
5758            download_throughput: self.download_throughput,
5759            upload_throughput: self.upload_throughput,
5760            connection_type: self.connection_type,
5761        }
5762    }
5763}
5764
5765impl OverrideNetworkStateParams { pub const METHOD: &'static str = "Network.overrideNetworkState"; }
5766
5767impl<'a> crate::CdpCommand<'a> for OverrideNetworkStateParams {
5768    const METHOD: &'static str = "Network.overrideNetworkState";
5769    type Response = crate::EmptyReturns;
5770}
5771
5772/// Enables network tracking, network events will now be delivered to the client.
5773
5774#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5775#[serde(rename_all = "camelCase")]
5776pub struct EnableParams {
5777    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5778    /// This is the maximum number of bytes that will be collected by this
5779    /// DevTools session.
5780    #[serde(skip_serializing_if = "Option::is_none", rename = "maxTotalBufferSize")]
5781    max_total_buffer_size: Option<u64>,
5782    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5783    #[serde(skip_serializing_if = "Option::is_none", rename = "maxResourceBufferSize")]
5784    max_resource_buffer_size: Option<u64>,
5785    /// Longest post body size (in bytes) that would be included in requestWillBeSent notification
5786    #[serde(skip_serializing_if = "Option::is_none", rename = "maxPostDataSize")]
5787    max_post_data_size: Option<u64>,
5788    /// Whether DirectSocket chunk send/receive events should be reported.
5789    #[serde(skip_serializing_if = "Option::is_none", rename = "reportDirectSocketTraffic")]
5790    report_direct_socket_traffic: Option<bool>,
5791    /// Enable storing response bodies outside of renderer, so that these survive
5792    /// a cross-process navigation. Requires maxTotalBufferSize to be set.
5793    /// Currently defaults to false. This field is being deprecated in favor of the dedicated
5794    /// configureDurableMessages command, due to the possibility of deadlocks when awaiting
5795    /// Network.enable before issuing Runtime.runIfWaitingForDebugger.
5796    #[serde(skip_serializing_if = "Option::is_none", rename = "enableDurableMessages")]
5797    enable_durable_messages: Option<bool>,
5798}
5799
5800impl EnableParams {
5801    /// Creates a builder for this type.
5802    pub fn builder() -> EnableParamsBuilder {
5803        EnableParamsBuilder {
5804            max_total_buffer_size: None,
5805            max_resource_buffer_size: None,
5806            max_post_data_size: None,
5807            report_direct_socket_traffic: None,
5808            enable_durable_messages: None,
5809        }
5810    }
5811    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5812    /// This is the maximum number of bytes that will be collected by this
5813    /// DevTools session.
5814    pub fn max_total_buffer_size(&self) -> Option<u64> { self.max_total_buffer_size }
5815    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5816    pub fn max_resource_buffer_size(&self) -> Option<u64> { self.max_resource_buffer_size }
5817    /// Longest post body size (in bytes) that would be included in requestWillBeSent notification
5818    pub fn max_post_data_size(&self) -> Option<u64> { self.max_post_data_size }
5819    /// Whether DirectSocket chunk send/receive events should be reported.
5820    pub fn report_direct_socket_traffic(&self) -> Option<bool> { self.report_direct_socket_traffic }
5821    /// Enable storing response bodies outside of renderer, so that these survive
5822    /// a cross-process navigation. Requires maxTotalBufferSize to be set.
5823    /// Currently defaults to false. This field is being deprecated in favor of the dedicated
5824    /// configureDurableMessages command, due to the possibility of deadlocks when awaiting
5825    /// Network.enable before issuing Runtime.runIfWaitingForDebugger.
5826    pub fn enable_durable_messages(&self) -> Option<bool> { self.enable_durable_messages }
5827}
5828
5829#[derive(Default)]
5830pub struct EnableParamsBuilder {
5831    max_total_buffer_size: Option<u64>,
5832    max_resource_buffer_size: Option<u64>,
5833    max_post_data_size: Option<u64>,
5834    report_direct_socket_traffic: Option<bool>,
5835    enable_durable_messages: Option<bool>,
5836}
5837
5838impl EnableParamsBuilder {
5839    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5840    /// This is the maximum number of bytes that will be collected by this
5841    /// DevTools session.
5842    pub fn max_total_buffer_size(mut self, max_total_buffer_size: u64) -> Self { self.max_total_buffer_size = Some(max_total_buffer_size); self }
5843    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5844    pub fn max_resource_buffer_size(mut self, max_resource_buffer_size: u64) -> Self { self.max_resource_buffer_size = Some(max_resource_buffer_size); self }
5845    /// Longest post body size (in bytes) that would be included in requestWillBeSent notification
5846    pub fn max_post_data_size(mut self, max_post_data_size: u64) -> Self { self.max_post_data_size = Some(max_post_data_size); self }
5847    /// Whether DirectSocket chunk send/receive events should be reported.
5848    pub fn report_direct_socket_traffic(mut self, report_direct_socket_traffic: bool) -> Self { self.report_direct_socket_traffic = Some(report_direct_socket_traffic); self }
5849    /// Enable storing response bodies outside of renderer, so that these survive
5850    /// a cross-process navigation. Requires maxTotalBufferSize to be set.
5851    /// Currently defaults to false. This field is being deprecated in favor of the dedicated
5852    /// configureDurableMessages command, due to the possibility of deadlocks when awaiting
5853    /// Network.enable before issuing Runtime.runIfWaitingForDebugger.
5854    pub fn enable_durable_messages(mut self, enable_durable_messages: bool) -> Self { self.enable_durable_messages = Some(enable_durable_messages); self }
5855    pub fn build(self) -> EnableParams {
5856        EnableParams {
5857            max_total_buffer_size: self.max_total_buffer_size,
5858            max_resource_buffer_size: self.max_resource_buffer_size,
5859            max_post_data_size: self.max_post_data_size,
5860            report_direct_socket_traffic: self.report_direct_socket_traffic,
5861            enable_durable_messages: self.enable_durable_messages,
5862        }
5863    }
5864}
5865
5866impl EnableParams { pub const METHOD: &'static str = "Network.enable"; }
5867
5868impl<'a> crate::CdpCommand<'a> for EnableParams {
5869    const METHOD: &'static str = "Network.enable";
5870    type Response = crate::EmptyReturns;
5871}
5872
5873/// Configures storing response bodies outside of renderer, so that these survive
5874/// a cross-process navigation.
5875/// If maxTotalBufferSize is not set, durable messages are disabled.
5876
5877#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5878#[serde(rename_all = "camelCase")]
5879pub struct ConfigureDurableMessagesParams {
5880    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5881    #[serde(skip_serializing_if = "Option::is_none", rename = "maxTotalBufferSize")]
5882    max_total_buffer_size: Option<u64>,
5883    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5884    #[serde(skip_serializing_if = "Option::is_none", rename = "maxResourceBufferSize")]
5885    max_resource_buffer_size: Option<u64>,
5886}
5887
5888impl ConfigureDurableMessagesParams {
5889    /// Creates a builder for this type.
5890    pub fn builder() -> ConfigureDurableMessagesParamsBuilder {
5891        ConfigureDurableMessagesParamsBuilder {
5892            max_total_buffer_size: None,
5893            max_resource_buffer_size: None,
5894        }
5895    }
5896    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5897    pub fn max_total_buffer_size(&self) -> Option<u64> { self.max_total_buffer_size }
5898    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5899    pub fn max_resource_buffer_size(&self) -> Option<u64> { self.max_resource_buffer_size }
5900}
5901
5902#[derive(Default)]
5903pub struct ConfigureDurableMessagesParamsBuilder {
5904    max_total_buffer_size: Option<u64>,
5905    max_resource_buffer_size: Option<u64>,
5906}
5907
5908impl ConfigureDurableMessagesParamsBuilder {
5909    /// Buffer size in bytes to use when preserving network payloads (XHRs, etc).
5910    pub fn max_total_buffer_size(mut self, max_total_buffer_size: u64) -> Self { self.max_total_buffer_size = Some(max_total_buffer_size); self }
5911    /// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
5912    pub fn max_resource_buffer_size(mut self, max_resource_buffer_size: u64) -> Self { self.max_resource_buffer_size = Some(max_resource_buffer_size); self }
5913    pub fn build(self) -> ConfigureDurableMessagesParams {
5914        ConfigureDurableMessagesParams {
5915            max_total_buffer_size: self.max_total_buffer_size,
5916            max_resource_buffer_size: self.max_resource_buffer_size,
5917        }
5918    }
5919}
5920
5921impl ConfigureDurableMessagesParams { pub const METHOD: &'static str = "Network.configureDurableMessages"; }
5922
5923impl<'a> crate::CdpCommand<'a> for ConfigureDurableMessagesParams {
5924    const METHOD: &'static str = "Network.configureDurableMessages";
5925    type Response = crate::EmptyReturns;
5926}
5927
5928/// Returns all browser cookies. Depending on the backend support, will return detailed cookie
5929/// information in the 'cookies' field.
5930/// Deprecated. Use Storage.getCookies instead.
5931
5932#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5933#[serde(rename_all = "camelCase")]
5934pub struct GetAllCookiesReturns<'a> {
5935    /// Array of cookie objects.
5936    cookies: Vec<Cookie<'a>>,
5937}
5938
5939impl<'a> GetAllCookiesReturns<'a> {
5940    /// Creates a builder for this type with the required parameters:
5941    /// * `cookies`: Array of cookie objects.
5942    pub fn builder(cookies: Vec<Cookie<'a>>) -> GetAllCookiesReturnsBuilder<'a> {
5943        GetAllCookiesReturnsBuilder {
5944            cookies: cookies,
5945        }
5946    }
5947    /// Array of cookie objects.
5948    pub fn cookies(&self) -> &[Cookie<'a>] { &self.cookies }
5949}
5950
5951
5952pub struct GetAllCookiesReturnsBuilder<'a> {
5953    cookies: Vec<Cookie<'a>>,
5954}
5955
5956impl<'a> GetAllCookiesReturnsBuilder<'a> {
5957    pub fn build(self) -> GetAllCookiesReturns<'a> {
5958        GetAllCookiesReturns {
5959            cookies: self.cookies,
5960        }
5961    }
5962}
5963
5964#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5965pub struct GetAllCookiesParams {}
5966
5967impl GetAllCookiesParams { pub const METHOD: &'static str = "Network.getAllCookies"; }
5968
5969impl<'a> crate::CdpCommand<'a> for GetAllCookiesParams {
5970    const METHOD: &'static str = "Network.getAllCookies";
5971    type Response = GetAllCookiesReturns<'a>;
5972}
5973
5974/// Returns the DER-encoded certificate.
5975
5976#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5977#[serde(rename_all = "camelCase")]
5978pub struct GetCertificateParams<'a> {
5979    /// Origin to get certificate for.
5980    origin: Cow<'a, str>,
5981}
5982
5983impl<'a> GetCertificateParams<'a> {
5984    /// Creates a builder for this type with the required parameters:
5985    /// * `origin`: Origin to get certificate for.
5986    pub fn builder(origin: impl Into<Cow<'a, str>>) -> GetCertificateParamsBuilder<'a> {
5987        GetCertificateParamsBuilder {
5988            origin: origin.into(),
5989        }
5990    }
5991    /// Origin to get certificate for.
5992    pub fn origin(&self) -> &str { self.origin.as_ref() }
5993}
5994
5995
5996pub struct GetCertificateParamsBuilder<'a> {
5997    origin: Cow<'a, str>,
5998}
5999
6000impl<'a> GetCertificateParamsBuilder<'a> {
6001    pub fn build(self) -> GetCertificateParams<'a> {
6002        GetCertificateParams {
6003            origin: self.origin,
6004        }
6005    }
6006}
6007
6008/// Returns the DER-encoded certificate.
6009
6010#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6011#[serde(rename_all = "camelCase")]
6012pub struct GetCertificateReturns<'a> {
6013    #[serde(rename = "tableNames")]
6014    table_names: Vec<Cow<'a, str>>,
6015}
6016
6017impl<'a> GetCertificateReturns<'a> {
6018    /// Creates a builder for this type with the required parameters:
6019    /// * `table_names`: 
6020    pub fn builder(table_names: Vec<Cow<'a, str>>) -> GetCertificateReturnsBuilder<'a> {
6021        GetCertificateReturnsBuilder {
6022            table_names: table_names,
6023        }
6024    }
6025    pub fn table_names(&self) -> &[Cow<'a, str>] { &self.table_names }
6026}
6027
6028
6029pub struct GetCertificateReturnsBuilder<'a> {
6030    table_names: Vec<Cow<'a, str>>,
6031}
6032
6033impl<'a> GetCertificateReturnsBuilder<'a> {
6034    pub fn build(self) -> GetCertificateReturns<'a> {
6035        GetCertificateReturns {
6036            table_names: self.table_names,
6037        }
6038    }
6039}
6040
6041impl<'a> GetCertificateParams<'a> { pub const METHOD: &'static str = "Network.getCertificate"; }
6042
6043impl<'a> crate::CdpCommand<'a> for GetCertificateParams<'a> {
6044    const METHOD: &'static str = "Network.getCertificate";
6045    type Response = GetCertificateReturns<'a>;
6046}
6047
6048/// Returns all browser cookies for the current URL. Depending on the backend support, will return
6049/// detailed cookie information in the 'cookies' field.
6050
6051#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6052#[serde(rename_all = "camelCase")]
6053pub struct GetCookiesParams<'a> {
6054    /// The list of URLs for which applicable cookies will be fetched.
6055    /// If not specified, it's assumed to be set to the list containing
6056    /// the URLs of the page and all of its subframes.
6057    #[serde(skip_serializing_if = "Option::is_none")]
6058    urls: Option<Vec<Cow<'a, str>>>,
6059}
6060
6061impl<'a> GetCookiesParams<'a> {
6062    /// Creates a builder for this type.
6063    pub fn builder() -> GetCookiesParamsBuilder<'a> {
6064        GetCookiesParamsBuilder {
6065            urls: None,
6066        }
6067    }
6068    /// The list of URLs for which applicable cookies will be fetched.
6069    /// If not specified, it's assumed to be set to the list containing
6070    /// the URLs of the page and all of its subframes.
6071    pub fn urls(&self) -> Option<&[Cow<'a, str>]> { self.urls.as_deref() }
6072}
6073
6074#[derive(Default)]
6075pub struct GetCookiesParamsBuilder<'a> {
6076    urls: Option<Vec<Cow<'a, str>>>,
6077}
6078
6079impl<'a> GetCookiesParamsBuilder<'a> {
6080    /// The list of URLs for which applicable cookies will be fetched.
6081    /// If not specified, it's assumed to be set to the list containing
6082    /// the URLs of the page and all of its subframes.
6083    pub fn urls(mut self, urls: Vec<Cow<'a, str>>) -> Self { self.urls = Some(urls); self }
6084    pub fn build(self) -> GetCookiesParams<'a> {
6085        GetCookiesParams {
6086            urls: self.urls,
6087        }
6088    }
6089}
6090
6091/// Returns all browser cookies for the current URL. Depending on the backend support, will return
6092/// detailed cookie information in the 'cookies' field.
6093
6094#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6095#[serde(rename_all = "camelCase")]
6096pub struct GetCookiesReturns<'a> {
6097    /// Array of cookie objects.
6098    cookies: Vec<Cookie<'a>>,
6099}
6100
6101impl<'a> GetCookiesReturns<'a> {
6102    /// Creates a builder for this type with the required parameters:
6103    /// * `cookies`: Array of cookie objects.
6104    pub fn builder(cookies: Vec<Cookie<'a>>) -> GetCookiesReturnsBuilder<'a> {
6105        GetCookiesReturnsBuilder {
6106            cookies: cookies,
6107        }
6108    }
6109    /// Array of cookie objects.
6110    pub fn cookies(&self) -> &[Cookie<'a>] { &self.cookies }
6111}
6112
6113
6114pub struct GetCookiesReturnsBuilder<'a> {
6115    cookies: Vec<Cookie<'a>>,
6116}
6117
6118impl<'a> GetCookiesReturnsBuilder<'a> {
6119    pub fn build(self) -> GetCookiesReturns<'a> {
6120        GetCookiesReturns {
6121            cookies: self.cookies,
6122        }
6123    }
6124}
6125
6126impl<'a> GetCookiesParams<'a> { pub const METHOD: &'static str = "Network.getCookies"; }
6127
6128impl<'a> crate::CdpCommand<'a> for GetCookiesParams<'a> {
6129    const METHOD: &'static str = "Network.getCookies";
6130    type Response = GetCookiesReturns<'a>;
6131}
6132
6133/// Returns content served for the given request.
6134
6135#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6136#[serde(rename_all = "camelCase")]
6137pub struct GetResponseBodyParams<'a> {
6138    /// Identifier of the network request to get content for.
6139    #[serde(rename = "requestId")]
6140    request_id: RequestId<'a>,
6141}
6142
6143impl<'a> GetResponseBodyParams<'a> {
6144    /// Creates a builder for this type with the required parameters:
6145    /// * `request_id`: Identifier of the network request to get content for.
6146    pub fn builder(request_id: impl Into<RequestId<'a>>) -> GetResponseBodyParamsBuilder<'a> {
6147        GetResponseBodyParamsBuilder {
6148            request_id: request_id.into(),
6149        }
6150    }
6151    /// Identifier of the network request to get content for.
6152    pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
6153}
6154
6155
6156pub struct GetResponseBodyParamsBuilder<'a> {
6157    request_id: RequestId<'a>,
6158}
6159
6160impl<'a> GetResponseBodyParamsBuilder<'a> {
6161    pub fn build(self) -> GetResponseBodyParams<'a> {
6162        GetResponseBodyParams {
6163            request_id: self.request_id,
6164        }
6165    }
6166}
6167
6168/// Returns content served for the given request.
6169
6170#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6171#[serde(rename_all = "camelCase")]
6172pub struct GetResponseBodyReturns<'a> {
6173    /// Response body.
6174    body: Cow<'a, str>,
6175    /// True, if content was sent as base64.
6176    #[serde(rename = "base64Encoded")]
6177    base64_encoded: bool,
6178}
6179
6180impl<'a> GetResponseBodyReturns<'a> {
6181    /// Creates a builder for this type with the required parameters:
6182    /// * `body`: Response body.
6183    /// * `base64_encoded`: True, if content was sent as base64.
6184    pub fn builder(body: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetResponseBodyReturnsBuilder<'a> {
6185        GetResponseBodyReturnsBuilder {
6186            body: body.into(),
6187            base64_encoded: base64_encoded,
6188        }
6189    }
6190    /// Response body.
6191    pub fn body(&self) -> &str { self.body.as_ref() }
6192    /// True, if content was sent as base64.
6193    pub fn base64_encoded(&self) -> bool { self.base64_encoded }
6194}
6195
6196
6197pub struct GetResponseBodyReturnsBuilder<'a> {
6198    body: Cow<'a, str>,
6199    base64_encoded: bool,
6200}
6201
6202impl<'a> GetResponseBodyReturnsBuilder<'a> {
6203    pub fn build(self) -> GetResponseBodyReturns<'a> {
6204        GetResponseBodyReturns {
6205            body: self.body,
6206            base64_encoded: self.base64_encoded,
6207        }
6208    }
6209}
6210
6211impl<'a> GetResponseBodyParams<'a> { pub const METHOD: &'static str = "Network.getResponseBody"; }
6212
6213impl<'a> crate::CdpCommand<'a> for GetResponseBodyParams<'a> {
6214    const METHOD: &'static str = "Network.getResponseBody";
6215    type Response = GetResponseBodyReturns<'a>;
6216}
6217
6218/// Returns post data sent with the request. Returns an error when no data was sent with the request.
6219
6220#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6221#[serde(rename_all = "camelCase")]
6222pub struct GetRequestPostDataParams<'a> {
6223    /// Identifier of the network request to get content for.
6224    #[serde(rename = "requestId")]
6225    request_id: RequestId<'a>,
6226}
6227
6228impl<'a> GetRequestPostDataParams<'a> {
6229    /// Creates a builder for this type with the required parameters:
6230    /// * `request_id`: Identifier of the network request to get content for.
6231    pub fn builder(request_id: impl Into<RequestId<'a>>) -> GetRequestPostDataParamsBuilder<'a> {
6232        GetRequestPostDataParamsBuilder {
6233            request_id: request_id.into(),
6234        }
6235    }
6236    /// Identifier of the network request to get content for.
6237    pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
6238}
6239
6240
6241pub struct GetRequestPostDataParamsBuilder<'a> {
6242    request_id: RequestId<'a>,
6243}
6244
6245impl<'a> GetRequestPostDataParamsBuilder<'a> {
6246    pub fn build(self) -> GetRequestPostDataParams<'a> {
6247        GetRequestPostDataParams {
6248            request_id: self.request_id,
6249        }
6250    }
6251}
6252
6253/// Returns post data sent with the request. Returns an error when no data was sent with the request.
6254
6255#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6256#[serde(rename_all = "camelCase")]
6257pub struct GetRequestPostDataReturns<'a> {
6258    /// Request body string, omitting files from multipart requests
6259    #[serde(rename = "postData")]
6260    post_data: Cow<'a, str>,
6261    /// True, if content was sent as base64.
6262    #[serde(rename = "base64Encoded")]
6263    base64_encoded: bool,
6264}
6265
6266impl<'a> GetRequestPostDataReturns<'a> {
6267    /// Creates a builder for this type with the required parameters:
6268    /// * `post_data`: Request body string, omitting files from multipart requests
6269    /// * `base64_encoded`: True, if content was sent as base64.
6270    pub fn builder(post_data: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetRequestPostDataReturnsBuilder<'a> {
6271        GetRequestPostDataReturnsBuilder {
6272            post_data: post_data.into(),
6273            base64_encoded: base64_encoded,
6274        }
6275    }
6276    /// Request body string, omitting files from multipart requests
6277    pub fn post_data(&self) -> &str { self.post_data.as_ref() }
6278    /// True, if content was sent as base64.
6279    pub fn base64_encoded(&self) -> bool { self.base64_encoded }
6280}
6281
6282
6283pub struct GetRequestPostDataReturnsBuilder<'a> {
6284    post_data: Cow<'a, str>,
6285    base64_encoded: bool,
6286}
6287
6288impl<'a> GetRequestPostDataReturnsBuilder<'a> {
6289    pub fn build(self) -> GetRequestPostDataReturns<'a> {
6290        GetRequestPostDataReturns {
6291            post_data: self.post_data,
6292            base64_encoded: self.base64_encoded,
6293        }
6294    }
6295}
6296
6297impl<'a> GetRequestPostDataParams<'a> { pub const METHOD: &'static str = "Network.getRequestPostData"; }
6298
6299impl<'a> crate::CdpCommand<'a> for GetRequestPostDataParams<'a> {
6300    const METHOD: &'static str = "Network.getRequestPostData";
6301    type Response = GetRequestPostDataReturns<'a>;
6302}
6303
6304/// Returns content served for the given currently intercepted request.
6305
6306#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6307#[serde(rename_all = "camelCase")]
6308pub struct GetResponseBodyForInterceptionParams<'a> {
6309    /// Identifier for the intercepted request to get body for.
6310    #[serde(rename = "interceptionId")]
6311    interception_id: InterceptionId<'a>,
6312}
6313
6314impl<'a> GetResponseBodyForInterceptionParams<'a> {
6315    /// Creates a builder for this type with the required parameters:
6316    /// * `interception_id`: Identifier for the intercepted request to get body for.
6317    pub fn builder(interception_id: impl Into<InterceptionId<'a>>) -> GetResponseBodyForInterceptionParamsBuilder<'a> {
6318        GetResponseBodyForInterceptionParamsBuilder {
6319            interception_id: interception_id.into(),
6320        }
6321    }
6322    /// Identifier for the intercepted request to get body for.
6323    pub fn interception_id(&self) -> &InterceptionId<'a> { &self.interception_id }
6324}
6325
6326
6327pub struct GetResponseBodyForInterceptionParamsBuilder<'a> {
6328    interception_id: InterceptionId<'a>,
6329}
6330
6331impl<'a> GetResponseBodyForInterceptionParamsBuilder<'a> {
6332    pub fn build(self) -> GetResponseBodyForInterceptionParams<'a> {
6333        GetResponseBodyForInterceptionParams {
6334            interception_id: self.interception_id,
6335        }
6336    }
6337}
6338
6339/// Returns content served for the given currently intercepted request.
6340
6341#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6342#[serde(rename_all = "camelCase")]
6343pub struct GetResponseBodyForInterceptionReturns<'a> {
6344    /// Response body.
6345    body: Cow<'a, str>,
6346    /// True, if content was sent as base64.
6347    #[serde(rename = "base64Encoded")]
6348    base64_encoded: bool,
6349}
6350
6351impl<'a> GetResponseBodyForInterceptionReturns<'a> {
6352    /// Creates a builder for this type with the required parameters:
6353    /// * `body`: Response body.
6354    /// * `base64_encoded`: True, if content was sent as base64.
6355    pub fn builder(body: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetResponseBodyForInterceptionReturnsBuilder<'a> {
6356        GetResponseBodyForInterceptionReturnsBuilder {
6357            body: body.into(),
6358            base64_encoded: base64_encoded,
6359        }
6360    }
6361    /// Response body.
6362    pub fn body(&self) -> &str { self.body.as_ref() }
6363    /// True, if content was sent as base64.
6364    pub fn base64_encoded(&self) -> bool { self.base64_encoded }
6365}
6366
6367
6368pub struct GetResponseBodyForInterceptionReturnsBuilder<'a> {
6369    body: Cow<'a, str>,
6370    base64_encoded: bool,
6371}
6372
6373impl<'a> GetResponseBodyForInterceptionReturnsBuilder<'a> {
6374    pub fn build(self) -> GetResponseBodyForInterceptionReturns<'a> {
6375        GetResponseBodyForInterceptionReturns {
6376            body: self.body,
6377            base64_encoded: self.base64_encoded,
6378        }
6379    }
6380}
6381
6382impl<'a> GetResponseBodyForInterceptionParams<'a> { pub const METHOD: &'static str = "Network.getResponseBodyForInterception"; }
6383
6384impl<'a> crate::CdpCommand<'a> for GetResponseBodyForInterceptionParams<'a> {
6385    const METHOD: &'static str = "Network.getResponseBodyForInterception";
6386    type Response = GetResponseBodyForInterceptionReturns<'a>;
6387}
6388
6389/// Returns a handle to the stream representing the response body. Note that after this command,
6390/// the intercepted request can't be continued as is -- you either need to cancel it or to provide
6391/// the response body. The stream only supports sequential read, IO.read will fail if the position
6392/// is specified.
6393
6394#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6395#[serde(rename_all = "camelCase")]
6396pub struct TakeResponseBodyForInterceptionAsStreamParams<'a> {
6397    #[serde(rename = "interceptionId")]
6398    interception_id: InterceptionId<'a>,
6399}
6400
6401impl<'a> TakeResponseBodyForInterceptionAsStreamParams<'a> {
6402    /// Creates a builder for this type with the required parameters:
6403    /// * `interception_id`: 
6404    pub fn builder(interception_id: impl Into<InterceptionId<'a>>) -> TakeResponseBodyForInterceptionAsStreamParamsBuilder<'a> {
6405        TakeResponseBodyForInterceptionAsStreamParamsBuilder {
6406            interception_id: interception_id.into(),
6407        }
6408    }
6409    pub fn interception_id(&self) -> &InterceptionId<'a> { &self.interception_id }
6410}
6411
6412
6413pub struct TakeResponseBodyForInterceptionAsStreamParamsBuilder<'a> {
6414    interception_id: InterceptionId<'a>,
6415}
6416
6417impl<'a> TakeResponseBodyForInterceptionAsStreamParamsBuilder<'a> {
6418    pub fn build(self) -> TakeResponseBodyForInterceptionAsStreamParams<'a> {
6419        TakeResponseBodyForInterceptionAsStreamParams {
6420            interception_id: self.interception_id,
6421        }
6422    }
6423}
6424
6425/// Returns a handle to the stream representing the response body. Note that after this command,
6426/// the intercepted request can't be continued as is -- you either need to cancel it or to provide
6427/// the response body. The stream only supports sequential read, IO.read will fail if the position
6428/// is specified.
6429
6430#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6431#[serde(rename_all = "camelCase")]
6432pub struct TakeResponseBodyForInterceptionAsStreamReturns<'a> {
6433    stream: crate::io::StreamHandle<'a>,
6434}
6435
6436impl<'a> TakeResponseBodyForInterceptionAsStreamReturns<'a> {
6437    /// Creates a builder for this type with the required parameters:
6438    /// * `stream`: 
6439    pub fn builder(stream: crate::io::StreamHandle<'a>) -> TakeResponseBodyForInterceptionAsStreamReturnsBuilder<'a> {
6440        TakeResponseBodyForInterceptionAsStreamReturnsBuilder {
6441            stream: stream,
6442        }
6443    }
6444    pub fn stream(&self) -> &crate::io::StreamHandle<'a> { &self.stream }
6445}
6446
6447
6448pub struct TakeResponseBodyForInterceptionAsStreamReturnsBuilder<'a> {
6449    stream: crate::io::StreamHandle<'a>,
6450}
6451
6452impl<'a> TakeResponseBodyForInterceptionAsStreamReturnsBuilder<'a> {
6453    pub fn build(self) -> TakeResponseBodyForInterceptionAsStreamReturns<'a> {
6454        TakeResponseBodyForInterceptionAsStreamReturns {
6455            stream: self.stream,
6456        }
6457    }
6458}
6459
6460impl<'a> TakeResponseBodyForInterceptionAsStreamParams<'a> { pub const METHOD: &'static str = "Network.takeResponseBodyForInterceptionAsStream"; }
6461
6462impl<'a> crate::CdpCommand<'a> for TakeResponseBodyForInterceptionAsStreamParams<'a> {
6463    const METHOD: &'static str = "Network.takeResponseBodyForInterceptionAsStream";
6464    type Response = TakeResponseBodyForInterceptionAsStreamReturns<'a>;
6465}
6466
6467/// This method sends a new XMLHttpRequest which is identical to the original one. The following
6468/// parameters should be identical: method, url, async, request body, extra headers, withCredentials
6469/// attribute, user, password.
6470
6471#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6472#[serde(rename_all = "camelCase")]
6473pub struct ReplayXHRParams<'a> {
6474    /// Identifier of XHR to replay.
6475    #[serde(rename = "requestId")]
6476    request_id: RequestId<'a>,
6477}
6478
6479impl<'a> ReplayXHRParams<'a> {
6480    /// Creates a builder for this type with the required parameters:
6481    /// * `request_id`: Identifier of XHR to replay.
6482    pub fn builder(request_id: impl Into<RequestId<'a>>) -> ReplayXHRParamsBuilder<'a> {
6483        ReplayXHRParamsBuilder {
6484            request_id: request_id.into(),
6485        }
6486    }
6487    /// Identifier of XHR to replay.
6488    pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
6489}
6490
6491
6492pub struct ReplayXHRParamsBuilder<'a> {
6493    request_id: RequestId<'a>,
6494}
6495
6496impl<'a> ReplayXHRParamsBuilder<'a> {
6497    pub fn build(self) -> ReplayXHRParams<'a> {
6498        ReplayXHRParams {
6499            request_id: self.request_id,
6500        }
6501    }
6502}
6503
6504impl<'a> ReplayXHRParams<'a> { pub const METHOD: &'static str = "Network.replayXHR"; }
6505
6506impl<'a> crate::CdpCommand<'a> for ReplayXHRParams<'a> {
6507    const METHOD: &'static str = "Network.replayXHR";
6508    type Response = crate::EmptyReturns;
6509}
6510
6511/// Searches for given string in response content.
6512
6513#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6514#[serde(rename_all = "camelCase")]
6515pub struct SearchInResponseBodyParams<'a> {
6516    /// Identifier of the network response to search.
6517    #[serde(rename = "requestId")]
6518    request_id: RequestId<'a>,
6519    /// String to search for.
6520    query: Cow<'a, str>,
6521    /// If true, search is case sensitive.
6522    #[serde(skip_serializing_if = "Option::is_none", rename = "caseSensitive")]
6523    case_sensitive: Option<bool>,
6524    /// If true, treats string parameter as regex.
6525    #[serde(skip_serializing_if = "Option::is_none", rename = "isRegex")]
6526    is_regex: Option<bool>,
6527}
6528
6529impl<'a> SearchInResponseBodyParams<'a> {
6530    /// Creates a builder for this type with the required parameters:
6531    /// * `request_id`: Identifier of the network response to search.
6532    /// * `query`: String to search for.
6533    pub fn builder(request_id: impl Into<RequestId<'a>>, query: impl Into<Cow<'a, str>>) -> SearchInResponseBodyParamsBuilder<'a> {
6534        SearchInResponseBodyParamsBuilder {
6535            request_id: request_id.into(),
6536            query: query.into(),
6537            case_sensitive: None,
6538            is_regex: None,
6539        }
6540    }
6541    /// Identifier of the network response to search.
6542    pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
6543    /// String to search for.
6544    pub fn query(&self) -> &str { self.query.as_ref() }
6545    /// If true, search is case sensitive.
6546    pub fn case_sensitive(&self) -> Option<bool> { self.case_sensitive }
6547    /// If true, treats string parameter as regex.
6548    pub fn is_regex(&self) -> Option<bool> { self.is_regex }
6549}
6550
6551
6552pub struct SearchInResponseBodyParamsBuilder<'a> {
6553    request_id: RequestId<'a>,
6554    query: Cow<'a, str>,
6555    case_sensitive: Option<bool>,
6556    is_regex: Option<bool>,
6557}
6558
6559impl<'a> SearchInResponseBodyParamsBuilder<'a> {
6560    /// If true, search is case sensitive.
6561    pub fn case_sensitive(mut self, case_sensitive: bool) -> Self { self.case_sensitive = Some(case_sensitive); self }
6562    /// If true, treats string parameter as regex.
6563    pub fn is_regex(mut self, is_regex: bool) -> Self { self.is_regex = Some(is_regex); self }
6564    pub fn build(self) -> SearchInResponseBodyParams<'a> {
6565        SearchInResponseBodyParams {
6566            request_id: self.request_id,
6567            query: self.query,
6568            case_sensitive: self.case_sensitive,
6569            is_regex: self.is_regex,
6570        }
6571    }
6572}
6573
6574/// Searches for given string in response content.
6575
6576#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6577#[serde(rename_all = "camelCase")]
6578pub struct SearchInResponseBodyReturns {
6579    /// List of search matches.
6580    result: Vec<crate::debugger::SearchMatch>,
6581}
6582
6583impl SearchInResponseBodyReturns {
6584    /// Creates a builder for this type with the required parameters:
6585    /// * `result`: List of search matches.
6586    pub fn builder(result: Vec<crate::debugger::SearchMatch>) -> SearchInResponseBodyReturnsBuilder {
6587        SearchInResponseBodyReturnsBuilder {
6588            result: result,
6589        }
6590    }
6591    /// List of search matches.
6592    pub fn result(&self) -> &[crate::debugger::SearchMatch] { &self.result }
6593}
6594
6595
6596pub struct SearchInResponseBodyReturnsBuilder {
6597    result: Vec<crate::debugger::SearchMatch>,
6598}
6599
6600impl SearchInResponseBodyReturnsBuilder {
6601    pub fn build(self) -> SearchInResponseBodyReturns {
6602        SearchInResponseBodyReturns {
6603            result: self.result,
6604        }
6605    }
6606}
6607
6608impl<'a> SearchInResponseBodyParams<'a> { pub const METHOD: &'static str = "Network.searchInResponseBody"; }
6609
6610impl<'a> crate::CdpCommand<'a> for SearchInResponseBodyParams<'a> {
6611    const METHOD: &'static str = "Network.searchInResponseBody";
6612    type Response = SearchInResponseBodyReturns;
6613}
6614
6615/// Blocks URLs from loading.
6616
6617#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6618#[serde(rename_all = "camelCase")]
6619pub struct SetBlockedURLsParams<'a> {
6620    /// Patterns to match in the order in which they are given. These patterns
6621    /// also take precedence over any wildcard patterns defined in 'urls'.
6622    #[serde(skip_serializing_if = "Option::is_none", rename = "urlPatterns")]
6623    url_patterns: Option<Vec<BlockPattern<'a>>>,
6624    /// URL patterns to block. Wildcards ('*') are allowed.
6625    #[serde(skip_serializing_if = "Option::is_none")]
6626    urls: Option<Vec<Cow<'a, str>>>,
6627}
6628
6629impl<'a> SetBlockedURLsParams<'a> {
6630    /// Creates a builder for this type.
6631    pub fn builder() -> SetBlockedURLsParamsBuilder<'a> {
6632        SetBlockedURLsParamsBuilder {
6633            url_patterns: None,
6634            urls: None,
6635        }
6636    }
6637    /// Patterns to match in the order in which they are given. These patterns
6638    /// also take precedence over any wildcard patterns defined in 'urls'.
6639    pub fn url_patterns(&self) -> Option<&[BlockPattern<'a>]> { self.url_patterns.as_deref() }
6640    /// URL patterns to block. Wildcards ('*') are allowed.
6641    pub fn urls(&self) -> Option<&[Cow<'a, str>]> { self.urls.as_deref() }
6642}
6643
6644#[derive(Default)]
6645pub struct SetBlockedURLsParamsBuilder<'a> {
6646    url_patterns: Option<Vec<BlockPattern<'a>>>,
6647    urls: Option<Vec<Cow<'a, str>>>,
6648}
6649
6650impl<'a> SetBlockedURLsParamsBuilder<'a> {
6651    /// Patterns to match in the order in which they are given. These patterns
6652    /// also take precedence over any wildcard patterns defined in 'urls'.
6653    pub fn url_patterns(mut self, url_patterns: Vec<BlockPattern<'a>>) -> Self { self.url_patterns = Some(url_patterns); self }
6654    /// URL patterns to block. Wildcards ('*') are allowed.
6655    pub fn urls(mut self, urls: Vec<Cow<'a, str>>) -> Self { self.urls = Some(urls); self }
6656    pub fn build(self) -> SetBlockedURLsParams<'a> {
6657        SetBlockedURLsParams {
6658            url_patterns: self.url_patterns,
6659            urls: self.urls,
6660        }
6661    }
6662}
6663
6664impl<'a> SetBlockedURLsParams<'a> { pub const METHOD: &'static str = "Network.setBlockedURLs"; }
6665
6666impl<'a> crate::CdpCommand<'a> for SetBlockedURLsParams<'a> {
6667    const METHOD: &'static str = "Network.setBlockedURLs";
6668    type Response = crate::EmptyReturns;
6669}
6670
6671/// Toggles ignoring of service worker for each request.
6672
6673#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6674#[serde(rename_all = "camelCase")]
6675pub struct SetBypassServiceWorkerParams {
6676    /// Bypass service worker and load from network.
6677    bypass: bool,
6678}
6679
6680impl SetBypassServiceWorkerParams {
6681    /// Creates a builder for this type with the required parameters:
6682    /// * `bypass`: Bypass service worker and load from network.
6683    pub fn builder(bypass: bool) -> SetBypassServiceWorkerParamsBuilder {
6684        SetBypassServiceWorkerParamsBuilder {
6685            bypass: bypass,
6686        }
6687    }
6688    /// Bypass service worker and load from network.
6689    pub fn bypass(&self) -> bool { self.bypass }
6690}
6691
6692
6693pub struct SetBypassServiceWorkerParamsBuilder {
6694    bypass: bool,
6695}
6696
6697impl SetBypassServiceWorkerParamsBuilder {
6698    pub fn build(self) -> SetBypassServiceWorkerParams {
6699        SetBypassServiceWorkerParams {
6700            bypass: self.bypass,
6701        }
6702    }
6703}
6704
6705impl SetBypassServiceWorkerParams { pub const METHOD: &'static str = "Network.setBypassServiceWorker"; }
6706
6707impl<'a> crate::CdpCommand<'a> for SetBypassServiceWorkerParams {
6708    const METHOD: &'static str = "Network.setBypassServiceWorker";
6709    type Response = crate::EmptyReturns;
6710}
6711
6712/// Toggles ignoring cache for each request. If 'true', cache will not be used.
6713
6714#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6715#[serde(rename_all = "camelCase")]
6716pub struct SetCacheDisabledParams {
6717    /// Cache disabled state.
6718    #[serde(rename = "cacheDisabled")]
6719    cache_disabled: bool,
6720}
6721
6722impl SetCacheDisabledParams {
6723    /// Creates a builder for this type with the required parameters:
6724    /// * `cache_disabled`: Cache disabled state.
6725    pub fn builder(cache_disabled: bool) -> SetCacheDisabledParamsBuilder {
6726        SetCacheDisabledParamsBuilder {
6727            cache_disabled: cache_disabled,
6728        }
6729    }
6730    /// Cache disabled state.
6731    pub fn cache_disabled(&self) -> bool { self.cache_disabled }
6732}
6733
6734
6735pub struct SetCacheDisabledParamsBuilder {
6736    cache_disabled: bool,
6737}
6738
6739impl SetCacheDisabledParamsBuilder {
6740    pub fn build(self) -> SetCacheDisabledParams {
6741        SetCacheDisabledParams {
6742            cache_disabled: self.cache_disabled,
6743        }
6744    }
6745}
6746
6747impl SetCacheDisabledParams { pub const METHOD: &'static str = "Network.setCacheDisabled"; }
6748
6749impl<'a> crate::CdpCommand<'a> for SetCacheDisabledParams {
6750    const METHOD: &'static str = "Network.setCacheDisabled";
6751    type Response = crate::EmptyReturns;
6752}
6753
6754/// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
6755
6756#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6757#[serde(rename_all = "camelCase")]
6758pub struct SetCookieParams<'a> {
6759    /// Cookie name.
6760    name: Cow<'a, str>,
6761    /// Cookie value.
6762    value: Cow<'a, str>,
6763    /// The request-URI to associate with the setting of the cookie. This value can affect the
6764    /// default domain, path, source port, and source scheme values of the created cookie.
6765    #[serde(skip_serializing_if = "Option::is_none")]
6766    url: Option<Cow<'a, str>>,
6767    /// Cookie domain.
6768    #[serde(skip_serializing_if = "Option::is_none")]
6769    domain: Option<Cow<'a, str>>,
6770    /// Cookie path.
6771    #[serde(skip_serializing_if = "Option::is_none")]
6772    path: Option<Cow<'a, str>>,
6773    /// True if cookie is secure.
6774    #[serde(skip_serializing_if = "Option::is_none")]
6775    secure: Option<bool>,
6776    /// True if cookie is http-only.
6777    #[serde(skip_serializing_if = "Option::is_none", rename = "httpOnly")]
6778    http_only: Option<bool>,
6779    /// Cookie SameSite type.
6780    #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
6781    same_site: Option<CookieSameSite>,
6782    /// Cookie expiration date, session cookie if not set
6783    #[serde(skip_serializing_if = "Option::is_none")]
6784    expires: Option<TimeSinceEpoch>,
6785    /// Cookie Priority type.
6786    #[serde(skip_serializing_if = "Option::is_none")]
6787    priority: Option<CookiePriority>,
6788    /// Cookie source scheme type.
6789    #[serde(skip_serializing_if = "Option::is_none", rename = "sourceScheme")]
6790    source_scheme: Option<CookieSourceScheme>,
6791    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
6792    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
6793    /// This is a temporary ability and it will be removed in the future.
6794    #[serde(skip_serializing_if = "Option::is_none", rename = "sourcePort")]
6795    source_port: Option<i64>,
6796    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
6797    #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
6798    partition_key: Option<CookiePartitionKey<'a>>,
6799}
6800
6801impl<'a> SetCookieParams<'a> {
6802    /// Creates a builder for this type with the required parameters:
6803    /// * `name`: Cookie name.
6804    /// * `value`: Cookie value.
6805    pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> SetCookieParamsBuilder<'a> {
6806        SetCookieParamsBuilder {
6807            name: name.into(),
6808            value: value.into(),
6809            url: None,
6810            domain: None,
6811            path: None,
6812            secure: None,
6813            http_only: None,
6814            same_site: None,
6815            expires: None,
6816            priority: None,
6817            source_scheme: None,
6818            source_port: None,
6819            partition_key: None,
6820        }
6821    }
6822    /// Cookie name.
6823    pub fn name(&self) -> &str { self.name.as_ref() }
6824    /// Cookie value.
6825    pub fn value(&self) -> &str { self.value.as_ref() }
6826    /// The request-URI to associate with the setting of the cookie. This value can affect the
6827    /// default domain, path, source port, and source scheme values of the created cookie.
6828    pub fn url(&self) -> Option<&str> { self.url.as_deref() }
6829    /// Cookie domain.
6830    pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
6831    /// Cookie path.
6832    pub fn path(&self) -> Option<&str> { self.path.as_deref() }
6833    /// True if cookie is secure.
6834    pub fn secure(&self) -> Option<bool> { self.secure }
6835    /// True if cookie is http-only.
6836    pub fn http_only(&self) -> Option<bool> { self.http_only }
6837    /// Cookie SameSite type.
6838    pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
6839    /// Cookie expiration date, session cookie if not set
6840    pub fn expires(&self) -> Option<&TimeSinceEpoch> { self.expires.as_ref() }
6841    /// Cookie Priority type.
6842    pub fn priority(&self) -> Option<&CookiePriority> { self.priority.as_ref() }
6843    /// Cookie source scheme type.
6844    pub fn source_scheme(&self) -> Option<&CookieSourceScheme> { self.source_scheme.as_ref() }
6845    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
6846    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
6847    /// This is a temporary ability and it will be removed in the future.
6848    pub fn source_port(&self) -> Option<i64> { self.source_port }
6849    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
6850    pub fn partition_key(&self) -> Option<&CookiePartitionKey<'a>> { self.partition_key.as_ref() }
6851}
6852
6853
6854pub struct SetCookieParamsBuilder<'a> {
6855    name: Cow<'a, str>,
6856    value: Cow<'a, str>,
6857    url: Option<Cow<'a, str>>,
6858    domain: Option<Cow<'a, str>>,
6859    path: Option<Cow<'a, str>>,
6860    secure: Option<bool>,
6861    http_only: Option<bool>,
6862    same_site: Option<CookieSameSite>,
6863    expires: Option<TimeSinceEpoch>,
6864    priority: Option<CookiePriority>,
6865    source_scheme: Option<CookieSourceScheme>,
6866    source_port: Option<i64>,
6867    partition_key: Option<CookiePartitionKey<'a>>,
6868}
6869
6870impl<'a> SetCookieParamsBuilder<'a> {
6871    /// The request-URI to associate with the setting of the cookie. This value can affect the
6872    /// default domain, path, source port, and source scheme values of the created cookie.
6873    pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
6874    /// Cookie domain.
6875    pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
6876    /// Cookie path.
6877    pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
6878    /// True if cookie is secure.
6879    pub fn secure(mut self, secure: bool) -> Self { self.secure = Some(secure); self }
6880    /// True if cookie is http-only.
6881    pub fn http_only(mut self, http_only: bool) -> Self { self.http_only = Some(http_only); self }
6882    /// Cookie SameSite type.
6883    pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
6884    /// Cookie expiration date, session cookie if not set
6885    pub fn expires(mut self, expires: TimeSinceEpoch) -> Self { self.expires = Some(expires); self }
6886    /// Cookie Priority type.
6887    pub fn priority(mut self, priority: impl Into<CookiePriority>) -> Self { self.priority = Some(priority.into()); self }
6888    /// Cookie source scheme type.
6889    pub fn source_scheme(mut self, source_scheme: impl Into<CookieSourceScheme>) -> Self { self.source_scheme = Some(source_scheme.into()); self }
6890    /// Cookie source port. Valid values are {-1, \[1, 65535\]}, -1 indicates an unspecified port.
6891    /// An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.
6892    /// This is a temporary ability and it will be removed in the future.
6893    pub fn source_port(mut self, source_port: i64) -> Self { self.source_port = Some(source_port); self }
6894    /// Cookie partition key. If not set, the cookie will be set as not partitioned.
6895    pub fn partition_key(mut self, partition_key: CookiePartitionKey<'a>) -> Self { self.partition_key = Some(partition_key); self }
6896    pub fn build(self) -> SetCookieParams<'a> {
6897        SetCookieParams {
6898            name: self.name,
6899            value: self.value,
6900            url: self.url,
6901            domain: self.domain,
6902            path: self.path,
6903            secure: self.secure,
6904            http_only: self.http_only,
6905            same_site: self.same_site,
6906            expires: self.expires,
6907            priority: self.priority,
6908            source_scheme: self.source_scheme,
6909            source_port: self.source_port,
6910            partition_key: self.partition_key,
6911        }
6912    }
6913}
6914
6915/// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
6916
6917#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6918#[serde(rename_all = "camelCase")]
6919pub struct SetCookieReturns {
6920    /// Always set to true. If an error occurs, the response indicates protocol error.
6921    success: bool,
6922}
6923
6924impl SetCookieReturns {
6925    /// Creates a builder for this type with the required parameters:
6926    /// * `success`: Always set to true. If an error occurs, the response indicates protocol error.
6927    pub fn builder(success: bool) -> SetCookieReturnsBuilder {
6928        SetCookieReturnsBuilder {
6929            success: success,
6930        }
6931    }
6932    /// Always set to true. If an error occurs, the response indicates protocol error.
6933    pub fn success(&self) -> bool { self.success }
6934}
6935
6936
6937pub struct SetCookieReturnsBuilder {
6938    success: bool,
6939}
6940
6941impl SetCookieReturnsBuilder {
6942    pub fn build(self) -> SetCookieReturns {
6943        SetCookieReturns {
6944            success: self.success,
6945        }
6946    }
6947}
6948
6949impl<'a> SetCookieParams<'a> { pub const METHOD: &'static str = "Network.setCookie"; }
6950
6951impl<'a> crate::CdpCommand<'a> for SetCookieParams<'a> {
6952    const METHOD: &'static str = "Network.setCookie";
6953    type Response = SetCookieReturns;
6954}
6955
6956/// Sets given cookies.
6957
6958#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6959#[serde(rename_all = "camelCase")]
6960pub struct SetCookiesParams<'a> {
6961    /// Cookies to be set.
6962    cookies: Vec<CookieParam<'a>>,
6963}
6964
6965impl<'a> SetCookiesParams<'a> {
6966    /// Creates a builder for this type with the required parameters:
6967    /// * `cookies`: Cookies to be set.
6968    pub fn builder(cookies: Vec<CookieParam<'a>>) -> SetCookiesParamsBuilder<'a> {
6969        SetCookiesParamsBuilder {
6970            cookies: cookies,
6971        }
6972    }
6973    /// Cookies to be set.
6974    pub fn cookies(&self) -> &[CookieParam<'a>] { &self.cookies }
6975}
6976
6977
6978pub struct SetCookiesParamsBuilder<'a> {
6979    cookies: Vec<CookieParam<'a>>,
6980}
6981
6982impl<'a> SetCookiesParamsBuilder<'a> {
6983    pub fn build(self) -> SetCookiesParams<'a> {
6984        SetCookiesParams {
6985            cookies: self.cookies,
6986        }
6987    }
6988}
6989
6990impl<'a> SetCookiesParams<'a> { pub const METHOD: &'static str = "Network.setCookies"; }
6991
6992impl<'a> crate::CdpCommand<'a> for SetCookiesParams<'a> {
6993    const METHOD: &'static str = "Network.setCookies";
6994    type Response = crate::EmptyReturns;
6995}
6996
6997/// Specifies whether to always send extra HTTP headers with the requests from this page.
6998
6999#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7000#[serde(rename_all = "camelCase")]
7001pub struct SetExtraHTTPHeadersParams {
7002    /// Map with extra HTTP headers.
7003    headers: Headers,
7004}
7005
7006impl SetExtraHTTPHeadersParams {
7007    /// Creates a builder for this type with the required parameters:
7008    /// * `headers`: Map with extra HTTP headers.
7009    pub fn builder(headers: Headers) -> SetExtraHTTPHeadersParamsBuilder {
7010        SetExtraHTTPHeadersParamsBuilder {
7011            headers: headers,
7012        }
7013    }
7014    /// Map with extra HTTP headers.
7015    pub fn headers(&self) -> &Headers { &self.headers }
7016}
7017
7018
7019pub struct SetExtraHTTPHeadersParamsBuilder {
7020    headers: Headers,
7021}
7022
7023impl SetExtraHTTPHeadersParamsBuilder {
7024    pub fn build(self) -> SetExtraHTTPHeadersParams {
7025        SetExtraHTTPHeadersParams {
7026            headers: self.headers,
7027        }
7028    }
7029}
7030
7031impl SetExtraHTTPHeadersParams { pub const METHOD: &'static str = "Network.setExtraHTTPHeaders"; }
7032
7033impl<'a> crate::CdpCommand<'a> for SetExtraHTTPHeadersParams {
7034    const METHOD: &'static str = "Network.setExtraHTTPHeaders";
7035    type Response = crate::EmptyReturns;
7036}
7037
7038/// Specifies whether to attach a page script stack id in requests
7039
7040#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7041#[serde(rename_all = "camelCase")]
7042pub struct SetAttachDebugStackParams {
7043    /// Whether to attach a page script stack for debugging purpose.
7044    enabled: bool,
7045}
7046
7047impl SetAttachDebugStackParams {
7048    /// Creates a builder for this type with the required parameters:
7049    /// * `enabled`: Whether to attach a page script stack for debugging purpose.
7050    pub fn builder(enabled: bool) -> SetAttachDebugStackParamsBuilder {
7051        SetAttachDebugStackParamsBuilder {
7052            enabled: enabled,
7053        }
7054    }
7055    /// Whether to attach a page script stack for debugging purpose.
7056    pub fn enabled(&self) -> bool { self.enabled }
7057}
7058
7059
7060pub struct SetAttachDebugStackParamsBuilder {
7061    enabled: bool,
7062}
7063
7064impl SetAttachDebugStackParamsBuilder {
7065    pub fn build(self) -> SetAttachDebugStackParams {
7066        SetAttachDebugStackParams {
7067            enabled: self.enabled,
7068        }
7069    }
7070}
7071
7072impl SetAttachDebugStackParams { pub const METHOD: &'static str = "Network.setAttachDebugStack"; }
7073
7074impl<'a> crate::CdpCommand<'a> for SetAttachDebugStackParams {
7075    const METHOD: &'static str = "Network.setAttachDebugStack";
7076    type Response = crate::EmptyReturns;
7077}
7078
7079/// Sets the requests to intercept that match the provided patterns and optionally resource types.
7080/// Deprecated, please use Fetch.enable instead.
7081
7082#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7083#[serde(rename_all = "camelCase")]
7084pub struct SetRequestInterceptionParams<'a> {
7085    /// Requests matching any of these patterns will be forwarded and wait for the corresponding
7086    /// continueInterceptedRequest call.
7087    patterns: Vec<RequestPattern<'a>>,
7088}
7089
7090impl<'a> SetRequestInterceptionParams<'a> {
7091    /// Creates a builder for this type with the required parameters:
7092    /// * `patterns`: Requests matching any of these patterns will be forwarded and wait for the corresponding continueInterceptedRequest call.
7093    pub fn builder(patterns: Vec<RequestPattern<'a>>) -> SetRequestInterceptionParamsBuilder<'a> {
7094        SetRequestInterceptionParamsBuilder {
7095            patterns: patterns,
7096        }
7097    }
7098    /// Requests matching any of these patterns will be forwarded and wait for the corresponding
7099    /// continueInterceptedRequest call.
7100    pub fn patterns(&self) -> &[RequestPattern<'a>] { &self.patterns }
7101}
7102
7103
7104pub struct SetRequestInterceptionParamsBuilder<'a> {
7105    patterns: Vec<RequestPattern<'a>>,
7106}
7107
7108impl<'a> SetRequestInterceptionParamsBuilder<'a> {
7109    pub fn build(self) -> SetRequestInterceptionParams<'a> {
7110        SetRequestInterceptionParams {
7111            patterns: self.patterns,
7112        }
7113    }
7114}
7115
7116impl<'a> SetRequestInterceptionParams<'a> { pub const METHOD: &'static str = "Network.setRequestInterception"; }
7117
7118impl<'a> crate::CdpCommand<'a> for SetRequestInterceptionParams<'a> {
7119    const METHOD: &'static str = "Network.setRequestInterception";
7120    type Response = crate::EmptyReturns;
7121}
7122
7123/// Allows overriding user agent with the given string.
7124
7125#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7126#[serde(rename_all = "camelCase")]
7127pub struct SetUserAgentOverrideParams<'a> {
7128    /// User agent to use.
7129    #[serde(rename = "userAgent")]
7130    user_agent: Cow<'a, str>,
7131    /// Browser language to emulate.
7132    #[serde(skip_serializing_if = "Option::is_none", rename = "acceptLanguage")]
7133    accept_language: Option<Cow<'a, str>>,
7134    /// The platform navigator.platform should return.
7135    #[serde(skip_serializing_if = "Option::is_none")]
7136    platform: Option<Cow<'a, str>>,
7137    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
7138    #[serde(skip_serializing_if = "Option::is_none", rename = "userAgentMetadata")]
7139    user_agent_metadata: Option<crate::emulation::UserAgentMetadata<'a>>,
7140}
7141
7142impl<'a> SetUserAgentOverrideParams<'a> {
7143    /// Creates a builder for this type with the required parameters:
7144    /// * `user_agent`: User agent to use.
7145    pub fn builder(user_agent: impl Into<Cow<'a, str>>) -> SetUserAgentOverrideParamsBuilder<'a> {
7146        SetUserAgentOverrideParamsBuilder {
7147            user_agent: user_agent.into(),
7148            accept_language: None,
7149            platform: None,
7150            user_agent_metadata: None,
7151        }
7152    }
7153    /// User agent to use.
7154    pub fn user_agent(&self) -> &str { self.user_agent.as_ref() }
7155    /// Browser language to emulate.
7156    pub fn accept_language(&self) -> Option<&str> { self.accept_language.as_deref() }
7157    /// The platform navigator.platform should return.
7158    pub fn platform(&self) -> Option<&str> { self.platform.as_deref() }
7159    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
7160    pub fn user_agent_metadata(&self) -> Option<&crate::emulation::UserAgentMetadata<'a>> { self.user_agent_metadata.as_ref() }
7161}
7162
7163
7164pub struct SetUserAgentOverrideParamsBuilder<'a> {
7165    user_agent: Cow<'a, str>,
7166    accept_language: Option<Cow<'a, str>>,
7167    platform: Option<Cow<'a, str>>,
7168    user_agent_metadata: Option<crate::emulation::UserAgentMetadata<'a>>,
7169}
7170
7171impl<'a> SetUserAgentOverrideParamsBuilder<'a> {
7172    /// Browser language to emulate.
7173    pub fn accept_language(mut self, accept_language: impl Into<Cow<'a, str>>) -> Self { self.accept_language = Some(accept_language.into()); self }
7174    /// The platform navigator.platform should return.
7175    pub fn platform(mut self, platform: impl Into<Cow<'a, str>>) -> Self { self.platform = Some(platform.into()); self }
7176    /// To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData
7177    pub fn user_agent_metadata(mut self, user_agent_metadata: crate::emulation::UserAgentMetadata<'a>) -> Self { self.user_agent_metadata = Some(user_agent_metadata); self }
7178    pub fn build(self) -> SetUserAgentOverrideParams<'a> {
7179        SetUserAgentOverrideParams {
7180            user_agent: self.user_agent,
7181            accept_language: self.accept_language,
7182            platform: self.platform,
7183            user_agent_metadata: self.user_agent_metadata,
7184        }
7185    }
7186}
7187
7188impl<'a> SetUserAgentOverrideParams<'a> { pub const METHOD: &'static str = "Network.setUserAgentOverride"; }
7189
7190impl<'a> crate::CdpCommand<'a> for SetUserAgentOverrideParams<'a> {
7191    const METHOD: &'static str = "Network.setUserAgentOverride";
7192    type Response = crate::EmptyReturns;
7193}
7194
7195/// Enables streaming of the response for the given requestId.
7196/// If enabled, the dataReceived event contains the data that was received during streaming.
7197
7198#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7199#[serde(rename_all = "camelCase")]
7200pub struct StreamResourceContentParams<'a> {
7201    /// Identifier of the request to stream.
7202    #[serde(rename = "requestId")]
7203    request_id: RequestId<'a>,
7204}
7205
7206impl<'a> StreamResourceContentParams<'a> {
7207    /// Creates a builder for this type with the required parameters:
7208    /// * `request_id`: Identifier of the request to stream.
7209    pub fn builder(request_id: impl Into<RequestId<'a>>) -> StreamResourceContentParamsBuilder<'a> {
7210        StreamResourceContentParamsBuilder {
7211            request_id: request_id.into(),
7212        }
7213    }
7214    /// Identifier of the request to stream.
7215    pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
7216}
7217
7218
7219pub struct StreamResourceContentParamsBuilder<'a> {
7220    request_id: RequestId<'a>,
7221}
7222
7223impl<'a> StreamResourceContentParamsBuilder<'a> {
7224    pub fn build(self) -> StreamResourceContentParams<'a> {
7225        StreamResourceContentParams {
7226            request_id: self.request_id,
7227        }
7228    }
7229}
7230
7231/// Enables streaming of the response for the given requestId.
7232/// If enabled, the dataReceived event contains the data that was received during streaming.
7233
7234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7235#[serde(rename_all = "camelCase")]
7236pub struct StreamResourceContentReturns<'a> {
7237    /// Data that has been buffered until streaming is enabled. (Encoded as a base64 string when passed over JSON)
7238    #[serde(rename = "bufferedData")]
7239    buffered_data: Cow<'a, str>,
7240}
7241
7242impl<'a> StreamResourceContentReturns<'a> {
7243    /// Creates a builder for this type with the required parameters:
7244    /// * `buffered_data`: Data that has been buffered until streaming is enabled. (Encoded as a base64 string when passed over JSON)
7245    pub fn builder(buffered_data: impl Into<Cow<'a, str>>) -> StreamResourceContentReturnsBuilder<'a> {
7246        StreamResourceContentReturnsBuilder {
7247            buffered_data: buffered_data.into(),
7248        }
7249    }
7250    /// Data that has been buffered until streaming is enabled. (Encoded as a base64 string when passed over JSON)
7251    pub fn buffered_data(&self) -> &str { self.buffered_data.as_ref() }
7252}
7253
7254
7255pub struct StreamResourceContentReturnsBuilder<'a> {
7256    buffered_data: Cow<'a, str>,
7257}
7258
7259impl<'a> StreamResourceContentReturnsBuilder<'a> {
7260    pub fn build(self) -> StreamResourceContentReturns<'a> {
7261        StreamResourceContentReturns {
7262            buffered_data: self.buffered_data,
7263        }
7264    }
7265}
7266
7267impl<'a> StreamResourceContentParams<'a> { pub const METHOD: &'static str = "Network.streamResourceContent"; }
7268
7269impl<'a> crate::CdpCommand<'a> for StreamResourceContentParams<'a> {
7270    const METHOD: &'static str = "Network.streamResourceContent";
7271    type Response = StreamResourceContentReturns<'a>;
7272}
7273
7274/// Returns information about the COEP/COOP isolation status.
7275
7276#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7277#[serde(rename_all = "camelCase")]
7278pub struct GetSecurityIsolationStatusParams<'a> {
7279    /// If no frameId is provided, the status of the target is provided.
7280    #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
7281    frame_id: Option<crate::page::FrameId<'a>>,
7282}
7283
7284impl<'a> GetSecurityIsolationStatusParams<'a> {
7285    /// Creates a builder for this type.
7286    pub fn builder() -> GetSecurityIsolationStatusParamsBuilder<'a> {
7287        GetSecurityIsolationStatusParamsBuilder {
7288            frame_id: None,
7289        }
7290    }
7291    /// If no frameId is provided, the status of the target is provided.
7292    pub fn frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.frame_id.as_ref() }
7293}
7294
7295#[derive(Default)]
7296pub struct GetSecurityIsolationStatusParamsBuilder<'a> {
7297    frame_id: Option<crate::page::FrameId<'a>>,
7298}
7299
7300impl<'a> GetSecurityIsolationStatusParamsBuilder<'a> {
7301    /// If no frameId is provided, the status of the target is provided.
7302    pub fn frame_id(mut self, frame_id: crate::page::FrameId<'a>) -> Self { self.frame_id = Some(frame_id); self }
7303    pub fn build(self) -> GetSecurityIsolationStatusParams<'a> {
7304        GetSecurityIsolationStatusParams {
7305            frame_id: self.frame_id,
7306        }
7307    }
7308}
7309
7310/// Returns information about the COEP/COOP isolation status.
7311
7312#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7313#[serde(rename_all = "camelCase")]
7314pub struct GetSecurityIsolationStatusReturns<'a> {
7315    status: SecurityIsolationStatus<'a>,
7316}
7317
7318impl<'a> GetSecurityIsolationStatusReturns<'a> {
7319    /// Creates a builder for this type with the required parameters:
7320    /// * `status`: 
7321    pub fn builder(status: SecurityIsolationStatus<'a>) -> GetSecurityIsolationStatusReturnsBuilder<'a> {
7322        GetSecurityIsolationStatusReturnsBuilder {
7323            status: status,
7324        }
7325    }
7326    pub fn status(&self) -> &SecurityIsolationStatus<'a> { &self.status }
7327}
7328
7329
7330pub struct GetSecurityIsolationStatusReturnsBuilder<'a> {
7331    status: SecurityIsolationStatus<'a>,
7332}
7333
7334impl<'a> GetSecurityIsolationStatusReturnsBuilder<'a> {
7335    pub fn build(self) -> GetSecurityIsolationStatusReturns<'a> {
7336        GetSecurityIsolationStatusReturns {
7337            status: self.status,
7338        }
7339    }
7340}
7341
7342impl<'a> GetSecurityIsolationStatusParams<'a> { pub const METHOD: &'static str = "Network.getSecurityIsolationStatus"; }
7343
7344impl<'a> crate::CdpCommand<'a> for GetSecurityIsolationStatusParams<'a> {
7345    const METHOD: &'static str = "Network.getSecurityIsolationStatus";
7346    type Response = GetSecurityIsolationStatusReturns<'a>;
7347}
7348
7349/// Enables tracking for the Reporting API, events generated by the Reporting API will now be delivered to the client.
7350/// Enabling triggers 'reportingApiReportAdded' for all existing reports.
7351
7352#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7353#[serde(rename_all = "camelCase")]
7354pub struct EnableReportingApiParams {
7355    /// Whether to enable or disable events for the Reporting API
7356    enable: bool,
7357}
7358
7359impl EnableReportingApiParams {
7360    /// Creates a builder for this type with the required parameters:
7361    /// * `enable`: Whether to enable or disable events for the Reporting API
7362    pub fn builder(enable: bool) -> EnableReportingApiParamsBuilder {
7363        EnableReportingApiParamsBuilder {
7364            enable: enable,
7365        }
7366    }
7367    /// Whether to enable or disable events for the Reporting API
7368    pub fn enable(&self) -> bool { self.enable }
7369}
7370
7371
7372pub struct EnableReportingApiParamsBuilder {
7373    enable: bool,
7374}
7375
7376impl EnableReportingApiParamsBuilder {
7377    pub fn build(self) -> EnableReportingApiParams {
7378        EnableReportingApiParams {
7379            enable: self.enable,
7380        }
7381    }
7382}
7383
7384impl EnableReportingApiParams { pub const METHOD: &'static str = "Network.enableReportingApi"; }
7385
7386impl<'a> crate::CdpCommand<'a> for EnableReportingApiParams {
7387    const METHOD: &'static str = "Network.enableReportingApi";
7388    type Response = crate::EmptyReturns;
7389}
7390
7391/// Sets up tracking device bound sessions and fetching of initial set of sessions.
7392
7393#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7394#[serde(rename_all = "camelCase")]
7395pub struct EnableDeviceBoundSessionsParams {
7396    /// Whether to enable or disable events.
7397    enable: bool,
7398}
7399
7400impl EnableDeviceBoundSessionsParams {
7401    /// Creates a builder for this type with the required parameters:
7402    /// * `enable`: Whether to enable or disable events.
7403    pub fn builder(enable: bool) -> EnableDeviceBoundSessionsParamsBuilder {
7404        EnableDeviceBoundSessionsParamsBuilder {
7405            enable: enable,
7406        }
7407    }
7408    /// Whether to enable or disable events.
7409    pub fn enable(&self) -> bool { self.enable }
7410}
7411
7412
7413pub struct EnableDeviceBoundSessionsParamsBuilder {
7414    enable: bool,
7415}
7416
7417impl EnableDeviceBoundSessionsParamsBuilder {
7418    pub fn build(self) -> EnableDeviceBoundSessionsParams {
7419        EnableDeviceBoundSessionsParams {
7420            enable: self.enable,
7421        }
7422    }
7423}
7424
7425impl EnableDeviceBoundSessionsParams { pub const METHOD: &'static str = "Network.enableDeviceBoundSessions"; }
7426
7427impl<'a> crate::CdpCommand<'a> for EnableDeviceBoundSessionsParams {
7428    const METHOD: &'static str = "Network.enableDeviceBoundSessions";
7429    type Response = crate::EmptyReturns;
7430}
7431
7432/// Deletes a device bound session.
7433
7434#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7435#[serde(rename_all = "camelCase")]
7436pub struct DeleteDeviceBoundSessionParams<'a> {
7437    key: DeviceBoundSessionKey<'a>,
7438}
7439
7440impl<'a> DeleteDeviceBoundSessionParams<'a> {
7441    /// Creates a builder for this type with the required parameters:
7442    /// * `key`: 
7443    pub fn builder(key: DeviceBoundSessionKey<'a>) -> DeleteDeviceBoundSessionParamsBuilder<'a> {
7444        DeleteDeviceBoundSessionParamsBuilder {
7445            key: key,
7446        }
7447    }
7448    pub fn key(&self) -> &DeviceBoundSessionKey<'a> { &self.key }
7449}
7450
7451
7452pub struct DeleteDeviceBoundSessionParamsBuilder<'a> {
7453    key: DeviceBoundSessionKey<'a>,
7454}
7455
7456impl<'a> DeleteDeviceBoundSessionParamsBuilder<'a> {
7457    pub fn build(self) -> DeleteDeviceBoundSessionParams<'a> {
7458        DeleteDeviceBoundSessionParams {
7459            key: self.key,
7460        }
7461    }
7462}
7463
7464impl<'a> DeleteDeviceBoundSessionParams<'a> { pub const METHOD: &'static str = "Network.deleteDeviceBoundSession"; }
7465
7466impl<'a> crate::CdpCommand<'a> for DeleteDeviceBoundSessionParams<'a> {
7467    const METHOD: &'static str = "Network.deleteDeviceBoundSession";
7468    type Response = crate::EmptyReturns;
7469}
7470
7471/// Fetches the schemeful site for a specific origin.
7472
7473#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7474#[serde(rename_all = "camelCase")]
7475pub struct FetchSchemefulSiteParams<'a> {
7476    /// The URL origin.
7477    origin: Cow<'a, str>,
7478}
7479
7480impl<'a> FetchSchemefulSiteParams<'a> {
7481    /// Creates a builder for this type with the required parameters:
7482    /// * `origin`: The URL origin.
7483    pub fn builder(origin: impl Into<Cow<'a, str>>) -> FetchSchemefulSiteParamsBuilder<'a> {
7484        FetchSchemefulSiteParamsBuilder {
7485            origin: origin.into(),
7486        }
7487    }
7488    /// The URL origin.
7489    pub fn origin(&self) -> &str { self.origin.as_ref() }
7490}
7491
7492
7493pub struct FetchSchemefulSiteParamsBuilder<'a> {
7494    origin: Cow<'a, str>,
7495}
7496
7497impl<'a> FetchSchemefulSiteParamsBuilder<'a> {
7498    pub fn build(self) -> FetchSchemefulSiteParams<'a> {
7499        FetchSchemefulSiteParams {
7500            origin: self.origin,
7501        }
7502    }
7503}
7504
7505/// Fetches the schemeful site for a specific origin.
7506
7507#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7508#[serde(rename_all = "camelCase")]
7509pub struct FetchSchemefulSiteReturns<'a> {
7510    /// The corresponding schemeful site.
7511    #[serde(rename = "schemefulSite")]
7512    schemeful_site: Cow<'a, str>,
7513}
7514
7515impl<'a> FetchSchemefulSiteReturns<'a> {
7516    /// Creates a builder for this type with the required parameters:
7517    /// * `schemeful_site`: The corresponding schemeful site.
7518    pub fn builder(schemeful_site: impl Into<Cow<'a, str>>) -> FetchSchemefulSiteReturnsBuilder<'a> {
7519        FetchSchemefulSiteReturnsBuilder {
7520            schemeful_site: schemeful_site.into(),
7521        }
7522    }
7523    /// The corresponding schemeful site.
7524    pub fn schemeful_site(&self) -> &str { self.schemeful_site.as_ref() }
7525}
7526
7527
7528pub struct FetchSchemefulSiteReturnsBuilder<'a> {
7529    schemeful_site: Cow<'a, str>,
7530}
7531
7532impl<'a> FetchSchemefulSiteReturnsBuilder<'a> {
7533    pub fn build(self) -> FetchSchemefulSiteReturns<'a> {
7534        FetchSchemefulSiteReturns {
7535            schemeful_site: self.schemeful_site,
7536        }
7537    }
7538}
7539
7540impl<'a> FetchSchemefulSiteParams<'a> { pub const METHOD: &'static str = "Network.fetchSchemefulSite"; }
7541
7542impl<'a> crate::CdpCommand<'a> for FetchSchemefulSiteParams<'a> {
7543    const METHOD: &'static str = "Network.fetchSchemefulSite";
7544    type Response = FetchSchemefulSiteReturns<'a>;
7545}
7546
7547/// Fetches the resource and returns the content.
7548
7549#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7550#[serde(rename_all = "camelCase")]
7551pub struct LoadNetworkResourceParams<'a> {
7552    /// Frame id to get the resource for. Mandatory for frame targets, and
7553    /// should be omitted for worker targets.
7554    #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
7555    frame_id: Option<crate::page::FrameId<'a>>,
7556    /// URL of the resource to get content for.
7557    url: Cow<'a, str>,
7558    /// Options for the request.
7559    options: LoadNetworkResourceOptions,
7560}
7561
7562impl<'a> LoadNetworkResourceParams<'a> {
7563    /// Creates a builder for this type with the required parameters:
7564    /// * `url`: URL of the resource to get content for.
7565    /// * `options`: Options for the request.
7566    pub fn builder(url: impl Into<Cow<'a, str>>, options: LoadNetworkResourceOptions) -> LoadNetworkResourceParamsBuilder<'a> {
7567        LoadNetworkResourceParamsBuilder {
7568            frame_id: None,
7569            url: url.into(),
7570            options: options,
7571        }
7572    }
7573    /// Frame id to get the resource for. Mandatory for frame targets, and
7574    /// should be omitted for worker targets.
7575    pub fn frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.frame_id.as_ref() }
7576    /// URL of the resource to get content for.
7577    pub fn url(&self) -> &str { self.url.as_ref() }
7578    /// Options for the request.
7579    pub fn options(&self) -> &LoadNetworkResourceOptions { &self.options }
7580}
7581
7582
7583pub struct LoadNetworkResourceParamsBuilder<'a> {
7584    frame_id: Option<crate::page::FrameId<'a>>,
7585    url: Cow<'a, str>,
7586    options: LoadNetworkResourceOptions,
7587}
7588
7589impl<'a> LoadNetworkResourceParamsBuilder<'a> {
7590    /// Frame id to get the resource for. Mandatory for frame targets, and
7591    /// should be omitted for worker targets.
7592    pub fn frame_id(mut self, frame_id: crate::page::FrameId<'a>) -> Self { self.frame_id = Some(frame_id); self }
7593    pub fn build(self) -> LoadNetworkResourceParams<'a> {
7594        LoadNetworkResourceParams {
7595            frame_id: self.frame_id,
7596            url: self.url,
7597            options: self.options,
7598        }
7599    }
7600}
7601
7602/// Fetches the resource and returns the content.
7603
7604#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7605#[serde(rename_all = "camelCase")]
7606pub struct LoadNetworkResourceReturns<'a> {
7607    resource: LoadNetworkResourcePageResult<'a>,
7608}
7609
7610impl<'a> LoadNetworkResourceReturns<'a> {
7611    /// Creates a builder for this type with the required parameters:
7612    /// * `resource`: 
7613    pub fn builder(resource: LoadNetworkResourcePageResult<'a>) -> LoadNetworkResourceReturnsBuilder<'a> {
7614        LoadNetworkResourceReturnsBuilder {
7615            resource: resource,
7616        }
7617    }
7618    pub fn resource(&self) -> &LoadNetworkResourcePageResult<'a> { &self.resource }
7619}
7620
7621
7622pub struct LoadNetworkResourceReturnsBuilder<'a> {
7623    resource: LoadNetworkResourcePageResult<'a>,
7624}
7625
7626impl<'a> LoadNetworkResourceReturnsBuilder<'a> {
7627    pub fn build(self) -> LoadNetworkResourceReturns<'a> {
7628        LoadNetworkResourceReturns {
7629            resource: self.resource,
7630        }
7631    }
7632}
7633
7634impl<'a> LoadNetworkResourceParams<'a> { pub const METHOD: &'static str = "Network.loadNetworkResource"; }
7635
7636impl<'a> crate::CdpCommand<'a> for LoadNetworkResourceParams<'a> {
7637    const METHOD: &'static str = "Network.loadNetworkResource";
7638    type Response = LoadNetworkResourceReturns<'a>;
7639}
7640
7641/// Sets Controls for third-party cookie access
7642/// Page reload is required before the new cookie behavior will be observed
7643
7644#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7645#[serde(rename_all = "camelCase")]
7646pub struct SetCookieControlsParams {
7647    /// Whether 3pc restriction is enabled.
7648    #[serde(rename = "enableThirdPartyCookieRestriction")]
7649    enable_third_party_cookie_restriction: bool,
7650}
7651
7652impl SetCookieControlsParams {
7653    /// Creates a builder for this type with the required parameters:
7654    /// * `enable_third_party_cookie_restriction`: Whether 3pc restriction is enabled.
7655    pub fn builder(enable_third_party_cookie_restriction: bool) -> SetCookieControlsParamsBuilder {
7656        SetCookieControlsParamsBuilder {
7657            enable_third_party_cookie_restriction: enable_third_party_cookie_restriction,
7658        }
7659    }
7660    /// Whether 3pc restriction is enabled.
7661    pub fn enable_third_party_cookie_restriction(&self) -> bool { self.enable_third_party_cookie_restriction }
7662}
7663
7664
7665pub struct SetCookieControlsParamsBuilder {
7666    enable_third_party_cookie_restriction: bool,
7667}
7668
7669impl SetCookieControlsParamsBuilder {
7670    pub fn build(self) -> SetCookieControlsParams {
7671        SetCookieControlsParams {
7672            enable_third_party_cookie_restriction: self.enable_third_party_cookie_restriction,
7673        }
7674    }
7675}
7676
7677impl SetCookieControlsParams { pub const METHOD: &'static str = "Network.setCookieControls"; }
7678
7679impl<'a> crate::CdpCommand<'a> for SetCookieControlsParams {
7680    const METHOD: &'static str = "Network.setCookieControls";
7681    type Response = crate::EmptyReturns;
7682}