1use serde::{Deserialize, Serialize};
2#[doc = "Activates (focuses) the target.\n[activateTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-activateTarget)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct ActivateTargetParams {
5 #[serde(rename = "targetId")]
6 pub target_id: super::types::TargetId,
7}
8impl ActivateTargetParams {
9 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
10 Self {
11 target_id: target_id.into(),
12 }
13 }
14}
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
16pub enum ActivateTargetMethod {
17 #[serde(rename = "Target.activateTarget")]
18 ActivateTarget,
19}
20#[doc = "Activates (focuses) the target.\n[activateTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-activateTarget)"]
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub struct ActivateTarget {
23 pub method: ActivateTargetMethod,
24 pub params: ActivateTargetParams,
25}
26impl ActivateTarget {
27 pub const IDENTIFIER: &'static str = "Target.activateTarget";
28 pub fn identifier(&self) -> &'static str {
29 Self::IDENTIFIER
30 }
31}
32impl crate::CommandResult for ActivateTarget {
33 type Result = super::results::ActivateTargetResult;
34}
35#[doc = "Attaches to the target with given id.\n[attachToTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget)"]
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
37pub struct AttachToTargetParams {
38 #[serde(rename = "targetId")]
39 pub target_id: super::types::TargetId,
40 #[doc = "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.\nWe plan to make this the default, deprecate non-flattened mode,\nand eventually retire it. See crbug.com/991325."]
41 #[serde(rename = "flatten")]
42 #[serde(skip_serializing_if = "Option::is_none")]
43 #[serde(default)]
44 pub flatten: Option<bool>,
45}
46impl AttachToTargetParams {
47 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
48 Self {
49 target_id: target_id.into(),
50 flatten: None,
51 }
52 }
53}
54#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
55pub enum AttachToTargetMethod {
56 #[serde(rename = "Target.attachToTarget")]
57 AttachToTarget,
58}
59#[doc = "Attaches to the target with given id.\n[attachToTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToTarget)"]
60#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
61pub struct AttachToTarget {
62 pub method: AttachToTargetMethod,
63 pub params: AttachToTargetParams,
64}
65impl AttachToTarget {
66 pub const IDENTIFIER: &'static str = "Target.attachToTarget";
67 pub fn identifier(&self) -> &'static str {
68 Self::IDENTIFIER
69 }
70}
71impl crate::CommandResult for AttachToTarget {
72 type Result = super::results::AttachToTargetResult;
73}
74#[doc = "Attaches to the browser target, only uses flat sessionId mode.\n[attachToBrowserTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToBrowserTarget)"]
75#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
76pub struct AttachToBrowserTargetParams {}
77#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
78pub enum AttachToBrowserTargetMethod {
79 #[serde(rename = "Target.attachToBrowserTarget")]
80 AttachToBrowserTarget,
81}
82#[doc = "Attaches to the browser target, only uses flat sessionId mode.\n[attachToBrowserTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-attachToBrowserTarget)"]
83#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
84pub struct AttachToBrowserTarget {
85 pub method: AttachToBrowserTargetMethod,
86 pub params: AttachToBrowserTargetParams,
87}
88impl AttachToBrowserTarget {
89 pub const IDENTIFIER: &'static str = "Target.attachToBrowserTarget";
90 pub fn identifier(&self) -> &'static str {
91 Self::IDENTIFIER
92 }
93}
94impl crate::CommandResult for AttachToBrowserTarget {
95 type Result = super::results::AttachToBrowserTargetResult;
96}
97#[doc = "Closes the target. If the target is a page that gets closed too.\n[closeTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-closeTarget)"]
98#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
99pub struct CloseTargetParams {
100 #[serde(rename = "targetId")]
101 pub target_id: super::types::TargetId,
102}
103impl CloseTargetParams {
104 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
105 Self {
106 target_id: target_id.into(),
107 }
108 }
109}
110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
111pub enum CloseTargetMethod {
112 #[serde(rename = "Target.closeTarget")]
113 CloseTarget,
114}
115#[doc = "Closes the target. If the target is a page that gets closed too.\n[closeTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-closeTarget)"]
116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
117pub struct CloseTarget {
118 pub method: CloseTargetMethod,
119 pub params: CloseTargetParams,
120}
121impl CloseTarget {
122 pub const IDENTIFIER: &'static str = "Target.closeTarget";
123 pub fn identifier(&self) -> &'static str {
124 Self::IDENTIFIER
125 }
126}
127impl crate::CommandResult for CloseTarget {
128 type Result = super::results::CloseTargetResult;
129}
130#[doc = "Inject object to the target's main frame that provides a communication\nchannel with browser target.\n\nInjected object will be available as `window[bindingName]`.\n\nThe object has the following API:\n- `binding.send(json)` - a method to send messages over the remote debugging protocol\n- `binding.onmessage = json => handleMessage(json)` - a callback that will be called for the protocol notifications and command responses.\n[exposeDevToolsProtocol](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-exposeDevToolsProtocol)"]
131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
132pub struct ExposeDevToolsProtocolParams {
133 #[serde(rename = "targetId")]
134 pub target_id: super::types::TargetId,
135 #[doc = "Binding name, 'cdp' if not specified."]
136 #[serde(rename = "bindingName")]
137 #[serde(skip_serializing_if = "Option::is_none")]
138 #[serde(default)]
139 pub binding_name: Option<String>,
140 #[doc = "If true, inherits the current root session's permissions (default: false)."]
141 #[serde(rename = "inheritPermissions")]
142 #[serde(skip_serializing_if = "Option::is_none")]
143 #[serde(default)]
144 pub inherit_permissions: Option<bool>,
145}
146impl ExposeDevToolsProtocolParams {
147 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
148 Self {
149 target_id: target_id.into(),
150 binding_name: None,
151 inherit_permissions: None,
152 }
153 }
154}
155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
156pub enum ExposeDevToolsProtocolMethod {
157 #[serde(rename = "Target.exposeDevToolsProtocol")]
158 ExposeDevToolsProtocol,
159}
160#[doc = "Inject object to the target's main frame that provides a communication\nchannel with browser target.\n\nInjected object will be available as `window[bindingName]`.\n\nThe object has the following API:\n- `binding.send(json)` - a method to send messages over the remote debugging protocol\n- `binding.onmessage = json => handleMessage(json)` - a callback that will be called for the protocol notifications and command responses.\n[exposeDevToolsProtocol](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-exposeDevToolsProtocol)"]
161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
162pub struct ExposeDevToolsProtocol {
163 pub method: ExposeDevToolsProtocolMethod,
164 pub params: ExposeDevToolsProtocolParams,
165}
166impl ExposeDevToolsProtocol {
167 pub const IDENTIFIER: &'static str = "Target.exposeDevToolsProtocol";
168 pub fn identifier(&self) -> &'static str {
169 Self::IDENTIFIER
170 }
171}
172impl crate::CommandResult for ExposeDevToolsProtocol {
173 type Result = super::results::ExposeDevToolsProtocolResult;
174}
175#[doc = "Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than\none.\n[createBrowserContext](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext)"]
176#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
177pub struct CreateBrowserContextParams {
178 #[doc = "If specified, disposes this context when debugging session disconnects."]
179 #[serde(rename = "disposeOnDetach")]
180 #[serde(skip_serializing_if = "Option::is_none")]
181 #[serde(default)]
182 pub dispose_on_detach: Option<bool>,
183 #[doc = "Proxy server, similar to the one passed to --proxy-server"]
184 #[serde(rename = "proxyServer")]
185 #[serde(skip_serializing_if = "Option::is_none")]
186 #[serde(default)]
187 pub proxy_server: Option<String>,
188 #[doc = "Proxy bypass list, similar to the one passed to --proxy-bypass-list"]
189 #[serde(rename = "proxyBypassList")]
190 #[serde(skip_serializing_if = "Option::is_none")]
191 #[serde(default)]
192 pub proxy_bypass_list: Option<String>,
193 #[doc = "An optional list of origins to grant unlimited cross-origin access to.\nParts of the URL other than those constituting origin are ignored."]
194 #[serde(rename = "originsWithUniversalNetworkAccess")]
195 #[serde(skip_serializing_if = "Option::is_none")]
196 #[serde(default)]
197 pub origins_with_universal_network_access: Option<Vec<String>>,
198}
199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
200pub enum CreateBrowserContextMethod {
201 #[serde(rename = "Target.createBrowserContext")]
202 CreateBrowserContext,
203}
204#[doc = "Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than\none.\n[createBrowserContext](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext)"]
205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
206pub struct CreateBrowserContext {
207 pub method: CreateBrowserContextMethod,
208 pub params: CreateBrowserContextParams,
209}
210impl CreateBrowserContext {
211 pub const IDENTIFIER: &'static str = "Target.createBrowserContext";
212 pub fn identifier(&self) -> &'static str {
213 Self::IDENTIFIER
214 }
215}
216impl crate::CommandResult for CreateBrowserContext {
217 type Result = super::results::CreateBrowserContextResult;
218}
219#[doc = "Returns all browser contexts created with `Target.createBrowserContext` method.\n[getBrowserContexts](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getBrowserContexts)"]
220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
221pub struct GetBrowserContextsParams {}
222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
223pub enum GetBrowserContextsMethod {
224 #[serde(rename = "Target.getBrowserContexts")]
225 GetBrowserContexts,
226}
227#[doc = "Returns all browser contexts created with `Target.createBrowserContext` method.\n[getBrowserContexts](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getBrowserContexts)"]
228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
229pub struct GetBrowserContexts {
230 pub method: GetBrowserContextsMethod,
231 pub params: GetBrowserContextsParams,
232}
233impl GetBrowserContexts {
234 pub const IDENTIFIER: &'static str = "Target.getBrowserContexts";
235 pub fn identifier(&self) -> &'static str {
236 Self::IDENTIFIER
237 }
238}
239impl crate::CommandResult for GetBrowserContexts {
240 type Result = super::results::GetBrowserContextsResult;
241}
242#[doc = "Creates a new page.\n[createTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createTarget)"]
243#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
244pub struct CreateTargetParams {
245 #[doc = "The initial URL the page will be navigated to. An empty string indicates about:blank."]
246 #[serde(rename = "url")]
247 pub url: String,
248 #[doc = "Frame left origin in DIP (requires newWindow to be true or headless shell)."]
249 #[serde(rename = "left")]
250 #[serde(skip_serializing_if = "Option::is_none")]
251 #[serde(default)]
252 pub left: Option<i64>,
253 #[doc = "Frame top origin in DIP (requires newWindow to be true or headless shell)."]
254 #[serde(rename = "top")]
255 #[serde(skip_serializing_if = "Option::is_none")]
256 #[serde(default)]
257 pub top: Option<i64>,
258 #[doc = "Frame width in DIP (requires newWindow to be true or headless shell)."]
259 #[serde(rename = "width")]
260 #[serde(skip_serializing_if = "Option::is_none")]
261 #[serde(default)]
262 pub width: Option<i64>,
263 #[doc = "Frame height in DIP (requires newWindow to be true or headless shell)."]
264 #[serde(rename = "height")]
265 #[serde(skip_serializing_if = "Option::is_none")]
266 #[serde(default)]
267 pub height: Option<i64>,
268 #[doc = "Frame window state (requires newWindow to be true or headless shell).\nDefault is normal."]
269 #[serde(rename = "windowState")]
270 #[serde(skip_serializing_if = "Option::is_none")]
271 #[serde(default)]
272 pub window_state: Option<super::types::WindowState>,
273 #[doc = "The browser context to create the page in."]
274 #[serde(rename = "browserContextId")]
275 #[serde(skip_serializing_if = "Option::is_none")]
276 #[serde(default)]
277 pub browser_context_id: Option<crate::browser_protocol::browser::types::BrowserContextId>,
278 #[doc = "Whether BeginFrames for this target will be controlled via DevTools (headless shell only,\nnot supported on MacOS yet, false by default)."]
279 #[serde(rename = "enableBeginFrameControl")]
280 #[serde(skip_serializing_if = "Option::is_none")]
281 #[serde(default)]
282 pub enable_begin_frame_control: Option<bool>,
283 #[doc = "Whether to create a new Window or Tab (false by default, not supported by headless shell)."]
284 #[serde(rename = "newWindow")]
285 #[serde(skip_serializing_if = "Option::is_none")]
286 #[serde(default)]
287 pub new_window: Option<bool>,
288 #[doc = "Whether to create the target in background or foreground (false by default, not supported\nby headless shell)."]
289 #[serde(rename = "background")]
290 #[serde(skip_serializing_if = "Option::is_none")]
291 #[serde(default)]
292 pub background: Option<bool>,
293 #[doc = "Whether to create the target of type \"tab\"."]
294 #[serde(rename = "forTab")]
295 #[serde(skip_serializing_if = "Option::is_none")]
296 #[serde(default)]
297 pub for_tab: Option<bool>,
298 #[doc = "Whether to create a hidden target. The hidden target is observable via protocol, but not\npresent in the tab UI strip. Cannot be created with `forTab: true`, `newWindow: true` or\n`background: false`. The life-time of the tab is limited to the life-time of the session."]
299 #[serde(rename = "hidden")]
300 #[serde(skip_serializing_if = "Option::is_none")]
301 #[serde(default)]
302 pub hidden: Option<bool>,
303 #[doc = "If specified, the option is used to determine if the new target should\nbe focused or not. By default, the focus behavior depends on the\nvalue of the background field. For example, background=false and focus=false\nwill result in the target tab being opened but the browser window remain\nunchanged (if it was in the background, it will remain in the background)\nand background=false with focus=undefined will result in the window being focused.\nUsing background: true and focus: true is not supported and will result in an error."]
304 #[serde(rename = "focus")]
305 #[serde(skip_serializing_if = "Option::is_none")]
306 #[serde(default)]
307 pub focus: Option<bool>,
308}
309impl CreateTargetParams {
310 pub fn new(url: impl Into<String>) -> Self {
311 Self {
312 url: url.into(),
313 left: None,
314 top: None,
315 width: None,
316 height: None,
317 window_state: None,
318 browser_context_id: None,
319 enable_begin_frame_control: None,
320 new_window: None,
321 background: None,
322 for_tab: None,
323 hidden: None,
324 focus: None,
325 }
326 }
327}
328impl<T: Into<String>> From<T> for CreateTargetParams {
329 fn from(url: T) -> Self {
330 CreateTargetParams::new(url)
331 }
332}
333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
334pub enum CreateTargetMethod {
335 #[serde(rename = "Target.createTarget")]
336 CreateTarget,
337}
338#[doc = "Creates a new page.\n[createTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createTarget)"]
339#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
340pub struct CreateTarget {
341 pub method: CreateTargetMethod,
342 pub params: CreateTargetParams,
343}
344impl CreateTarget {
345 pub const IDENTIFIER: &'static str = "Target.createTarget";
346 pub fn identifier(&self) -> &'static str {
347 Self::IDENTIFIER
348 }
349}
350impl crate::CommandResult for CreateTarget {
351 type Result = super::results::CreateTargetResult;
352}
353#[doc = "Detaches session with given id.\n[detachFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-detachFromTarget)"]
354#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
355pub struct DetachFromTargetParams {
356 #[doc = "Session to detach."]
357 #[serde(rename = "sessionId")]
358 #[serde(skip_serializing_if = "Option::is_none")]
359 #[serde(default)]
360 pub session_id: Option<super::types::SessionId>,
361}
362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
363pub enum DetachFromTargetMethod {
364 #[serde(rename = "Target.detachFromTarget")]
365 DetachFromTarget,
366}
367#[doc = "Detaches session with given id.\n[detachFromTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-detachFromTarget)"]
368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
369pub struct DetachFromTarget {
370 pub method: DetachFromTargetMethod,
371 pub params: DetachFromTargetParams,
372}
373impl DetachFromTarget {
374 pub const IDENTIFIER: &'static str = "Target.detachFromTarget";
375 pub fn identifier(&self) -> &'static str {
376 Self::IDENTIFIER
377 }
378}
379impl crate::CommandResult for DetachFromTarget {
380 type Result = super::results::DetachFromTargetResult;
381}
382#[doc = "Deletes a BrowserContext. All the belonging pages will be closed without calling their\nbeforeunload hooks.\n[disposeBrowserContext](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-disposeBrowserContext)"]
383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
384pub struct DisposeBrowserContextParams {
385 #[serde(rename = "browserContextId")]
386 pub browser_context_id: crate::browser_protocol::browser::types::BrowserContextId,
387}
388impl DisposeBrowserContextParams {
389 pub fn new(
390 browser_context_id: impl Into<crate::browser_protocol::browser::types::BrowserContextId>,
391 ) -> Self {
392 Self {
393 browser_context_id: browser_context_id.into(),
394 }
395 }
396}
397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
398pub enum DisposeBrowserContextMethod {
399 #[serde(rename = "Target.disposeBrowserContext")]
400 DisposeBrowserContext,
401}
402#[doc = "Deletes a BrowserContext. All the belonging pages will be closed without calling their\nbeforeunload hooks.\n[disposeBrowserContext](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-disposeBrowserContext)"]
403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
404pub struct DisposeBrowserContext {
405 pub method: DisposeBrowserContextMethod,
406 pub params: DisposeBrowserContextParams,
407}
408impl DisposeBrowserContext {
409 pub const IDENTIFIER: &'static str = "Target.disposeBrowserContext";
410 pub fn identifier(&self) -> &'static str {
411 Self::IDENTIFIER
412 }
413}
414impl crate::CommandResult for DisposeBrowserContext {
415 type Result = super::results::DisposeBrowserContextResult;
416}
417#[doc = "Returns information about a target.\n[getTargetInfo](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getTargetInfo)"]
418#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
419pub struct GetTargetInfoParams {
420 #[serde(rename = "targetId")]
421 #[serde(skip_serializing_if = "Option::is_none")]
422 #[serde(default)]
423 pub target_id: Option<super::types::TargetId>,
424}
425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
426pub enum GetTargetInfoMethod {
427 #[serde(rename = "Target.getTargetInfo")]
428 GetTargetInfo,
429}
430#[doc = "Returns information about a target.\n[getTargetInfo](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getTargetInfo)"]
431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
432pub struct GetTargetInfo {
433 pub method: GetTargetInfoMethod,
434 pub params: GetTargetInfoParams,
435}
436impl GetTargetInfo {
437 pub const IDENTIFIER: &'static str = "Target.getTargetInfo";
438 pub fn identifier(&self) -> &'static str {
439 Self::IDENTIFIER
440 }
441}
442impl crate::CommandResult for GetTargetInfo {
443 type Result = super::results::GetTargetInfoResult;
444}
445#[doc = "Retrieves a list of available targets.\n[getTargets](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getTargets)"]
446#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
447pub struct GetTargetsParams {
448 #[doc = "Only targets matching filter will be reported. If filter is not specified\nand target discovery is currently enabled, a filter used for target discovery\nis used for consistency."]
449 #[serde(rename = "filter")]
450 #[serde(skip_serializing_if = "Option::is_none")]
451 #[serde(default)]
452 pub filter: Option<super::types::TargetFilter>,
453}
454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
455pub enum GetTargetsMethod {
456 #[serde(rename = "Target.getTargets")]
457 GetTargets,
458}
459#[doc = "Retrieves a list of available targets.\n[getTargets](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getTargets)"]
460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
461pub struct GetTargets {
462 pub method: GetTargetsMethod,
463 pub params: GetTargetsParams,
464}
465impl GetTargets {
466 pub const IDENTIFIER: &'static str = "Target.getTargets";
467 pub fn identifier(&self) -> &'static str {
468 Self::IDENTIFIER
469 }
470}
471impl crate::CommandResult for GetTargets {
472 type Result = super::results::GetTargetsResult;
473}
474#[doc = "Controls whether to automatically attach to new targets which are considered\nto be directly related to this one (for example, iframes or workers).\nWhen turned on, attaches to all existing related targets as well. When turned off,\nautomatically detaches from all currently attached targets.\nThis also clears all targets added by `autoAttachRelated` from the list of targets to watch\nfor creation of related targets.\nYou might want to call this recursively for auto-attached targets to attach\nto all available targets.\n[setAutoAttach](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setAutoAttach)"]
475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
476pub struct SetAutoAttachParams {
477 #[doc = "Whether to auto-attach to related targets."]
478 #[serde(rename = "autoAttach")]
479 pub auto_attach: bool,
480 #[doc = "Whether to pause new targets when attaching to them. Use `Runtime.runIfWaitingForDebugger`\nto run paused targets."]
481 #[serde(rename = "waitForDebuggerOnStart")]
482 pub wait_for_debugger_on_start: bool,
483 #[doc = "Enables \"flat\" access to the session via specifying sessionId attribute in the commands.\nWe plan to make this the default, deprecate non-flattened mode,\nand eventually retire it. See crbug.com/991325."]
484 #[serde(rename = "flatten")]
485 #[serde(skip_serializing_if = "Option::is_none")]
486 #[serde(default)]
487 pub flatten: Option<bool>,
488 #[doc = "Only targets matching filter will be attached."]
489 #[serde(rename = "filter")]
490 #[serde(skip_serializing_if = "Option::is_none")]
491 #[serde(default)]
492 pub filter: Option<super::types::TargetFilter>,
493}
494impl SetAutoAttachParams {
495 pub fn new(auto_attach: impl Into<bool>, wait_for_debugger_on_start: impl Into<bool>) -> Self {
496 Self {
497 auto_attach: auto_attach.into(),
498 wait_for_debugger_on_start: wait_for_debugger_on_start.into(),
499 flatten: None,
500 filter: None,
501 }
502 }
503}
504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
505pub enum SetAutoAttachMethod {
506 #[serde(rename = "Target.setAutoAttach")]
507 SetAutoAttach,
508}
509#[doc = "Controls whether to automatically attach to new targets which are considered\nto be directly related to this one (for example, iframes or workers).\nWhen turned on, attaches to all existing related targets as well. When turned off,\nautomatically detaches from all currently attached targets.\nThis also clears all targets added by `autoAttachRelated` from the list of targets to watch\nfor creation of related targets.\nYou might want to call this recursively for auto-attached targets to attach\nto all available targets.\n[setAutoAttach](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setAutoAttach)"]
510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
511pub struct SetAutoAttach {
512 pub method: SetAutoAttachMethod,
513 pub params: SetAutoAttachParams,
514}
515impl SetAutoAttach {
516 pub const IDENTIFIER: &'static str = "Target.setAutoAttach";
517 pub fn identifier(&self) -> &'static str {
518 Self::IDENTIFIER
519 }
520}
521impl crate::CommandResult for SetAutoAttach {
522 type Result = super::results::SetAutoAttachResult;
523}
524#[doc = "Adds the specified target to the list of targets that will be monitored for any related target\ncreation (such as child frames, child workers and new versions of service worker) and reported\nthrough `attachedToTarget`. The specified target is also auto-attached.\nThis cancels the effect of any previous `setAutoAttach` and is also cancelled by subsequent\n`setAutoAttach`. Only available at the Browser target.\n[autoAttachRelated](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-autoAttachRelated)"]
525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
526pub struct AutoAttachRelatedParams {
527 #[serde(rename = "targetId")]
528 pub target_id: super::types::TargetId,
529 #[doc = "Whether to pause new targets when attaching to them. Use `Runtime.runIfWaitingForDebugger`\nto run paused targets."]
530 #[serde(rename = "waitForDebuggerOnStart")]
531 pub wait_for_debugger_on_start: bool,
532 #[doc = "Only targets matching filter will be attached."]
533 #[serde(rename = "filter")]
534 #[serde(skip_serializing_if = "Option::is_none")]
535 #[serde(default)]
536 pub filter: Option<super::types::TargetFilter>,
537}
538impl AutoAttachRelatedParams {
539 pub fn new(
540 target_id: impl Into<super::types::TargetId>,
541 wait_for_debugger_on_start: impl Into<bool>,
542 ) -> Self {
543 Self {
544 target_id: target_id.into(),
545 wait_for_debugger_on_start: wait_for_debugger_on_start.into(),
546 filter: None,
547 }
548 }
549}
550#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
551pub enum AutoAttachRelatedMethod {
552 #[serde(rename = "Target.autoAttachRelated")]
553 AutoAttachRelated,
554}
555#[doc = "Adds the specified target to the list of targets that will be monitored for any related target\ncreation (such as child frames, child workers and new versions of service worker) and reported\nthrough `attachedToTarget`. The specified target is also auto-attached.\nThis cancels the effect of any previous `setAutoAttach` and is also cancelled by subsequent\n`setAutoAttach`. Only available at the Browser target.\n[autoAttachRelated](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-autoAttachRelated)"]
556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
557pub struct AutoAttachRelated {
558 pub method: AutoAttachRelatedMethod,
559 pub params: AutoAttachRelatedParams,
560}
561impl AutoAttachRelated {
562 pub const IDENTIFIER: &'static str = "Target.autoAttachRelated";
563 pub fn identifier(&self) -> &'static str {
564 Self::IDENTIFIER
565 }
566}
567impl crate::CommandResult for AutoAttachRelated {
568 type Result = super::results::AutoAttachRelatedResult;
569}
570#[doc = "Controls whether to discover available targets and notify via\n`targetCreated/targetInfoChanged/targetDestroyed` events.\n[setDiscoverTargets](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setDiscoverTargets)"]
571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
572pub struct SetDiscoverTargetsParams {
573 #[doc = "Whether to discover available targets."]
574 #[serde(rename = "discover")]
575 pub discover: bool,
576 #[doc = "Only targets matching filter will be attached. If `discover` is false,\n`filter` must be omitted or empty."]
577 #[serde(rename = "filter")]
578 #[serde(skip_serializing_if = "Option::is_none")]
579 #[serde(default)]
580 pub filter: Option<super::types::TargetFilter>,
581}
582impl SetDiscoverTargetsParams {
583 pub fn new(discover: impl Into<bool>) -> Self {
584 Self {
585 discover: discover.into(),
586 filter: None,
587 }
588 }
589}
590#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
591pub enum SetDiscoverTargetsMethod {
592 #[serde(rename = "Target.setDiscoverTargets")]
593 SetDiscoverTargets,
594}
595#[doc = "Controls whether to discover available targets and notify via\n`targetCreated/targetInfoChanged/targetDestroyed` events.\n[setDiscoverTargets](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setDiscoverTargets)"]
596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
597pub struct SetDiscoverTargets {
598 pub method: SetDiscoverTargetsMethod,
599 pub params: SetDiscoverTargetsParams,
600}
601impl SetDiscoverTargets {
602 pub const IDENTIFIER: &'static str = "Target.setDiscoverTargets";
603 pub fn identifier(&self) -> &'static str {
604 Self::IDENTIFIER
605 }
606}
607impl crate::CommandResult for SetDiscoverTargets {
608 type Result = super::results::SetDiscoverTargetsResult;
609}
610#[doc = "Enables target discovery for the specified locations, when `setDiscoverTargets` was set to\n`true`.\n[setRemoteLocations](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setRemoteLocations)"]
611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
612pub struct SetRemoteLocationsParams {
613 #[doc = "List of remote locations."]
614 #[serde(rename = "locations")]
615 #[serde(skip_serializing_if = "Vec::is_empty")]
616 pub locations: Vec<super::types::RemoteLocation>,
617}
618impl SetRemoteLocationsParams {
619 pub fn new(locations: Vec<super::types::RemoteLocation>) -> Self {
620 Self { locations }
621 }
622}
623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
624pub enum SetRemoteLocationsMethod {
625 #[serde(rename = "Target.setRemoteLocations")]
626 SetRemoteLocations,
627}
628#[doc = "Enables target discovery for the specified locations, when `setDiscoverTargets` was set to\n`true`.\n[setRemoteLocations](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-setRemoteLocations)"]
629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
630pub struct SetRemoteLocations {
631 pub method: SetRemoteLocationsMethod,
632 pub params: SetRemoteLocationsParams,
633}
634impl SetRemoteLocations {
635 pub const IDENTIFIER: &'static str = "Target.setRemoteLocations";
636 pub fn identifier(&self) -> &'static str {
637 Self::IDENTIFIER
638 }
639}
640impl crate::CommandResult for SetRemoteLocations {
641 type Result = super::results::SetRemoteLocationsResult;
642}
643#[doc = "Gets the targetId of the DevTools page target opened for the given target\n(if any).\n[getDevToolsTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getDevToolsTarget)"]
644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
645pub struct GetDevToolsTargetParams {
646 #[doc = "Page or tab target ID."]
647 #[serde(rename = "targetId")]
648 pub target_id: super::types::TargetId,
649}
650impl GetDevToolsTargetParams {
651 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
652 Self {
653 target_id: target_id.into(),
654 }
655 }
656}
657#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
658pub enum GetDevToolsTargetMethod {
659 #[serde(rename = "Target.getDevToolsTarget")]
660 GetDevToolsTarget,
661}
662#[doc = "Gets the targetId of the DevTools page target opened for the given target\n(if any).\n[getDevToolsTarget](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-getDevToolsTarget)"]
663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
664pub struct GetDevToolsTarget {
665 pub method: GetDevToolsTargetMethod,
666 pub params: GetDevToolsTargetParams,
667}
668impl GetDevToolsTarget {
669 pub const IDENTIFIER: &'static str = "Target.getDevToolsTarget";
670 pub fn identifier(&self) -> &'static str {
671 Self::IDENTIFIER
672 }
673}
674impl crate::CommandResult for GetDevToolsTarget {
675 type Result = super::results::GetDevToolsTargetResult;
676}
677#[doc = "Opens a DevTools window for the target.\n[openDevTools](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-openDevTools)"]
678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
679pub struct OpenDevToolsParams {
680 #[doc = "This can be the page or tab target ID."]
681 #[serde(rename = "targetId")]
682 pub target_id: super::types::TargetId,
683 #[doc = "The id of the panel we want DevTools to open initially. Currently\nsupported panels are elements, console, network, sources, resources\nand performance."]
684 #[serde(rename = "panelId")]
685 #[serde(skip_serializing_if = "Option::is_none")]
686 #[serde(default)]
687 pub panel_id: Option<String>,
688}
689impl OpenDevToolsParams {
690 pub fn new(target_id: impl Into<super::types::TargetId>) -> Self {
691 Self {
692 target_id: target_id.into(),
693 panel_id: None,
694 }
695 }
696}
697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
698pub enum OpenDevToolsMethod {
699 #[serde(rename = "Target.openDevTools")]
700 OpenDevTools,
701}
702#[doc = "Opens a DevTools window for the target.\n[openDevTools](https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-openDevTools)"]
703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
704pub struct OpenDevTools {
705 pub method: OpenDevToolsMethod,
706 pub params: OpenDevToolsParams,
707}
708impl OpenDevTools {
709 pub const IDENTIFIER: &'static str = "Target.openDevTools";
710 pub fn identifier(&self) -> &'static str {
711 Self::IDENTIFIER
712 }
713}
714impl crate::CommandResult for OpenDevTools {
715 type Result = super::results::OpenDevToolsResult;
716}
717group_enum ! (TargetCommands { ActivateTarget (ActivateTarget) , AttachToTarget (AttachToTarget) , AttachToBrowserTarget (AttachToBrowserTarget) , CloseTarget (CloseTarget) , ExposeDevToolsProtocol (ExposeDevToolsProtocol) , CreateBrowserContext (CreateBrowserContext) , GetBrowserContexts (GetBrowserContexts) , CreateTarget (CreateTarget) , DetachFromTarget (DetachFromTarget) , DisposeBrowserContext (DisposeBrowserContext) , GetTargetInfo (GetTargetInfo) , GetTargets (GetTargets) , SetAutoAttach (SetAutoAttach) , AutoAttachRelated (AutoAttachRelated) , SetDiscoverTargets (SetDiscoverTargets) , SetRemoteLocations (SetRemoteLocations) , GetDevToolsTarget (GetDevToolsTarget) , OpenDevTools (OpenDevTools) } + identifiable);