1use serde::{Serialize, Deserialize};
5use serde_json::Value as JsonValue;
6use std::borrow::Cow;
7
8
9pub type TargetID<'a> = Cow<'a, str>;
10
11pub type SessionID<'a> = Cow<'a, str>;
14
15
16#[derive(Debug, Clone, Serialize, Deserialize, Default)]
17#[serde(rename_all = "camelCase")]
18pub struct TargetInfo<'a> {
19 #[serde(rename = "targetId")]
20 target_id: TargetID<'a>,
21 #[serde(rename = "type")]
23 type_: Cow<'a, str>,
24 title: Cow<'a, str>,
25 url: Cow<'a, str>,
26 attached: bool,
28 #[serde(skip_serializing_if = "Option::is_none", rename = "parentId")]
30 parent_id: Option<TargetID<'a>>,
31 #[serde(skip_serializing_if = "Option::is_none", rename = "openerId")]
33 opener_id: Option<TargetID<'a>>,
34 #[serde(rename = "canAccessOpener")]
36 can_access_opener: bool,
37 #[serde(skip_serializing_if = "Option::is_none", rename = "openerFrameId")]
39 opener_frame_id: Option<crate::page::FrameId<'a>>,
40 #[serde(skip_serializing_if = "Option::is_none", rename = "parentFrameId")]
43 parent_frame_id: Option<crate::page::FrameId<'a>>,
44 #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
45 browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
46 #[serde(skip_serializing_if = "Option::is_none")]
49 subtype: Option<Cow<'a, str>>,
50}
51
52impl<'a> TargetInfo<'a> {
53 pub fn builder(target_id: impl Into<TargetID<'a>>, type_: impl Into<Cow<'a, str>>, title: impl Into<Cow<'a, str>>, url: impl Into<Cow<'a, str>>, attached: bool, can_access_opener: bool) -> TargetInfoBuilder<'a> {
61 TargetInfoBuilder {
62 target_id: target_id.into(),
63 type_: type_.into(),
64 title: title.into(),
65 url: url.into(),
66 attached: attached,
67 parent_id: None,
68 opener_id: None,
69 can_access_opener: can_access_opener,
70 opener_frame_id: None,
71 parent_frame_id: None,
72 browser_context_id: None,
73 subtype: None,
74 }
75 }
76 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
77 pub fn type_(&self) -> &str { self.type_.as_ref() }
79 pub fn title(&self) -> &str { self.title.as_ref() }
80 pub fn url(&self) -> &str { self.url.as_ref() }
81 pub fn attached(&self) -> bool { self.attached }
83 pub fn parent_id(&self) -> Option<&TargetID<'a>> { self.parent_id.as_ref() }
85 pub fn opener_id(&self) -> Option<&TargetID<'a>> { self.opener_id.as_ref() }
87 pub fn can_access_opener(&self) -> bool { self.can_access_opener }
89 pub fn opener_frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.opener_frame_id.as_ref() }
91 pub fn parent_frame_id(&self) -> Option<&crate::page::FrameId<'a>> { self.parent_frame_id.as_ref() }
94 pub fn browser_context_id(&self) -> Option<&crate::browser::BrowserContextID<'a>> { self.browser_context_id.as_ref() }
95 pub fn subtype(&self) -> Option<&str> { self.subtype.as_deref() }
98}
99
100
101pub struct TargetInfoBuilder<'a> {
102 target_id: TargetID<'a>,
103 type_: Cow<'a, str>,
104 title: Cow<'a, str>,
105 url: Cow<'a, str>,
106 attached: bool,
107 parent_id: Option<TargetID<'a>>,
108 opener_id: Option<TargetID<'a>>,
109 can_access_opener: bool,
110 opener_frame_id: Option<crate::page::FrameId<'a>>,
111 parent_frame_id: Option<crate::page::FrameId<'a>>,
112 browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
113 subtype: Option<Cow<'a, str>>,
114}
115
116impl<'a> TargetInfoBuilder<'a> {
117 pub fn parent_id(mut self, parent_id: impl Into<TargetID<'a>>) -> Self { self.parent_id = Some(parent_id.into()); self }
119 pub fn opener_id(mut self, opener_id: impl Into<TargetID<'a>>) -> Self { self.opener_id = Some(opener_id.into()); self }
121 pub fn opener_frame_id(mut self, opener_frame_id: crate::page::FrameId<'a>) -> Self { self.opener_frame_id = Some(opener_frame_id); self }
123 pub fn parent_frame_id(mut self, parent_frame_id: crate::page::FrameId<'a>) -> Self { self.parent_frame_id = Some(parent_frame_id); self }
126 pub fn browser_context_id(mut self, browser_context_id: crate::browser::BrowserContextID<'a>) -> Self { self.browser_context_id = Some(browser_context_id); self }
127 pub fn subtype(mut self, subtype: impl Into<Cow<'a, str>>) -> Self { self.subtype = Some(subtype.into()); self }
130 pub fn build(self) -> TargetInfo<'a> {
131 TargetInfo {
132 target_id: self.target_id,
133 type_: self.type_,
134 title: self.title,
135 url: self.url,
136 attached: self.attached,
137 parent_id: self.parent_id,
138 opener_id: self.opener_id,
139 can_access_opener: self.can_access_opener,
140 opener_frame_id: self.opener_frame_id,
141 parent_frame_id: self.parent_frame_id,
142 browser_context_id: self.browser_context_id,
143 subtype: self.subtype,
144 }
145 }
146}
147
148#[derive(Debug, Clone, Serialize, Deserialize, Default)]
151#[serde(rename_all = "camelCase")]
152pub struct FilterEntry<'a> {
153 #[serde(skip_serializing_if = "Option::is_none")]
155 exclude: Option<bool>,
156 #[serde(skip_serializing_if = "Option::is_none", rename = "type")]
158 type_: Option<Cow<'a, str>>,
159}
160
161impl<'a> FilterEntry<'a> {
162 pub fn builder() -> FilterEntryBuilder<'a> {
164 FilterEntryBuilder {
165 exclude: None,
166 type_: None,
167 }
168 }
169 pub fn exclude(&self) -> Option<bool> { self.exclude }
171 pub fn type_(&self) -> Option<&str> { self.type_.as_deref() }
173}
174
175#[derive(Default)]
176pub struct FilterEntryBuilder<'a> {
177 exclude: Option<bool>,
178 type_: Option<Cow<'a, str>>,
179}
180
181impl<'a> FilterEntryBuilder<'a> {
182 pub fn exclude(mut self, exclude: bool) -> Self { self.exclude = Some(exclude); self }
184 pub fn type_(mut self, type_: impl Into<Cow<'a, str>>) -> Self { self.type_ = Some(type_.into()); self }
186 pub fn build(self) -> FilterEntry<'a> {
187 FilterEntry {
188 exclude: self.exclude,
189 type_: self.type_,
190 }
191 }
192}
193
194pub type TargetFilter<'a> = Vec<FilterEntry<'a>>;
202
203
204#[derive(Debug, Clone, Serialize, Deserialize, Default)]
205#[serde(rename_all = "camelCase")]
206pub struct RemoteLocation<'a> {
207 host: Cow<'a, str>,
208 port: i64,
209}
210
211impl<'a> RemoteLocation<'a> {
212 pub fn builder(host: impl Into<Cow<'a, str>>, port: i64) -> RemoteLocationBuilder<'a> {
216 RemoteLocationBuilder {
217 host: host.into(),
218 port: port,
219 }
220 }
221 pub fn host(&self) -> &str { self.host.as_ref() }
222 pub fn port(&self) -> i64 { self.port }
223}
224
225
226pub struct RemoteLocationBuilder<'a> {
227 host: Cow<'a, str>,
228 port: i64,
229}
230
231impl<'a> RemoteLocationBuilder<'a> {
232 pub fn build(self) -> RemoteLocation<'a> {
233 RemoteLocation {
234 host: self.host,
235 port: self.port,
236 }
237 }
238}
239
240#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
243pub enum WindowState {
244 #[default]
245 #[serde(rename = "normal")]
246 Normal,
247 #[serde(rename = "minimized")]
248 Minimized,
249 #[serde(rename = "maximized")]
250 Maximized,
251 #[serde(rename = "fullscreen")]
252 Fullscreen,
253}
254
255#[derive(Debug, Clone, Serialize, Deserialize, Default)]
258#[serde(rename_all = "camelCase")]
259pub struct ActivateTargetParams<'a> {
260 #[serde(rename = "targetId")]
261 target_id: TargetID<'a>,
262}
263
264impl<'a> ActivateTargetParams<'a> {
265 pub fn builder(target_id: impl Into<TargetID<'a>>) -> ActivateTargetParamsBuilder<'a> {
268 ActivateTargetParamsBuilder {
269 target_id: target_id.into(),
270 }
271 }
272 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
273}
274
275
276pub struct ActivateTargetParamsBuilder<'a> {
277 target_id: TargetID<'a>,
278}
279
280impl<'a> ActivateTargetParamsBuilder<'a> {
281 pub fn build(self) -> ActivateTargetParams<'a> {
282 ActivateTargetParams {
283 target_id: self.target_id,
284 }
285 }
286}
287
288impl<'a> ActivateTargetParams<'a> { pub const METHOD: &'static str = "Target.activateTarget"; }
289
290impl<'a> crate::CdpCommand<'a> for ActivateTargetParams<'a> {
291 const METHOD: &'static str = "Target.activateTarget";
292 type Response = crate::EmptyReturns;
293}
294
295#[derive(Debug, Clone, Serialize, Deserialize, Default)]
298#[serde(rename_all = "camelCase")]
299pub struct AttachToTargetParams<'a> {
300 #[serde(rename = "targetId")]
301 target_id: TargetID<'a>,
302 #[serde(skip_serializing_if = "Option::is_none")]
306 flatten: Option<bool>,
307}
308
309impl<'a> AttachToTargetParams<'a> {
310 pub fn builder(target_id: impl Into<TargetID<'a>>) -> AttachToTargetParamsBuilder<'a> {
313 AttachToTargetParamsBuilder {
314 target_id: target_id.into(),
315 flatten: None,
316 }
317 }
318 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
319 pub fn flatten(&self) -> Option<bool> { self.flatten }
323}
324
325
326pub struct AttachToTargetParamsBuilder<'a> {
327 target_id: TargetID<'a>,
328 flatten: Option<bool>,
329}
330
331impl<'a> AttachToTargetParamsBuilder<'a> {
332 pub fn flatten(mut self, flatten: bool) -> Self { self.flatten = Some(flatten); self }
336 pub fn build(self) -> AttachToTargetParams<'a> {
337 AttachToTargetParams {
338 target_id: self.target_id,
339 flatten: self.flatten,
340 }
341 }
342}
343
344#[derive(Debug, Clone, Serialize, Deserialize, Default)]
347#[serde(rename_all = "camelCase")]
348pub struct AttachToTargetReturns<'a> {
349 #[serde(rename = "sessionId")]
351 session_id: SessionID<'a>,
352}
353
354impl<'a> AttachToTargetReturns<'a> {
355 pub fn builder(session_id: impl Into<SessionID<'a>>) -> AttachToTargetReturnsBuilder<'a> {
358 AttachToTargetReturnsBuilder {
359 session_id: session_id.into(),
360 }
361 }
362 pub fn session_id(&self) -> &SessionID<'a> { &self.session_id }
364}
365
366
367pub struct AttachToTargetReturnsBuilder<'a> {
368 session_id: SessionID<'a>,
369}
370
371impl<'a> AttachToTargetReturnsBuilder<'a> {
372 pub fn build(self) -> AttachToTargetReturns<'a> {
373 AttachToTargetReturns {
374 session_id: self.session_id,
375 }
376 }
377}
378
379impl<'a> AttachToTargetParams<'a> { pub const METHOD: &'static str = "Target.attachToTarget"; }
380
381impl<'a> crate::CdpCommand<'a> for AttachToTargetParams<'a> {
382 const METHOD: &'static str = "Target.attachToTarget";
383 type Response = AttachToTargetReturns<'a>;
384}
385
386#[derive(Debug, Clone, Serialize, Deserialize, Default)]
389#[serde(rename_all = "camelCase")]
390pub struct AttachToBrowserTargetReturns<'a> {
391 #[serde(rename = "sessionId")]
393 session_id: SessionID<'a>,
394}
395
396impl<'a> AttachToBrowserTargetReturns<'a> {
397 pub fn builder(session_id: impl Into<SessionID<'a>>) -> AttachToBrowserTargetReturnsBuilder<'a> {
400 AttachToBrowserTargetReturnsBuilder {
401 session_id: session_id.into(),
402 }
403 }
404 pub fn session_id(&self) -> &SessionID<'a> { &self.session_id }
406}
407
408
409pub struct AttachToBrowserTargetReturnsBuilder<'a> {
410 session_id: SessionID<'a>,
411}
412
413impl<'a> AttachToBrowserTargetReturnsBuilder<'a> {
414 pub fn build(self) -> AttachToBrowserTargetReturns<'a> {
415 AttachToBrowserTargetReturns {
416 session_id: self.session_id,
417 }
418 }
419}
420
421#[derive(Debug, Clone, Serialize, Deserialize, Default)]
422pub struct AttachToBrowserTargetParams {}
423
424impl AttachToBrowserTargetParams { pub const METHOD: &'static str = "Target.attachToBrowserTarget"; }
425
426impl<'a> crate::CdpCommand<'a> for AttachToBrowserTargetParams {
427 const METHOD: &'static str = "Target.attachToBrowserTarget";
428 type Response = AttachToBrowserTargetReturns<'a>;
429}
430
431#[derive(Debug, Clone, Serialize, Deserialize, Default)]
434#[serde(rename_all = "camelCase")]
435pub struct CloseTargetParams<'a> {
436 #[serde(rename = "targetId")]
437 target_id: TargetID<'a>,
438}
439
440impl<'a> CloseTargetParams<'a> {
441 pub fn builder(target_id: impl Into<TargetID<'a>>) -> CloseTargetParamsBuilder<'a> {
444 CloseTargetParamsBuilder {
445 target_id: target_id.into(),
446 }
447 }
448 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
449}
450
451
452pub struct CloseTargetParamsBuilder<'a> {
453 target_id: TargetID<'a>,
454}
455
456impl<'a> CloseTargetParamsBuilder<'a> {
457 pub fn build(self) -> CloseTargetParams<'a> {
458 CloseTargetParams {
459 target_id: self.target_id,
460 }
461 }
462}
463
464#[derive(Debug, Clone, Serialize, Deserialize, Default)]
467#[serde(rename_all = "camelCase")]
468pub struct CloseTargetReturns {
469 success: bool,
471}
472
473impl CloseTargetReturns {
474 pub fn builder(success: bool) -> CloseTargetReturnsBuilder {
477 CloseTargetReturnsBuilder {
478 success: success,
479 }
480 }
481 pub fn success(&self) -> bool { self.success }
483}
484
485
486pub struct CloseTargetReturnsBuilder {
487 success: bool,
488}
489
490impl CloseTargetReturnsBuilder {
491 pub fn build(self) -> CloseTargetReturns {
492 CloseTargetReturns {
493 success: self.success,
494 }
495 }
496}
497
498impl<'a> CloseTargetParams<'a> { pub const METHOD: &'static str = "Target.closeTarget"; }
499
500impl<'a> crate::CdpCommand<'a> for CloseTargetParams<'a> {
501 const METHOD: &'static str = "Target.closeTarget";
502 type Response = CloseTargetReturns;
503}
504
505#[derive(Debug, Clone, Serialize, Deserialize, Default)]
515#[serde(rename_all = "camelCase")]
516pub struct ExposeDevToolsProtocolParams<'a> {
517 #[serde(rename = "targetId")]
518 target_id: TargetID<'a>,
519 #[serde(skip_serializing_if = "Option::is_none", rename = "bindingName")]
521 binding_name: Option<Cow<'a, str>>,
522 #[serde(skip_serializing_if = "Option::is_none", rename = "inheritPermissions")]
524 inherit_permissions: Option<bool>,
525}
526
527impl<'a> ExposeDevToolsProtocolParams<'a> {
528 pub fn builder(target_id: impl Into<TargetID<'a>>) -> ExposeDevToolsProtocolParamsBuilder<'a> {
531 ExposeDevToolsProtocolParamsBuilder {
532 target_id: target_id.into(),
533 binding_name: None,
534 inherit_permissions: None,
535 }
536 }
537 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
538 pub fn binding_name(&self) -> Option<&str> { self.binding_name.as_deref() }
540 pub fn inherit_permissions(&self) -> Option<bool> { self.inherit_permissions }
542}
543
544
545pub struct ExposeDevToolsProtocolParamsBuilder<'a> {
546 target_id: TargetID<'a>,
547 binding_name: Option<Cow<'a, str>>,
548 inherit_permissions: Option<bool>,
549}
550
551impl<'a> ExposeDevToolsProtocolParamsBuilder<'a> {
552 pub fn binding_name(mut self, binding_name: impl Into<Cow<'a, str>>) -> Self { self.binding_name = Some(binding_name.into()); self }
554 pub fn inherit_permissions(mut self, inherit_permissions: bool) -> Self { self.inherit_permissions = Some(inherit_permissions); self }
556 pub fn build(self) -> ExposeDevToolsProtocolParams<'a> {
557 ExposeDevToolsProtocolParams {
558 target_id: self.target_id,
559 binding_name: self.binding_name,
560 inherit_permissions: self.inherit_permissions,
561 }
562 }
563}
564
565impl<'a> ExposeDevToolsProtocolParams<'a> { pub const METHOD: &'static str = "Target.exposeDevToolsProtocol"; }
566
567impl<'a> crate::CdpCommand<'a> for ExposeDevToolsProtocolParams<'a> {
568 const METHOD: &'static str = "Target.exposeDevToolsProtocol";
569 type Response = crate::EmptyReturns;
570}
571
572#[derive(Debug, Clone, Serialize, Deserialize, Default)]
576#[serde(rename_all = "camelCase")]
577pub struct CreateBrowserContextParams<'a> {
578 #[serde(skip_serializing_if = "Option::is_none", rename = "disposeOnDetach")]
580 dispose_on_detach: Option<bool>,
581 #[serde(skip_serializing_if = "Option::is_none", rename = "proxyServer")]
583 proxy_server: Option<Cow<'a, str>>,
584 #[serde(skip_serializing_if = "Option::is_none", rename = "proxyBypassList")]
586 proxy_bypass_list: Option<Cow<'a, str>>,
587 #[serde(skip_serializing_if = "Option::is_none", rename = "originsWithUniversalNetworkAccess")]
590 origins_with_universal_network_access: Option<Vec<Cow<'a, str>>>,
591}
592
593impl<'a> CreateBrowserContextParams<'a> {
594 pub fn builder() -> CreateBrowserContextParamsBuilder<'a> {
596 CreateBrowserContextParamsBuilder {
597 dispose_on_detach: None,
598 proxy_server: None,
599 proxy_bypass_list: None,
600 origins_with_universal_network_access: None,
601 }
602 }
603 pub fn dispose_on_detach(&self) -> Option<bool> { self.dispose_on_detach }
605 pub fn proxy_server(&self) -> Option<&str> { self.proxy_server.as_deref() }
607 pub fn proxy_bypass_list(&self) -> Option<&str> { self.proxy_bypass_list.as_deref() }
609 pub fn origins_with_universal_network_access(&self) -> Option<&[Cow<'a, str>]> { self.origins_with_universal_network_access.as_deref() }
612}
613
614#[derive(Default)]
615pub struct CreateBrowserContextParamsBuilder<'a> {
616 dispose_on_detach: Option<bool>,
617 proxy_server: Option<Cow<'a, str>>,
618 proxy_bypass_list: Option<Cow<'a, str>>,
619 origins_with_universal_network_access: Option<Vec<Cow<'a, str>>>,
620}
621
622impl<'a> CreateBrowserContextParamsBuilder<'a> {
623 pub fn dispose_on_detach(mut self, dispose_on_detach: bool) -> Self { self.dispose_on_detach = Some(dispose_on_detach); self }
625 pub fn proxy_server(mut self, proxy_server: impl Into<Cow<'a, str>>) -> Self { self.proxy_server = Some(proxy_server.into()); self }
627 pub fn proxy_bypass_list(mut self, proxy_bypass_list: impl Into<Cow<'a, str>>) -> Self { self.proxy_bypass_list = Some(proxy_bypass_list.into()); self }
629 pub fn origins_with_universal_network_access(mut self, origins_with_universal_network_access: Vec<Cow<'a, str>>) -> Self { self.origins_with_universal_network_access = Some(origins_with_universal_network_access); self }
632 pub fn build(self) -> CreateBrowserContextParams<'a> {
633 CreateBrowserContextParams {
634 dispose_on_detach: self.dispose_on_detach,
635 proxy_server: self.proxy_server,
636 proxy_bypass_list: self.proxy_bypass_list,
637 origins_with_universal_network_access: self.origins_with_universal_network_access,
638 }
639 }
640}
641
642#[derive(Debug, Clone, Serialize, Deserialize, Default)]
646#[serde(rename_all = "camelCase")]
647pub struct CreateBrowserContextReturns<'a> {
648 #[serde(rename = "browserContextId")]
650 browser_context_id: crate::browser::BrowserContextID<'a>,
651}
652
653impl<'a> CreateBrowserContextReturns<'a> {
654 pub fn builder(browser_context_id: crate::browser::BrowserContextID<'a>) -> CreateBrowserContextReturnsBuilder<'a> {
657 CreateBrowserContextReturnsBuilder {
658 browser_context_id: browser_context_id,
659 }
660 }
661 pub fn browser_context_id(&self) -> &crate::browser::BrowserContextID<'a> { &self.browser_context_id }
663}
664
665
666pub struct CreateBrowserContextReturnsBuilder<'a> {
667 browser_context_id: crate::browser::BrowserContextID<'a>,
668}
669
670impl<'a> CreateBrowserContextReturnsBuilder<'a> {
671 pub fn build(self) -> CreateBrowserContextReturns<'a> {
672 CreateBrowserContextReturns {
673 browser_context_id: self.browser_context_id,
674 }
675 }
676}
677
678impl<'a> CreateBrowserContextParams<'a> { pub const METHOD: &'static str = "Target.createBrowserContext"; }
679
680impl<'a> crate::CdpCommand<'a> for CreateBrowserContextParams<'a> {
681 const METHOD: &'static str = "Target.createBrowserContext";
682 type Response = CreateBrowserContextReturns<'a>;
683}
684
685#[derive(Debug, Clone, Serialize, Deserialize, Default)]
688#[serde(rename_all = "camelCase")]
689pub struct GetBrowserContextsReturns<'a> {
690 #[serde(rename = "browserContextIds")]
692 browser_context_ids: Vec<crate::browser::BrowserContextID<'a>>,
693 #[serde(skip_serializing_if = "Option::is_none", rename = "defaultBrowserContextId")]
695 default_browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
696}
697
698impl<'a> GetBrowserContextsReturns<'a> {
699 pub fn builder(browser_context_ids: Vec<crate::browser::BrowserContextID<'a>>) -> GetBrowserContextsReturnsBuilder<'a> {
702 GetBrowserContextsReturnsBuilder {
703 browser_context_ids: browser_context_ids,
704 default_browser_context_id: None,
705 }
706 }
707 pub fn browser_context_ids(&self) -> &[crate::browser::BrowserContextID<'a>] { &self.browser_context_ids }
709 pub fn default_browser_context_id(&self) -> Option<&crate::browser::BrowserContextID<'a>> { self.default_browser_context_id.as_ref() }
711}
712
713
714pub struct GetBrowserContextsReturnsBuilder<'a> {
715 browser_context_ids: Vec<crate::browser::BrowserContextID<'a>>,
716 default_browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
717}
718
719impl<'a> GetBrowserContextsReturnsBuilder<'a> {
720 pub fn default_browser_context_id(mut self, default_browser_context_id: crate::browser::BrowserContextID<'a>) -> Self { self.default_browser_context_id = Some(default_browser_context_id); self }
722 pub fn build(self) -> GetBrowserContextsReturns<'a> {
723 GetBrowserContextsReturns {
724 browser_context_ids: self.browser_context_ids,
725 default_browser_context_id: self.default_browser_context_id,
726 }
727 }
728}
729
730#[derive(Debug, Clone, Serialize, Deserialize, Default)]
731pub struct GetBrowserContextsParams {}
732
733impl GetBrowserContextsParams { pub const METHOD: &'static str = "Target.getBrowserContexts"; }
734
735impl<'a> crate::CdpCommand<'a> for GetBrowserContextsParams {
736 const METHOD: &'static str = "Target.getBrowserContexts";
737 type Response = GetBrowserContextsReturns<'a>;
738}
739
740#[derive(Debug, Clone, Serialize, Deserialize, Default)]
743#[serde(rename_all = "camelCase")]
744pub struct CreateTargetParams<'a> {
745 url: Cow<'a, str>,
747 #[serde(skip_serializing_if = "Option::is_none")]
749 left: Option<i64>,
750 #[serde(skip_serializing_if = "Option::is_none")]
752 top: Option<i64>,
753 #[serde(skip_serializing_if = "Option::is_none")]
755 width: Option<u64>,
756 #[serde(skip_serializing_if = "Option::is_none")]
758 height: Option<i64>,
759 #[serde(skip_serializing_if = "Option::is_none", rename = "windowState")]
762 window_state: Option<WindowState>,
763 #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
765 browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
766 #[serde(skip_serializing_if = "Option::is_none", rename = "enableBeginFrameControl")]
769 enable_begin_frame_control: Option<bool>,
770 #[serde(skip_serializing_if = "Option::is_none", rename = "newWindow")]
772 new_window: Option<bool>,
773 #[serde(skip_serializing_if = "Option::is_none")]
776 background: Option<bool>,
777 #[serde(skip_serializing_if = "Option::is_none", rename = "forTab")]
779 for_tab: Option<bool>,
780 #[serde(skip_serializing_if = "Option::is_none")]
784 hidden: Option<bool>,
785 #[serde(skip_serializing_if = "Option::is_none")]
793 focus: Option<bool>,
794}
795
796impl<'a> CreateTargetParams<'a> {
797 pub fn builder(url: impl Into<Cow<'a, str>>) -> CreateTargetParamsBuilder<'a> {
800 CreateTargetParamsBuilder {
801 url: url.into(),
802 left: None,
803 top: None,
804 width: None,
805 height: None,
806 window_state: None,
807 browser_context_id: None,
808 enable_begin_frame_control: None,
809 new_window: None,
810 background: None,
811 for_tab: None,
812 hidden: None,
813 focus: None,
814 }
815 }
816 pub fn url(&self) -> &str { self.url.as_ref() }
818 pub fn left(&self) -> Option<i64> { self.left }
820 pub fn top(&self) -> Option<i64> { self.top }
822 pub fn width(&self) -> Option<u64> { self.width }
824 pub fn height(&self) -> Option<i64> { self.height }
826 pub fn window_state(&self) -> Option<&WindowState> { self.window_state.as_ref() }
829 pub fn browser_context_id(&self) -> Option<&crate::browser::BrowserContextID<'a>> { self.browser_context_id.as_ref() }
831 pub fn enable_begin_frame_control(&self) -> Option<bool> { self.enable_begin_frame_control }
834 pub fn new_window(&self) -> Option<bool> { self.new_window }
836 pub fn background(&self) -> Option<bool> { self.background }
839 pub fn for_tab(&self) -> Option<bool> { self.for_tab }
841 pub fn hidden(&self) -> Option<bool> { self.hidden }
845 pub fn focus(&self) -> Option<bool> { self.focus }
853}
854
855
856pub struct CreateTargetParamsBuilder<'a> {
857 url: Cow<'a, str>,
858 left: Option<i64>,
859 top: Option<i64>,
860 width: Option<u64>,
861 height: Option<i64>,
862 window_state: Option<WindowState>,
863 browser_context_id: Option<crate::browser::BrowserContextID<'a>>,
864 enable_begin_frame_control: Option<bool>,
865 new_window: Option<bool>,
866 background: Option<bool>,
867 for_tab: Option<bool>,
868 hidden: Option<bool>,
869 focus: Option<bool>,
870}
871
872impl<'a> CreateTargetParamsBuilder<'a> {
873 pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
875 pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
877 pub fn width(mut self, width: u64) -> Self { self.width = Some(width); self }
879 pub fn height(mut self, height: i64) -> Self { self.height = Some(height); self }
881 pub fn window_state(mut self, window_state: impl Into<WindowState>) -> Self { self.window_state = Some(window_state.into()); self }
884 pub fn browser_context_id(mut self, browser_context_id: crate::browser::BrowserContextID<'a>) -> Self { self.browser_context_id = Some(browser_context_id); self }
886 pub fn enable_begin_frame_control(mut self, enable_begin_frame_control: bool) -> Self { self.enable_begin_frame_control = Some(enable_begin_frame_control); self }
889 pub fn new_window(mut self, new_window: bool) -> Self { self.new_window = Some(new_window); self }
891 pub fn background(mut self, background: bool) -> Self { self.background = Some(background); self }
894 pub fn for_tab(mut self, for_tab: bool) -> Self { self.for_tab = Some(for_tab); self }
896 pub fn hidden(mut self, hidden: bool) -> Self { self.hidden = Some(hidden); self }
900 pub fn focus(mut self, focus: bool) -> Self { self.focus = Some(focus); self }
908 pub fn build(self) -> CreateTargetParams<'a> {
909 CreateTargetParams {
910 url: self.url,
911 left: self.left,
912 top: self.top,
913 width: self.width,
914 height: self.height,
915 window_state: self.window_state,
916 browser_context_id: self.browser_context_id,
917 enable_begin_frame_control: self.enable_begin_frame_control,
918 new_window: self.new_window,
919 background: self.background,
920 for_tab: self.for_tab,
921 hidden: self.hidden,
922 focus: self.focus,
923 }
924 }
925}
926
927#[derive(Debug, Clone, Serialize, Deserialize, Default)]
930#[serde(rename_all = "camelCase")]
931pub struct CreateTargetReturns<'a> {
932 #[serde(rename = "targetId")]
934 target_id: TargetID<'a>,
935}
936
937impl<'a> CreateTargetReturns<'a> {
938 pub fn builder(target_id: impl Into<TargetID<'a>>) -> CreateTargetReturnsBuilder<'a> {
941 CreateTargetReturnsBuilder {
942 target_id: target_id.into(),
943 }
944 }
945 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
947}
948
949
950pub struct CreateTargetReturnsBuilder<'a> {
951 target_id: TargetID<'a>,
952}
953
954impl<'a> CreateTargetReturnsBuilder<'a> {
955 pub fn build(self) -> CreateTargetReturns<'a> {
956 CreateTargetReturns {
957 target_id: self.target_id,
958 }
959 }
960}
961
962impl<'a> CreateTargetParams<'a> { pub const METHOD: &'static str = "Target.createTarget"; }
963
964impl<'a> crate::CdpCommand<'a> for CreateTargetParams<'a> {
965 const METHOD: &'static str = "Target.createTarget";
966 type Response = CreateTargetReturns<'a>;
967}
968
969#[derive(Debug, Clone, Serialize, Deserialize, Default)]
972#[serde(rename_all = "camelCase")]
973pub struct DetachFromTargetParams<'a> {
974 #[serde(skip_serializing_if = "Option::is_none", rename = "sessionId")]
976 session_id: Option<SessionID<'a>>,
977 #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
979 target_id: Option<TargetID<'a>>,
980}
981
982impl<'a> DetachFromTargetParams<'a> {
983 pub fn builder() -> DetachFromTargetParamsBuilder<'a> {
985 DetachFromTargetParamsBuilder {
986 session_id: None,
987 target_id: None,
988 }
989 }
990 pub fn session_id(&self) -> Option<&SessionID<'a>> { self.session_id.as_ref() }
992 pub fn target_id(&self) -> Option<&TargetID<'a>> { self.target_id.as_ref() }
994}
995
996#[derive(Default)]
997pub struct DetachFromTargetParamsBuilder<'a> {
998 session_id: Option<SessionID<'a>>,
999 target_id: Option<TargetID<'a>>,
1000}
1001
1002impl<'a> DetachFromTargetParamsBuilder<'a> {
1003 pub fn session_id(mut self, session_id: impl Into<SessionID<'a>>) -> Self { self.session_id = Some(session_id.into()); self }
1005 pub fn target_id(mut self, target_id: impl Into<TargetID<'a>>) -> Self { self.target_id = Some(target_id.into()); self }
1007 pub fn build(self) -> DetachFromTargetParams<'a> {
1008 DetachFromTargetParams {
1009 session_id: self.session_id,
1010 target_id: self.target_id,
1011 }
1012 }
1013}
1014
1015impl<'a> DetachFromTargetParams<'a> { pub const METHOD: &'static str = "Target.detachFromTarget"; }
1016
1017impl<'a> crate::CdpCommand<'a> for DetachFromTargetParams<'a> {
1018 const METHOD: &'static str = "Target.detachFromTarget";
1019 type Response = crate::EmptyReturns;
1020}
1021
1022#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1026#[serde(rename_all = "camelCase")]
1027pub struct DisposeBrowserContextParams<'a> {
1028 #[serde(rename = "browserContextId")]
1029 browser_context_id: crate::browser::BrowserContextID<'a>,
1030}
1031
1032impl<'a> DisposeBrowserContextParams<'a> {
1033 pub fn builder(browser_context_id: crate::browser::BrowserContextID<'a>) -> DisposeBrowserContextParamsBuilder<'a> {
1036 DisposeBrowserContextParamsBuilder {
1037 browser_context_id: browser_context_id,
1038 }
1039 }
1040 pub fn browser_context_id(&self) -> &crate::browser::BrowserContextID<'a> { &self.browser_context_id }
1041}
1042
1043
1044pub struct DisposeBrowserContextParamsBuilder<'a> {
1045 browser_context_id: crate::browser::BrowserContextID<'a>,
1046}
1047
1048impl<'a> DisposeBrowserContextParamsBuilder<'a> {
1049 pub fn build(self) -> DisposeBrowserContextParams<'a> {
1050 DisposeBrowserContextParams {
1051 browser_context_id: self.browser_context_id,
1052 }
1053 }
1054}
1055
1056impl<'a> DisposeBrowserContextParams<'a> { pub const METHOD: &'static str = "Target.disposeBrowserContext"; }
1057
1058impl<'a> crate::CdpCommand<'a> for DisposeBrowserContextParams<'a> {
1059 const METHOD: &'static str = "Target.disposeBrowserContext";
1060 type Response = crate::EmptyReturns;
1061}
1062
1063#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1066#[serde(rename_all = "camelCase")]
1067pub struct GetTargetInfoParams<'a> {
1068 #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
1069 target_id: Option<TargetID<'a>>,
1070}
1071
1072impl<'a> GetTargetInfoParams<'a> {
1073 pub fn builder() -> GetTargetInfoParamsBuilder<'a> {
1075 GetTargetInfoParamsBuilder {
1076 target_id: None,
1077 }
1078 }
1079 pub fn target_id(&self) -> Option<&TargetID<'a>> { self.target_id.as_ref() }
1080}
1081
1082#[derive(Default)]
1083pub struct GetTargetInfoParamsBuilder<'a> {
1084 target_id: Option<TargetID<'a>>,
1085}
1086
1087impl<'a> GetTargetInfoParamsBuilder<'a> {
1088 pub fn target_id(mut self, target_id: impl Into<TargetID<'a>>) -> Self { self.target_id = Some(target_id.into()); self }
1089 pub fn build(self) -> GetTargetInfoParams<'a> {
1090 GetTargetInfoParams {
1091 target_id: self.target_id,
1092 }
1093 }
1094}
1095
1096#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1099#[serde(rename_all = "camelCase")]
1100pub struct GetTargetInfoReturns<'a> {
1101 #[serde(rename = "targetInfo")]
1102 target_info: TargetInfo<'a>,
1103}
1104
1105impl<'a> GetTargetInfoReturns<'a> {
1106 pub fn builder(target_info: TargetInfo<'a>) -> GetTargetInfoReturnsBuilder<'a> {
1109 GetTargetInfoReturnsBuilder {
1110 target_info: target_info,
1111 }
1112 }
1113 pub fn target_info(&self) -> &TargetInfo<'a> { &self.target_info }
1114}
1115
1116
1117pub struct GetTargetInfoReturnsBuilder<'a> {
1118 target_info: TargetInfo<'a>,
1119}
1120
1121impl<'a> GetTargetInfoReturnsBuilder<'a> {
1122 pub fn build(self) -> GetTargetInfoReturns<'a> {
1123 GetTargetInfoReturns {
1124 target_info: self.target_info,
1125 }
1126 }
1127}
1128
1129impl<'a> GetTargetInfoParams<'a> { pub const METHOD: &'static str = "Target.getTargetInfo"; }
1130
1131impl<'a> crate::CdpCommand<'a> for GetTargetInfoParams<'a> {
1132 const METHOD: &'static str = "Target.getTargetInfo";
1133 type Response = GetTargetInfoReturns<'a>;
1134}
1135
1136#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1139#[serde(rename_all = "camelCase")]
1140pub struct GetTargetsParams<'a> {
1141 #[serde(skip_serializing_if = "Option::is_none")]
1145 filter: Option<TargetFilter<'a>>,
1146}
1147
1148impl<'a> GetTargetsParams<'a> {
1149 pub fn builder() -> GetTargetsParamsBuilder<'a> {
1151 GetTargetsParamsBuilder {
1152 filter: None,
1153 }
1154 }
1155 pub fn filter(&self) -> Option<&TargetFilter<'a>> { self.filter.as_ref() }
1159}
1160
1161#[derive(Default)]
1162pub struct GetTargetsParamsBuilder<'a> {
1163 filter: Option<TargetFilter<'a>>,
1164}
1165
1166impl<'a> GetTargetsParamsBuilder<'a> {
1167 pub fn filter(mut self, filter: TargetFilter<'a>) -> Self { self.filter = Some(filter); self }
1171 pub fn build(self) -> GetTargetsParams<'a> {
1172 GetTargetsParams {
1173 filter: self.filter,
1174 }
1175 }
1176}
1177
1178#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1181#[serde(rename_all = "camelCase")]
1182pub struct GetTargetsReturns<'a> {
1183 #[serde(rename = "targetInfos")]
1185 target_infos: Vec<TargetInfo<'a>>,
1186}
1187
1188impl<'a> GetTargetsReturns<'a> {
1189 pub fn builder(target_infos: Vec<TargetInfo<'a>>) -> GetTargetsReturnsBuilder<'a> {
1192 GetTargetsReturnsBuilder {
1193 target_infos: target_infos,
1194 }
1195 }
1196 pub fn target_infos(&self) -> &[TargetInfo<'a>] { &self.target_infos }
1198}
1199
1200
1201pub struct GetTargetsReturnsBuilder<'a> {
1202 target_infos: Vec<TargetInfo<'a>>,
1203}
1204
1205impl<'a> GetTargetsReturnsBuilder<'a> {
1206 pub fn build(self) -> GetTargetsReturns<'a> {
1207 GetTargetsReturns {
1208 target_infos: self.target_infos,
1209 }
1210 }
1211}
1212
1213impl<'a> GetTargetsParams<'a> { pub const METHOD: &'static str = "Target.getTargets"; }
1214
1215impl<'a> crate::CdpCommand<'a> for GetTargetsParams<'a> {
1216 const METHOD: &'static str = "Target.getTargets";
1217 type Response = GetTargetsReturns<'a>;
1218}
1219
1220#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1225#[serde(rename_all = "camelCase")]
1226pub struct SendMessageToTargetParams<'a> {
1227 message: Cow<'a, str>,
1228 #[serde(skip_serializing_if = "Option::is_none", rename = "sessionId")]
1230 session_id: Option<SessionID<'a>>,
1231 #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
1233 target_id: Option<TargetID<'a>>,
1234}
1235
1236impl<'a> SendMessageToTargetParams<'a> {
1237 pub fn builder(message: impl Into<Cow<'a, str>>) -> SendMessageToTargetParamsBuilder<'a> {
1240 SendMessageToTargetParamsBuilder {
1241 message: message.into(),
1242 session_id: None,
1243 target_id: None,
1244 }
1245 }
1246 pub fn message(&self) -> &str { self.message.as_ref() }
1247 pub fn session_id(&self) -> Option<&SessionID<'a>> { self.session_id.as_ref() }
1249 pub fn target_id(&self) -> Option<&TargetID<'a>> { self.target_id.as_ref() }
1251}
1252
1253
1254pub struct SendMessageToTargetParamsBuilder<'a> {
1255 message: Cow<'a, str>,
1256 session_id: Option<SessionID<'a>>,
1257 target_id: Option<TargetID<'a>>,
1258}
1259
1260impl<'a> SendMessageToTargetParamsBuilder<'a> {
1261 pub fn session_id(mut self, session_id: impl Into<SessionID<'a>>) -> Self { self.session_id = Some(session_id.into()); self }
1263 pub fn target_id(mut self, target_id: impl Into<TargetID<'a>>) -> Self { self.target_id = Some(target_id.into()); self }
1265 pub fn build(self) -> SendMessageToTargetParams<'a> {
1266 SendMessageToTargetParams {
1267 message: self.message,
1268 session_id: self.session_id,
1269 target_id: self.target_id,
1270 }
1271 }
1272}
1273
1274impl<'a> SendMessageToTargetParams<'a> { pub const METHOD: &'static str = "Target.sendMessageToTarget"; }
1275
1276impl<'a> crate::CdpCommand<'a> for SendMessageToTargetParams<'a> {
1277 const METHOD: &'static str = "Target.sendMessageToTarget";
1278 type Response = crate::EmptyReturns;
1279}
1280
1281#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1291#[serde(rename_all = "camelCase")]
1292pub struct SetAutoAttachParams<'a> {
1293 #[serde(rename = "autoAttach")]
1295 auto_attach: bool,
1296 #[serde(rename = "waitForDebuggerOnStart")]
1299 wait_for_debugger_on_start: bool,
1300 #[serde(skip_serializing_if = "Option::is_none")]
1304 flatten: Option<bool>,
1305 #[serde(skip_serializing_if = "Option::is_none")]
1307 filter: Option<TargetFilter<'a>>,
1308}
1309
1310impl<'a> SetAutoAttachParams<'a> {
1311 pub fn builder(auto_attach: bool, wait_for_debugger_on_start: bool) -> SetAutoAttachParamsBuilder<'a> {
1315 SetAutoAttachParamsBuilder {
1316 auto_attach: auto_attach,
1317 wait_for_debugger_on_start: wait_for_debugger_on_start,
1318 flatten: None,
1319 filter: None,
1320 }
1321 }
1322 pub fn auto_attach(&self) -> bool { self.auto_attach }
1324 pub fn wait_for_debugger_on_start(&self) -> bool { self.wait_for_debugger_on_start }
1327 pub fn flatten(&self) -> Option<bool> { self.flatten }
1331 pub fn filter(&self) -> Option<&TargetFilter<'a>> { self.filter.as_ref() }
1333}
1334
1335
1336pub struct SetAutoAttachParamsBuilder<'a> {
1337 auto_attach: bool,
1338 wait_for_debugger_on_start: bool,
1339 flatten: Option<bool>,
1340 filter: Option<TargetFilter<'a>>,
1341}
1342
1343impl<'a> SetAutoAttachParamsBuilder<'a> {
1344 pub fn flatten(mut self, flatten: bool) -> Self { self.flatten = Some(flatten); self }
1348 pub fn filter(mut self, filter: TargetFilter<'a>) -> Self { self.filter = Some(filter); self }
1350 pub fn build(self) -> SetAutoAttachParams<'a> {
1351 SetAutoAttachParams {
1352 auto_attach: self.auto_attach,
1353 wait_for_debugger_on_start: self.wait_for_debugger_on_start,
1354 flatten: self.flatten,
1355 filter: self.filter,
1356 }
1357 }
1358}
1359
1360impl<'a> SetAutoAttachParams<'a> { pub const METHOD: &'static str = "Target.setAutoAttach"; }
1361
1362impl<'a> crate::CdpCommand<'a> for SetAutoAttachParams<'a> {
1363 const METHOD: &'static str = "Target.setAutoAttach";
1364 type Response = crate::EmptyReturns;
1365}
1366
1367#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1374#[serde(rename_all = "camelCase")]
1375pub struct AutoAttachRelatedParams<'a> {
1376 #[serde(rename = "targetId")]
1377 target_id: TargetID<'a>,
1378 #[serde(rename = "waitForDebuggerOnStart")]
1381 wait_for_debugger_on_start: bool,
1382 #[serde(skip_serializing_if = "Option::is_none")]
1384 filter: Option<TargetFilter<'a>>,
1385}
1386
1387impl<'a> AutoAttachRelatedParams<'a> {
1388 pub fn builder(target_id: impl Into<TargetID<'a>>, wait_for_debugger_on_start: bool) -> AutoAttachRelatedParamsBuilder<'a> {
1392 AutoAttachRelatedParamsBuilder {
1393 target_id: target_id.into(),
1394 wait_for_debugger_on_start: wait_for_debugger_on_start,
1395 filter: None,
1396 }
1397 }
1398 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
1399 pub fn wait_for_debugger_on_start(&self) -> bool { self.wait_for_debugger_on_start }
1402 pub fn filter(&self) -> Option<&TargetFilter<'a>> { self.filter.as_ref() }
1404}
1405
1406
1407pub struct AutoAttachRelatedParamsBuilder<'a> {
1408 target_id: TargetID<'a>,
1409 wait_for_debugger_on_start: bool,
1410 filter: Option<TargetFilter<'a>>,
1411}
1412
1413impl<'a> AutoAttachRelatedParamsBuilder<'a> {
1414 pub fn filter(mut self, filter: TargetFilter<'a>) -> Self { self.filter = Some(filter); self }
1416 pub fn build(self) -> AutoAttachRelatedParams<'a> {
1417 AutoAttachRelatedParams {
1418 target_id: self.target_id,
1419 wait_for_debugger_on_start: self.wait_for_debugger_on_start,
1420 filter: self.filter,
1421 }
1422 }
1423}
1424
1425impl<'a> AutoAttachRelatedParams<'a> { pub const METHOD: &'static str = "Target.autoAttachRelated"; }
1426
1427impl<'a> crate::CdpCommand<'a> for AutoAttachRelatedParams<'a> {
1428 const METHOD: &'static str = "Target.autoAttachRelated";
1429 type Response = crate::EmptyReturns;
1430}
1431
1432#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1436#[serde(rename_all = "camelCase")]
1437pub struct SetDiscoverTargetsParams<'a> {
1438 discover: bool,
1440 #[serde(skip_serializing_if = "Option::is_none")]
1443 filter: Option<TargetFilter<'a>>,
1444}
1445
1446impl<'a> SetDiscoverTargetsParams<'a> {
1447 pub fn builder(discover: bool) -> SetDiscoverTargetsParamsBuilder<'a> {
1450 SetDiscoverTargetsParamsBuilder {
1451 discover: discover,
1452 filter: None,
1453 }
1454 }
1455 pub fn discover(&self) -> bool { self.discover }
1457 pub fn filter(&self) -> Option<&TargetFilter<'a>> { self.filter.as_ref() }
1460}
1461
1462
1463pub struct SetDiscoverTargetsParamsBuilder<'a> {
1464 discover: bool,
1465 filter: Option<TargetFilter<'a>>,
1466}
1467
1468impl<'a> SetDiscoverTargetsParamsBuilder<'a> {
1469 pub fn filter(mut self, filter: TargetFilter<'a>) -> Self { self.filter = Some(filter); self }
1472 pub fn build(self) -> SetDiscoverTargetsParams<'a> {
1473 SetDiscoverTargetsParams {
1474 discover: self.discover,
1475 filter: self.filter,
1476 }
1477 }
1478}
1479
1480impl<'a> SetDiscoverTargetsParams<'a> { pub const METHOD: &'static str = "Target.setDiscoverTargets"; }
1481
1482impl<'a> crate::CdpCommand<'a> for SetDiscoverTargetsParams<'a> {
1483 const METHOD: &'static str = "Target.setDiscoverTargets";
1484 type Response = crate::EmptyReturns;
1485}
1486
1487#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1491#[serde(rename_all = "camelCase")]
1492pub struct SetRemoteLocationsParams<'a> {
1493 locations: Vec<RemoteLocation<'a>>,
1495}
1496
1497impl<'a> SetRemoteLocationsParams<'a> {
1498 pub fn builder(locations: Vec<RemoteLocation<'a>>) -> SetRemoteLocationsParamsBuilder<'a> {
1501 SetRemoteLocationsParamsBuilder {
1502 locations: locations,
1503 }
1504 }
1505 pub fn locations(&self) -> &[RemoteLocation<'a>] { &self.locations }
1507}
1508
1509
1510pub struct SetRemoteLocationsParamsBuilder<'a> {
1511 locations: Vec<RemoteLocation<'a>>,
1512}
1513
1514impl<'a> SetRemoteLocationsParamsBuilder<'a> {
1515 pub fn build(self) -> SetRemoteLocationsParams<'a> {
1516 SetRemoteLocationsParams {
1517 locations: self.locations,
1518 }
1519 }
1520}
1521
1522impl<'a> SetRemoteLocationsParams<'a> { pub const METHOD: &'static str = "Target.setRemoteLocations"; }
1523
1524impl<'a> crate::CdpCommand<'a> for SetRemoteLocationsParams<'a> {
1525 const METHOD: &'static str = "Target.setRemoteLocations";
1526 type Response = crate::EmptyReturns;
1527}
1528
1529#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1533#[serde(rename_all = "camelCase")]
1534pub struct GetDevToolsTargetParams<'a> {
1535 #[serde(rename = "targetId")]
1537 target_id: TargetID<'a>,
1538}
1539
1540impl<'a> GetDevToolsTargetParams<'a> {
1541 pub fn builder(target_id: impl Into<TargetID<'a>>) -> GetDevToolsTargetParamsBuilder<'a> {
1544 GetDevToolsTargetParamsBuilder {
1545 target_id: target_id.into(),
1546 }
1547 }
1548 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
1550}
1551
1552
1553pub struct GetDevToolsTargetParamsBuilder<'a> {
1554 target_id: TargetID<'a>,
1555}
1556
1557impl<'a> GetDevToolsTargetParamsBuilder<'a> {
1558 pub fn build(self) -> GetDevToolsTargetParams<'a> {
1559 GetDevToolsTargetParams {
1560 target_id: self.target_id,
1561 }
1562 }
1563}
1564
1565#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1569#[serde(rename_all = "camelCase")]
1570pub struct GetDevToolsTargetReturns<'a> {
1571 #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
1573 target_id: Option<TargetID<'a>>,
1574}
1575
1576impl<'a> GetDevToolsTargetReturns<'a> {
1577 pub fn builder() -> GetDevToolsTargetReturnsBuilder<'a> {
1579 GetDevToolsTargetReturnsBuilder {
1580 target_id: None,
1581 }
1582 }
1583 pub fn target_id(&self) -> Option<&TargetID<'a>> { self.target_id.as_ref() }
1585}
1586
1587#[derive(Default)]
1588pub struct GetDevToolsTargetReturnsBuilder<'a> {
1589 target_id: Option<TargetID<'a>>,
1590}
1591
1592impl<'a> GetDevToolsTargetReturnsBuilder<'a> {
1593 pub fn target_id(mut self, target_id: impl Into<TargetID<'a>>) -> Self { self.target_id = Some(target_id.into()); self }
1595 pub fn build(self) -> GetDevToolsTargetReturns<'a> {
1596 GetDevToolsTargetReturns {
1597 target_id: self.target_id,
1598 }
1599 }
1600}
1601
1602impl<'a> GetDevToolsTargetParams<'a> { pub const METHOD: &'static str = "Target.getDevToolsTarget"; }
1603
1604impl<'a> crate::CdpCommand<'a> for GetDevToolsTargetParams<'a> {
1605 const METHOD: &'static str = "Target.getDevToolsTarget";
1606 type Response = GetDevToolsTargetReturns<'a>;
1607}
1608
1609#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1612#[serde(rename_all = "camelCase")]
1613pub struct OpenDevToolsParams<'a> {
1614 #[serde(rename = "targetId")]
1616 target_id: TargetID<'a>,
1617 #[serde(skip_serializing_if = "Option::is_none", rename = "panelId")]
1621 panel_id: Option<Cow<'a, str>>,
1622}
1623
1624impl<'a> OpenDevToolsParams<'a> {
1625 pub fn builder(target_id: impl Into<TargetID<'a>>) -> OpenDevToolsParamsBuilder<'a> {
1628 OpenDevToolsParamsBuilder {
1629 target_id: target_id.into(),
1630 panel_id: None,
1631 }
1632 }
1633 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
1635 pub fn panel_id(&self) -> Option<&str> { self.panel_id.as_deref() }
1639}
1640
1641
1642pub struct OpenDevToolsParamsBuilder<'a> {
1643 target_id: TargetID<'a>,
1644 panel_id: Option<Cow<'a, str>>,
1645}
1646
1647impl<'a> OpenDevToolsParamsBuilder<'a> {
1648 pub fn panel_id(mut self, panel_id: impl Into<Cow<'a, str>>) -> Self { self.panel_id = Some(panel_id.into()); self }
1652 pub fn build(self) -> OpenDevToolsParams<'a> {
1653 OpenDevToolsParams {
1654 target_id: self.target_id,
1655 panel_id: self.panel_id,
1656 }
1657 }
1658}
1659
1660#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1663#[serde(rename_all = "camelCase")]
1664pub struct OpenDevToolsReturns<'a> {
1665 #[serde(rename = "targetId")]
1667 target_id: TargetID<'a>,
1668}
1669
1670impl<'a> OpenDevToolsReturns<'a> {
1671 pub fn builder(target_id: impl Into<TargetID<'a>>) -> OpenDevToolsReturnsBuilder<'a> {
1674 OpenDevToolsReturnsBuilder {
1675 target_id: target_id.into(),
1676 }
1677 }
1678 pub fn target_id(&self) -> &TargetID<'a> { &self.target_id }
1680}
1681
1682
1683pub struct OpenDevToolsReturnsBuilder<'a> {
1684 target_id: TargetID<'a>,
1685}
1686
1687impl<'a> OpenDevToolsReturnsBuilder<'a> {
1688 pub fn build(self) -> OpenDevToolsReturns<'a> {
1689 OpenDevToolsReturns {
1690 target_id: self.target_id,
1691 }
1692 }
1693}
1694
1695impl<'a> OpenDevToolsParams<'a> { pub const METHOD: &'static str = "Target.openDevTools"; }
1696
1697impl<'a> crate::CdpCommand<'a> for OpenDevToolsParams<'a> {
1698 const METHOD: &'static str = "Target.openDevTools";
1699 type Response = OpenDevToolsReturns<'a>;
1700}