1use serde::{Deserialize, Serialize};
11
12pub type TargetId = String;
13
14pub type SessionId = String;
16
17#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
18pub struct TargetInfo {
19 #[serde(rename = "targetId")]
20 pub target_id: TargetId,
21 pub r#type: String,
24 pub title: String,
25 pub url: String,
26 pub attached: bool,
28 #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
31 pub parent_id: Option<TargetId>,
32 #[serde(rename = "openerId", default, skip_serializing_if = "Option::is_none")]
34 pub opener_id: Option<TargetId>,
35 #[serde(rename = "canAccessOpener")]
39 pub can_access_opener: bool,
40 #[serde(
44 rename = "openerFrameId",
45 default,
46 skip_serializing_if = "Option::is_none"
47 )]
48 pub opener_frame_id: Option<crate::protocol::page::FrameId>,
49 #[serde(
55 rename = "parentFrameId",
56 default,
57 skip_serializing_if = "Option::is_none"
58 )]
59 pub parent_frame_id: Option<crate::protocol::page::FrameId>,
60 #[serde(
62 rename = "browserContextId",
63 default,
64 skip_serializing_if = "Option::is_none"
65 )]
66 pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
67 #[serde(default, skip_serializing_if = "Option::is_none")]
72 pub subtype: Option<String>,
73 #[serde(
78 rename = "embedderData",
79 default,
80 skip_serializing_if = "Option::is_none"
81 )]
82 pub embedder_data: Option<serde_json::Value>,
83}
84
85#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
89pub struct FilterEntry {
90 #[serde(default, skip_serializing_if = "Option::is_none")]
92 pub exclude: Option<bool>,
93 #[serde(default, skip_serializing_if = "Option::is_none")]
95 pub r#type: Option<String>,
96}
97
98pub type TargetFilter = Vec<FilterEntry>;
107
108#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
110pub struct RemoteLocation {
111 pub host: String,
112 pub port: i64,
113}
114
115#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
119pub enum WindowState {
120 #[serde(rename = "normal")]
122 Normal,
123 #[serde(rename = "minimized")]
125 Minimized,
126 #[serde(rename = "maximized")]
128 Maximized,
129 #[serde(rename = "fullscreen")]
131 Fullscreen,
132 #[serde(untagged)]
136 Unrecognized(String),
137}
138
139#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
143pub struct ActivateTargetParams {
144 #[serde(rename = "targetId")]
145 pub target_id: TargetId,
146}
147
148impl crate::typed::Command for ActivateTargetParams {
149 const METHOD: &'static str = "Target.activateTarget";
150 type Returns = crate::typed::NoReturns;
151}
152
153#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
157pub struct AttachToTargetParams {
158 #[serde(rename = "targetId")]
159 pub target_id: TargetId,
160 #[serde(default, skip_serializing_if = "Option::is_none")]
164 pub flatten: Option<bool>,
165}
166
167#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
169pub struct AttachToTargetReturns {
170 #[serde(rename = "sessionId")]
172 pub session_id: SessionId,
173}
174
175impl crate::typed::Command for AttachToTargetParams {
176 const METHOD: &'static str = "Target.attachToTarget";
177 type Returns = AttachToTargetReturns;
178}
179
180#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
186pub struct AttachToBrowserTargetParams {}
187
188#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
190pub struct AttachToBrowserTargetReturns {
191 #[serde(rename = "sessionId")]
193 pub session_id: SessionId,
194}
195
196impl crate::typed::Command for AttachToBrowserTargetParams {
197 const METHOD: &'static str = "Target.attachToBrowserTarget";
198 type Returns = AttachToBrowserTargetReturns;
199}
200
201#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
205pub struct CloseTargetParams {
206 #[serde(rename = "targetId")]
207 pub target_id: TargetId,
208}
209
210#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
212pub struct CloseTargetReturns {
213 pub success: bool,
218}
219
220impl crate::typed::Command for CloseTargetParams {
221 const METHOD: &'static str = "Target.closeTarget";
222 type Returns = CloseTargetReturns;
223}
224
225#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
236pub struct ExposeDevToolsProtocolParams {
237 #[serde(rename = "targetId")]
238 pub target_id: TargetId,
239 #[serde(
241 rename = "bindingName",
242 default,
243 skip_serializing_if = "Option::is_none"
244 )]
245 pub binding_name: Option<String>,
246 #[serde(
248 rename = "inheritPermissions",
249 default,
250 skip_serializing_if = "Option::is_none"
251 )]
252 pub inherit_permissions: Option<bool>,
253}
254
255impl crate::typed::Command for ExposeDevToolsProtocolParams {
256 const METHOD: &'static str = "Target.exposeDevToolsProtocol";
257 type Returns = crate::typed::NoReturns;
258}
259
260#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
265pub struct CreateBrowserContextParams {
266 #[serde(
270 rename = "disposeOnDetach",
271 default,
272 skip_serializing_if = "Option::is_none"
273 )]
274 pub dispose_on_detach: Option<bool>,
275 #[serde(
279 rename = "proxyServer",
280 default,
281 skip_serializing_if = "Option::is_none"
282 )]
283 pub proxy_server: Option<String>,
284 #[serde(
288 rename = "proxyBypassList",
289 default,
290 skip_serializing_if = "Option::is_none"
291 )]
292 pub proxy_bypass_list: Option<String>,
293 #[serde(
298 rename = "originsWithUniversalNetworkAccess",
299 default,
300 skip_serializing_if = "Option::is_none"
301 )]
302 pub origins_with_universal_network_access: Option<Vec<String>>,
303}
304
305#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
307pub struct CreateBrowserContextReturns {
308 #[serde(rename = "browserContextId")]
310 pub browser_context_id: crate::protocol::browser::BrowserContextId,
311}
312
313impl crate::typed::Command for CreateBrowserContextParams {
314 const METHOD: &'static str = "Target.createBrowserContext";
315 type Returns = CreateBrowserContextReturns;
316}
317
318#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
323pub struct GetBrowserContextsParams {}
324
325#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
327pub struct GetBrowserContextsReturns {
328 #[serde(rename = "browserContextIds")]
330 pub browser_context_ids: Vec<crate::protocol::browser::BrowserContextId>,
331 #[serde(
335 rename = "defaultBrowserContextId",
336 default,
337 skip_serializing_if = "Option::is_none"
338 )]
339 pub default_browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
340}
341
342impl crate::typed::Command for GetBrowserContextsParams {
343 const METHOD: &'static str = "Target.getBrowserContexts";
344 type Returns = GetBrowserContextsReturns;
345}
346
347#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
351pub struct CreateTargetParams {
352 pub url: String,
355 #[serde(default, skip_serializing_if = "Option::is_none")]
360 pub left: Option<i64>,
361 #[serde(default, skip_serializing_if = "Option::is_none")]
365 pub top: Option<i64>,
366 #[serde(default, skip_serializing_if = "Option::is_none")]
368 pub width: Option<i64>,
369 #[serde(default, skip_serializing_if = "Option::is_none")]
371 pub height: Option<i64>,
372 #[serde(
375 rename = "windowState",
376 default,
377 skip_serializing_if = "Option::is_none"
378 )]
379 pub window_state: Option<WindowState>,
380 #[serde(
384 rename = "browserContextId",
385 default,
386 skip_serializing_if = "Option::is_none"
387 )]
388 pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
389 #[serde(
394 rename = "enableBeginFrameControl",
395 default,
396 skip_serializing_if = "Option::is_none"
397 )]
398 pub enable_begin_frame_control: Option<bool>,
399 #[serde(rename = "newWindow", default, skip_serializing_if = "Option::is_none")]
402 pub new_window: Option<bool>,
403 #[serde(default, skip_serializing_if = "Option::is_none")]
406 pub background: Option<bool>,
407 #[serde(rename = "forTab", default, skip_serializing_if = "Option::is_none")]
411 pub for_tab: Option<bool>,
412 #[serde(default, skip_serializing_if = "Option::is_none")]
419 pub hidden: Option<bool>,
420 #[serde(default, skip_serializing_if = "Option::is_none")]
431 pub focus: Option<bool>,
432}
433
434#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
436pub struct CreateTargetReturns {
437 #[serde(rename = "targetId")]
439 pub target_id: TargetId,
440}
441
442impl crate::typed::Command for CreateTargetParams {
443 const METHOD: &'static str = "Target.createTarget";
444 type Returns = CreateTargetReturns;
445}
446
447#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
451pub struct DetachFromTargetParams {
452 #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")]
454 pub session_id: Option<SessionId>,
455 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
459 pub target_id: Option<TargetId>,
460}
461
462impl crate::typed::Command for DetachFromTargetParams {
463 const METHOD: &'static str = "Target.detachFromTarget";
464 type Returns = crate::typed::NoReturns;
465}
466
467#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
472pub struct DisposeBrowserContextParams {
473 #[serde(rename = "browserContextId")]
474 pub browser_context_id: crate::protocol::browser::BrowserContextId,
475}
476
477impl crate::typed::Command for DisposeBrowserContextParams {
478 const METHOD: &'static str = "Target.disposeBrowserContext";
479 type Returns = crate::typed::NoReturns;
480}
481
482#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
488pub struct GetTargetInfoParams {
489 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
490 pub target_id: Option<TargetId>,
491}
492
493#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
495pub struct GetTargetInfoReturns {
496 #[serde(rename = "targetInfo")]
497 pub target_info: TargetInfo,
498}
499
500impl crate::typed::Command for GetTargetInfoParams {
501 const METHOD: &'static str = "Target.getTargetInfo";
502 type Returns = GetTargetInfoReturns;
503}
504
505#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
509pub struct GetTargetsParams {
510 #[serde(default, skip_serializing_if = "Option::is_none")]
516 pub filter: Option<TargetFilter>,
517}
518
519#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
521pub struct GetTargetsReturns {
522 #[serde(rename = "targetInfos")]
524 pub target_infos: Vec<TargetInfo>,
525}
526
527impl crate::typed::Command for GetTargetsParams {
528 const METHOD: &'static str = "Target.getTargets";
529 type Returns = GetTargetsReturns;
530}
531
532#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
540pub struct SendMessageToTargetParams {
541 pub message: String,
542 #[serde(rename = "sessionId", default, skip_serializing_if = "Option::is_none")]
544 pub session_id: Option<SessionId>,
545 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
549 pub target_id: Option<TargetId>,
550}
551
552impl crate::typed::Command for SendMessageToTargetParams {
553 const METHOD: &'static str = "Target.sendMessageToTarget";
554 type Returns = crate::typed::NoReturns;
555}
556
557#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
568pub struct SetAutoAttachParams {
569 #[serde(rename = "autoAttach")]
571 pub auto_attach: bool,
572 #[serde(rename = "waitForDebuggerOnStart")]
575 pub wait_for_debugger_on_start: bool,
576 #[serde(default, skip_serializing_if = "Option::is_none")]
582 pub flatten: Option<bool>,
583 #[serde(default, skip_serializing_if = "Option::is_none")]
587 pub filter: Option<TargetFilter>,
588}
589
590impl crate::typed::Command for SetAutoAttachParams {
591 const METHOD: &'static str = "Target.setAutoAttach";
592 type Returns = crate::typed::NoReturns;
593}
594
595#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
606pub struct AutoAttachRelatedParams {
607 #[serde(rename = "targetId")]
608 pub target_id: TargetId,
609 #[serde(rename = "waitForDebuggerOnStart")]
612 pub wait_for_debugger_on_start: bool,
613 #[serde(default, skip_serializing_if = "Option::is_none")]
617 pub filter: Option<TargetFilter>,
618}
619
620impl crate::typed::Command for AutoAttachRelatedParams {
621 const METHOD: &'static str = "Target.autoAttachRelated";
622 type Returns = crate::typed::NoReturns;
623}
624
625#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
630pub struct SetDiscoverTargetsParams {
631 pub discover: bool,
633 #[serde(default, skip_serializing_if = "Option::is_none")]
638 pub filter: Option<TargetFilter>,
639}
640
641impl crate::typed::Command for SetDiscoverTargetsParams {
642 const METHOD: &'static str = "Target.setDiscoverTargets";
643 type Returns = crate::typed::NoReturns;
644}
645
646#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
653pub struct SetRemoteLocationsParams {
654 pub locations: Vec<RemoteLocation>,
656}
657
658impl crate::typed::Command for SetRemoteLocationsParams {
659 const METHOD: &'static str = "Target.setRemoteLocations";
660 type Returns = crate::typed::NoReturns;
661}
662
663#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
670pub struct GetDevToolsTargetParams {
671 #[serde(rename = "targetId")]
673 pub target_id: TargetId,
674}
675
676#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
678pub struct GetDevToolsTargetReturns {
679 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
681 pub target_id: Option<TargetId>,
682}
683
684impl crate::typed::Command for GetDevToolsTargetParams {
685 const METHOD: &'static str = "Target.getDevToolsTarget";
686 type Returns = GetDevToolsTargetReturns;
687}
688
689#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
695pub struct OpenDevToolsParams {
696 #[serde(rename = "targetId")]
698 pub target_id: TargetId,
699 #[serde(rename = "panelId", default, skip_serializing_if = "Option::is_none")]
703 pub panel_id: Option<String>,
704}
705
706#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
708pub struct OpenDevToolsReturns {
709 #[serde(rename = "targetId")]
711 pub target_id: TargetId,
712}
713
714impl crate::typed::Command for OpenDevToolsParams {
715 const METHOD: &'static str = "Target.openDevTools";
716 type Returns = OpenDevToolsReturns;
717}
718
719#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
726pub struct AttachedToTargetEvent {
727 #[serde(rename = "sessionId")]
729 pub session_id: SessionId,
730 #[serde(rename = "targetInfo")]
731 pub target_info: TargetInfo,
732 #[serde(rename = "waitingForDebugger")]
733 pub waiting_for_debugger: bool,
734}
735
736impl crate::typed::Event for AttachedToTargetEvent {
737 const METHOD: &'static str = "Target.attachedToTarget";
738}
739
740#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
748pub struct DetachedFromTargetEvent {
749 #[serde(rename = "sessionId")]
751 pub session_id: SessionId,
752 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
756 pub target_id: Option<TargetId>,
757}
758
759impl crate::typed::Event for DetachedFromTargetEvent {
760 const METHOD: &'static str = "Target.detachedFromTarget";
761}
762
763#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
768pub struct ReceivedMessageFromTargetEvent {
769 #[serde(rename = "sessionId")]
771 pub session_id: SessionId,
772 pub message: String,
773 #[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
777 pub target_id: Option<TargetId>,
778}
779
780impl crate::typed::Event for ReceivedMessageFromTargetEvent {
781 const METHOD: &'static str = "Target.receivedMessageFromTarget";
782}
783
784#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
788pub struct TargetCreatedEvent {
789 #[serde(rename = "targetInfo")]
790 pub target_info: TargetInfo,
791}
792
793impl crate::typed::Event for TargetCreatedEvent {
794 const METHOD: &'static str = "Target.targetCreated";
795}
796
797#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
801pub struct TargetDestroyedEvent {
802 #[serde(rename = "targetId")]
803 pub target_id: TargetId,
804}
805
806impl crate::typed::Event for TargetDestroyedEvent {
807 const METHOD: &'static str = "Target.targetDestroyed";
808}
809
810#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
814pub struct TargetCrashedEvent {
815 #[serde(rename = "targetId")]
816 pub target_id: TargetId,
817 pub status: String,
819 #[serde(rename = "errorCode")]
821 pub error_code: i64,
822}
823
824impl crate::typed::Event for TargetCrashedEvent {
825 const METHOD: &'static str = "Target.targetCrashed";
826}
827
828#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
833pub struct TargetInfoChangedEvent {
834 #[serde(rename = "targetInfo")]
835 pub target_info: TargetInfo,
836}
837
838impl crate::typed::Event for TargetInfoChangedEvent {
839 const METHOD: &'static str = "Target.targetInfoChanged";
840}