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")]
34 urlPattern: Option<Cow<'a, str>>,
35 #[serde(skip_serializing_if = "Option::is_none")]
37 resourceType: Option<crate::network::ResourceType>,
38 #[serde(skip_serializing_if = "Option::is_none")]
40 requestStage: Option<RequestStage>,
41}
42
43impl<'a> RequestPattern<'a> {
44 pub fn builder() -> RequestPatternBuilder<'a> {
45 RequestPatternBuilder {
46 urlPattern: None,
47 resourceType: None,
48 requestStage: None,
49 }
50 }
51 pub fn urlPattern(&self) -> Option<&str> { self.urlPattern.as_deref() }
52 pub fn resourceType(&self) -> Option<&crate::network::ResourceType> { self.resourceType.as_ref() }
53 pub fn requestStage(&self) -> Option<&RequestStage> { self.requestStage.as_ref() }
54}
55
56#[derive(Default)]
57pub struct RequestPatternBuilder<'a> {
58 urlPattern: Option<Cow<'a, str>>,
59 resourceType: Option<crate::network::ResourceType>,
60 requestStage: Option<RequestStage>,
61}
62
63impl<'a> RequestPatternBuilder<'a> {
64 pub fn urlPattern(mut self, urlPattern: impl Into<Cow<'a, str>>) -> Self { self.urlPattern = Some(urlPattern.into()); self }
67 pub fn resourceType(mut self, resourceType: crate::network::ResourceType) -> Self { self.resourceType = Some(resourceType); self }
69 pub fn requestStage(mut self, requestStage: RequestStage) -> Self { self.requestStage = Some(requestStage); self }
71 pub fn build(self) -> RequestPattern<'a> {
72 RequestPattern {
73 urlPattern: self.urlPattern,
74 resourceType: self.resourceType,
75 requestStage: self.requestStage,
76 }
77 }
78}
79
80#[derive(Debug, Clone, Serialize, Deserialize, Default)]
83#[serde(rename_all = "camelCase")]
84pub struct HeaderEntry<'a> {
85 name: Cow<'a, str>,
86 value: Cow<'a, str>,
87}
88
89impl<'a> HeaderEntry<'a> {
90 pub fn builder(name: impl Into<Cow<'a, str>>, value: impl Into<Cow<'a, str>>) -> HeaderEntryBuilder<'a> {
91 HeaderEntryBuilder {
92 name: name.into(),
93 value: value.into(),
94 }
95 }
96 pub fn name(&self) -> &str { self.name.as_ref() }
97 pub fn value(&self) -> &str { self.value.as_ref() }
98}
99
100
101pub struct HeaderEntryBuilder<'a> {
102 name: Cow<'a, str>,
103 value: Cow<'a, str>,
104}
105
106impl<'a> HeaderEntryBuilder<'a> {
107 pub fn build(self) -> HeaderEntry<'a> {
108 HeaderEntry {
109 name: self.name,
110 value: self.value,
111 }
112 }
113}
114
115#[derive(Debug, Clone, Serialize, Deserialize, Default)]
118#[serde(rename_all = "camelCase")]
119pub struct AuthChallenge<'a> {
120 #[serde(skip_serializing_if = "Option::is_none")]
122 source: Option<Cow<'a, str>>,
123 origin: Cow<'a, str>,
125 scheme: Cow<'a, str>,
127 realm: Cow<'a, str>,
129}
130
131impl<'a> AuthChallenge<'a> {
132 pub fn builder(origin: impl Into<Cow<'a, str>>, scheme: impl Into<Cow<'a, str>>, realm: impl Into<Cow<'a, str>>) -> AuthChallengeBuilder<'a> {
133 AuthChallengeBuilder {
134 source: None,
135 origin: origin.into(),
136 scheme: scheme.into(),
137 realm: realm.into(),
138 }
139 }
140 pub fn source(&self) -> Option<&str> { self.source.as_deref() }
141 pub fn origin(&self) -> &str { self.origin.as_ref() }
142 pub fn scheme(&self) -> &str { self.scheme.as_ref() }
143 pub fn realm(&self) -> &str { self.realm.as_ref() }
144}
145
146
147pub struct AuthChallengeBuilder<'a> {
148 source: Option<Cow<'a, str>>,
149 origin: Cow<'a, str>,
150 scheme: Cow<'a, str>,
151 realm: Cow<'a, str>,
152}
153
154impl<'a> AuthChallengeBuilder<'a> {
155 pub fn source(mut self, source: impl Into<Cow<'a, str>>) -> Self { self.source = Some(source.into()); self }
157 pub fn build(self) -> AuthChallenge<'a> {
158 AuthChallenge {
159 source: self.source,
160 origin: self.origin,
161 scheme: self.scheme,
162 realm: self.realm,
163 }
164 }
165}
166
167#[derive(Debug, Clone, Serialize, Deserialize, Default)]
170#[serde(rename_all = "camelCase")]
171pub struct AuthChallengeResponse<'a> {
172 response: Cow<'a, str>,
176 #[serde(skip_serializing_if = "Option::is_none")]
179 username: Option<Cow<'a, str>>,
180 #[serde(skip_serializing_if = "Option::is_none")]
183 password: Option<Cow<'a, str>>,
184}
185
186impl<'a> AuthChallengeResponse<'a> {
187 pub fn builder(response: impl Into<Cow<'a, str>>) -> AuthChallengeResponseBuilder<'a> {
188 AuthChallengeResponseBuilder {
189 response: response.into(),
190 username: None,
191 password: None,
192 }
193 }
194 pub fn response(&self) -> &str { self.response.as_ref() }
195 pub fn username(&self) -> Option<&str> { self.username.as_deref() }
196 pub fn password(&self) -> Option<&str> { self.password.as_deref() }
197}
198
199
200pub struct AuthChallengeResponseBuilder<'a> {
201 response: Cow<'a, str>,
202 username: Option<Cow<'a, str>>,
203 password: Option<Cow<'a, str>>,
204}
205
206impl<'a> AuthChallengeResponseBuilder<'a> {
207 pub fn username(mut self, username: impl Into<Cow<'a, str>>) -> Self { self.username = Some(username.into()); self }
210 pub fn password(mut self, password: impl Into<Cow<'a, str>>) -> Self { self.password = Some(password.into()); self }
213 pub fn build(self) -> AuthChallengeResponse<'a> {
214 AuthChallengeResponse {
215 response: self.response,
216 username: self.username,
217 password: self.password,
218 }
219 }
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize, Default)]
223pub struct DisableParams {}
224
225impl DisableParams { pub const METHOD: &'static str = "Fetch.disable"; }
226
227impl<'a> crate::CdpCommand<'a> for DisableParams {
228 const METHOD: &'static str = "Fetch.disable";
229 type Response = crate::EmptyReturns;
230}
231
232#[derive(Debug, Clone, Serialize, Deserialize, Default)]
236#[serde(rename_all = "camelCase")]
237pub struct EnableParams<'a> {
238 #[serde(skip_serializing_if = "Option::is_none")]
242 patterns: Option<Vec<RequestPattern<'a>>>,
243 #[serde(skip_serializing_if = "Option::is_none")]
246 handleAuthRequests: Option<bool>,
247}
248
249impl<'a> EnableParams<'a> {
250 pub fn builder() -> EnableParamsBuilder<'a> {
251 EnableParamsBuilder {
252 patterns: None,
253 handleAuthRequests: None,
254 }
255 }
256 pub fn patterns(&self) -> Option<&[RequestPattern<'a>]> { self.patterns.as_deref() }
257 pub fn handleAuthRequests(&self) -> Option<bool> { self.handleAuthRequests }
258}
259
260#[derive(Default)]
261pub struct EnableParamsBuilder<'a> {
262 patterns: Option<Vec<RequestPattern<'a>>>,
263 handleAuthRequests: Option<bool>,
264}
265
266impl<'a> EnableParamsBuilder<'a> {
267 pub fn patterns(mut self, patterns: Vec<RequestPattern<'a>>) -> Self { self.patterns = Some(patterns); self }
271 pub fn handleAuthRequests(mut self, handleAuthRequests: bool) -> Self { self.handleAuthRequests = Some(handleAuthRequests); self }
274 pub fn build(self) -> EnableParams<'a> {
275 EnableParams {
276 patterns: self.patterns,
277 handleAuthRequests: self.handleAuthRequests,
278 }
279 }
280}
281
282impl<'a> EnableParams<'a> { pub const METHOD: &'static str = "Fetch.enable"; }
283
284impl<'a> crate::CdpCommand<'a> for EnableParams<'a> {
285 const METHOD: &'static str = "Fetch.enable";
286 type Response = crate::EmptyReturns;
287}
288
289#[derive(Debug, Clone, Serialize, Deserialize, Default)]
292#[serde(rename_all = "camelCase")]
293pub struct FailRequestParams<'a> {
294 requestId: RequestId<'a>,
296 errorReason: crate::network::ErrorReason,
298}
299
300impl<'a> FailRequestParams<'a> {
301 pub fn builder(requestId: RequestId<'a>, errorReason: crate::network::ErrorReason) -> FailRequestParamsBuilder<'a> {
302 FailRequestParamsBuilder {
303 requestId: requestId,
304 errorReason: errorReason,
305 }
306 }
307 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
308 pub fn errorReason(&self) -> &crate::network::ErrorReason { &self.errorReason }
309}
310
311
312pub struct FailRequestParamsBuilder<'a> {
313 requestId: RequestId<'a>,
314 errorReason: crate::network::ErrorReason,
315}
316
317impl<'a> FailRequestParamsBuilder<'a> {
318 pub fn build(self) -> FailRequestParams<'a> {
319 FailRequestParams {
320 requestId: self.requestId,
321 errorReason: self.errorReason,
322 }
323 }
324}
325
326impl<'a> FailRequestParams<'a> { pub const METHOD: &'static str = "Fetch.failRequest"; }
327
328impl<'a> crate::CdpCommand<'a> for FailRequestParams<'a> {
329 const METHOD: &'static str = "Fetch.failRequest";
330 type Response = crate::EmptyReturns;
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
336#[serde(rename_all = "camelCase")]
337pub struct FulfillRequestParams<'a> {
338 requestId: RequestId<'a>,
340 responseCode: i64,
342 #[serde(skip_serializing_if = "Option::is_none")]
344 responseHeaders: Option<Vec<HeaderEntry<'a>>>,
345 #[serde(skip_serializing_if = "Option::is_none")]
350 binaryResponseHeaders: Option<Cow<'a, str>>,
351 #[serde(skip_serializing_if = "Option::is_none")]
355 body: Option<Cow<'a, str>>,
356 #[serde(skip_serializing_if = "Option::is_none")]
359 responsePhrase: Option<Cow<'a, str>>,
360}
361
362impl<'a> FulfillRequestParams<'a> {
363 pub fn builder(requestId: RequestId<'a>, responseCode: i64) -> FulfillRequestParamsBuilder<'a> {
364 FulfillRequestParamsBuilder {
365 requestId: requestId,
366 responseCode: responseCode,
367 responseHeaders: None,
368 binaryResponseHeaders: None,
369 body: None,
370 responsePhrase: None,
371 }
372 }
373 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
374 pub fn responseCode(&self) -> i64 { self.responseCode }
375 pub fn responseHeaders(&self) -> Option<&[HeaderEntry<'a>]> { self.responseHeaders.as_deref() }
376 pub fn binaryResponseHeaders(&self) -> Option<&str> { self.binaryResponseHeaders.as_deref() }
377 pub fn body(&self) -> Option<&str> { self.body.as_deref() }
378 pub fn responsePhrase(&self) -> Option<&str> { self.responsePhrase.as_deref() }
379}
380
381
382pub struct FulfillRequestParamsBuilder<'a> {
383 requestId: RequestId<'a>,
384 responseCode: i64,
385 responseHeaders: Option<Vec<HeaderEntry<'a>>>,
386 binaryResponseHeaders: Option<Cow<'a, str>>,
387 body: Option<Cow<'a, str>>,
388 responsePhrase: Option<Cow<'a, str>>,
389}
390
391impl<'a> FulfillRequestParamsBuilder<'a> {
392 pub fn responseHeaders(mut self, responseHeaders: Vec<HeaderEntry<'a>>) -> Self { self.responseHeaders = Some(responseHeaders); self }
394 pub fn binaryResponseHeaders(mut self, binaryResponseHeaders: impl Into<Cow<'a, str>>) -> Self { self.binaryResponseHeaders = Some(binaryResponseHeaders.into()); self }
399 pub fn body(mut self, body: impl Into<Cow<'a, str>>) -> Self { self.body = Some(body.into()); self }
403 pub fn responsePhrase(mut self, responsePhrase: impl Into<Cow<'a, str>>) -> Self { self.responsePhrase = Some(responsePhrase.into()); self }
406 pub fn build(self) -> FulfillRequestParams<'a> {
407 FulfillRequestParams {
408 requestId: self.requestId,
409 responseCode: self.responseCode,
410 responseHeaders: self.responseHeaders,
411 binaryResponseHeaders: self.binaryResponseHeaders,
412 body: self.body,
413 responsePhrase: self.responsePhrase,
414 }
415 }
416}
417
418impl<'a> FulfillRequestParams<'a> { pub const METHOD: &'static str = "Fetch.fulfillRequest"; }
419
420impl<'a> crate::CdpCommand<'a> for FulfillRequestParams<'a> {
421 const METHOD: &'static str = "Fetch.fulfillRequest";
422 type Response = crate::EmptyReturns;
423}
424
425#[derive(Debug, Clone, Serialize, Deserialize, Default)]
428#[serde(rename_all = "camelCase")]
429pub struct ContinueRequestParams<'a> {
430 requestId: RequestId<'a>,
432 #[serde(skip_serializing_if = "Option::is_none")]
434 url: Option<Cow<'a, str>>,
435 #[serde(skip_serializing_if = "Option::is_none")]
437 method: Option<Cow<'a, str>>,
438 #[serde(skip_serializing_if = "Option::is_none")]
440 postData: Option<Cow<'a, str>>,
441 #[serde(skip_serializing_if = "Option::is_none")]
445 headers: Option<Vec<HeaderEntry<'a>>>,
446 #[serde(skip_serializing_if = "Option::is_none")]
448 interceptResponse: Option<bool>,
449}
450
451impl<'a> ContinueRequestParams<'a> {
452 pub fn builder(requestId: RequestId<'a>) -> ContinueRequestParamsBuilder<'a> {
453 ContinueRequestParamsBuilder {
454 requestId: requestId,
455 url: None,
456 method: None,
457 postData: None,
458 headers: None,
459 interceptResponse: None,
460 }
461 }
462 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
463 pub fn url(&self) -> Option<&str> { self.url.as_deref() }
464 pub fn method(&self) -> Option<&str> { self.method.as_deref() }
465 pub fn postData(&self) -> Option<&str> { self.postData.as_deref() }
466 pub fn headers(&self) -> Option<&[HeaderEntry<'a>]> { self.headers.as_deref() }
467 pub fn interceptResponse(&self) -> Option<bool> { self.interceptResponse }
468}
469
470
471pub struct ContinueRequestParamsBuilder<'a> {
472 requestId: RequestId<'a>,
473 url: Option<Cow<'a, str>>,
474 method: Option<Cow<'a, str>>,
475 postData: Option<Cow<'a, str>>,
476 headers: Option<Vec<HeaderEntry<'a>>>,
477 interceptResponse: Option<bool>,
478}
479
480impl<'a> ContinueRequestParamsBuilder<'a> {
481 pub fn url(mut self, url: impl Into<Cow<'a, str>>) -> Self { self.url = Some(url.into()); self }
483 pub fn method(mut self, method: impl Into<Cow<'a, str>>) -> Self { self.method = Some(method.into()); self }
485 pub fn postData(mut self, postData: impl Into<Cow<'a, str>>) -> Self { self.postData = Some(postData.into()); self }
487 pub fn headers(mut self, headers: Vec<HeaderEntry<'a>>) -> Self { self.headers = Some(headers); self }
491 pub fn interceptResponse(mut self, interceptResponse: bool) -> Self { self.interceptResponse = Some(interceptResponse); self }
493 pub fn build(self) -> ContinueRequestParams<'a> {
494 ContinueRequestParams {
495 requestId: self.requestId,
496 url: self.url,
497 method: self.method,
498 postData: self.postData,
499 headers: self.headers,
500 interceptResponse: self.interceptResponse,
501 }
502 }
503}
504
505impl<'a> ContinueRequestParams<'a> { pub const METHOD: &'static str = "Fetch.continueRequest"; }
506
507impl<'a> crate::CdpCommand<'a> for ContinueRequestParams<'a> {
508 const METHOD: &'static str = "Fetch.continueRequest";
509 type Response = crate::EmptyReturns;
510}
511
512#[derive(Debug, Clone, Serialize, Deserialize, Default)]
515#[serde(rename_all = "camelCase")]
516pub struct ContinueWithAuthParams<'a> {
517 requestId: RequestId<'a>,
519 authChallengeResponse: AuthChallengeResponse<'a>,
521}
522
523impl<'a> ContinueWithAuthParams<'a> {
524 pub fn builder(requestId: RequestId<'a>, authChallengeResponse: AuthChallengeResponse<'a>) -> ContinueWithAuthParamsBuilder<'a> {
525 ContinueWithAuthParamsBuilder {
526 requestId: requestId,
527 authChallengeResponse: authChallengeResponse,
528 }
529 }
530 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
531 pub fn authChallengeResponse(&self) -> &AuthChallengeResponse<'a> { &self.authChallengeResponse }
532}
533
534
535pub struct ContinueWithAuthParamsBuilder<'a> {
536 requestId: RequestId<'a>,
537 authChallengeResponse: AuthChallengeResponse<'a>,
538}
539
540impl<'a> ContinueWithAuthParamsBuilder<'a> {
541 pub fn build(self) -> ContinueWithAuthParams<'a> {
542 ContinueWithAuthParams {
543 requestId: self.requestId,
544 authChallengeResponse: self.authChallengeResponse,
545 }
546 }
547}
548
549impl<'a> ContinueWithAuthParams<'a> { pub const METHOD: &'static str = "Fetch.continueWithAuth"; }
550
551impl<'a> crate::CdpCommand<'a> for ContinueWithAuthParams<'a> {
552 const METHOD: &'static str = "Fetch.continueWithAuth";
553 type Response = crate::EmptyReturns;
554}
555
556#[derive(Debug, Clone, Serialize, Deserialize, Default)]
561#[serde(rename_all = "camelCase")]
562pub struct ContinueResponseParams<'a> {
563 requestId: RequestId<'a>,
565 #[serde(skip_serializing_if = "Option::is_none")]
567 responseCode: Option<i64>,
568 #[serde(skip_serializing_if = "Option::is_none")]
571 responsePhrase: Option<Cow<'a, str>>,
572 #[serde(skip_serializing_if = "Option::is_none")]
574 responseHeaders: Option<Vec<HeaderEntry<'a>>>,
575 #[serde(skip_serializing_if = "Option::is_none")]
580 binaryResponseHeaders: Option<Cow<'a, str>>,
581}
582
583impl<'a> ContinueResponseParams<'a> {
584 pub fn builder(requestId: RequestId<'a>) -> ContinueResponseParamsBuilder<'a> {
585 ContinueResponseParamsBuilder {
586 requestId: requestId,
587 responseCode: None,
588 responsePhrase: None,
589 responseHeaders: None,
590 binaryResponseHeaders: None,
591 }
592 }
593 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
594 pub fn responseCode(&self) -> Option<i64> { self.responseCode }
595 pub fn responsePhrase(&self) -> Option<&str> { self.responsePhrase.as_deref() }
596 pub fn responseHeaders(&self) -> Option<&[HeaderEntry<'a>]> { self.responseHeaders.as_deref() }
597 pub fn binaryResponseHeaders(&self) -> Option<&str> { self.binaryResponseHeaders.as_deref() }
598}
599
600
601pub struct ContinueResponseParamsBuilder<'a> {
602 requestId: RequestId<'a>,
603 responseCode: Option<i64>,
604 responsePhrase: Option<Cow<'a, str>>,
605 responseHeaders: Option<Vec<HeaderEntry<'a>>>,
606 binaryResponseHeaders: Option<Cow<'a, str>>,
607}
608
609impl<'a> ContinueResponseParamsBuilder<'a> {
610 pub fn responseCode(mut self, responseCode: i64) -> Self { self.responseCode = Some(responseCode); self }
612 pub fn responsePhrase(mut self, responsePhrase: impl Into<Cow<'a, str>>) -> Self { self.responsePhrase = Some(responsePhrase.into()); self }
615 pub fn responseHeaders(mut self, responseHeaders: Vec<HeaderEntry<'a>>) -> Self { self.responseHeaders = Some(responseHeaders); self }
617 pub fn binaryResponseHeaders(mut self, binaryResponseHeaders: impl Into<Cow<'a, str>>) -> Self { self.binaryResponseHeaders = Some(binaryResponseHeaders.into()); self }
622 pub fn build(self) -> ContinueResponseParams<'a> {
623 ContinueResponseParams {
624 requestId: self.requestId,
625 responseCode: self.responseCode,
626 responsePhrase: self.responsePhrase,
627 responseHeaders: self.responseHeaders,
628 binaryResponseHeaders: self.binaryResponseHeaders,
629 }
630 }
631}
632
633impl<'a> ContinueResponseParams<'a> { pub const METHOD: &'static str = "Fetch.continueResponse"; }
634
635impl<'a> crate::CdpCommand<'a> for ContinueResponseParams<'a> {
636 const METHOD: &'static str = "Fetch.continueResponse";
637 type Response = crate::EmptyReturns;
638}
639
640#[derive(Debug, Clone, Serialize, Deserialize, Default)]
652#[serde(rename_all = "camelCase")]
653pub struct GetResponseBodyParams<'a> {
654 requestId: RequestId<'a>,
656}
657
658impl<'a> GetResponseBodyParams<'a> {
659 pub fn builder(requestId: RequestId<'a>) -> GetResponseBodyParamsBuilder<'a> {
660 GetResponseBodyParamsBuilder {
661 requestId: requestId,
662 }
663 }
664 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
665}
666
667
668pub struct GetResponseBodyParamsBuilder<'a> {
669 requestId: RequestId<'a>,
670}
671
672impl<'a> GetResponseBodyParamsBuilder<'a> {
673 pub fn build(self) -> GetResponseBodyParams<'a> {
674 GetResponseBodyParams {
675 requestId: self.requestId,
676 }
677 }
678}
679
680#[derive(Debug, Clone, Serialize, Deserialize, Default)]
692#[serde(rename_all = "camelCase")]
693pub struct GetResponseBodyReturns<'a> {
694 body: Cow<'a, str>,
696 base64Encoded: bool,
698}
699
700impl<'a> GetResponseBodyReturns<'a> {
701 pub fn builder(body: impl Into<Cow<'a, str>>, base64Encoded: bool) -> GetResponseBodyReturnsBuilder<'a> {
702 GetResponseBodyReturnsBuilder {
703 body: body.into(),
704 base64Encoded: base64Encoded,
705 }
706 }
707 pub fn body(&self) -> &str { self.body.as_ref() }
708 pub fn base64Encoded(&self) -> bool { self.base64Encoded }
709}
710
711
712pub struct GetResponseBodyReturnsBuilder<'a> {
713 body: Cow<'a, str>,
714 base64Encoded: bool,
715}
716
717impl<'a> GetResponseBodyReturnsBuilder<'a> {
718 pub fn build(self) -> GetResponseBodyReturns<'a> {
719 GetResponseBodyReturns {
720 body: self.body,
721 base64Encoded: self.base64Encoded,
722 }
723 }
724}
725
726impl<'a> GetResponseBodyParams<'a> { pub const METHOD: &'static str = "Fetch.getResponseBody"; }
727
728impl<'a> crate::CdpCommand<'a> for GetResponseBodyParams<'a> {
729 const METHOD: &'static str = "Fetch.getResponseBody";
730 type Response = GetResponseBodyReturns<'a>;
731}
732
733#[derive(Debug, Clone, Serialize, Deserialize, Default)]
745#[serde(rename_all = "camelCase")]
746pub struct TakeResponseBodyAsStreamParams<'a> {
747 requestId: RequestId<'a>,
748}
749
750impl<'a> TakeResponseBodyAsStreamParams<'a> {
751 pub fn builder(requestId: RequestId<'a>) -> TakeResponseBodyAsStreamParamsBuilder<'a> {
752 TakeResponseBodyAsStreamParamsBuilder {
753 requestId: requestId,
754 }
755 }
756 pub fn requestId(&self) -> &RequestId<'a> { &self.requestId }
757}
758
759
760pub struct TakeResponseBodyAsStreamParamsBuilder<'a> {
761 requestId: RequestId<'a>,
762}
763
764impl<'a> TakeResponseBodyAsStreamParamsBuilder<'a> {
765 pub fn build(self) -> TakeResponseBodyAsStreamParams<'a> {
766 TakeResponseBodyAsStreamParams {
767 requestId: self.requestId,
768 }
769 }
770}
771
772#[derive(Debug, Clone, Serialize, Deserialize, Default)]
784#[serde(rename_all = "camelCase")]
785pub struct TakeResponseBodyAsStreamReturns<'a> {
786 stream: crate::io::StreamHandle<'a>,
787}
788
789impl<'a> TakeResponseBodyAsStreamReturns<'a> {
790 pub fn builder(stream: crate::io::StreamHandle<'a>) -> TakeResponseBodyAsStreamReturnsBuilder<'a> {
791 TakeResponseBodyAsStreamReturnsBuilder {
792 stream: stream,
793 }
794 }
795 pub fn stream(&self) -> &crate::io::StreamHandle<'a> { &self.stream }
796}
797
798
799pub struct TakeResponseBodyAsStreamReturnsBuilder<'a> {
800 stream: crate::io::StreamHandle<'a>,
801}
802
803impl<'a> TakeResponseBodyAsStreamReturnsBuilder<'a> {
804 pub fn build(self) -> TakeResponseBodyAsStreamReturns<'a> {
805 TakeResponseBodyAsStreamReturns {
806 stream: self.stream,
807 }
808 }
809}
810
811impl<'a> TakeResponseBodyAsStreamParams<'a> { pub const METHOD: &'static str = "Fetch.takeResponseBodyAsStream"; }
812
813impl<'a> crate::CdpCommand<'a> for TakeResponseBodyAsStreamParams<'a> {
814 const METHOD: &'static str = "Fetch.takeResponseBodyAsStream";
815 type Response = TakeResponseBodyAsStreamReturns<'a>;
816}