1use serde::{Serialize, Deserialize};
6use serde_json::Value as JsonValue;
7use std::borrow::Cow;
8
9#[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
54pub type LoaderId<'a> = Cow<'a, str>;
57
58pub type RequestId<'a> = Cow<'a, str>;
63
64pub type InterceptionId<'a> = Cow<'a, str>;
67
68#[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
103pub type TimeSinceEpoch = f64;
106
107pub type MonotonicTime = f64;
110
111pub type Headers = serde_json::Map<String, JsonValue>;
114
115#[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#[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#[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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
186#[serde(rename_all = "camelCase")]
187pub struct ResourceTiming {
188 #[serde(rename = "requestTime")]
191 request_time: f64,
192 #[serde(rename = "proxyStart")]
194 proxy_start: f64,
195 #[serde(rename = "proxyEnd")]
197 proxy_end: f64,
198 #[serde(rename = "dnsStart")]
200 dns_start: f64,
201 #[serde(rename = "dnsEnd")]
203 dns_end: f64,
204 #[serde(rename = "connectStart")]
206 connect_start: f64,
207 #[serde(rename = "connectEnd")]
209 connect_end: f64,
210 #[serde(rename = "sslStart")]
212 ssl_start: f64,
213 #[serde(rename = "sslEnd")]
215 ssl_end: f64,
216 #[serde(rename = "workerStart")]
218 worker_start: f64,
219 #[serde(rename = "workerReady")]
221 worker_ready: f64,
222 #[serde(rename = "workerFetchStart")]
224 worker_fetch_start: f64,
225 #[serde(rename = "workerRespondWithSettled")]
227 worker_respond_with_settled: f64,
228 #[serde(skip_serializing_if = "Option::is_none", rename = "workerRouterEvaluationStart")]
230 worker_router_evaluation_start: Option<f64>,
231 #[serde(skip_serializing_if = "Option::is_none", rename = "workerCacheLookupStart")]
233 worker_cache_lookup_start: Option<f64>,
234 #[serde(rename = "sendStart")]
236 send_start: f64,
237 #[serde(rename = "sendEnd")]
239 send_end: f64,
240 #[serde(rename = "pushStart")]
242 push_start: f64,
243 #[serde(rename = "pushEnd")]
245 push_end: f64,
246 #[serde(rename = "receiveHeadersStart")]
248 receive_headers_start: f64,
249 #[serde(rename = "receiveHeadersEnd")]
251 receive_headers_end: f64,
252}
253
254impl ResourceTiming {
255 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 pub fn request_time(&self) -> f64 { self.request_time }
303 pub fn proxy_start(&self) -> f64 { self.proxy_start }
305 pub fn proxy_end(&self) -> f64 { self.proxy_end }
307 pub fn dns_start(&self) -> f64 { self.dns_start }
309 pub fn dns_end(&self) -> f64 { self.dns_end }
311 pub fn connect_start(&self) -> f64 { self.connect_start }
313 pub fn connect_end(&self) -> f64 { self.connect_end }
315 pub fn ssl_start(&self) -> f64 { self.ssl_start }
317 pub fn ssl_end(&self) -> f64 { self.ssl_end }
319 pub fn worker_start(&self) -> f64 { self.worker_start }
321 pub fn worker_ready(&self) -> f64 { self.worker_ready }
323 pub fn worker_fetch_start(&self) -> f64 { self.worker_fetch_start }
325 pub fn worker_respond_with_settled(&self) -> f64 { self.worker_respond_with_settled }
327 pub fn worker_router_evaluation_start(&self) -> Option<f64> { self.worker_router_evaluation_start }
329 pub fn worker_cache_lookup_start(&self) -> Option<f64> { self.worker_cache_lookup_start }
331 pub fn send_start(&self) -> f64 { self.send_start }
333 pub fn send_end(&self) -> f64 { self.send_end }
335 pub fn push_start(&self) -> f64 { self.push_start }
337 pub fn push_end(&self) -> f64 { self.push_end }
339 pub fn receive_headers_start(&self) -> f64 { self.receive_headers_start }
341 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 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 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#[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#[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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
472#[serde(rename_all = "camelCase")]
473pub struct Request<'a> {
474 url: Cow<'a, str>,
476 #[serde(skip_serializing_if = "Option::is_none", rename = "urlFragment")]
478 url_fragment: Option<Cow<'a, str>>,
479 method: Cow<'a, str>,
481 headers: Headers,
483 #[serde(skip_serializing_if = "Option::is_none", rename = "postData")]
486 post_data: Option<Cow<'a, str>>,
487 #[serde(skip_serializing_if = "Option::is_none", rename = "hasPostData")]
489 has_post_data: Option<bool>,
490 #[serde(skip_serializing_if = "Option::is_none", rename = "postDataEntries")]
492 post_data_entries: Option<Vec<PostDataEntry<'a>>>,
493 #[serde(skip_serializing_if = "Option::is_none", rename = "mixedContentType")]
495 mixed_content_type: Option<crate::security::MixedContentType>,
496 #[serde(rename = "initialPriority")]
498 initial_priority: ResourcePriority,
499 #[serde(rename = "referrerPolicy")]
501 referrer_policy: Cow<'a, str>,
502 #[serde(skip_serializing_if = "Option::is_none", rename = "isLinkPreload")]
504 is_link_preload: Option<bool>,
505 #[serde(skip_serializing_if = "Option::is_none", rename = "trustTokenParams")]
508 trust_token_params: Option<TrustTokenParams<'a>>,
509 #[serde(skip_serializing_if = "Option::is_none", rename = "isSameSite")]
512 is_same_site: Option<bool>,
513 #[serde(skip_serializing_if = "Option::is_none", rename = "isAdRelated")]
515 is_ad_related: Option<bool>,
516}
517
518impl<'a> Request<'a> {
519 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 pub fn url(&self) -> &str { self.url.as_ref() }
545 pub fn url_fragment(&self) -> Option<&str> { self.url_fragment.as_deref() }
547 pub fn method(&self) -> &str { self.method.as_ref() }
549 pub fn headers(&self) -> &Headers { &self.headers }
551 pub fn post_data(&self) -> Option<&str> { self.post_data.as_deref() }
554 pub fn has_post_data(&self) -> Option<bool> { self.has_post_data }
556 pub fn post_data_entries(&self) -> Option<&[PostDataEntry<'a>]> { self.post_data_entries.as_deref() }
558 pub fn mixed_content_type(&self) -> Option<&crate::security::MixedContentType> { self.mixed_content_type.as_ref() }
560 pub fn initial_priority(&self) -> &ResourcePriority { &self.initial_priority }
562 pub fn referrer_policy(&self) -> &str { self.referrer_policy.as_ref() }
564 pub fn is_link_preload(&self) -> Option<bool> { self.is_link_preload }
566 pub fn trust_token_params(&self) -> Option<&TrustTokenParams<'a>> { self.trust_token_params.as_ref() }
569 pub fn is_same_site(&self) -> Option<bool> { self.is_same_site }
572 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 pub fn url_fragment(mut self, url_fragment: impl Into<Cow<'a, str>>) -> Self { self.url_fragment = Some(url_fragment.into()); self }
597 pub fn post_data(mut self, post_data: impl Into<Cow<'a, str>>) -> Self { self.post_data = Some(post_data.into()); self }
600 pub fn has_post_data(mut self, has_post_data: bool) -> Self { self.has_post_data = Some(has_post_data); self }
602 pub fn post_data_entries(mut self, post_data_entries: Vec<PostDataEntry<'a>>) -> Self { self.post_data_entries = Some(post_data_entries); self }
604 pub fn mixed_content_type(mut self, mixed_content_type: crate::security::MixedContentType) -> Self { self.mixed_content_type = Some(mixed_content_type); self }
606 pub fn is_link_preload(mut self, is_link_preload: bool) -> Self { self.is_link_preload = Some(is_link_preload); self }
608 pub fn trust_token_params(mut self, trust_token_params: TrustTokenParams<'a>) -> Self { self.trust_token_params = Some(trust_token_params); self }
611 pub fn is_same_site(mut self, is_same_site: bool) -> Self { self.is_same_site = Some(is_same_site); self }
614 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
639#[serde(rename_all = "camelCase")]
640pub struct SignedCertificateTimestamp<'a> {
641 status: Cow<'a, str>,
643 origin: Cow<'a, str>,
645 #[serde(rename = "logDescription")]
647 log_description: Cow<'a, str>,
648 #[serde(rename = "logId")]
650 log_id: Cow<'a, str>,
651 timestamp: f64,
654 #[serde(rename = "hashAlgorithm")]
656 hash_algorithm: Cow<'a, str>,
657 #[serde(rename = "signatureAlgorithm")]
659 signature_algorithm: Cow<'a, str>,
660 #[serde(rename = "signatureData")]
662 signature_data: Cow<'a, str>,
663}
664
665impl<'a> SignedCertificateTimestamp<'a> {
666 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 pub fn status(&self) -> &str { self.status.as_ref() }
689 pub fn origin(&self) -> &str { self.origin.as_ref() }
691 pub fn log_description(&self) -> &str { self.log_description.as_ref() }
693 pub fn log_id(&self) -> &str { self.log_id.as_ref() }
695 pub fn timestamp(&self) -> f64 { self.timestamp }
698 pub fn hash_algorithm(&self) -> &str { self.hash_algorithm.as_ref() }
700 pub fn signature_algorithm(&self) -> &str { self.signature_algorithm.as_ref() }
702 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
736#[serde(rename_all = "camelCase")]
737pub struct SecurityDetails<'a> {
738 protocol: Cow<'a, str>,
740 #[serde(rename = "keyExchange")]
742 key_exchange: Cow<'a, str>,
743 #[serde(skip_serializing_if = "Option::is_none", rename = "keyExchangeGroup")]
745 key_exchange_group: Option<Cow<'a, str>>,
746 cipher: Cow<'a, str>,
748 #[serde(skip_serializing_if = "Option::is_none")]
750 mac: Option<Cow<'a, str>>,
751 #[serde(rename = "certificateId")]
753 certificate_id: crate::security::CertificateId,
754 #[serde(rename = "subjectName")]
756 subject_name: Cow<'a, str>,
757 #[serde(rename = "sanList")]
759 san_list: Vec<Cow<'a, str>>,
760 issuer: Cow<'a, str>,
762 #[serde(rename = "validFrom")]
764 valid_from: TimeSinceEpoch,
765 #[serde(rename = "validTo")]
767 valid_to: TimeSinceEpoch,
768 #[serde(rename = "signedCertificateTimestampList")]
770 signed_certificate_timestamp_list: Vec<SignedCertificateTimestamp<'a>>,
771 #[serde(rename = "certificateTransparencyCompliance")]
773 certificate_transparency_compliance: CertificateTransparencyCompliance,
774 #[serde(skip_serializing_if = "Option::is_none", rename = "serverSignatureAlgorithm")]
778 server_signature_algorithm: Option<i64>,
779 #[serde(rename = "encryptedClientHello")]
781 encrypted_client_hello: bool,
782}
783
784impl<'a> SecurityDetails<'a> {
785 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 pub fn protocol(&self) -> &str { self.protocol.as_ref() }
819 pub fn key_exchange(&self) -> &str { self.key_exchange.as_ref() }
821 pub fn key_exchange_group(&self) -> Option<&str> { self.key_exchange_group.as_deref() }
823 pub fn cipher(&self) -> &str { self.cipher.as_ref() }
825 pub fn mac(&self) -> Option<&str> { self.mac.as_deref() }
827 pub fn certificate_id(&self) -> &crate::security::CertificateId { &self.certificate_id }
829 pub fn subject_name(&self) -> &str { self.subject_name.as_ref() }
831 pub fn san_list(&self) -> &[Cow<'a, str>] { &self.san_list }
833 pub fn issuer(&self) -> &str { self.issuer.as_ref() }
835 pub fn valid_from(&self) -> &TimeSinceEpoch { &self.valid_from }
837 pub fn valid_to(&self) -> &TimeSinceEpoch { &self.valid_to }
839 pub fn signed_certificate_timestamp_list(&self) -> &[SignedCertificateTimestamp<'a>] { &self.signed_certificate_timestamp_list }
841 pub fn certificate_transparency_compliance(&self) -> &CertificateTransparencyCompliance { &self.certificate_transparency_compliance }
843 pub fn server_signature_algorithm(&self) -> Option<i64> { self.server_signature_algorithm }
847 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 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 pub fn mac(mut self, mac: impl Into<Cow<'a, str>>) -> Self { self.mac = Some(mac.into()); self }
875 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#[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#[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#[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 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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1074#[serde(rename_all = "camelCase")]
1075pub struct TrustTokenParams<'a> {
1076 operation: TrustTokenOperationType,
1077 #[serde(rename = "refreshPolicy")]
1080 refresh_policy: Cow<'a, str>,
1081 #[serde(skip_serializing_if = "Option::is_none")]
1084 issuers: Option<Vec<Cow<'a, str>>>,
1085}
1086
1087impl<'a> TrustTokenParams<'a> {
1088 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 pub fn refresh_policy(&self) -> &str { self.refresh_policy.as_ref() }
1102 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 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#[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#[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 #[serde(skip_serializing_if = "Option::is_none", rename = "ruleIdMatched")]
1186 rule_id_matched: Option<u64>,
1187 #[serde(skip_serializing_if = "Option::is_none", rename = "matchedSourceType")]
1190 matched_source_type: Option<ServiceWorkerRouterSource>,
1191 #[serde(skip_serializing_if = "Option::is_none", rename = "actualSourceType")]
1193 actual_source_type: Option<ServiceWorkerRouterSource>,
1194}
1195
1196impl ServiceWorkerRouterInfo {
1197 pub fn builder() -> ServiceWorkerRouterInfoBuilder {
1199 ServiceWorkerRouterInfoBuilder {
1200 rule_id_matched: None,
1201 matched_source_type: None,
1202 actual_source_type: None,
1203 }
1204 }
1205 pub fn rule_id_matched(&self) -> Option<u64> { self.rule_id_matched }
1208 pub fn matched_source_type(&self) -> Option<&ServiceWorkerRouterSource> { self.matched_source_type.as_ref() }
1211 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 pub fn rule_id_matched(mut self, rule_id_matched: u64) -> Self { self.rule_id_matched = Some(rule_id_matched); self }
1226 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1243#[serde(rename_all = "camelCase")]
1244pub struct Response<'a> {
1245 url: Cow<'a, str>,
1247 status: i64,
1249 #[serde(rename = "statusText")]
1251 status_text: Cow<'a, str>,
1252 headers: Headers,
1254 #[serde(skip_serializing_if = "Option::is_none", rename = "headersText")]
1256 headers_text: Option<Cow<'a, str>>,
1257 #[serde(rename = "mimeType")]
1259 mime_type: Cow<'a, str>,
1260 charset: Cow<'a, str>,
1262 #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeaders")]
1264 request_headers: Option<Headers>,
1265 #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeadersText")]
1267 request_headers_text: Option<Cow<'a, str>>,
1268 #[serde(rename = "connectionReused")]
1270 connection_reused: bool,
1271 #[serde(rename = "connectionId")]
1273 connection_id: f64,
1274 #[serde(skip_serializing_if = "Option::is_none", rename = "remoteIPAddress")]
1276 remote_ip_address: Option<Cow<'a, str>>,
1277 #[serde(skip_serializing_if = "Option::is_none", rename = "remotePort")]
1279 remote_port: Option<i64>,
1280 #[serde(skip_serializing_if = "Option::is_none", rename = "fromDiskCache")]
1282 from_disk_cache: Option<bool>,
1283 #[serde(skip_serializing_if = "Option::is_none", rename = "fromServiceWorker")]
1285 from_service_worker: Option<bool>,
1286 #[serde(skip_serializing_if = "Option::is_none", rename = "fromPrefetchCache")]
1288 from_prefetch_cache: Option<bool>,
1289 #[serde(skip_serializing_if = "Option::is_none", rename = "fromEarlyHints")]
1291 from_early_hints: Option<bool>,
1292 #[serde(skip_serializing_if = "Option::is_none", rename = "serviceWorkerRouterInfo")]
1297 service_worker_router_info: Option<ServiceWorkerRouterInfo>,
1298 #[serde(rename = "encodedDataLength")]
1300 encoded_data_length: f64,
1301 #[serde(skip_serializing_if = "Option::is_none")]
1303 timing: Option<ResourceTiming>,
1304 #[serde(skip_serializing_if = "Option::is_none", rename = "serviceWorkerResponseSource")]
1306 service_worker_response_source: Option<ServiceWorkerResponseSource>,
1307 #[serde(skip_serializing_if = "Option::is_none", rename = "responseTime")]
1309 response_time: Option<TimeSinceEpoch>,
1310 #[serde(skip_serializing_if = "Option::is_none", rename = "cacheStorageCacheName")]
1312 cache_storage_cache_name: Option<Cow<'a, str>>,
1313 #[serde(skip_serializing_if = "Option::is_none")]
1315 protocol: Option<Cow<'a, str>>,
1316 #[serde(skip_serializing_if = "Option::is_none", rename = "alternateProtocolUsage")]
1318 alternate_protocol_usage: Option<AlternateProtocolUsage>,
1319 #[serde(rename = "securityState")]
1321 security_state: crate::security::SecurityState,
1322 #[serde(skip_serializing_if = "Option::is_none", rename = "securityDetails")]
1324 security_details: Option<SecurityDetails<'a>>,
1325}
1326
1327impl<'a> Response<'a> {
1328 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 pub fn url(&self) -> &str { self.url.as_ref() }
1372 pub fn status(&self) -> i64 { self.status }
1374 pub fn status_text(&self) -> &str { self.status_text.as_ref() }
1376 pub fn headers(&self) -> &Headers { &self.headers }
1378 pub fn headers_text(&self) -> Option<&str> { self.headers_text.as_deref() }
1380 pub fn mime_type(&self) -> &str { self.mime_type.as_ref() }
1382 pub fn charset(&self) -> &str { self.charset.as_ref() }
1384 pub fn request_headers(&self) -> Option<&Headers> { self.request_headers.as_ref() }
1386 pub fn request_headers_text(&self) -> Option<&str> { self.request_headers_text.as_deref() }
1388 pub fn connection_reused(&self) -> bool { self.connection_reused }
1390 pub fn connection_id(&self) -> f64 { self.connection_id }
1392 pub fn remote_ip_address(&self) -> Option<&str> { self.remote_ip_address.as_deref() }
1394 pub fn remote_port(&self) -> Option<i64> { self.remote_port }
1396 pub fn from_disk_cache(&self) -> Option<bool> { self.from_disk_cache }
1398 pub fn from_service_worker(&self) -> Option<bool> { self.from_service_worker }
1400 pub fn from_prefetch_cache(&self) -> Option<bool> { self.from_prefetch_cache }
1402 pub fn from_early_hints(&self) -> Option<bool> { self.from_early_hints }
1404 pub fn service_worker_router_info(&self) -> Option<&ServiceWorkerRouterInfo> { self.service_worker_router_info.as_ref() }
1409 pub fn encoded_data_length(&self) -> f64 { self.encoded_data_length }
1411 pub fn timing(&self) -> Option<&ResourceTiming> { self.timing.as_ref() }
1413 pub fn service_worker_response_source(&self) -> Option<&ServiceWorkerResponseSource> { self.service_worker_response_source.as_ref() }
1415 pub fn response_time(&self) -> Option<&TimeSinceEpoch> { self.response_time.as_ref() }
1417 pub fn cache_storage_cache_name(&self) -> Option<&str> { self.cache_storage_cache_name.as_deref() }
1419 pub fn protocol(&self) -> Option<&str> { self.protocol.as_deref() }
1421 pub fn alternate_protocol_usage(&self) -> Option<&AlternateProtocolUsage> { self.alternate_protocol_usage.as_ref() }
1423 pub fn security_state(&self) -> &crate::security::SecurityState { &self.security_state }
1425 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 pub fn headers_text(mut self, headers_text: impl Into<Cow<'a, str>>) -> Self { self.headers_text = Some(headers_text.into()); self }
1463 pub fn request_headers(mut self, request_headers: Headers) -> Self { self.request_headers = Some(request_headers); self }
1465 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 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 pub fn remote_port(mut self, remote_port: i64) -> Self { self.remote_port = Some(remote_port); self }
1471 pub fn from_disk_cache(mut self, from_disk_cache: bool) -> Self { self.from_disk_cache = Some(from_disk_cache); self }
1473 pub fn from_service_worker(mut self, from_service_worker: bool) -> Self { self.from_service_worker = Some(from_service_worker); self }
1475 pub fn from_prefetch_cache(mut self, from_prefetch_cache: bool) -> Self { self.from_prefetch_cache = Some(from_prefetch_cache); self }
1477 pub fn from_early_hints(mut self, from_early_hints: bool) -> Self { self.from_early_hints = Some(from_early_hints); self }
1479 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 pub fn timing(mut self, timing: ResourceTiming) -> Self { self.timing = Some(timing); self }
1486 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 pub fn response_time(mut self, response_time: TimeSinceEpoch) -> Self { self.response_time = Some(response_time); self }
1490 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 pub fn protocol(mut self, protocol: impl Into<Cow<'a, str>>) -> Self { self.protocol = Some(protocol.into()); self }
1494 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1534#[serde(rename_all = "camelCase")]
1535pub struct WebSocketRequest {
1536 headers: Headers,
1538}
1539
1540impl WebSocketRequest {
1541 pub fn builder(headers: Headers) -> WebSocketRequestBuilder {
1544 WebSocketRequestBuilder {
1545 headers: headers,
1546 }
1547 }
1548 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1568#[serde(rename_all = "camelCase")]
1569pub struct WebSocketResponse<'a> {
1570 status: i64,
1572 #[serde(rename = "statusText")]
1574 status_text: Cow<'a, str>,
1575 headers: Headers,
1577 #[serde(skip_serializing_if = "Option::is_none", rename = "headersText")]
1579 headers_text: Option<Cow<'a, str>>,
1580 #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeaders")]
1582 request_headers: Option<Headers>,
1583 #[serde(skip_serializing_if = "Option::is_none", rename = "requestHeadersText")]
1585 request_headers_text: Option<Cow<'a, str>>,
1586}
1587
1588impl<'a> WebSocketResponse<'a> {
1589 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 pub fn status(&self) -> i64 { self.status }
1605 pub fn status_text(&self) -> &str { self.status_text.as_ref() }
1607 pub fn headers(&self) -> &Headers { &self.headers }
1609 pub fn headers_text(&self) -> Option<&str> { self.headers_text.as_deref() }
1611 pub fn request_headers(&self) -> Option<&Headers> { self.request_headers.as_ref() }
1613 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 pub fn headers_text(mut self, headers_text: impl Into<Cow<'a, str>>) -> Self { self.headers_text = Some(headers_text.into()); self }
1630 pub fn request_headers(mut self, request_headers: Headers) -> Self { self.request_headers = Some(request_headers); self }
1632 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1649#[serde(rename_all = "camelCase")]
1650pub struct WebSocketFrame<'a> {
1651 opcode: f64,
1653 mask: bool,
1655 #[serde(rename = "payloadData")]
1659 payload_data: Cow<'a, str>,
1660}
1661
1662impl<'a> WebSocketFrame<'a> {
1663 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 pub fn opcode(&self) -> f64 { self.opcode }
1676 pub fn mask(&self) -> bool { self.mask }
1678 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1704#[serde(rename_all = "camelCase")]
1705pub struct CachedResource<'a> {
1706 url: Cow<'a, str>,
1708 #[serde(rename = "type")]
1710 type_: ResourceType,
1711 #[serde(skip_serializing_if = "Option::is_none")]
1713 response: Option<Response<'a>>,
1714 #[serde(rename = "bodySize")]
1716 body_size: f64,
1717}
1718
1719impl<'a> CachedResource<'a> {
1720 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 pub fn url(&self) -> &str { self.url.as_ref() }
1734 pub fn type_(&self) -> &ResourceType { &self.type_ }
1736 pub fn response(&self) -> Option<&Response<'a>> { self.response.as_ref() }
1738 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1766#[serde(rename_all = "camelCase")]
1767pub struct Initiator<'a> {
1768 #[serde(rename = "type")]
1770 type_: Cow<'a, str>,
1771 #[serde(skip_serializing_if = "Option::is_none")]
1774 stack: Option<crate::runtime::StackTrace>,
1775 #[serde(skip_serializing_if = "Option::is_none")]
1777 url: Option<Cow<'a, str>>,
1778 #[serde(skip_serializing_if = "Option::is_none", rename = "lineNumber")]
1781 line_number: Option<f64>,
1782 #[serde(skip_serializing_if = "Option::is_none", rename = "columnNumber")]
1785 column_number: Option<f64>,
1786 #[serde(skip_serializing_if = "Option::is_none", rename = "requestId")]
1788 request_id: Option<RequestId<'a>>,
1789}
1790
1791impl<'a> Initiator<'a> {
1792 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 pub fn type_(&self) -> &str { self.type_.as_ref() }
1806 pub fn stack(&self) -> Option<&crate::runtime::StackTrace> { self.stack.as_ref() }
1809 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
1811 pub fn line_number(&self) -> Option<f64> { self.line_number }
1814 pub fn column_number(&self) -> Option<f64> { self.column_number }
1817 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 pub fn stack(mut self, stack: crate::runtime::StackTrace) -> Self { self.stack = Some(stack); self }
1835 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
1837 pub fn line_number(mut self, line_number: f64) -> Self { self.line_number = Some(line_number); self }
1840 pub fn column_number(mut self, column_number: f64) -> Self { self.column_number = Some(column_number); self }
1843 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1861#[serde(rename_all = "camelCase")]
1862pub struct CookiePartitionKey<'a> {
1863 #[serde(rename = "topLevelSite")]
1866 top_level_site: Cow<'a, str>,
1867 #[serde(rename = "hasCrossSiteAncestor")]
1869 has_cross_site_ancestor: bool,
1870}
1871
1872impl<'a> CookiePartitionKey<'a> {
1873 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 pub fn top_level_site(&self) -> &str { self.top_level_site.as_ref() }
1885 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1907#[serde(rename_all = "camelCase")]
1908pub struct Cookie<'a> {
1909 name: Cow<'a, str>,
1911 value: Cow<'a, str>,
1913 domain: Cow<'a, str>,
1915 path: Cow<'a, str>,
1917 expires: f64,
1922 size: u64,
1924 #[serde(rename = "httpOnly")]
1926 http_only: bool,
1927 secure: bool,
1929 session: bool,
1931 #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
1933 same_site: Option<CookieSameSite>,
1934 priority: CookiePriority,
1936 #[serde(rename = "sourceScheme")]
1938 source_scheme: CookieSourceScheme,
1939 #[serde(rename = "sourcePort")]
1943 source_port: i64,
1944 #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
1946 partition_key: Option<CookiePartitionKey<'a>>,
1947 #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKeyOpaque")]
1949 partition_key_opaque: Option<bool>,
1950}
1951
1952impl<'a> Cookie<'a> {
1953 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 pub fn name(&self) -> &str { self.name.as_ref() }
1987 pub fn value(&self) -> &str { self.value.as_ref() }
1989 pub fn domain(&self) -> &str { self.domain.as_ref() }
1991 pub fn path(&self) -> &str { self.path.as_ref() }
1993 pub fn expires(&self) -> f64 { self.expires }
1998 pub fn size(&self) -> u64 { self.size }
2000 pub fn http_only(&self) -> bool { self.http_only }
2002 pub fn secure(&self) -> bool { self.secure }
2004 pub fn session(&self) -> bool { self.session }
2006 pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
2008 pub fn priority(&self) -> &CookiePriority { &self.priority }
2010 pub fn source_scheme(&self) -> &CookieSourceScheme { &self.source_scheme }
2012 pub fn source_port(&self) -> i64 { self.source_port }
2016 pub fn partition_key(&self) -> Option<&CookiePartitionKey<'a>> { self.partition_key.as_ref() }
2018 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 pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
2044 pub fn partition_key(mut self, partition_key: CookiePartitionKey<'a>) -> Self { self.partition_key = Some(partition_key); self }
2046 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#[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#[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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2191#[serde(rename_all = "camelCase")]
2192pub struct BlockedSetCookieWithReason<'a> {
2193 #[serde(rename = "blockedReasons")]
2195 blocked_reasons: Vec<SetCookieBlockedReason>,
2196 #[serde(rename = "cookieLine")]
2199 cookie_line: Cow<'a, str>,
2200 #[serde(skip_serializing_if = "Option::is_none")]
2204 cookie: Option<Cookie<'a>>,
2205}
2206
2207impl<'a> BlockedSetCookieWithReason<'a> {
2208 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 pub fn blocked_reasons(&self) -> &[SetCookieBlockedReason] { &self.blocked_reasons }
2220 pub fn cookie_line(&self) -> &str { self.cookie_line.as_ref() }
2223 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2254#[serde(rename_all = "camelCase")]
2255pub struct ExemptedSetCookieWithReason<'a> {
2256 #[serde(rename = "exemptionReason")]
2258 exemption_reason: CookieExemptionReason,
2259 #[serde(rename = "cookieLine")]
2261 cookie_line: Cow<'a, str>,
2262 cookie: Cookie<'a>,
2264}
2265
2266impl<'a> ExemptedSetCookieWithReason<'a> {
2267 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 pub fn exemption_reason(&self) -> &CookieExemptionReason { &self.exemption_reason }
2280 pub fn cookie_line(&self) -> &str { self.cookie_line.as_ref() }
2282 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2307#[serde(rename_all = "camelCase")]
2308pub struct AssociatedCookie<'a> {
2309 cookie: Cookie<'a>,
2311 #[serde(rename = "blockedReasons")]
2313 blocked_reasons: Vec<CookieBlockedReason>,
2314 #[serde(skip_serializing_if = "Option::is_none", rename = "exemptionReason")]
2317 exemption_reason: Option<CookieExemptionReason>,
2318}
2319
2320impl<'a> AssociatedCookie<'a> {
2321 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 pub fn cookie(&self) -> &Cookie<'a> { &self.cookie }
2333 pub fn blocked_reasons(&self) -> &[CookieBlockedReason] { &self.blocked_reasons }
2335 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2363#[serde(rename_all = "camelCase")]
2364pub struct CookieParam<'a> {
2365 name: Cow<'a, str>,
2367 value: Cow<'a, str>,
2369 #[serde(skip_serializing_if = "Option::is_none")]
2372 url: Option<Cow<'a, str>>,
2373 #[serde(skip_serializing_if = "Option::is_none")]
2375 domain: Option<Cow<'a, str>>,
2376 #[serde(skip_serializing_if = "Option::is_none")]
2378 path: Option<Cow<'a, str>>,
2379 #[serde(skip_serializing_if = "Option::is_none")]
2381 secure: Option<bool>,
2382 #[serde(skip_serializing_if = "Option::is_none", rename = "httpOnly")]
2384 http_only: Option<bool>,
2385 #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
2387 same_site: Option<CookieSameSite>,
2388 #[serde(skip_serializing_if = "Option::is_none")]
2390 expires: Option<TimeSinceEpoch>,
2391 #[serde(skip_serializing_if = "Option::is_none")]
2393 priority: Option<CookiePriority>,
2394 #[serde(skip_serializing_if = "Option::is_none", rename = "sourceScheme")]
2396 source_scheme: Option<CookieSourceScheme>,
2397 #[serde(skip_serializing_if = "Option::is_none", rename = "sourcePort")]
2401 source_port: Option<i64>,
2402 #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
2404 partition_key: Option<CookiePartitionKey<'a>>,
2405}
2406
2407impl<'a> CookieParam<'a> {
2408 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 pub fn name(&self) -> &str { self.name.as_ref() }
2430 pub fn value(&self) -> &str { self.value.as_ref() }
2432 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
2435 pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
2437 pub fn path(&self) -> Option<&str> { self.path.as_deref() }
2439 pub fn secure(&self) -> Option<bool> { self.secure }
2441 pub fn http_only(&self) -> Option<bool> { self.http_only }
2443 pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
2445 pub fn expires(&self) -> Option<&TimeSinceEpoch> { self.expires.as_ref() }
2447 pub fn priority(&self) -> Option<&CookiePriority> { self.priority.as_ref() }
2449 pub fn source_scheme(&self) -> Option<&CookieSourceScheme> { self.source_scheme.as_ref() }
2451 pub fn source_port(&self) -> Option<i64> { self.source_port }
2455 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 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
2480 pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
2482 pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
2484 pub fn secure(mut self, secure: bool) -> Self { self.secure = Some(secure); self }
2486 pub fn http_only(mut self, http_only: bool) -> Self { self.http_only = Some(http_only); self }
2488 pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
2490 pub fn expires(mut self, expires: TimeSinceEpoch) -> Self { self.expires = Some(expires); self }
2492 pub fn priority(mut self, priority: impl Into<CookiePriority>) -> Self { self.priority = Some(priority.into()); self }
2494 pub fn source_scheme(mut self, source_scheme: impl Into<CookieSourceScheme>) -> Self { self.source_scheme = Some(source_scheme.into()); self }
2496 pub fn source_port(mut self, source_port: i64) -> Self { self.source_port = Some(source_port); self }
2500 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2524#[serde(rename_all = "camelCase")]
2525pub struct AuthChallenge<'a> {
2526 #[serde(skip_serializing_if = "Option::is_none")]
2528 source: Option<Cow<'a, str>>,
2529 origin: Cow<'a, str>,
2531 scheme: Cow<'a, str>,
2533 realm: Cow<'a, str>,
2535}
2536
2537impl<'a> AuthChallenge<'a> {
2538 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 pub fn source(&self) -> Option<&str> { self.source.as_deref() }
2552 pub fn origin(&self) -> &str { self.origin.as_ref() }
2554 pub fn scheme(&self) -> &str { self.scheme.as_ref() }
2556 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2584#[serde(rename_all = "camelCase")]
2585pub struct AuthChallengeResponse<'a> {
2586 response: Cow<'a, str>,
2590 #[serde(skip_serializing_if = "Option::is_none")]
2593 username: Option<Cow<'a, str>>,
2594 #[serde(skip_serializing_if = "Option::is_none")]
2597 password: Option<Cow<'a, str>>,
2598}
2599
2600impl<'a> AuthChallengeResponse<'a> {
2601 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 pub fn response(&self) -> &str { self.response.as_ref() }
2614 pub fn username(&self) -> Option<&str> { self.username.as_deref() }
2617 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 pub fn username(mut self, username: impl Into<Cow<'a, str>>) -> Self { self.username = Some(username.into()); self }
2633 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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2660#[serde(rename_all = "camelCase")]
2661pub struct RequestPattern<'a> {
2662 #[serde(skip_serializing_if = "Option::is_none", rename = "urlPattern")]
2665 url_pattern: Option<Cow<'a, str>>,
2666 #[serde(skip_serializing_if = "Option::is_none", rename = "resourceType")]
2668 resource_type: Option<ResourceType>,
2669 #[serde(skip_serializing_if = "Option::is_none", rename = "interceptionStage")]
2671 interception_stage: Option<InterceptionStage>,
2672}
2673
2674impl<'a> RequestPattern<'a> {
2675 pub fn builder() -> RequestPatternBuilder<'a> {
2677 RequestPatternBuilder {
2678 url_pattern: None,
2679 resource_type: None,
2680 interception_stage: None,
2681 }
2682 }
2683 pub fn url_pattern(&self) -> Option<&str> { self.url_pattern.as_deref() }
2686 pub fn resource_type(&self) -> Option<&ResourceType> { self.resource_type.as_ref() }
2688 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 pub fn url_pattern(mut self, url_pattern: impl Into<Cow<'a, str>>) -> Self { self.url_pattern = Some(url_pattern.into()); self }
2703 pub fn resource_type(mut self, resource_type: impl Into<ResourceType>) -> Self { self.resource_type = Some(resource_type.into()); self }
2705 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2720#[serde(rename_all = "camelCase")]
2721pub struct SignedExchangeSignature<'a> {
2722 label: Cow<'a, str>,
2724 signature: Cow<'a, str>,
2726 integrity: Cow<'a, str>,
2728 #[serde(skip_serializing_if = "Option::is_none", rename = "certUrl")]
2730 cert_url: Option<Cow<'a, str>>,
2731 #[serde(skip_serializing_if = "Option::is_none", rename = "certSha256")]
2733 cert_sha256: Option<Cow<'a, str>>,
2734 #[serde(rename = "validityUrl")]
2736 validity_url: Cow<'a, str>,
2737 date: i64,
2739 expires: i64,
2741 #[serde(skip_serializing_if = "Option::is_none")]
2743 certificates: Option<Vec<Cow<'a, str>>>,
2744}
2745
2746impl<'a> SignedExchangeSignature<'a> {
2747 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 pub fn label(&self) -> &str { self.label.as_ref() }
2769 pub fn signature(&self) -> &str { self.signature.as_ref() }
2771 pub fn integrity(&self) -> &str { self.integrity.as_ref() }
2773 pub fn cert_url(&self) -> Option<&str> { self.cert_url.as_deref() }
2775 pub fn cert_sha256(&self) -> Option<&str> { self.cert_sha256.as_deref() }
2777 pub fn validity_url(&self) -> &str { self.validity_url.as_ref() }
2779 pub fn date(&self) -> i64 { self.date }
2781 pub fn expires(&self) -> i64 { self.expires }
2783 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 pub fn cert_url(mut self, cert_url: impl Into<Cow<'a, str>>) -> Self { self.cert_url = Some(cert_url.into()); self }
2803 pub fn cert_sha256(mut self, cert_sha256: impl Into<Cow<'a, str>>) -> Self { self.cert_sha256 = Some(cert_sha256.into()); self }
2805 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2826#[serde(rename_all = "camelCase")]
2827pub struct SignedExchangeHeader<'a> {
2828 #[serde(rename = "requestUrl")]
2830 request_url: Cow<'a, str>,
2831 #[serde(rename = "responseCode")]
2833 response_code: i64,
2834 #[serde(rename = "responseHeaders")]
2836 response_headers: Headers,
2837 signatures: Vec<SignedExchangeSignature<'a>>,
2839 #[serde(rename = "headerIntegrity")]
2841 header_integrity: Cow<'a, str>,
2842}
2843
2844impl<'a> SignedExchangeHeader<'a> {
2845 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 pub fn request_url(&self) -> &str { self.request_url.as_ref() }
2862 pub fn response_code(&self) -> i64 { self.response_code }
2864 pub fn response_headers(&self) -> &Headers { &self.response_headers }
2866 pub fn signatures(&self) -> &[SignedExchangeSignature<'a>] { &self.signatures }
2868 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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2915#[serde(rename_all = "camelCase")]
2916pub struct SignedExchangeError<'a> {
2917 message: Cow<'a, str>,
2919 #[serde(skip_serializing_if = "Option::is_none", rename = "signatureIndex")]
2921 signature_index: Option<u64>,
2922 #[serde(skip_serializing_if = "Option::is_none", rename = "errorField")]
2924 error_field: Option<SignedExchangeErrorField>,
2925}
2926
2927impl<'a> SignedExchangeError<'a> {
2928 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 pub fn message(&self) -> &str { self.message.as_ref() }
2939 pub fn signature_index(&self) -> Option<u64> { self.signature_index }
2941 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 pub fn signature_index(mut self, signature_index: u64) -> Self { self.signature_index = Some(signature_index); self }
2955 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
2969#[serde(rename_all = "camelCase")]
2970pub struct SignedExchangeInfo<'a> {
2971 #[serde(rename = "outerResponse")]
2973 outer_response: Response<'a>,
2974 #[serde(rename = "hasExtraInfo")]
2977 has_extra_info: bool,
2978 #[serde(skip_serializing_if = "Option::is_none")]
2980 header: Option<SignedExchangeHeader<'a>>,
2981 #[serde(skip_serializing_if = "Option::is_none", rename = "securityDetails")]
2983 security_details: Option<SecurityDetails<'a>>,
2984 #[serde(skip_serializing_if = "Option::is_none")]
2986 errors: Option<Vec<SignedExchangeError<'a>>>,
2987}
2988
2989impl<'a> SignedExchangeInfo<'a> {
2990 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 pub fn outer_response(&self) -> &Response<'a> { &self.outer_response }
3004 pub fn has_extra_info(&self) -> bool { self.has_extra_info }
3007 pub fn header(&self) -> Option<&SignedExchangeHeader<'a>> { self.header.as_ref() }
3009 pub fn security_details(&self) -> Option<&SecurityDetails<'a>> { self.security_details.as_ref() }
3011 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 pub fn header(mut self, header: SignedExchangeHeader<'a>) -> Self { self.header = Some(header); self }
3027 pub fn security_details(mut self, security_details: SecurityDetails<'a>) -> Self { self.security_details = Some(security_details); self }
3029 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#[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 #[serde(rename = "urlPattern")]
3065 url_pattern: Cow<'a, str>,
3066 latency: f64,
3068 #[serde(rename = "downloadThroughput")]
3070 download_throughput: f64,
3071 #[serde(rename = "uploadThroughput")]
3073 upload_throughput: f64,
3074 #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
3076 connection_type: Option<ConnectionType>,
3077 #[serde(skip_serializing_if = "Option::is_none", rename = "packetLoss")]
3079 packet_loss: Option<f64>,
3080 #[serde(skip_serializing_if = "Option::is_none", rename = "packetQueueLength")]
3082 packet_queue_length: Option<u64>,
3083 #[serde(skip_serializing_if = "Option::is_none", rename = "packetReordering")]
3085 packet_reordering: Option<bool>,
3086 #[serde(skip_serializing_if = "Option::is_none")]
3088 offline: Option<bool>,
3089}
3090
3091impl<'a> NetworkConditions<'a> {
3092 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 pub fn url_pattern(&self) -> &str { self.url_pattern.as_ref() }
3114 pub fn latency(&self) -> f64 { self.latency }
3116 pub fn download_throughput(&self) -> f64 { self.download_throughput }
3118 pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
3120 pub fn connection_type(&self) -> Option<&ConnectionType> { self.connection_type.as_ref() }
3122 pub fn packet_loss(&self) -> Option<f64> { self.packet_loss }
3124 pub fn packet_queue_length(&self) -> Option<u64> { self.packet_queue_length }
3126 pub fn packet_reordering(&self) -> Option<bool> { self.packet_reordering }
3128 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 pub fn connection_type(mut self, connection_type: impl Into<ConnectionType>) -> Self { self.connection_type = Some(connection_type.into()); self }
3148 pub fn packet_loss(mut self, packet_loss: f64) -> Self { self.packet_loss = Some(packet_loss); self }
3150 pub fn packet_queue_length(mut self, packet_queue_length: u64) -> Self { self.packet_queue_length = Some(packet_queue_length); self }
3152 pub fn packet_reordering(mut self, packet_reordering: bool) -> Self { self.packet_reordering = Some(packet_reordering); self }
3154 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 #[serde(rename = "urlPattern")]
3178 url_pattern: Cow<'a, str>,
3179 block: bool,
3182}
3183
3184impl<'a> BlockPattern<'a> {
3185 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 pub fn url_pattern(&self) -> &str { self.url_pattern.as_ref() }
3197 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 #[serde(rename = "noDelay")]
3233 no_delay: bool,
3234 #[serde(skip_serializing_if = "Option::is_none", rename = "keepAliveDelay")]
3236 keep_alive_delay: Option<f64>,
3237 #[serde(skip_serializing_if = "Option::is_none", rename = "sendBufferSize")]
3239 send_buffer_size: Option<f64>,
3240 #[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 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 pub fn no_delay(&self) -> bool { self.no_delay }
3261 pub fn keep_alive_delay(&self) -> Option<f64> { self.keep_alive_delay }
3263 pub fn send_buffer_size(&self) -> Option<f64> { self.send_buffer_size }
3265 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 pub fn keep_alive_delay(mut self, keep_alive_delay: f64) -> Self { self.keep_alive_delay = Some(keep_alive_delay); self }
3282 pub fn send_buffer_size(mut self, send_buffer_size: f64) -> Self { self.send_buffer_size = Some(send_buffer_size); self }
3284 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 #[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 #[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 #[serde(skip_serializing_if = "Option::is_none", rename = "sendBufferSize")]
3316 send_buffer_size: Option<f64>,
3317 #[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 #[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 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 pub fn remote_port(&self) -> Option<i64> { self.remote_port }
3348 pub fn local_addr(&self) -> Option<&str> { self.local_addr.as_deref() }
3349 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 pub fn send_buffer_size(&self) -> Option<f64> { self.send_buffer_size }
3354 pub fn receive_buffer_size(&self) -> Option<f64> { self.receive_buffer_size }
3356 pub fn multicast_loopback(&self) -> Option<bool> { self.multicast_loopback }
3357 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 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 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 pub fn send_buffer_size(mut self, send_buffer_size: f64) -> Self { self.send_buffer_size = Some(send_buffer_size); self }
3386 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 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 #[serde(skip_serializing_if = "Option::is_none", rename = "remoteAddr")]
3415 remote_addr: Option<Cow<'a, str>>,
3416 #[serde(skip_serializing_if = "Option::is_none", rename = "remotePort")]
3419 remote_port: Option<i64>,
3420}
3421
3422impl<'a> DirectUDPMessage<'a> {
3423 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 pub fn remote_addr(&self) -> Option<&str> { self.remote_addr.as_deref() }
3435 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 pub fn remote_addr(mut self, remote_addr: impl Into<Cow<'a, str>>) -> Self { self.remote_addr = Some(remote_addr.into()); self }
3450 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 #[serde(rename = "requestTime")]
3500 request_time: f64,
3501}
3502
3503impl ConnectTiming {
3504 pub fn builder(request_time: f64) -> ConnectTimingBuilder {
3507 ConnectTimingBuilder {
3508 request_time: request_time,
3509 }
3510 }
3511 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3582#[serde(rename_all = "camelCase")]
3583pub struct AdScriptIdentifier<'a> {
3584 #[serde(rename = "scriptId")]
3586 script_id: crate::runtime::ScriptId<'a>,
3587 #[serde(rename = "debuggerId")]
3589 debugger_id: crate::runtime::UniqueDebuggerId<'a>,
3590 name: Cow<'a, str>,
3592}
3593
3594impl<'a> AdScriptIdentifier<'a> {
3595 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 pub fn script_id(&self) -> &crate::runtime::ScriptId<'a> { &self.script_id }
3608 pub fn debugger_id(&self) -> &crate::runtime::UniqueDebuggerId<'a> { &self.debugger_id }
3610 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3635#[serde(rename_all = "camelCase")]
3636pub struct AdAncestry<'a> {
3637 #[serde(rename = "ancestryChain")]
3642 ancestry_chain: Vec<AdScriptIdentifier<'a>>,
3643 #[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 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 pub fn ancestry_chain(&self) -> &[AdScriptIdentifier<'a>] { &self.ancestry_chain }
3663 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3694#[serde(rename_all = "camelCase")]
3695pub struct AdProvenance<'a> {
3696 #[serde(skip_serializing_if = "Option::is_none", rename = "filterlistRule")]
3698 filterlist_rule: Option<Cow<'a, str>>,
3699 #[serde(skip_serializing_if = "Option::is_none", rename = "adScriptAncestry")]
3701 ad_script_ancestry: Option<AdAncestry<'a>>,
3702}
3703
3704impl<'a> AdProvenance<'a> {
3705 pub fn builder() -> AdProvenanceBuilder<'a> {
3707 AdProvenanceBuilder {
3708 filterlist_rule: None,
3709 ad_script_ancestry: None,
3710 }
3711 }
3712 pub fn filterlist_rule(&self) -> Option<&str> { self.filterlist_rule.as_deref() }
3714 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 pub fn filterlist_rule(mut self, filterlist_rule: impl Into<Cow<'a, str>>) -> Self { self.filterlist_rule = Some(filterlist_rule.into()); self }
3727 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 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 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 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 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#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
3995#[serde(rename_all = "camelCase")]
3996pub struct ReportingApiReport<'a> {
3997 id: ReportId<'a>,
3998 #[serde(rename = "initiatorUrl")]
4000 initiator_url: Cow<'a, str>,
4001 destination: Cow<'a, str>,
4003 #[serde(rename = "type")]
4005 type_: Cow<'a, str>,
4006 timestamp: crate::network::TimeSinceEpoch,
4008 depth: i64,
4010 #[serde(rename = "completedAttempts")]
4012 completed_attempts: i64,
4013 body: serde_json::Map<String, JsonValue>,
4014 status: ReportStatus,
4015}
4016
4017impl<'a> ReportingApiReport<'a> {
4018 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 pub fn initiator_url(&self) -> &str { self.initiator_url.as_ref() }
4044 pub fn destination(&self) -> &str { self.destination.as_ref() }
4046 pub fn type_(&self) -> &str { self.type_.as_ref() }
4048 pub fn timestamp(&self) -> &crate::network::TimeSinceEpoch { &self.timestamp }
4050 pub fn depth(&self) -> i64 { self.depth }
4052 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 url: Cow<'a, str>,
4093 #[serde(rename = "groupName")]
4095 group_name: Cow<'a, str>,
4096}
4097
4098impl<'a> ReportingApiEndpoint<'a> {
4099 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 pub fn url(&self) -> &str { self.url.as_ref() }
4110 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4132#[serde(rename_all = "camelCase")]
4133pub struct DeviceBoundSessionKey<'a> {
4134 site: Cow<'a, str>,
4136 id: Cow<'a, str>,
4138}
4139
4140impl<'a> DeviceBoundSessionKey<'a> {
4141 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 pub fn site(&self) -> &str { self.site.as_ref() }
4152 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4174#[serde(rename_all = "camelCase")]
4175pub struct DeviceBoundSessionWithUsage<'a> {
4176 #[serde(rename = "sessionKey")]
4178 session_key: DeviceBoundSessionKey<'a>,
4179 usage: Cow<'a, str>,
4181}
4182
4183impl<'a> DeviceBoundSessionWithUsage<'a> {
4184 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 pub fn session_key(&self) -> &DeviceBoundSessionKey<'a> { &self.session_key }
4195 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4217#[serde(rename_all = "camelCase")]
4218pub struct DeviceBoundSessionCookieCraving<'a> {
4219 name: Cow<'a, str>,
4221 domain: Cow<'a, str>,
4223 path: Cow<'a, str>,
4225 secure: bool,
4227 #[serde(rename = "httpOnly")]
4229 http_only: bool,
4230 #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
4232 same_site: Option<CookieSameSite>,
4233}
4234
4235impl<'a> DeviceBoundSessionCookieCraving<'a> {
4236 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 pub fn name(&self) -> &str { self.name.as_ref() }
4254 pub fn domain(&self) -> &str { self.domain.as_ref() }
4256 pub fn path(&self) -> &str { self.path.as_ref() }
4258 pub fn secure(&self) -> bool { self.secure }
4260 pub fn http_only(&self) -> bool { self.http_only }
4262 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4294#[serde(rename_all = "camelCase")]
4295pub struct DeviceBoundSessionUrlRule<'a> {
4296 #[serde(rename = "ruleType")]
4298 rule_type: Cow<'a, str>,
4299 #[serde(rename = "hostPattern")]
4301 host_pattern: Cow<'a, str>,
4302 #[serde(rename = "pathPrefix")]
4304 path_prefix: Cow<'a, str>,
4305}
4306
4307impl<'a> DeviceBoundSessionUrlRule<'a> {
4308 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 pub fn rule_type(&self) -> &str { self.rule_type.as_ref() }
4321 pub fn host_pattern(&self) -> &str { self.host_pattern.as_ref() }
4323 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4347#[serde(rename_all = "camelCase")]
4348pub struct DeviceBoundSessionInclusionRules<'a> {
4349 origin: Cow<'a, str>,
4351 #[serde(rename = "includeSite")]
4355 include_site: bool,
4356 #[serde(rename = "urlRules")]
4358 url_rules: Vec<DeviceBoundSessionUrlRule<'a>>,
4359}
4360
4361impl<'a> DeviceBoundSessionInclusionRules<'a> {
4362 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 pub fn origin(&self) -> &str { self.origin.as_ref() }
4375 pub fn include_site(&self) -> bool { self.include_site }
4379 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4403#[serde(rename_all = "camelCase")]
4404pub struct DeviceBoundSession<'a> {
4405 key: DeviceBoundSessionKey<'a>,
4407 #[serde(rename = "refreshUrl")]
4409 refresh_url: Cow<'a, str>,
4410 #[serde(rename = "inclusionRules")]
4412 inclusion_rules: DeviceBoundSessionInclusionRules<'a>,
4413 #[serde(rename = "cookieCravings")]
4415 cookie_cravings: Vec<DeviceBoundSessionCookieCraving<'a>>,
4416 #[serde(rename = "expiryDate")]
4418 expiry_date: crate::network::TimeSinceEpoch,
4419 #[serde(skip_serializing_if = "Option::is_none", rename = "cachedChallenge")]
4421 cached_challenge: Option<Cow<'a, str>>,
4422 #[serde(rename = "allowedRefreshInitiators")]
4424 allowed_refresh_initiators: Vec<Cow<'a, str>>,
4425}
4426
4427impl<'a> DeviceBoundSession<'a> {
4428 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 pub fn key(&self) -> &DeviceBoundSessionKey<'a> { &self.key }
4448 pub fn refresh_url(&self) -> &str { self.refresh_url.as_ref() }
4450 pub fn inclusion_rules(&self) -> &DeviceBoundSessionInclusionRules<'a> { &self.inclusion_rules }
4452 pub fn cookie_cravings(&self) -> &[DeviceBoundSessionCookieCraving<'a>] { &self.cookie_cravings }
4454 pub fn expiry_date(&self) -> &crate::network::TimeSinceEpoch { &self.expiry_date }
4456 pub fn cached_challenge(&self) -> Option<&str> { self.cached_challenge.as_deref() }
4458 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 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
4489pub type DeviceBoundSessionEventId<'a> = Cow<'a, str>;
4492
4493#[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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4641#[serde(rename_all = "camelCase")]
4642pub struct DeviceBoundSessionFailedRequest<'a> {
4643 #[serde(rename = "requestUrl")]
4645 request_url: Cow<'a, str>,
4646 #[serde(skip_serializing_if = "Option::is_none", rename = "netError")]
4648 net_error: Option<Cow<'a, str>>,
4649 #[serde(skip_serializing_if = "Option::is_none", rename = "responseError")]
4652 response_error: Option<i64>,
4653 #[serde(skip_serializing_if = "Option::is_none", rename = "responseErrorBody")]
4656 response_error_body: Option<Cow<'a, str>>,
4657}
4658
4659impl<'a> DeviceBoundSessionFailedRequest<'a> {
4660 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 pub fn request_url(&self) -> &str { self.request_url.as_ref() }
4672 pub fn net_error(&self) -> Option<&str> { self.net_error.as_deref() }
4674 pub fn response_error(&self) -> Option<i64> { self.response_error }
4677 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 pub fn net_error(mut self, net_error: impl Into<Cow<'a, str>>) -> Self { self.net_error = Some(net_error.into()); self }
4693 pub fn response_error(mut self, response_error: i64) -> Self { self.response_error = Some(response_error); self }
4696 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4712#[serde(rename_all = "camelCase")]
4713pub struct CreationEventDetails<'a> {
4714 #[serde(rename = "fetchResult")]
4716 fetch_result: DeviceBoundSessionFetchResult,
4717 #[serde(skip_serializing_if = "Option::is_none", rename = "newSession")]
4720 new_session: Option<DeviceBoundSession<'a>>,
4721 #[serde(skip_serializing_if = "Option::is_none", rename = "failedRequest")]
4724 failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4725}
4726
4727impl<'a> CreationEventDetails<'a> {
4728 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 pub fn fetch_result(&self) -> &DeviceBoundSessionFetchResult { &self.fetch_result }
4739 pub fn new_session(&self) -> Option<&DeviceBoundSession<'a>> { self.new_session.as_ref() }
4742 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 pub fn new_session(mut self, new_session: DeviceBoundSession<'a>) -> Self { self.new_session = Some(new_session); self }
4758 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4773#[serde(rename_all = "camelCase")]
4774pub struct RefreshEventDetails<'a> {
4775 #[serde(rename = "refreshResult")]
4777 refresh_result: Cow<'a, str>,
4778 #[serde(skip_serializing_if = "Option::is_none", rename = "fetchResult")]
4780 fetch_result: Option<DeviceBoundSessionFetchResult>,
4781 #[serde(skip_serializing_if = "Option::is_none", rename = "newSession")]
4784 new_session: Option<DeviceBoundSession<'a>>,
4785 #[serde(rename = "wasFullyProactiveRefresh")]
4787 was_fully_proactive_refresh: bool,
4788 #[serde(skip_serializing_if = "Option::is_none", rename = "failedRequest")]
4791 failed_request: Option<DeviceBoundSessionFailedRequest<'a>>,
4792}
4793
4794impl<'a> RefreshEventDetails<'a> {
4795 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 pub fn refresh_result(&self) -> &str { self.refresh_result.as_ref() }
4809 pub fn fetch_result(&self) -> Option<&DeviceBoundSessionFetchResult> { self.fetch_result.as_ref() }
4811 pub fn new_session(&self) -> Option<&DeviceBoundSession<'a>> { self.new_session.as_ref() }
4814 pub fn was_fully_proactive_refresh(&self) -> bool { self.was_fully_proactive_refresh }
4816 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 pub fn fetch_result(mut self, fetch_result: impl Into<DeviceBoundSessionFetchResult>) -> Self { self.fetch_result = Some(fetch_result.into()); self }
4833 pub fn new_session(mut self, new_session: DeviceBoundSession<'a>) -> Self { self.new_session = Some(new_session); self }
4836 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4853#[serde(rename_all = "camelCase")]
4854pub struct TerminationEventDetails<'a> {
4855 #[serde(rename = "deletionReason")]
4857 deletion_reason: Cow<'a, str>,
4858}
4859
4860impl<'a> TerminationEventDetails<'a> {
4861 pub fn builder(deletion_reason: impl Into<Cow<'a, str>>) -> TerminationEventDetailsBuilder<'a> {
4864 TerminationEventDetailsBuilder {
4865 deletion_reason: deletion_reason.into(),
4866 }
4867 }
4868 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4888#[serde(rename_all = "camelCase")]
4889pub struct ChallengeEventDetails<'a> {
4890 #[serde(rename = "challengeResult")]
4892 challenge_result: Cow<'a, str>,
4893 challenge: Cow<'a, str>,
4895}
4896
4897impl<'a> ChallengeEventDetails<'a> {
4898 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 pub fn challenge_result(&self) -> &str { self.challenge_result.as_ref() }
4909 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
4931#[serde(rename_all = "camelCase")]
4932pub struct LoadNetworkResourcePageResult<'a> {
4933 success: bool,
4934 #[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 #[serde(skip_serializing_if = "Option::is_none")]
4943 stream: Option<crate::io::StreamHandle<'a>>,
4944 #[serde(skip_serializing_if = "Option::is_none")]
4946 headers: Option<crate::network::Headers>,
4947}
4948
4949impl<'a> LoadNetworkResourcePageResult<'a> {
4950 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 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 pub fn stream(&self) -> Option<&crate::io::StreamHandle<'a>> { self.stream.as_ref() }
4969 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 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 pub fn stream(mut self, stream: crate::io::StreamHandle<'a>) -> Self { self.stream = Some(stream); self }
4990 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5048#[serde(rename_all = "camelCase")]
5049pub struct SetAcceptedEncodingsParams {
5050 encodings: Vec<ContentEncoding>,
5052}
5053
5054impl SetAcceptedEncodingsParams {
5055 pub fn builder(encodings: Vec<ContentEncoding>) -> SetAcceptedEncodingsParamsBuilder {
5058 SetAcceptedEncodingsParamsBuilder {
5059 encodings: encodings,
5060 }
5061 }
5062 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5099#[serde(rename_all = "camelCase")]
5100pub struct CanClearBrowserCacheReturns {
5101 result: bool,
5103}
5104
5105impl CanClearBrowserCacheReturns {
5106 pub fn builder(result: bool) -> CanClearBrowserCacheReturnsBuilder {
5109 CanClearBrowserCacheReturnsBuilder {
5110 result: result,
5111 }
5112 }
5113 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5143#[serde(rename_all = "camelCase")]
5144pub struct CanClearBrowserCookiesReturns {
5145 result: bool,
5147}
5148
5149impl CanClearBrowserCookiesReturns {
5150 pub fn builder(result: bool) -> CanClearBrowserCookiesReturnsBuilder {
5153 CanClearBrowserCookiesReturnsBuilder {
5154 result: result,
5155 }
5156 }
5157 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5187#[serde(rename_all = "camelCase")]
5188pub struct CanEmulateNetworkConditionsReturns {
5189 result: bool,
5191}
5192
5193impl CanEmulateNetworkConditionsReturns {
5194 pub fn builder(result: bool) -> CanEmulateNetworkConditionsReturnsBuilder {
5197 CanEmulateNetworkConditionsReturnsBuilder {
5198 result: result,
5199 }
5200 }
5201 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#[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 #[serde(skip_serializing_if = "Option::is_none", rename = "errorReason")]
5263 error_reason: Option<ErrorReason>,
5264 #[serde(skip_serializing_if = "Option::is_none", rename = "rawResponse")]
5267 raw_response: Option<Cow<'a, str>>,
5268 #[serde(skip_serializing_if = "Option::is_none")]
5271 url: Option<Cow<'a, str>>,
5272 #[serde(skip_serializing_if = "Option::is_none")]
5275 method: Option<Cow<'a, str>>,
5276 #[serde(skip_serializing_if = "Option::is_none", rename = "postData")]
5278 post_data: Option<Cow<'a, str>>,
5279 #[serde(skip_serializing_if = "Option::is_none")]
5282 headers: Option<Headers>,
5283 #[serde(skip_serializing_if = "Option::is_none", rename = "authChallengeResponse")]
5285 auth_challenge_response: Option<AuthChallengeResponse<'a>>,
5286}
5287
5288impl<'a> ContinueInterceptedRequestParams<'a> {
5289 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 pub fn error_reason(&self) -> Option<&ErrorReason> { self.error_reason.as_ref() }
5308 pub fn raw_response(&self) -> Option<&str> { self.raw_response.as_deref() }
5311 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
5314 pub fn method(&self) -> Option<&str> { self.method.as_deref() }
5317 pub fn post_data(&self) -> Option<&str> { self.post_data.as_deref() }
5319 pub fn headers(&self) -> Option<&Headers> { self.headers.as_ref() }
5322 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 pub fn error_reason(mut self, error_reason: impl Into<ErrorReason>) -> Self { self.error_reason = Some(error_reason.into()); self }
5343 pub fn raw_response(mut self, raw_response: impl Into<Cow<'a, str>>) -> Self { self.raw_response = Some(raw_response.into()); self }
5346 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
5349 pub fn method(mut self, method: impl Into<Cow<'a, str>>) -> Self { self.method = Some(method.into()); self }
5352 pub fn post_data(mut self, post_data: impl Into<Cow<'a, str>>) -> Self { self.post_data = Some(post_data.into()); self }
5354 pub fn headers(mut self, headers: Headers) -> Self { self.headers = Some(headers); self }
5357 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5383#[serde(rename_all = "camelCase")]
5384pub struct DeleteCookiesParams<'a> {
5385 name: Cow<'a, str>,
5387 #[serde(skip_serializing_if = "Option::is_none")]
5390 url: Option<Cow<'a, str>>,
5391 #[serde(skip_serializing_if = "Option::is_none")]
5393 domain: Option<Cow<'a, str>>,
5394 #[serde(skip_serializing_if = "Option::is_none")]
5396 path: Option<Cow<'a, str>>,
5397 #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
5400 partition_key: Option<CookiePartitionKey<'a>>,
5401}
5402
5403impl<'a> DeleteCookiesParams<'a> {
5404 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 pub fn name(&self) -> &str { self.name.as_ref() }
5417 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
5420 pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
5422 pub fn path(&self) -> Option<&str> { self.path.as_deref() }
5424 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 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
5442 pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
5444 pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
5446 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5481#[serde(rename_all = "camelCase")]
5482pub struct EmulateNetworkConditionsParams {
5483 offline: bool,
5485 latency: f64,
5487 #[serde(rename = "downloadThroughput")]
5489 download_throughput: f64,
5490 #[serde(rename = "uploadThroughput")]
5492 upload_throughput: f64,
5493 #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
5495 connection_type: Option<ConnectionType>,
5496 #[serde(skip_serializing_if = "Option::is_none", rename = "packetLoss")]
5498 packet_loss: Option<f64>,
5499 #[serde(skip_serializing_if = "Option::is_none", rename = "packetQueueLength")]
5501 packet_queue_length: Option<u64>,
5502 #[serde(skip_serializing_if = "Option::is_none", rename = "packetReordering")]
5504 packet_reordering: Option<bool>,
5505}
5506
5507impl EmulateNetworkConditionsParams {
5508 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 pub fn offline(&self) -> bool { self.offline }
5527 pub fn latency(&self) -> f64 { self.latency }
5529 pub fn download_throughput(&self) -> f64 { self.download_throughput }
5531 pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
5533 pub fn connection_type(&self) -> Option<&ConnectionType> { self.connection_type.as_ref() }
5535 pub fn packet_loss(&self) -> Option<f64> { self.packet_loss }
5537 pub fn packet_queue_length(&self) -> Option<u64> { self.packet_queue_length }
5539 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 pub fn connection_type(mut self, connection_type: impl Into<ConnectionType>) -> Self { self.connection_type = Some(connection_type.into()); self }
5558 pub fn packet_loss(mut self, packet_loss: f64) -> Self { self.packet_loss = Some(packet_loss); self }
5560 pub fn packet_queue_length(mut self, packet_queue_length: u64) -> Self { self.packet_queue_length = Some(packet_queue_length); self }
5562 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5590#[serde(rename_all = "camelCase")]
5591pub struct EmulateNetworkConditionsByRuleParams<'a> {
5592 #[serde(skip_serializing_if = "Option::is_none")]
5595 offline: Option<bool>,
5596 #[serde(skip_serializing_if = "Option::is_none", rename = "emulateOfflineServiceWorker")]
5598 emulate_offline_service_worker: Option<bool>,
5599 #[serde(rename = "matchedNetworkConditions")]
5603 matched_network_conditions: Vec<NetworkConditions<'a>>,
5604}
5605
5606impl<'a> EmulateNetworkConditionsByRuleParams<'a> {
5607 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 pub fn offline(&self) -> Option<bool> { self.offline }
5619 pub fn emulate_offline_service_worker(&self) -> Option<bool> { self.emulate_offline_service_worker }
5621 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 pub fn offline(mut self, offline: bool) -> Self { self.offline = Some(offline); self }
5638 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5654#[serde(rename_all = "camelCase")]
5655pub struct EmulateNetworkConditionsByRuleReturns<'a> {
5656 #[serde(rename = "ruleIds")]
5659 rule_ids: Vec<Cow<'a, str>>,
5660}
5661
5662impl<'a> EmulateNetworkConditionsByRuleReturns<'a> {
5663 pub fn builder(rule_ids: Vec<Cow<'a, str>>) -> EmulateNetworkConditionsByRuleReturnsBuilder<'a> {
5666 EmulateNetworkConditionsByRuleReturnsBuilder {
5667 rule_ids: rule_ids,
5668 }
5669 }
5670 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5698#[serde(rename_all = "camelCase")]
5699pub struct OverrideNetworkStateParams {
5700 offline: bool,
5702 latency: f64,
5704 #[serde(rename = "downloadThroughput")]
5706 download_throughput: f64,
5707 #[serde(rename = "uploadThroughput")]
5709 upload_throughput: f64,
5710 #[serde(skip_serializing_if = "Option::is_none", rename = "connectionType")]
5712 connection_type: Option<ConnectionType>,
5713}
5714
5715impl OverrideNetworkStateParams {
5716 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 pub fn offline(&self) -> bool { self.offline }
5732 pub fn latency(&self) -> f64 { self.latency }
5734 pub fn download_throughput(&self) -> f64 { self.download_throughput }
5736 pub fn upload_throughput(&self) -> f64 { self.upload_throughput }
5738 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5775#[serde(rename_all = "camelCase")]
5776pub struct EnableParams {
5777 #[serde(skip_serializing_if = "Option::is_none", rename = "maxTotalBufferSize")]
5781 max_total_buffer_size: Option<u64>,
5782 #[serde(skip_serializing_if = "Option::is_none", rename = "maxResourceBufferSize")]
5784 max_resource_buffer_size: Option<u64>,
5785 #[serde(skip_serializing_if = "Option::is_none", rename = "maxPostDataSize")]
5787 max_post_data_size: Option<u64>,
5788 #[serde(skip_serializing_if = "Option::is_none", rename = "reportDirectSocketTraffic")]
5790 report_direct_socket_traffic: Option<bool>,
5791 #[serde(skip_serializing_if = "Option::is_none", rename = "enableDurableMessages")]
5797 enable_durable_messages: Option<bool>,
5798}
5799
5800impl EnableParams {
5801 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 pub fn max_total_buffer_size(&self) -> Option<u64> { self.max_total_buffer_size }
5815 pub fn max_resource_buffer_size(&self) -> Option<u64> { self.max_resource_buffer_size }
5817 pub fn max_post_data_size(&self) -> Option<u64> { self.max_post_data_size }
5819 pub fn report_direct_socket_traffic(&self) -> Option<bool> { self.report_direct_socket_traffic }
5821 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 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 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 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 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5878#[serde(rename_all = "camelCase")]
5879pub struct ConfigureDurableMessagesParams {
5880 #[serde(skip_serializing_if = "Option::is_none", rename = "maxTotalBufferSize")]
5882 max_total_buffer_size: Option<u64>,
5883 #[serde(skip_serializing_if = "Option::is_none", rename = "maxResourceBufferSize")]
5885 max_resource_buffer_size: Option<u64>,
5886}
5887
5888impl ConfigureDurableMessagesParams {
5889 pub fn builder() -> ConfigureDurableMessagesParamsBuilder {
5891 ConfigureDurableMessagesParamsBuilder {
5892 max_total_buffer_size: None,
5893 max_resource_buffer_size: None,
5894 }
5895 }
5896 pub fn max_total_buffer_size(&self) -> Option<u64> { self.max_total_buffer_size }
5898 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 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5933#[serde(rename_all = "camelCase")]
5934pub struct GetAllCookiesReturns<'a> {
5935 cookies: Vec<Cookie<'a>>,
5937}
5938
5939impl<'a> GetAllCookiesReturns<'a> {
5940 pub fn builder(cookies: Vec<Cookie<'a>>) -> GetAllCookiesReturnsBuilder<'a> {
5943 GetAllCookiesReturnsBuilder {
5944 cookies: cookies,
5945 }
5946 }
5947 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5977#[serde(rename_all = "camelCase")]
5978pub struct GetCertificateParams<'a> {
5979 origin: Cow<'a, str>,
5981}
5982
5983impl<'a> GetCertificateParams<'a> {
5984 pub fn builder(origin: impl Into<Cow<'a, str>>) -> GetCertificateParamsBuilder<'a> {
5987 GetCertificateParamsBuilder {
5988 origin: origin.into(),
5989 }
5990 }
5991 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6052#[serde(rename_all = "camelCase")]
6053pub struct GetCookiesParams<'a> {
6054 #[serde(skip_serializing_if = "Option::is_none")]
6058 urls: Option<Vec<Cow<'a, str>>>,
6059}
6060
6061impl<'a> GetCookiesParams<'a> {
6062 pub fn builder() -> GetCookiesParamsBuilder<'a> {
6064 GetCookiesParamsBuilder {
6065 urls: None,
6066 }
6067 }
6068 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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6095#[serde(rename_all = "camelCase")]
6096pub struct GetCookiesReturns<'a> {
6097 cookies: Vec<Cookie<'a>>,
6099}
6100
6101impl<'a> GetCookiesReturns<'a> {
6102 pub fn builder(cookies: Vec<Cookie<'a>>) -> GetCookiesReturnsBuilder<'a> {
6105 GetCookiesReturnsBuilder {
6106 cookies: cookies,
6107 }
6108 }
6109 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6136#[serde(rename_all = "camelCase")]
6137pub struct GetResponseBodyParams<'a> {
6138 #[serde(rename = "requestId")]
6140 request_id: RequestId<'a>,
6141}
6142
6143impl<'a> GetResponseBodyParams<'a> {
6144 pub fn builder(request_id: impl Into<RequestId<'a>>) -> GetResponseBodyParamsBuilder<'a> {
6147 GetResponseBodyParamsBuilder {
6148 request_id: request_id.into(),
6149 }
6150 }
6151 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6171#[serde(rename_all = "camelCase")]
6172pub struct GetResponseBodyReturns<'a> {
6173 body: Cow<'a, str>,
6175 #[serde(rename = "base64Encoded")]
6177 base64_encoded: bool,
6178}
6179
6180impl<'a> GetResponseBodyReturns<'a> {
6181 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 pub fn body(&self) -> &str { self.body.as_ref() }
6192 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6221#[serde(rename_all = "camelCase")]
6222pub struct GetRequestPostDataParams<'a> {
6223 #[serde(rename = "requestId")]
6225 request_id: RequestId<'a>,
6226}
6227
6228impl<'a> GetRequestPostDataParams<'a> {
6229 pub fn builder(request_id: impl Into<RequestId<'a>>) -> GetRequestPostDataParamsBuilder<'a> {
6232 GetRequestPostDataParamsBuilder {
6233 request_id: request_id.into(),
6234 }
6235 }
6236 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6256#[serde(rename_all = "camelCase")]
6257pub struct GetRequestPostDataReturns<'a> {
6258 #[serde(rename = "postData")]
6260 post_data: Cow<'a, str>,
6261 #[serde(rename = "base64Encoded")]
6263 base64_encoded: bool,
6264}
6265
6266impl<'a> GetRequestPostDataReturns<'a> {
6267 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 pub fn post_data(&self) -> &str { self.post_data.as_ref() }
6278 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6307#[serde(rename_all = "camelCase")]
6308pub struct GetResponseBodyForInterceptionParams<'a> {
6309 #[serde(rename = "interceptionId")]
6311 interception_id: InterceptionId<'a>,
6312}
6313
6314impl<'a> GetResponseBodyForInterceptionParams<'a> {
6315 pub fn builder(interception_id: impl Into<InterceptionId<'a>>) -> GetResponseBodyForInterceptionParamsBuilder<'a> {
6318 GetResponseBodyForInterceptionParamsBuilder {
6319 interception_id: interception_id.into(),
6320 }
6321 }
6322 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6342#[serde(rename_all = "camelCase")]
6343pub struct GetResponseBodyForInterceptionReturns<'a> {
6344 body: Cow<'a, str>,
6346 #[serde(rename = "base64Encoded")]
6348 base64_encoded: bool,
6349}
6350
6351impl<'a> GetResponseBodyForInterceptionReturns<'a> {
6352 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 pub fn body(&self) -> &str { self.body.as_ref() }
6363 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#[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 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6472#[serde(rename_all = "camelCase")]
6473pub struct ReplayXHRParams<'a> {
6474 #[serde(rename = "requestId")]
6476 request_id: RequestId<'a>,
6477}
6478
6479impl<'a> ReplayXHRParams<'a> {
6480 pub fn builder(request_id: impl Into<RequestId<'a>>) -> ReplayXHRParamsBuilder<'a> {
6483 ReplayXHRParamsBuilder {
6484 request_id: request_id.into(),
6485 }
6486 }
6487 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6514#[serde(rename_all = "camelCase")]
6515pub struct SearchInResponseBodyParams<'a> {
6516 #[serde(rename = "requestId")]
6518 request_id: RequestId<'a>,
6519 query: Cow<'a, str>,
6521 #[serde(skip_serializing_if = "Option::is_none", rename = "caseSensitive")]
6523 case_sensitive: Option<bool>,
6524 #[serde(skip_serializing_if = "Option::is_none", rename = "isRegex")]
6526 is_regex: Option<bool>,
6527}
6528
6529impl<'a> SearchInResponseBodyParams<'a> {
6530 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 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
6543 pub fn query(&self) -> &str { self.query.as_ref() }
6545 pub fn case_sensitive(&self) -> Option<bool> { self.case_sensitive }
6547 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 pub fn case_sensitive(mut self, case_sensitive: bool) -> Self { self.case_sensitive = Some(case_sensitive); self }
6562 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6577#[serde(rename_all = "camelCase")]
6578pub struct SearchInResponseBodyReturns {
6579 result: Vec<crate::debugger::SearchMatch>,
6581}
6582
6583impl SearchInResponseBodyReturns {
6584 pub fn builder(result: Vec<crate::debugger::SearchMatch>) -> SearchInResponseBodyReturnsBuilder {
6587 SearchInResponseBodyReturnsBuilder {
6588 result: result,
6589 }
6590 }
6591 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6618#[serde(rename_all = "camelCase")]
6619pub struct SetBlockedURLsParams<'a> {
6620 #[serde(skip_serializing_if = "Option::is_none", rename = "urlPatterns")]
6623 url_patterns: Option<Vec<BlockPattern<'a>>>,
6624 #[serde(skip_serializing_if = "Option::is_none")]
6626 urls: Option<Vec<Cow<'a, str>>>,
6627}
6628
6629impl<'a> SetBlockedURLsParams<'a> {
6630 pub fn builder() -> SetBlockedURLsParamsBuilder<'a> {
6632 SetBlockedURLsParamsBuilder {
6633 url_patterns: None,
6634 urls: None,
6635 }
6636 }
6637 pub fn url_patterns(&self) -> Option<&[BlockPattern<'a>]> { self.url_patterns.as_deref() }
6640 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 pub fn url_patterns(mut self, url_patterns: Vec<BlockPattern<'a>>) -> Self { self.url_patterns = Some(url_patterns); self }
6654 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6674#[serde(rename_all = "camelCase")]
6675pub struct SetBypassServiceWorkerParams {
6676 bypass: bool,
6678}
6679
6680impl SetBypassServiceWorkerParams {
6681 pub fn builder(bypass: bool) -> SetBypassServiceWorkerParamsBuilder {
6684 SetBypassServiceWorkerParamsBuilder {
6685 bypass: bypass,
6686 }
6687 }
6688 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6715#[serde(rename_all = "camelCase")]
6716pub struct SetCacheDisabledParams {
6717 #[serde(rename = "cacheDisabled")]
6719 cache_disabled: bool,
6720}
6721
6722impl SetCacheDisabledParams {
6723 pub fn builder(cache_disabled: bool) -> SetCacheDisabledParamsBuilder {
6726 SetCacheDisabledParamsBuilder {
6727 cache_disabled: cache_disabled,
6728 }
6729 }
6730 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6757#[serde(rename_all = "camelCase")]
6758pub struct SetCookieParams<'a> {
6759 name: Cow<'a, str>,
6761 value: Cow<'a, str>,
6763 #[serde(skip_serializing_if = "Option::is_none")]
6766 url: Option<Cow<'a, str>>,
6767 #[serde(skip_serializing_if = "Option::is_none")]
6769 domain: Option<Cow<'a, str>>,
6770 #[serde(skip_serializing_if = "Option::is_none")]
6772 path: Option<Cow<'a, str>>,
6773 #[serde(skip_serializing_if = "Option::is_none")]
6775 secure: Option<bool>,
6776 #[serde(skip_serializing_if = "Option::is_none", rename = "httpOnly")]
6778 http_only: Option<bool>,
6779 #[serde(skip_serializing_if = "Option::is_none", rename = "sameSite")]
6781 same_site: Option<CookieSameSite>,
6782 #[serde(skip_serializing_if = "Option::is_none")]
6784 expires: Option<TimeSinceEpoch>,
6785 #[serde(skip_serializing_if = "Option::is_none")]
6787 priority: Option<CookiePriority>,
6788 #[serde(skip_serializing_if = "Option::is_none", rename = "sourceScheme")]
6790 source_scheme: Option<CookieSourceScheme>,
6791 #[serde(skip_serializing_if = "Option::is_none", rename = "sourcePort")]
6795 source_port: Option<i64>,
6796 #[serde(skip_serializing_if = "Option::is_none", rename = "partitionKey")]
6798 partition_key: Option<CookiePartitionKey<'a>>,
6799}
6800
6801impl<'a> SetCookieParams<'a> {
6802 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 pub fn name(&self) -> &str { self.name.as_ref() }
6824 pub fn value(&self) -> &str { self.value.as_ref() }
6826 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
6829 pub fn domain(&self) -> Option<&str> { self.domain.as_deref() }
6831 pub fn path(&self) -> Option<&str> { self.path.as_deref() }
6833 pub fn secure(&self) -> Option<bool> { self.secure }
6835 pub fn http_only(&self) -> Option<bool> { self.http_only }
6837 pub fn same_site(&self) -> Option<&CookieSameSite> { self.same_site.as_ref() }
6839 pub fn expires(&self) -> Option<&TimeSinceEpoch> { self.expires.as_ref() }
6841 pub fn priority(&self) -> Option<&CookiePriority> { self.priority.as_ref() }
6843 pub fn source_scheme(&self) -> Option<&CookieSourceScheme> { self.source_scheme.as_ref() }
6845 pub fn source_port(&self) -> Option<i64> { self.source_port }
6849 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 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
6874 pub fn domain(mut self, domain: impl Into<Cow<'a, str>>) -> Self { self.domain = Some(domain.into()); self }
6876 pub fn path(mut self, path: impl Into<Cow<'a, str>>) -> Self { self.path = Some(path.into()); self }
6878 pub fn secure(mut self, secure: bool) -> Self { self.secure = Some(secure); self }
6880 pub fn http_only(mut self, http_only: bool) -> Self { self.http_only = Some(http_only); self }
6882 pub fn same_site(mut self, same_site: impl Into<CookieSameSite>) -> Self { self.same_site = Some(same_site.into()); self }
6884 pub fn expires(mut self, expires: TimeSinceEpoch) -> Self { self.expires = Some(expires); self }
6886 pub fn priority(mut self, priority: impl Into<CookiePriority>) -> Self { self.priority = Some(priority.into()); self }
6888 pub fn source_scheme(mut self, source_scheme: impl Into<CookieSourceScheme>) -> Self { self.source_scheme = Some(source_scheme.into()); self }
6890 pub fn source_port(mut self, source_port: i64) -> Self { self.source_port = Some(source_port); self }
6894 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6918#[serde(rename_all = "camelCase")]
6919pub struct SetCookieReturns {
6920 success: bool,
6922}
6923
6924impl SetCookieReturns {
6925 pub fn builder(success: bool) -> SetCookieReturnsBuilder {
6928 SetCookieReturnsBuilder {
6929 success: success,
6930 }
6931 }
6932 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6959#[serde(rename_all = "camelCase")]
6960pub struct SetCookiesParams<'a> {
6961 cookies: Vec<CookieParam<'a>>,
6963}
6964
6965impl<'a> SetCookiesParams<'a> {
6966 pub fn builder(cookies: Vec<CookieParam<'a>>) -> SetCookiesParamsBuilder<'a> {
6969 SetCookiesParamsBuilder {
6970 cookies: cookies,
6971 }
6972 }
6973 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7000#[serde(rename_all = "camelCase")]
7001pub struct SetExtraHTTPHeadersParams {
7002 headers: Headers,
7004}
7005
7006impl SetExtraHTTPHeadersParams {
7007 pub fn builder(headers: Headers) -> SetExtraHTTPHeadersParamsBuilder {
7010 SetExtraHTTPHeadersParamsBuilder {
7011 headers: headers,
7012 }
7013 }
7014 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7041#[serde(rename_all = "camelCase")]
7042pub struct SetAttachDebugStackParams {
7043 enabled: bool,
7045}
7046
7047impl SetAttachDebugStackParams {
7048 pub fn builder(enabled: bool) -> SetAttachDebugStackParamsBuilder {
7051 SetAttachDebugStackParamsBuilder {
7052 enabled: enabled,
7053 }
7054 }
7055 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7083#[serde(rename_all = "camelCase")]
7084pub struct SetRequestInterceptionParams<'a> {
7085 patterns: Vec<RequestPattern<'a>>,
7088}
7089
7090impl<'a> SetRequestInterceptionParams<'a> {
7091 pub fn builder(patterns: Vec<RequestPattern<'a>>) -> SetRequestInterceptionParamsBuilder<'a> {
7094 SetRequestInterceptionParamsBuilder {
7095 patterns: patterns,
7096 }
7097 }
7098 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7126#[serde(rename_all = "camelCase")]
7127pub struct SetUserAgentOverrideParams<'a> {
7128 #[serde(rename = "userAgent")]
7130 user_agent: Cow<'a, str>,
7131 #[serde(skip_serializing_if = "Option::is_none", rename = "acceptLanguage")]
7133 accept_language: Option<Cow<'a, str>>,
7134 #[serde(skip_serializing_if = "Option::is_none")]
7136 platform: Option<Cow<'a, str>>,
7137 #[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 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 pub fn user_agent(&self) -> &str { self.user_agent.as_ref() }
7155 pub fn accept_language(&self) -> Option<&str> { self.accept_language.as_deref() }
7157 pub fn platform(&self) -> Option<&str> { self.platform.as_deref() }
7159 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 pub fn accept_language(mut self, accept_language: impl Into<Cow<'a, str>>) -> Self { self.accept_language = Some(accept_language.into()); self }
7174 pub fn platform(mut self, platform: impl Into<Cow<'a, str>>) -> Self { self.platform = Some(platform.into()); self }
7176 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7199#[serde(rename_all = "camelCase")]
7200pub struct StreamResourceContentParams<'a> {
7201 #[serde(rename = "requestId")]
7203 request_id: RequestId<'a>,
7204}
7205
7206impl<'a> StreamResourceContentParams<'a> {
7207 pub fn builder(request_id: impl Into<RequestId<'a>>) -> StreamResourceContentParamsBuilder<'a> {
7210 StreamResourceContentParamsBuilder {
7211 request_id: request_id.into(),
7212 }
7213 }
7214 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7235#[serde(rename_all = "camelCase")]
7236pub struct StreamResourceContentReturns<'a> {
7237 #[serde(rename = "bufferedData")]
7239 buffered_data: Cow<'a, str>,
7240}
7241
7242impl<'a> StreamResourceContentReturns<'a> {
7243 pub fn builder(buffered_data: impl Into<Cow<'a, str>>) -> StreamResourceContentReturnsBuilder<'a> {
7246 StreamResourceContentReturnsBuilder {
7247 buffered_data: buffered_data.into(),
7248 }
7249 }
7250 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7277#[serde(rename_all = "camelCase")]
7278pub struct GetSecurityIsolationStatusParams<'a> {
7279 #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
7281 frame_id: Option<crate::page::FrameId<'a>>,
7282}
7283
7284impl<'a> GetSecurityIsolationStatusParams<'a> {
7285 pub fn builder() -> GetSecurityIsolationStatusParamsBuilder<'a> {
7287 GetSecurityIsolationStatusParamsBuilder {
7288 frame_id: None,
7289 }
7290 }
7291 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 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7353#[serde(rename_all = "camelCase")]
7354pub struct EnableReportingApiParams {
7355 enable: bool,
7357}
7358
7359impl EnableReportingApiParams {
7360 pub fn builder(enable: bool) -> EnableReportingApiParamsBuilder {
7363 EnableReportingApiParamsBuilder {
7364 enable: enable,
7365 }
7366 }
7367 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7394#[serde(rename_all = "camelCase")]
7395pub struct EnableDeviceBoundSessionsParams {
7396 enable: bool,
7398}
7399
7400impl EnableDeviceBoundSessionsParams {
7401 pub fn builder(enable: bool) -> EnableDeviceBoundSessionsParamsBuilder {
7404 EnableDeviceBoundSessionsParamsBuilder {
7405 enable: enable,
7406 }
7407 }
7408 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7474#[serde(rename_all = "camelCase")]
7475pub struct FetchSchemefulSiteParams<'a> {
7476 origin: Cow<'a, str>,
7478}
7479
7480impl<'a> FetchSchemefulSiteParams<'a> {
7481 pub fn builder(origin: impl Into<Cow<'a, str>>) -> FetchSchemefulSiteParamsBuilder<'a> {
7484 FetchSchemefulSiteParamsBuilder {
7485 origin: origin.into(),
7486 }
7487 }
7488 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7508#[serde(rename_all = "camelCase")]
7509pub struct FetchSchemefulSiteReturns<'a> {
7510 #[serde(rename = "schemefulSite")]
7512 schemeful_site: Cow<'a, str>,
7513}
7514
7515impl<'a> FetchSchemefulSiteReturns<'a> {
7516 pub fn builder(schemeful_site: impl Into<Cow<'a, str>>) -> FetchSchemefulSiteReturnsBuilder<'a> {
7519 FetchSchemefulSiteReturnsBuilder {
7520 schemeful_site: schemeful_site.into(),
7521 }
7522 }
7523 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7550#[serde(rename_all = "camelCase")]
7551pub struct LoadNetworkResourceParams<'a> {
7552 #[serde(skip_serializing_if = "Option::is_none", rename = "frameId")]
7555 frame_id: Option<crate::page::FrameId<'a>>,
7556 url: Cow<'a, str>,
7558 options: LoadNetworkResourceOptions,
7560}
7561
7562impl<'a> LoadNetworkResourceParams<'a> {
7563 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 pub fn frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.frame_id.as_ref() }
7576 pub fn url(&self) -> &str { self.url.as_ref() }
7578 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 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#[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 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#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7645#[serde(rename_all = "camelCase")]
7646pub struct SetCookieControlsParams {
7647 #[serde(rename = "enableThirdPartyCookieRestriction")]
7649 enable_third_party_cookie_restriction: bool,
7650}
7651
7652impl SetCookieControlsParams {
7653 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 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}