1use super::browser;
3use super::page;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use serde::{Deserialize, Serialize};
8#[allow(unused_imports)]
9use serde_json::Value as Json;
10pub type TargetId = String;
11pub type SessionId = String;
12pub type TargetFilter = Vec<FilterEntry>;
13#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
14pub enum WindowState {
15 #[serde(rename = "normal")]
16 Normal,
17 #[serde(rename = "minimized")]
18 Minimized,
19 #[serde(rename = "maximized")]
20 Maximized,
21 #[serde(rename = "fullscreen")]
22 Fullscreen,
23}
24#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
25pub struct TargetInfo {
26 #[serde(rename = "targetId")]
27 pub target_id: TargetId,
28 #[serde(default)]
29 #[serde(rename = "type")]
30 pub r#type: String,
31 #[serde(default)]
32 #[serde(rename = "title")]
33 pub title: String,
34 #[serde(default)]
35 #[serde(rename = "url")]
36 pub url: String,
37 #[serde(default)]
38 #[serde(rename = "attached")]
39 pub attached: bool,
40 #[serde(skip_serializing_if = "Option::is_none")]
41 #[serde(rename = "openerId")]
42 pub opener_id: Option<TargetId>,
43 #[serde(default)]
44 #[serde(rename = "canAccessOpener")]
45 pub can_access_opener: bool,
46 #[serde(skip_serializing_if = "Option::is_none")]
47 #[serde(rename = "openerFrameId")]
48 pub opener_frame_id: Option<page::FrameId>,
49 #[serde(skip_serializing_if = "Option::is_none")]
50 #[serde(rename = "parentFrameId")]
51 pub parent_frame_id: Option<page::FrameId>,
52 #[serde(skip_serializing_if = "Option::is_none")]
53 #[serde(rename = "browserContextId")]
54 pub browser_context_id: Option<browser::BrowserContextId>,
55 #[serde(skip_serializing_if = "Option::is_none")]
56 #[serde(default)]
57 #[serde(rename = "subtype")]
58 pub subtype: Option<String>,
59}
60#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
61pub struct FilterEntry {
62 #[serde(skip_serializing_if = "Option::is_none")]
63 #[serde(default)]
64 #[serde(rename = "exclude")]
65 pub exclude: Option<bool>,
66 #[serde(skip_serializing_if = "Option::is_none")]
67 #[serde(default)]
68 #[serde(rename = "type")]
69 pub r#type: Option<String>,
70}
71#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
72pub struct RemoteLocation {
73 #[serde(default)]
74 #[serde(rename = "host")]
75 pub host: String,
76 #[serde(default)]
77 #[serde(rename = "port")]
78 pub port: JsUInt,
79}
80#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
81pub struct ActivateTarget {
82 #[serde(rename = "targetId")]
83 pub target_id: TargetId,
84}
85#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
86pub struct AttachToTarget {
87 #[serde(rename = "targetId")]
88 pub target_id: TargetId,
89 #[serde(skip_serializing_if = "Option::is_none")]
90 #[serde(default)]
91 #[serde(rename = "flatten")]
92 pub flatten: Option<bool>,
93}
94#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
95#[serde(rename_all = "camelCase")]
96pub struct AttachToBrowserTarget(pub Option<serde_json::Value>);
97#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
98pub struct CloseTarget {
99 #[serde(rename = "targetId")]
100 pub target_id: TargetId,
101}
102#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
103pub struct ExposeDevToolsProtocol {
104 #[serde(rename = "targetId")]
105 pub target_id: TargetId,
106 #[serde(skip_serializing_if = "Option::is_none")]
107 #[serde(default)]
108 #[serde(rename = "bindingName")]
109 pub binding_name: Option<String>,
110 #[serde(skip_serializing_if = "Option::is_none")]
111 #[serde(default)]
112 #[serde(rename = "inheritPermissions")]
113 pub inherit_permissions: Option<bool>,
114}
115#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
116pub struct CreateBrowserContext {
117 #[serde(skip_serializing_if = "Option::is_none")]
118 #[serde(default)]
119 #[serde(rename = "disposeOnDetach")]
120 pub dispose_on_detach: Option<bool>,
121 #[serde(skip_serializing_if = "Option::is_none")]
122 #[serde(default)]
123 #[serde(rename = "proxyServer")]
124 pub proxy_server: Option<String>,
125 #[serde(skip_serializing_if = "Option::is_none")]
126 #[serde(default)]
127 #[serde(rename = "proxyBypassList")]
128 pub proxy_bypass_list: Option<String>,
129 #[serde(skip_serializing_if = "Option::is_none")]
130 #[serde(default)]
131 #[serde(rename = "originsWithUniversalNetworkAccess")]
132 pub origins_with_universal_network_access: Option<Vec<String>>,
133}
134#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
135#[serde(rename_all = "camelCase")]
136pub struct GetBrowserContexts(pub Option<serde_json::Value>);
137#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
138pub struct CreateTarget {
139 #[serde(default)]
140 #[serde(rename = "url")]
141 pub url: String,
142 #[serde(skip_serializing_if = "Option::is_none")]
143 #[serde(default)]
144 #[serde(rename = "left")]
145 pub left: Option<JsUInt>,
146 #[serde(skip_serializing_if = "Option::is_none")]
147 #[serde(default)]
148 #[serde(rename = "top")]
149 pub top: Option<JsUInt>,
150 #[serde(skip_serializing_if = "Option::is_none")]
151 #[serde(default)]
152 #[serde(rename = "width")]
153 pub width: Option<JsUInt>,
154 #[serde(skip_serializing_if = "Option::is_none")]
155 #[serde(default)]
156 #[serde(rename = "height")]
157 pub height: Option<JsUInt>,
158 #[serde(skip_serializing_if = "Option::is_none")]
159 #[serde(rename = "windowState")]
160 pub window_state: Option<WindowState>,
161 #[serde(skip_serializing_if = "Option::is_none")]
162 #[serde(rename = "browserContextId")]
163 pub browser_context_id: Option<browser::BrowserContextId>,
164 #[serde(skip_serializing_if = "Option::is_none")]
165 #[serde(default)]
166 #[serde(rename = "enableBeginFrameControl")]
167 pub enable_begin_frame_control: Option<bool>,
168 #[serde(skip_serializing_if = "Option::is_none")]
169 #[serde(default)]
170 #[serde(rename = "newWindow")]
171 pub new_window: Option<bool>,
172 #[serde(skip_serializing_if = "Option::is_none")]
173 #[serde(default)]
174 #[serde(rename = "background")]
175 pub background: Option<bool>,
176 #[serde(skip_serializing_if = "Option::is_none")]
177 #[serde(default)]
178 #[serde(rename = "forTab")]
179 pub for_tab: Option<bool>,
180 #[serde(skip_serializing_if = "Option::is_none")]
181 #[serde(default)]
182 #[serde(rename = "hidden")]
183 pub hidden: Option<bool>,
184}
185#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
186pub struct DetachFromTarget {
187 #[serde(skip_serializing_if = "Option::is_none")]
188 #[serde(rename = "sessionId")]
189 pub session_id: Option<SessionId>,
190 #[serde(skip_serializing_if = "Option::is_none")]
191 #[serde(rename = "targetId")]
192 pub target_id: Option<TargetId>,
193}
194#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
195pub struct DisposeBrowserContext {
196 #[serde(rename = "browserContextId")]
197 pub browser_context_id: browser::BrowserContextId,
198}
199#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
200pub struct GetTargetInfo {
201 #[serde(skip_serializing_if = "Option::is_none")]
202 #[serde(rename = "targetId")]
203 pub target_id: Option<TargetId>,
204}
205#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
206pub struct GetTargets {
207 #[serde(skip_serializing_if = "Option::is_none")]
208 #[serde(rename = "filter")]
209 pub filter: Option<TargetFilter>,
210}
211#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
212pub struct SendMessageToTarget {
213 #[serde(default)]
214 #[serde(rename = "message")]
215 pub message: String,
216 #[serde(skip_serializing_if = "Option::is_none")]
217 #[serde(rename = "sessionId")]
218 pub session_id: Option<SessionId>,
219 #[serde(skip_serializing_if = "Option::is_none")]
220 #[serde(rename = "targetId")]
221 pub target_id: Option<TargetId>,
222}
223#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
224pub struct SetAutoAttach {
225 #[serde(default)]
226 #[serde(rename = "autoAttach")]
227 pub auto_attach: bool,
228 #[serde(default)]
229 #[serde(rename = "waitForDebuggerOnStart")]
230 pub wait_for_debugger_on_start: bool,
231 #[serde(skip_serializing_if = "Option::is_none")]
232 #[serde(default)]
233 #[serde(rename = "flatten")]
234 pub flatten: Option<bool>,
235 #[serde(skip_serializing_if = "Option::is_none")]
236 #[serde(rename = "filter")]
237 pub filter: Option<TargetFilter>,
238}
239#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
240pub struct AutoAttachRelated {
241 #[serde(rename = "targetId")]
242 pub target_id: TargetId,
243 #[serde(default)]
244 #[serde(rename = "waitForDebuggerOnStart")]
245 pub wait_for_debugger_on_start: bool,
246 #[serde(skip_serializing_if = "Option::is_none")]
247 #[serde(rename = "filter")]
248 pub filter: Option<TargetFilter>,
249}
250#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
251pub struct SetDiscoverTargets {
252 #[serde(default)]
253 #[serde(rename = "discover")]
254 pub discover: bool,
255 #[serde(skip_serializing_if = "Option::is_none")]
256 #[serde(rename = "filter")]
257 pub filter: Option<TargetFilter>,
258}
259#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
260pub struct SetRemoteLocations {
261 #[serde(rename = "locations")]
262 pub locations: Vec<RemoteLocation>,
263}
264#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
265pub struct OpenDevTools {
266 #[serde(rename = "targetId")]
267 pub target_id: TargetId,
268}
269#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
270#[serde(rename_all = "camelCase")]
271pub struct ActivateTargetReturnObject {}
272#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
273pub struct AttachToTargetReturnObject {
274 #[serde(rename = "sessionId")]
275 pub session_id: SessionId,
276}
277#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
278pub struct AttachToBrowserTargetReturnObject {
279 #[serde(rename = "sessionId")]
280 pub session_id: SessionId,
281}
282#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
283pub struct CloseTargetReturnObject {
284 #[serde(default)]
285 #[serde(rename = "success")]
286 pub success: bool,
287}
288#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
289#[serde(rename_all = "camelCase")]
290pub struct ExposeDevToolsProtocolReturnObject {}
291#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
292pub struct CreateBrowserContextReturnObject {
293 #[serde(rename = "browserContextId")]
294 pub browser_context_id: browser::BrowserContextId,
295}
296#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
297pub struct GetBrowserContextsReturnObject {
298 #[serde(rename = "browserContextIds")]
299 pub browser_context_ids: browser::BrowserContextId,
300}
301#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
302pub struct CreateTargetReturnObject {
303 #[serde(rename = "targetId")]
304 pub target_id: TargetId,
305}
306#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
307#[serde(rename_all = "camelCase")]
308pub struct DetachFromTargetReturnObject {}
309#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
310#[serde(rename_all = "camelCase")]
311pub struct DisposeBrowserContextReturnObject {}
312#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
313pub struct GetTargetInfoReturnObject {
314 #[serde(rename = "targetInfo")]
315 pub target_info: TargetInfo,
316}
317#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
318pub struct GetTargetsReturnObject {
319 #[serde(rename = "targetInfos")]
320 pub target_infos: Vec<TargetInfo>,
321}
322#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
323#[serde(rename_all = "camelCase")]
324pub struct SendMessageToTargetReturnObject {}
325#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
326#[serde(rename_all = "camelCase")]
327pub struct SetAutoAttachReturnObject {}
328#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
329#[serde(rename_all = "camelCase")]
330pub struct AutoAttachRelatedReturnObject {}
331#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
332#[serde(rename_all = "camelCase")]
333pub struct SetDiscoverTargetsReturnObject {}
334#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
335#[serde(rename_all = "camelCase")]
336pub struct SetRemoteLocationsReturnObject {}
337#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
338pub struct OpenDevToolsReturnObject {
339 #[serde(rename = "targetId")]
340 pub target_id: TargetId,
341}
342impl Method for ActivateTarget {
343 const NAME: &'static str = "Target.activateTarget";
344 type ReturnObject = ActivateTargetReturnObject;
345}
346impl Method for AttachToTarget {
347 const NAME: &'static str = "Target.attachToTarget";
348 type ReturnObject = AttachToTargetReturnObject;
349}
350impl Method for AttachToBrowserTarget {
351 const NAME: &'static str = "Target.attachToBrowserTarget";
352 type ReturnObject = AttachToBrowserTargetReturnObject;
353}
354impl Method for CloseTarget {
355 const NAME: &'static str = "Target.closeTarget";
356 type ReturnObject = CloseTargetReturnObject;
357}
358impl Method for ExposeDevToolsProtocol {
359 const NAME: &'static str = "Target.exposeDevToolsProtocol";
360 type ReturnObject = ExposeDevToolsProtocolReturnObject;
361}
362impl Method for CreateBrowserContext {
363 const NAME: &'static str = "Target.createBrowserContext";
364 type ReturnObject = CreateBrowserContextReturnObject;
365}
366impl Method for GetBrowserContexts {
367 const NAME: &'static str = "Target.getBrowserContexts";
368 type ReturnObject = GetBrowserContextsReturnObject;
369}
370impl Method for CreateTarget {
371 const NAME: &'static str = "Target.createTarget";
372 type ReturnObject = CreateTargetReturnObject;
373}
374impl Method for DetachFromTarget {
375 const NAME: &'static str = "Target.detachFromTarget";
376 type ReturnObject = DetachFromTargetReturnObject;
377}
378impl Method for DisposeBrowserContext {
379 const NAME: &'static str = "Target.disposeBrowserContext";
380 type ReturnObject = DisposeBrowserContextReturnObject;
381}
382impl Method for GetTargetInfo {
383 const NAME: &'static str = "Target.getTargetInfo";
384 type ReturnObject = GetTargetInfoReturnObject;
385}
386impl Method for GetTargets {
387 const NAME: &'static str = "Target.getTargets";
388 type ReturnObject = GetTargetsReturnObject;
389}
390impl Method for SendMessageToTarget {
391 const NAME: &'static str = "Target.sendMessageToTarget";
392 type ReturnObject = SendMessageToTargetReturnObject;
393}
394impl Method for SetAutoAttach {
395 const NAME: &'static str = "Target.setAutoAttach";
396 type ReturnObject = SetAutoAttachReturnObject;
397}
398impl Method for AutoAttachRelated {
399 const NAME: &'static str = "Target.autoAttachRelated";
400 type ReturnObject = AutoAttachRelatedReturnObject;
401}
402impl Method for SetDiscoverTargets {
403 const NAME: &'static str = "Target.setDiscoverTargets";
404 type ReturnObject = SetDiscoverTargetsReturnObject;
405}
406impl Method for SetRemoteLocations {
407 const NAME: &'static str = "Target.setRemoteLocations";
408 type ReturnObject = SetRemoteLocationsReturnObject;
409}
410impl Method for OpenDevTools {
411 const NAME: &'static str = "Target.openDevTools";
412 type ReturnObject = OpenDevToolsReturnObject;
413}
414pub mod events {
415 #[allow(unused_imports)]
416 use super::super::types::*;
417 #[allow(unused_imports)]
418 use serde::{Deserialize, Serialize};
419 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
420 pub struct AttachedToTargetEvent {
421 pub params: AttachedToTargetEventParams,
422 }
423 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
424 pub struct AttachedToTargetEventParams {
425 #[serde(rename = "sessionId")]
426 pub session_id: super::SessionId,
427 #[serde(rename = "targetInfo")]
428 pub target_info: super::TargetInfo,
429 #[serde(default)]
430 #[serde(rename = "waitingForDebugger")]
431 pub waiting_for_debugger: bool,
432 }
433 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
434 pub struct DetachedFromTargetEvent {
435 pub params: DetachedFromTargetEventParams,
436 }
437 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
438 pub struct DetachedFromTargetEventParams {
439 #[serde(rename = "sessionId")]
440 pub session_id: super::SessionId,
441 #[serde(skip_serializing_if = "Option::is_none")]
442 #[serde(rename = "targetId")]
443 pub target_id: Option<super::TargetId>,
444 }
445 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
446 pub struct ReceivedMessageFromTargetEvent {
447 pub params: ReceivedMessageFromTargetEventParams,
448 }
449 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
450 pub struct ReceivedMessageFromTargetEventParams {
451 #[serde(rename = "sessionId")]
452 pub session_id: super::SessionId,
453 #[serde(default)]
454 #[serde(rename = "message")]
455 pub message: String,
456 #[serde(skip_serializing_if = "Option::is_none")]
457 #[serde(rename = "targetId")]
458 pub target_id: Option<super::TargetId>,
459 }
460 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
461 pub struct TargetCreatedEvent {
462 pub params: TargetCreatedEventParams,
463 }
464 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
465 pub struct TargetCreatedEventParams {
466 #[serde(rename = "targetInfo")]
467 pub target_info: super::TargetInfo,
468 }
469 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
470 pub struct TargetDestroyedEvent {
471 pub params: TargetDestroyedEventParams,
472 }
473 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
474 pub struct TargetDestroyedEventParams {
475 #[serde(rename = "targetId")]
476 pub target_id: super::TargetId,
477 }
478 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
479 pub struct TargetCrashedEvent {
480 pub params: TargetCrashedEventParams,
481 }
482 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
483 pub struct TargetCrashedEventParams {
484 #[serde(rename = "targetId")]
485 pub target_id: super::TargetId,
486 #[serde(default)]
487 #[serde(rename = "status")]
488 pub status: String,
489 #[serde(default)]
490 #[serde(rename = "errorCode")]
491 pub error_code: JsUInt,
492 }
493 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
494 pub struct TargetInfoChangedEvent {
495 pub params: TargetInfoChangedEventParams,
496 }
497 #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
498 pub struct TargetInfoChangedEventParams {
499 #[serde(rename = "targetInfo")]
500 pub target_info: super::TargetInfo,
501 }
502}