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