1use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8pub type RequestId<'a> = Cow<'a, str>;
13
14#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
19pub enum RequestStage {
20 #[default]
21 #[serde(rename = "Request")]
22 Request,
23 #[serde(rename = "Response")]
24 Response,
25}
26
27
28#[derive(Debug, Clone, Serialize, Deserialize, Default)]
29#[serde(rename_all = "camelCase")]
30pub struct RequestPattern<'a> {
31 #[serde(skip_serializing_if = "Option::is_none", rename = "urlPattern")]
34 url_pattern: Option<Cow<'a, str>>,
35 #[serde(skip_serializing_if = "Option::is_none", rename = "resourceType")]
37 resource_type: Option<crate::network::ResourceType>,
38 #[serde(skip_serializing_if = "Option::is_none", rename = "requestStage")]
40 request_stage: Option<RequestStage>,
41}
42
43impl<'a> RequestPattern<'a> {
44 pub fn builder() -> RequestPatternBuilder<'a> {
46 RequestPatternBuilder {
47 url_pattern: None,
48 resource_type: None,
49 request_stage: None,
50 }
51 }
52 pub fn url_pattern(&self) -> Option<&str> { self.url_pattern.as_deref() }
55 pub fn resource_type(&self) -> Option<&crate::network::ResourceType> { self.resource_type.as_ref() }
57 pub fn request_stage(&self) -> Option<&RequestStage> { self.request_stage.as_ref() }
59}
60
61#[derive(Default)]
62pub struct RequestPatternBuilder<'a> {
63 url_pattern: Option<Cow<'a, str>>,
64 resource_type: Option<crate::network::ResourceType>,
65 request_stage: Option<RequestStage>,
66}
67
68impl<'a> RequestPatternBuilder<'a> {
69 pub fn url_pattern(mut self, url_pattern: impl Into<Cow<'a, str>>) -> Self { self.url_pattern = Some(url_pattern.into()); self }
72 pub fn resource_type(mut self, resource_type: crate::network::ResourceType) -> Self { self.resource_type = Some(resource_type); self }
74 pub fn request_stage(mut self, request_stage: impl Into<RequestStage>) -> Self { self.request_stage = Some(request_stage.into()); self }
76 pub fn build(self) -> RequestPattern<'a> {
77 RequestPattern {
78 url_pattern: self.url_pattern,
79 resource_type: self.resource_type,
80 request_stage: self.request_stage,
81 }
82 }
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize, Default)]
88#[serde(rename_all = "camelCase")]
89pub struct HeaderEntry<'a> {
90 name: Cow<'a, str>,
91 value: Cow<'a, str>,
92}
93
94impl<'a> HeaderEntry<'a> {
95 pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> HeaderEntryBuilder<'a> {
99 HeaderEntryBuilder {
100 name: name.into(),
101 value: value.into(),
102 }
103 }
104 pub fn name(&self) -> &str { self.name.as_ref() }
105 pub fn value(&self) -> &str { self.value.as_ref() }
106}
107
108
109pub struct HeaderEntryBuilder<'a> {
110 name: Cow<'a, str>,
111 value: Cow<'a, str>,
112}
113
114impl<'a> HeaderEntryBuilder<'a> {
115 pub fn build(self) -> HeaderEntry<'a> {
116 HeaderEntry {
117 name: self.name,
118 value: self.value,
119 }
120 }
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize, Default)]
126#[serde(rename_all = "camelCase")]
127pub struct AuthChallenge<'a> {
128 #[serde(skip_serializing_if = "Option::is_none")]
130 source: Option<Cow<'a, str>>,
131 origin: Cow<'a, str>,
133 scheme: Cow<'a, str>,
135 realm: Cow<'a, str>,
137}
138
139impl<'a> AuthChallenge<'a> {
140 pub fn builder(origin: impl Into<Cow<'a, str>>, scheme: impl Into<Cow<'a, str>>, realm: impl Into<Cow<'a, str>>) -> AuthChallengeBuilder<'a> {
145 AuthChallengeBuilder {
146 source: None,
147 origin: origin.into(),
148 scheme: scheme.into(),
149 realm: realm.into(),
150 }
151 }
152 pub fn source(&self) -> Option<&str> { self.source.as_deref() }
154 pub fn origin(&self) -> &str { self.origin.as_ref() }
156 pub fn scheme(&self) -> &str { self.scheme.as_ref() }
158 pub fn realm(&self) -> &str { self.realm.as_ref() }
160}
161
162
163pub struct AuthChallengeBuilder<'a> {
164 source: Option<Cow<'a, str>>,
165 origin: Cow<'a, str>,
166 scheme: Cow<'a, str>,
167 realm: Cow<'a, str>,
168}
169
170impl<'a> AuthChallengeBuilder<'a> {
171 pub fn source(mut self, source: impl Into<Cow<'a, str>>) -> Self { self.source = Some(source.into()); self }
173 pub fn build(self) -> AuthChallenge<'a> {
174 AuthChallenge {
175 source: self.source,
176 origin: self.origin,
177 scheme: self.scheme,
178 realm: self.realm,
179 }
180 }
181}
182
183#[derive(Debug, Clone, Serialize, Deserialize, Default)]
186#[serde(rename_all = "camelCase")]
187pub struct AuthChallengeResponse<'a> {
188 response: Cow<'a, str>,
192 #[serde(skip_serializing_if = "Option::is_none")]
195 username: Option<Cow<'a, str>>,
196 #[serde(skip_serializing_if = "Option::is_none")]
199 password: Option<Cow<'a, str>>,
200}
201
202impl<'a> AuthChallengeResponse<'a> {
203 pub fn builder(response: impl Into<Cow<'a, str>>) -> AuthChallengeResponseBuilder<'a> {
206 AuthChallengeResponseBuilder {
207 response: response.into(),
208 username: None,
209 password: None,
210 }
211 }
212 pub fn response(&self) -> &str { self.response.as_ref() }
216 pub fn username(&self) -> Option<&str> { self.username.as_deref() }
219 pub fn password(&self) -> Option<&str> { self.password.as_deref() }
222}
223
224
225pub struct AuthChallengeResponseBuilder<'a> {
226 response: Cow<'a, str>,
227 username: Option<Cow<'a, str>>,
228 password: Option<Cow<'a, str>>,
229}
230
231impl<'a> AuthChallengeResponseBuilder<'a> {
232 pub fn username(mut self, username: impl Into<Cow<'a, str>>) -> Self { self.username = Some(username.into()); self }
235 pub fn password(mut self, password: impl Into<Cow<'a, str>>) -> Self { self.password = Some(password.into()); self }
238 pub fn build(self) -> AuthChallengeResponse<'a> {
239 AuthChallengeResponse {
240 response: self.response,
241 username: self.username,
242 password: self.password,
243 }
244 }
245}
246
247#[derive(Debug, Clone, Serialize, Deserialize, Default)]
248pub struct DisableParams {}
249
250impl DisableParams { pub const METHOD: &'static str = "Fetch.disable"; }
251
252impl<'a> crate::CdpCommand<'a> for DisableParams {
253 const METHOD: &'static str = "Fetch.disable";
254 type Response = crate::EmptyReturns;
255}
256
257#[derive(Debug, Clone, Serialize, Deserialize, Default)]
261#[serde(rename_all = "camelCase")]
262pub struct EnableParams<'a> {
263 #[serde(skip_serializing_if = "Option::is_none")]
267 patterns: Option<Vec<RequestPattern<'a>>>,
268 #[serde(skip_serializing_if = "Option::is_none", rename = "handleAuthRequests")]
271 handle_auth_requests: Option<bool>,
272}
273
274impl<'a> EnableParams<'a> {
275 pub fn builder() -> EnableParamsBuilder<'a> {
277 EnableParamsBuilder {
278 patterns: None,
279 handle_auth_requests: None,
280 }
281 }
282 pub fn patterns(&self) -> Option<&[RequestPattern<'a>]> { self.patterns.as_deref() }
286 pub fn handle_auth_requests(&self) -> Option<bool> { self.handle_auth_requests }
289}
290
291#[derive(Default)]
292pub struct EnableParamsBuilder<'a> {
293 patterns: Option<Vec<RequestPattern<'a>>>,
294 handle_auth_requests: Option<bool>,
295}
296
297impl<'a> EnableParamsBuilder<'a> {
298 pub fn patterns(mut self, patterns: Vec<RequestPattern<'a>>) -> Self { self.patterns = Some(patterns); self }
302 pub fn handle_auth_requests(mut self, handle_auth_requests: bool) -> Self { self.handle_auth_requests = Some(handle_auth_requests); self }
305 pub fn build(self) -> EnableParams<'a> {
306 EnableParams {
307 patterns: self.patterns,
308 handle_auth_requests: self.handle_auth_requests,
309 }
310 }
311}
312
313impl<'a> EnableParams<'a> { pub const METHOD: &'static str = "Fetch.enable"; }
314
315impl<'a> crate::CdpCommand<'a> for EnableParams<'a> {
316 const METHOD: &'static str = "Fetch.enable";
317 type Response = crate::EmptyReturns;
318}
319
320#[derive(Debug, Clone, Serialize, Deserialize, Default)]
323#[serde(rename_all = "camelCase")]
324pub struct FailRequestParams<'a> {
325 #[serde(rename = "requestId")]
327 request_id: RequestId<'a>,
328 #[serde(rename = "errorReason")]
330 error_reason: crate::network::ErrorReason,
331}
332
333impl<'a> FailRequestParams<'a> {
334 pub fn builder(request_id: impl Into<RequestId<'a>>, error_reason: crate::network::ErrorReason) -> FailRequestParamsBuilder<'a> {
338 FailRequestParamsBuilder {
339 request_id: request_id.into(),
340 error_reason: error_reason,
341 }
342 }
343 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
345 pub fn error_reason(&self) -> &crate::network::ErrorReason { &self.error_reason }
347}
348
349
350pub struct FailRequestParamsBuilder<'a> {
351 request_id: RequestId<'a>,
352 error_reason: crate::network::ErrorReason,
353}
354
355impl<'a> FailRequestParamsBuilder<'a> {
356 pub fn build(self) -> FailRequestParams<'a> {
357 FailRequestParams {
358 request_id: self.request_id,
359 error_reason: self.error_reason,
360 }
361 }
362}
363
364impl<'a> FailRequestParams<'a> { pub const METHOD: &'static str = "Fetch.failRequest"; }
365
366impl<'a> crate::CdpCommand<'a> for FailRequestParams<'a> {
367 const METHOD: &'static str = "Fetch.failRequest";
368 type Response = crate::EmptyReturns;
369}
370
371#[derive(Debug, Clone, Serialize, Deserialize, Default)]
374#[serde(rename_all = "camelCase")]
375pub struct FulfillRequestParams<'a> {
376 #[serde(rename = "requestId")]
378 request_id: RequestId<'a>,
379 #[serde(rename = "responseCode")]
381 response_code: i64,
382 #[serde(skip_serializing_if = "Option::is_none", rename = "responseHeaders")]
384 response_headers: Option<Vec<HeaderEntry<'a>>>,
385 #[serde(skip_serializing_if = "Option::is_none", rename = "binaryResponseHeaders")]
390 binary_response_headers: Option<Cow<'a, str>>,
391 #[serde(skip_serializing_if = "Option::is_none")]
395 body: Option<Cow<'a, str>>,
396 #[serde(skip_serializing_if = "Option::is_none", rename = "responsePhrase")]
399 response_phrase: Option<Cow<'a, str>>,
400}
401
402impl<'a> FulfillRequestParams<'a> {
403 pub fn builder(request_id: impl Into<RequestId<'a>>, response_code: i64) -> FulfillRequestParamsBuilder<'a> {
407 FulfillRequestParamsBuilder {
408 request_id: request_id.into(),
409 response_code: response_code,
410 response_headers: None,
411 binary_response_headers: None,
412 body: None,
413 response_phrase: None,
414 }
415 }
416 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
418 pub fn response_code(&self) -> i64 { self.response_code }
420 pub fn response_headers(&self) -> Option<&[HeaderEntry<'a>]> { self.response_headers.as_deref() }
422 pub fn binary_response_headers(&self) -> Option<&str> { self.binary_response_headers.as_deref() }
427 pub fn body(&self) -> Option<&str> { self.body.as_deref() }
431 pub fn response_phrase(&self) -> Option<&str> { self.response_phrase.as_deref() }
434}
435
436
437pub struct FulfillRequestParamsBuilder<'a> {
438 request_id: RequestId<'a>,
439 response_code: i64,
440 response_headers: Option<Vec<HeaderEntry<'a>>>,
441 binary_response_headers: Option<Cow<'a, str>>,
442 body: Option<Cow<'a, str>>,
443 response_phrase: Option<Cow<'a, str>>,
444}
445
446impl<'a> FulfillRequestParamsBuilder<'a> {
447 pub fn response_headers(mut self, response_headers: Vec<HeaderEntry<'a>>) -> Self { self.response_headers = Some(response_headers); self }
449 pub fn binary_response_headers(mut self, binary_response_headers: impl Into<Cow<'a, str>>) -> Self { self.binary_response_headers = Some(binary_response_headers.into()); self }
454 pub fn body(mut self, body: impl Into<Cow<'a, str>>) -> Self { self.body = Some(body.into()); self }
458 pub fn response_phrase(mut self, response_phrase: impl Into<Cow<'a, str>>) -> Self { self.response_phrase = Some(response_phrase.into()); self }
461 pub fn build(self) -> FulfillRequestParams<'a> {
462 FulfillRequestParams {
463 request_id: self.request_id,
464 response_code: self.response_code,
465 response_headers: self.response_headers,
466 binary_response_headers: self.binary_response_headers,
467 body: self.body,
468 response_phrase: self.response_phrase,
469 }
470 }
471}
472
473impl<'a> FulfillRequestParams<'a> { pub const METHOD: &'static str = "Fetch.fulfillRequest"; }
474
475impl<'a> crate::CdpCommand<'a> for FulfillRequestParams<'a> {
476 const METHOD: &'static str = "Fetch.fulfillRequest";
477 type Response = crate::EmptyReturns;
478}
479
480#[derive(Debug, Clone, Serialize, Deserialize, Default)]
483#[serde(rename_all = "camelCase")]
484pub struct ContinueRequestParams<'a> {
485 #[serde(rename = "requestId")]
487 request_id: RequestId<'a>,
488 #[serde(skip_serializing_if = "Option::is_none")]
490 url: Option<Cow<'a, str>>,
491 #[serde(skip_serializing_if = "Option::is_none")]
493 method: Option<Cow<'a, str>>,
494 #[serde(skip_serializing_if = "Option::is_none", rename = "postData")]
496 post_data: Option<Cow<'a, str>>,
497 #[serde(skip_serializing_if = "Option::is_none")]
501 headers: Option<Vec<HeaderEntry<'a>>>,
502 #[serde(skip_serializing_if = "Option::is_none", rename = "interceptResponse")]
504 intercept_response: Option<bool>,
505}
506
507impl<'a> ContinueRequestParams<'a> {
508 pub fn builder(request_id: impl Into<RequestId<'a>>) -> ContinueRequestParamsBuilder<'a> {
511 ContinueRequestParamsBuilder {
512 request_id: request_id.into(),
513 url: None,
514 method: None,
515 post_data: None,
516 headers: None,
517 intercept_response: None,
518 }
519 }
520 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
522 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
524 pub fn method(&self) -> Option<&str> { self.method.as_deref() }
526 pub fn post_data(&self) -> Option<&str> { self.post_data.as_deref() }
528 pub fn headers(&self) -> Option<&[HeaderEntry<'a>]> { self.headers.as_deref() }
532 pub fn intercept_response(&self) -> Option<bool> { self.intercept_response }
534}
535
536
537pub struct ContinueRequestParamsBuilder<'a> {
538 request_id: RequestId<'a>,
539 url: Option<Cow<'a, str>>,
540 method: Option<Cow<'a, str>>,
541 post_data: Option<Cow<'a, str>>,
542 headers: Option<Vec<HeaderEntry<'a>>>,
543 intercept_response: Option<bool>,
544}
545
546impl<'a> ContinueRequestParamsBuilder<'a> {
547 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
549 pub fn method(mut self, method: impl Into<Cow<'a, str>>) -> Self { self.method = Some(method.into()); self }
551 pub fn post_data(mut self, post_data: impl Into<Cow<'a, str>>) -> Self { self.post_data = Some(post_data.into()); self }
553 pub fn headers(mut self, headers: Vec<HeaderEntry<'a>>) -> Self { self.headers = Some(headers); self }
557 pub fn intercept_response(mut self, intercept_response: bool) -> Self { self.intercept_response = Some(intercept_response); self }
559 pub fn build(self) -> ContinueRequestParams<'a> {
560 ContinueRequestParams {
561 request_id: self.request_id,
562 url: self.url,
563 method: self.method,
564 post_data: self.post_data,
565 headers: self.headers,
566 intercept_response: self.intercept_response,
567 }
568 }
569}
570
571impl<'a> ContinueRequestParams<'a> { pub const METHOD: &'static str = "Fetch.continueRequest"; }
572
573impl<'a> crate::CdpCommand<'a> for ContinueRequestParams<'a> {
574 const METHOD: &'static str = "Fetch.continueRequest";
575 type Response = crate::EmptyReturns;
576}
577
578#[derive(Debug, Clone, Serialize, Deserialize, Default)]
581#[serde(rename_all = "camelCase")]
582pub struct ContinueWithAuthParams<'a> {
583 #[serde(rename = "requestId")]
585 request_id: RequestId<'a>,
586 #[serde(rename = "authChallengeResponse")]
588 auth_challenge_response: AuthChallengeResponse<'a>,
589}
590
591impl<'a> ContinueWithAuthParams<'a> {
592 pub fn builder(request_id: impl Into<RequestId<'a>>, auth_challenge_response: AuthChallengeResponse<'a>) -> ContinueWithAuthParamsBuilder<'a> {
596 ContinueWithAuthParamsBuilder {
597 request_id: request_id.into(),
598 auth_challenge_response: auth_challenge_response,
599 }
600 }
601 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
603 pub fn auth_challenge_response(&self) -> &AuthChallengeResponse<'a> { &self.auth_challenge_response }
605}
606
607
608pub struct ContinueWithAuthParamsBuilder<'a> {
609 request_id: RequestId<'a>,
610 auth_challenge_response: AuthChallengeResponse<'a>,
611}
612
613impl<'a> ContinueWithAuthParamsBuilder<'a> {
614 pub fn build(self) -> ContinueWithAuthParams<'a> {
615 ContinueWithAuthParams {
616 request_id: self.request_id,
617 auth_challenge_response: self.auth_challenge_response,
618 }
619 }
620}
621
622impl<'a> ContinueWithAuthParams<'a> { pub const METHOD: &'static str = "Fetch.continueWithAuth"; }
623
624impl<'a> crate::CdpCommand<'a> for ContinueWithAuthParams<'a> {
625 const METHOD: &'static str = "Fetch.continueWithAuth";
626 type Response = crate::EmptyReturns;
627}
628
629#[derive(Debug, Clone, Serialize, Deserialize, Default)]
634#[serde(rename_all = "camelCase")]
635pub struct ContinueResponseParams<'a> {
636 #[serde(rename = "requestId")]
638 request_id: RequestId<'a>,
639 #[serde(skip_serializing_if = "Option::is_none", rename = "responseCode")]
641 response_code: Option<i64>,
642 #[serde(skip_serializing_if = "Option::is_none", rename = "responsePhrase")]
645 response_phrase: Option<Cow<'a, str>>,
646 #[serde(skip_serializing_if = "Option::is_none", rename = "responseHeaders")]
648 response_headers: Option<Vec<HeaderEntry<'a>>>,
649 #[serde(skip_serializing_if = "Option::is_none", rename = "binaryResponseHeaders")]
654 binary_response_headers: Option<Cow<'a, str>>,
655}
656
657impl<'a> ContinueResponseParams<'a> {
658 pub fn builder(request_id: impl Into<RequestId<'a>>) -> ContinueResponseParamsBuilder<'a> {
661 ContinueResponseParamsBuilder {
662 request_id: request_id.into(),
663 response_code: None,
664 response_phrase: None,
665 response_headers: None,
666 binary_response_headers: None,
667 }
668 }
669 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
671 pub fn response_code(&self) -> Option<i64> { self.response_code }
673 pub fn response_phrase(&self) -> Option<&str> { self.response_phrase.as_deref() }
676 pub fn response_headers(&self) -> Option<&[HeaderEntry<'a>]> { self.response_headers.as_deref() }
678 pub fn binary_response_headers(&self) -> Option<&str> { self.binary_response_headers.as_deref() }
683}
684
685
686pub struct ContinueResponseParamsBuilder<'a> {
687 request_id: RequestId<'a>,
688 response_code: Option<i64>,
689 response_phrase: Option<Cow<'a, str>>,
690 response_headers: Option<Vec<HeaderEntry<'a>>>,
691 binary_response_headers: Option<Cow<'a, str>>,
692}
693
694impl<'a> ContinueResponseParamsBuilder<'a> {
695 pub fn response_code(mut self, response_code: i64) -> Self { self.response_code = Some(response_code); self }
697 pub fn response_phrase(mut self, response_phrase: impl Into<Cow<'a, str>>) -> Self { self.response_phrase = Some(response_phrase.into()); self }
700 pub fn response_headers(mut self, response_headers: Vec<HeaderEntry<'a>>) -> Self { self.response_headers = Some(response_headers); self }
702 pub fn binary_response_headers(mut self, binary_response_headers: impl Into<Cow<'a, str>>) -> Self { self.binary_response_headers = Some(binary_response_headers.into()); self }
707 pub fn build(self) -> ContinueResponseParams<'a> {
708 ContinueResponseParams {
709 request_id: self.request_id,
710 response_code: self.response_code,
711 response_phrase: self.response_phrase,
712 response_headers: self.response_headers,
713 binary_response_headers: self.binary_response_headers,
714 }
715 }
716}
717
718impl<'a> ContinueResponseParams<'a> { pub const METHOD: &'static str = "Fetch.continueResponse"; }
719
720impl<'a> crate::CdpCommand<'a> for ContinueResponseParams<'a> {
721 const METHOD: &'static str = "Fetch.continueResponse";
722 type Response = crate::EmptyReturns;
723}
724
725#[derive(Debug, Clone, Serialize, Deserialize, Default)]
737#[serde(rename_all = "camelCase")]
738pub struct GetResponseBodyParams<'a> {
739 #[serde(rename = "requestId")]
741 request_id: RequestId<'a>,
742}
743
744impl<'a> GetResponseBodyParams<'a> {
745 pub fn builder(request_id: impl Into<RequestId<'a>>) -> GetResponseBodyParamsBuilder<'a> {
748 GetResponseBodyParamsBuilder {
749 request_id: request_id.into(),
750 }
751 }
752 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
754}
755
756
757pub struct GetResponseBodyParamsBuilder<'a> {
758 request_id: RequestId<'a>,
759}
760
761impl<'a> GetResponseBodyParamsBuilder<'a> {
762 pub fn build(self) -> GetResponseBodyParams<'a> {
763 GetResponseBodyParams {
764 request_id: self.request_id,
765 }
766 }
767}
768
769#[derive(Debug, Clone, Serialize, Deserialize, Default)]
781#[serde(rename_all = "camelCase")]
782pub struct GetResponseBodyReturns<'a> {
783 body: Cow<'a, str>,
785 #[serde(rename = "base64Encoded")]
787 base64_encoded: bool,
788}
789
790impl<'a> GetResponseBodyReturns<'a> {
791 pub fn builder(body: impl Into<Cow<'a, str>>, base64_encoded: bool) -> GetResponseBodyReturnsBuilder<'a> {
795 GetResponseBodyReturnsBuilder {
796 body: body.into(),
797 base64_encoded: base64_encoded,
798 }
799 }
800 pub fn body(&self) -> &str { self.body.as_ref() }
802 pub fn base64_encoded(&self) -> bool { self.base64_encoded }
804}
805
806
807pub struct GetResponseBodyReturnsBuilder<'a> {
808 body: Cow<'a, str>,
809 base64_encoded: bool,
810}
811
812impl<'a> GetResponseBodyReturnsBuilder<'a> {
813 pub fn build(self) -> GetResponseBodyReturns<'a> {
814 GetResponseBodyReturns {
815 body: self.body,
816 base64_encoded: self.base64_encoded,
817 }
818 }
819}
820
821impl<'a> GetResponseBodyParams<'a> { pub const METHOD: &'static str = "Fetch.getResponseBody"; }
822
823impl<'a> crate::CdpCommand<'a> for GetResponseBodyParams<'a> {
824 const METHOD: &'static str = "Fetch.getResponseBody";
825 type Response = GetResponseBodyReturns<'a>;
826}
827
828#[derive(Debug, Clone, Serialize, Deserialize, Default)]
840#[serde(rename_all = "camelCase")]
841pub struct TakeResponseBodyAsStreamParams<'a> {
842 #[serde(rename = "requestId")]
843 request_id: RequestId<'a>,
844}
845
846impl<'a> TakeResponseBodyAsStreamParams<'a> {
847 pub fn builder(request_id: impl Into<RequestId<'a>>) -> TakeResponseBodyAsStreamParamsBuilder<'a> {
850 TakeResponseBodyAsStreamParamsBuilder {
851 request_id: request_id.into(),
852 }
853 }
854 pub fn request_id(&self) -> &RequestId<'a> { &self.request_id }
855}
856
857
858pub struct TakeResponseBodyAsStreamParamsBuilder<'a> {
859 request_id: RequestId<'a>,
860}
861
862impl<'a> TakeResponseBodyAsStreamParamsBuilder<'a> {
863 pub fn build(self) -> TakeResponseBodyAsStreamParams<'a> {
864 TakeResponseBodyAsStreamParams {
865 request_id: self.request_id,
866 }
867 }
868}
869
870#[derive(Debug, Clone, Serialize, Deserialize, Default)]
882#[serde(rename_all = "camelCase")]
883pub struct TakeResponseBodyAsStreamReturns<'a> {
884 stream: crate::io::StreamHandle<'a>,
885}
886
887impl<'a> TakeResponseBodyAsStreamReturns<'a> {
888 pub fn builder(stream: crate::io::StreamHandle<'a>) -> TakeResponseBodyAsStreamReturnsBuilder<'a> {
891 TakeResponseBodyAsStreamReturnsBuilder {
892 stream: stream,
893 }
894 }
895 pub fn stream(&self) -> &crate::io::StreamHandle<'a> { &self.stream }
896}
897
898
899pub struct TakeResponseBodyAsStreamReturnsBuilder<'a> {
900 stream: crate::io::StreamHandle<'a>,
901}
902
903impl<'a> TakeResponseBodyAsStreamReturnsBuilder<'a> {
904 pub fn build(self) -> TakeResponseBodyAsStreamReturns<'a> {
905 TakeResponseBodyAsStreamReturns {
906 stream: self.stream,
907 }
908 }
909}
910
911impl<'a> TakeResponseBodyAsStreamParams<'a> { pub const METHOD: &'static str = "Fetch.takeResponseBodyAsStream"; }
912
913impl<'a> crate::CdpCommand<'a> for TakeResponseBodyAsStreamParams<'a> {
914 const METHOD: &'static str = "Fetch.takeResponseBodyAsStream";
915 type Response = TakeResponseBodyAsStreamReturns<'a>;
916}