1use serde::{Deserialize, Serialize};
2#[doc = "Notification is issued every time when binding is called.\n[bindingCalled](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-bindingCalled)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct BindingCalledParams {
5 #[serde(rename = "name")]
6 pub name: String,
7 #[serde(rename = "payload")]
8 pub payload: String,
9 #[doc = "Identifier of the context where the call was made."]
10 #[serde(rename = "executionContextId")]
11 pub execution_context_id: super::types::ExecutionContextId,
12}
13#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14pub enum BindingCalledMethod {
15 #[serde(rename = "Runtime.bindingCalled")]
16 BindingCalled,
17}
18#[doc = "Notification is issued every time when binding is called.\n[bindingCalled](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-bindingCalled)"]
19#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
20pub struct BindingCalled {
21 pub method: BindingCalledMethod,
22 pub params: BindingCalledParams,
23}
24impl BindingCalled {
25 pub const IDENTIFIER: &'static str = "Runtime.bindingCalled";
26 pub fn identifier(&self) -> &'static str {
27 Self::IDENTIFIER
28 }
29}
30#[doc = "Issued when console API was called.\n[consoleAPICalled](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-consoleAPICalled)"]
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub struct ConsoleApiCalledParams {
33 #[doc = "Type of the call."]
34 #[serde(rename = "type")]
35 pub r#type: ConsoleApiCalledType,
36 #[doc = "Call arguments."]
37 #[serde(rename = "args")]
38 #[serde(skip_serializing_if = "Vec::is_empty")]
39 pub args: Vec<super::types::RemoteObject>,
40 #[doc = "Identifier of the context where the call was made."]
41 #[serde(rename = "executionContextId")]
42 pub execution_context_id: super::types::ExecutionContextId,
43 #[doc = "Call timestamp."]
44 #[serde(rename = "timestamp")]
45 pub timestamp: super::types::Timestamp,
46 #[doc = "Stack trace captured when the call was made. The async stack chain is automatically reported for\nthe following call types: `assert`, `error`, `trace`, `warning`. For other types the async call\nchain can be retrieved using `Debugger.getStackTrace` and `stackTrace.parentId` field."]
47 #[serde(rename = "stackTrace")]
48 #[serde(skip_serializing_if = "Option::is_none")]
49 #[serde(default)]
50 pub stack_trace: Option<super::types::StackTrace>,
51 #[doc = "Console context descriptor for calls on non-default console context (not console.*):\n'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call\non named context."]
52 #[serde(rename = "context")]
53 #[serde(skip_serializing_if = "Option::is_none")]
54 #[serde(default)]
55 pub context: Option<String>,
56}
57#[doc = "Type of the call."]
58#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
59pub enum ConsoleApiCalledType {
60 #[serde(rename = "log")]
61 Log,
62 #[serde(rename = "debug")]
63 Debug,
64 #[serde(rename = "info")]
65 Info,
66 #[serde(rename = "error")]
67 Error,
68 #[serde(rename = "warning")]
69 Warning,
70 #[serde(rename = "dir")]
71 Dir,
72 #[serde(rename = "dirxml")]
73 Dirxml,
74 #[serde(rename = "table")]
75 Table,
76 #[serde(rename = "trace")]
77 Trace,
78 #[serde(rename = "clear")]
79 Clear,
80 #[serde(rename = "startGroup")]
81 StartGroup,
82 #[serde(rename = "startGroupCollapsed")]
83 StartGroupCollapsed,
84 #[serde(rename = "endGroup")]
85 EndGroup,
86 #[serde(rename = "assert")]
87 Assert,
88 #[serde(rename = "profile")]
89 Profile,
90 #[serde(rename = "profileEnd")]
91 ProfileEnd,
92 #[serde(rename = "count")]
93 Count,
94 #[serde(rename = "timeEnd")]
95 TimeEnd,
96}
97#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
98pub enum ConsoleApiCalledMethod {
99 #[serde(rename = "Runtime.consoleAPICalled")]
100 ConsoleApiCalled,
101}
102#[doc = "Issued when console API was called.\n[consoleAPICalled](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-consoleAPICalled)"]
103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
104pub struct ConsoleApiCalled {
105 pub method: ConsoleApiCalledMethod,
106 pub params: ConsoleApiCalledParams,
107}
108impl ConsoleApiCalled {
109 pub const IDENTIFIER: &'static str = "Runtime.consoleAPICalled";
110 pub fn identifier(&self) -> &'static str {
111 Self::IDENTIFIER
112 }
113}
114#[doc = "Issued when unhandled exception was revoked.\n[exceptionRevoked](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-exceptionRevoked)"]
115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
116pub struct ExceptionRevokedParams {
117 #[doc = "Reason describing why exception was revoked."]
118 #[serde(rename = "reason")]
119 pub reason: String,
120 #[doc = "The id of revoked exception, as reported in `exceptionThrown`."]
121 #[serde(rename = "exceptionId")]
122 pub exception_id: i64,
123}
124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
125pub enum ExceptionRevokedMethod {
126 #[serde(rename = "Runtime.exceptionRevoked")]
127 ExceptionRevoked,
128}
129#[doc = "Issued when unhandled exception was revoked.\n[exceptionRevoked](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-exceptionRevoked)"]
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
131pub struct ExceptionRevoked {
132 pub method: ExceptionRevokedMethod,
133 pub params: ExceptionRevokedParams,
134}
135impl ExceptionRevoked {
136 pub const IDENTIFIER: &'static str = "Runtime.exceptionRevoked";
137 pub fn identifier(&self) -> &'static str {
138 Self::IDENTIFIER
139 }
140}
141#[doc = "Issued when exception was thrown and unhandled.\n[exceptionThrown](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-exceptionThrown)"]
142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
143pub struct ExceptionThrownParams {
144 #[doc = "Timestamp of the exception."]
145 #[serde(rename = "timestamp")]
146 pub timestamp: super::types::Timestamp,
147 #[serde(rename = "exceptionDetails")]
148 pub exception_details: super::types::ExceptionDetails,
149}
150#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
151pub enum ExceptionThrownMethod {
152 #[serde(rename = "Runtime.exceptionThrown")]
153 ExceptionThrown,
154}
155#[doc = "Issued when exception was thrown and unhandled.\n[exceptionThrown](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-exceptionThrown)"]
156#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
157pub struct ExceptionThrown {
158 pub method: ExceptionThrownMethod,
159 pub params: ExceptionThrownParams,
160}
161impl ExceptionThrown {
162 pub const IDENTIFIER: &'static str = "Runtime.exceptionThrown";
163 pub fn identifier(&self) -> &'static str {
164 Self::IDENTIFIER
165 }
166}
167#[doc = "Issued when new execution context is created.\n[executionContextCreated](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextCreated)"]
168#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
169pub struct ExecutionContextCreatedParams {
170 #[doc = "A newly created execution context."]
171 #[serde(rename = "context")]
172 pub context: super::types::ExecutionContextDescription,
173}
174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
175pub enum ExecutionContextCreatedMethod {
176 #[serde(rename = "Runtime.executionContextCreated")]
177 ExecutionContextCreated,
178}
179#[doc = "Issued when new execution context is created.\n[executionContextCreated](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextCreated)"]
180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
181pub struct ExecutionContextCreated {
182 pub method: ExecutionContextCreatedMethod,
183 pub params: ExecutionContextCreatedParams,
184}
185impl ExecutionContextCreated {
186 pub const IDENTIFIER: &'static str = "Runtime.executionContextCreated";
187 pub fn identifier(&self) -> &'static str {
188 Self::IDENTIFIER
189 }
190}
191#[doc = "Issued when execution context is destroyed.\n[executionContextDestroyed](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextDestroyed)"]
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
193pub struct ExecutionContextDestroyedParams {
194 #[doc = "Unique Id of the destroyed context"]
195 #[serde(rename = "executionContextUniqueId")]
196 pub execution_context_unique_id: String,
197}
198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
199pub enum ExecutionContextDestroyedMethod {
200 #[serde(rename = "Runtime.executionContextDestroyed")]
201 ExecutionContextDestroyed,
202}
203#[doc = "Issued when execution context is destroyed.\n[executionContextDestroyed](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextDestroyed)"]
204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
205pub struct ExecutionContextDestroyed {
206 pub method: ExecutionContextDestroyedMethod,
207 pub params: ExecutionContextDestroyedParams,
208}
209impl ExecutionContextDestroyed {
210 pub const IDENTIFIER: &'static str = "Runtime.executionContextDestroyed";
211 pub fn identifier(&self) -> &'static str {
212 Self::IDENTIFIER
213 }
214}
215#[doc = "Issued when all executionContexts were cleared in browser\n[executionContextsCleared](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextsCleared)"]
216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
217pub struct ExecutionContextsClearedParams {}
218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
219pub enum ExecutionContextsClearedMethod {
220 #[serde(rename = "Runtime.executionContextsCleared")]
221 ExecutionContextsCleared,
222}
223#[doc = "Issued when all executionContexts were cleared in browser\n[executionContextsCleared](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-executionContextsCleared)"]
224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
225pub struct ExecutionContextsCleared {
226 pub method: ExecutionContextsClearedMethod,
227 pub params: ExecutionContextsClearedParams,
228}
229impl ExecutionContextsCleared {
230 pub const IDENTIFIER: &'static str = "Runtime.executionContextsCleared";
231 pub fn identifier(&self) -> &'static str {
232 Self::IDENTIFIER
233 }
234}
235#[doc = "Issued when object should be inspected (for example, as a result of inspect() command line API\ncall).\n[inspectRequested](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-inspectRequested)"]
236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
237pub struct InspectRequestedParams {
238 #[serde(rename = "object")]
239 pub object: super::types::RemoteObject,
240 #[serde(rename = "hints")]
241 pub hints: serde_json::Value,
242 #[doc = "Identifier of the context where the call was made."]
243 #[serde(rename = "executionContextId")]
244 #[serde(skip_serializing_if = "Option::is_none")]
245 #[serde(default)]
246 pub execution_context_id: Option<super::types::ExecutionContextId>,
247}
248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
249pub enum InspectRequestedMethod {
250 #[serde(rename = "Runtime.inspectRequested")]
251 InspectRequested,
252}
253#[doc = "Issued when object should be inspected (for example, as a result of inspect() command line API\ncall).\n[inspectRequested](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#event-inspectRequested)"]
254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
255pub struct InspectRequested {
256 pub method: InspectRequestedMethod,
257 pub params: InspectRequestedParams,
258}
259impl InspectRequested {
260 pub const IDENTIFIER: &'static str = "Runtime.inspectRequested";
261 pub fn identifier(&self) -> &'static str {
262 Self::IDENTIFIER
263 }
264}
265group_enum ! (RuntimeEvents { BindingCalled (BindingCalled) , ConsoleApiCalled (ConsoleApiCalled) , ExceptionRevoked (ExceptionRevoked) , ExceptionThrown (ExceptionThrown) , ExecutionContextCreated (ExecutionContextCreated) , ExecutionContextDestroyed (ExecutionContextDestroyed) , ExecutionContextsCleared (ExecutionContextsCleared) , InspectRequested (InspectRequested) } + identifiable);