js-protocol 0.1.2

Generated Rust types and commands for the Chrome DevTools Protocol (js-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
//! Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects.
//! Evaluation results are returned as mirror object that expose object type, string representation
//! and unique identifier that can be used for further object reference. Original objects are
//! maintained in memory unless they are either explicitly released or are released along with the
//! other objects in their object group.
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;

/// Unique script identifier.

pub type ScriptId = String;

/// Represents options for serialization. Overrides 'generatePreview' and 'returnByValue'.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SerializationOptions {

    pub serialization: String,
    /// Deep serialization depth. Default is full depth. Respected only in 'deep' serialization mode.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub maxDepth: Option<i64>,
    /// Embedder-specific parameters. For example if connected to V8 in Chrome these control DOM
    /// serialization via 'maxNodeDepth: integer' and 'includeShadowTree: "none" | "open" | "all"'.
    /// Values can be only of type string or integer.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub additionalParameters: Option<serde_json::Map<String, JsonValue>>,
}

/// Represents deep serialized value.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DeepSerializedValue {

    #[serde(rename = "type")]
    pub type_: String,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<JsonValue>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectId: Option<String>,
    /// Set if value reference met more then once during serialization. In such
    /// case, value is provided only to one of the serialized values. Unique
    /// per value in the scope of one CDP call.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub weakLocalObjectReference: Option<i64>,
}

/// Unique object identifier.

pub type RemoteObjectId = String;

/// Primitive value which cannot be JSON-stringified. Includes values '-0', 'NaN', 'Infinity',
/// '-Infinity', and bigint literals.

pub type UnserializableValue = String;

/// Mirror object referencing original JavaScript object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoteObject {
    /// Object type.

    #[serde(rename = "type")]
    pub type_: String,
    /// Object subtype hint. Specified for 'object' type values only.
    /// NOTE: If you change anything here, make sure to also update
    /// 'subtype' in 'ObjectPreview' and 'PropertyPreview' below.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub subtype: Option<String>,
    /// Object class (constructor) name. Specified for 'object' type values only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub className: Option<String>,
    /// Remote object value in case of primitive values or JSON values (if it was requested).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<JsonValue>,
    /// Primitive value which can not be JSON-stringified does not have 'value', but gets this
    /// property.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unserializableValue: Option<UnserializableValue>,
    /// String representation of the object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Deep serialized value.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub deepSerializedValue: Option<DeepSerializedValue>,
    /// Unique object identifier (for non-primitive values).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectId: Option<RemoteObjectId>,
    /// Preview containing abbreviated property values. Specified for 'object' type values only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub preview: Option<ObjectPreview>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub customPreview: Option<CustomPreview>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CustomPreview {
    /// The JSON-stringified result of formatter.header(object, config) call.
    /// It contains json ML array that represents RemoteObject.

    pub header: String,
    /// If formatter returns true as a result of formatter.hasBody call then bodyGetterId will
    /// contain RemoteObjectId for the function that returns result of formatter.body(object, config) call.
    /// The result value is json ML array.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub bodyGetterId: Option<RemoteObjectId>,
}

/// Object containing abbreviated remote object value.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ObjectPreview {
    /// Object type.

    #[serde(rename = "type")]
    pub type_: String,
    /// Object subtype hint. Specified for 'object' type values only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub subtype: Option<String>,
    /// String representation of the object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// True iff some of the properties or entries of the original object did not fit.

    pub overflow: bool,
    /// List of the properties.

    pub properties: Vec<PropertyPreview>,
    /// List of the entries. Specified for 'map' and 'set' subtype values only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub entries: Option<Vec<EntryPreview>>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PropertyPreview {
    /// Property name.

    pub name: String,
    /// Object type. Accessor means that the property itself is an accessor property.

    #[serde(rename = "type")]
    pub type_: String,
    /// User-friendly property value string.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
    /// Nested value preview.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub valuePreview: Option<ObjectPreview>,
    /// Object subtype hint. Specified for 'object' type values only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub subtype: Option<String>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EntryPreview {
    /// Preview of the key. Specified for map-like collection entries.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub key: Option<ObjectPreview>,
    /// Preview of the value.

    pub value: ObjectPreview,
}

/// Object property descriptor.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PropertyDescriptor {
    /// Property name or symbol description.

    pub name: String,
    /// The value associated with the property.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<RemoteObject>,
    /// True if the value associated with the property may be changed (data descriptors only).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub writable: Option<bool>,
    /// A function which serves as a getter for the property, or 'undefined' if there is no getter
    /// (accessor descriptors only).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub get: Option<RemoteObject>,
    /// A function which serves as a setter for the property, or 'undefined' if there is no setter
    /// (accessor descriptors only).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub set: Option<RemoteObject>,
    /// True if the type of this property descriptor may be changed and if the property may be
    /// deleted from the corresponding object.

    pub configurable: bool,
    /// True if this property shows up during enumeration of the properties on the corresponding
    /// object.

    pub enumerable: bool,
    /// True if the result was thrown during the evaluation.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub wasThrown: Option<bool>,
    /// True if the property is owned for the object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub isOwn: Option<bool>,
    /// Property symbol object, if the property is of the 'symbol' type.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub symbol: Option<RemoteObject>,
}

/// Object internal property descriptor. This property isn't normally visible in JavaScript code.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct InternalPropertyDescriptor {
    /// Conventional property name.

    pub name: String,
    /// The value associated with the property.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<RemoteObject>,
}

/// Object private field descriptor.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PrivatePropertyDescriptor {
    /// Private property name.

    pub name: String,
    /// The value associated with the private property.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<RemoteObject>,
    /// A function which serves as a getter for the private property,
    /// or 'undefined' if there is no getter (accessor descriptors only).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub get: Option<RemoteObject>,
    /// A function which serves as a setter for the private property,
    /// or 'undefined' if there is no setter (accessor descriptors only).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub set: Option<RemoteObject>,
}

/// Represents function call argument. Either remote object id 'objectId', primitive 'value',
/// unserializable primitive value or neither of (for undefined) them should be specified.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CallArgument {
    /// Primitive value or serializable javascript object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub value: Option<JsonValue>,
    /// Primitive value which can not be JSON-stringified.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unserializableValue: Option<UnserializableValue>,
    /// Remote object handle.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectId: Option<RemoteObjectId>,
}

/// Id of an execution context.

pub type ExecutionContextId = i64;

/// Description of an isolated world.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ExecutionContextDescription {
    /// Unique id of the execution context. It can be used to specify in which execution context
    /// script evaluation should be performed.

    pub id: ExecutionContextId,
    /// Execution context origin.

    pub origin: String,
    /// Human readable name describing given context.

    pub name: String,
    /// A system-unique execution context identifier. Unlike the id, this is unique across
    /// multiple processes, so can be reliably used to identify specific context while backend
    /// performs a cross-process navigation.

    pub uniqueId: String,
    /// Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}

    #[serde(skip_serializing_if = "Option::is_none")]
    pub auxData: Option<serde_json::Map<String, JsonValue>>,
}

/// Detailed information about exception (or error) that was thrown during script compilation or
/// execution.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ExceptionDetails {
    /// Exception id.

    pub exceptionId: u64,
    /// Exception text, which should be used together with exception object when available.

    pub text: String,
    /// Line number of the exception location (0-based).

    pub lineNumber: i64,
    /// Column number of the exception location (0-based).

    pub columnNumber: i64,
    /// Script ID of the exception location.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub scriptId: Option<ScriptId>,
    /// URL of the exception location, to be used when the script was not reported.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
    /// JavaScript stack trace if available.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub stackTrace: Option<StackTrace>,
    /// Exception object if available.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exception: Option<RemoteObject>,
    /// Identifier of the context where exception happened.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
    /// Dictionary with entries of meta data that the client associated
    /// with this exception, such as information about associated network
    /// requests, etc.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionMetaData: Option<serde_json::Map<String, JsonValue>>,
}

/// Number of milliseconds since epoch.

pub type Timestamp = f64;

/// Number of milliseconds.

pub type TimeDelta = f64;

/// Stack entry for runtime errors and assertions.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CallFrame {
    /// JavaScript function name.

    pub functionName: String,
    /// JavaScript script id.

    pub scriptId: ScriptId,
    /// JavaScript script name or url.

    pub url: String,
    /// JavaScript script line number (0-based).

    pub lineNumber: i64,
    /// JavaScript script column number (0-based).

    pub columnNumber: i64,
}

/// Call frames for assertions or error messages.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StackTrace {
    /// String label of this stack trace. For async traces this may be a name of the function that
    /// initiated the async call.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// JavaScript function name.

    pub callFrames: Vec<CallFrame>,
    /// Asynchronous JavaScript stack trace that preceded this stack, if available.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub parent: Option<Box<StackTrace>>,
    /// Asynchronous JavaScript stack trace that preceded this stack, if available.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub parentId: Option<StackTraceId>,
}

/// Unique identifier of current debugger.

pub type UniqueDebuggerId = String;

/// If 'debuggerId' is set stack trace comes from another debugger and can be resolved there. This
/// allows to track cross-debugger calls. See 'Runtime.StackTrace' and 'Debugger.paused' for usages.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct StackTraceId {

    pub id: String,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub debuggerId: Option<UniqueDebuggerId>,
}

/// Add handler to promise with given promise object id.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AwaitPromiseParams {
    /// Identifier of the promise.

    pub promiseObjectId: RemoteObjectId,
    /// Whether the result is expected to be a JSON object that should be sent by value.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub returnByValue: Option<bool>,
    /// Whether preview should be generated for the result.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub generatePreview: Option<bool>,
}

/// Add handler to promise with given promise object id.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AwaitPromiseReturns {
    /// Promise result. Will contain rejected value if promise was rejected.

    pub result: RemoteObject,
    /// Exception details if stack strace is available.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl AwaitPromiseParams { pub const METHOD: &'static str = "Runtime.awaitPromise"; }

impl crate::CdpCommand for AwaitPromiseParams {
    const METHOD: &'static str = "Runtime.awaitPromise";
    type Response = AwaitPromiseReturns;
}

/// Calls function with given declaration on the given object. Object group of the result is
/// inherited from the target object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CallFunctionOnParams {
    /// Declaration of the function to call.

    pub functionDeclaration: String,
    /// Identifier of the object to call function on. Either objectId or executionContextId should
    /// be specified.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectId: Option<RemoteObjectId>,
    /// Call arguments. All call arguments must belong to the same JavaScript world as the target
    /// object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub arguments: Option<Vec<CallArgument>>,
    /// In silent mode exceptions thrown during evaluation are not reported and do not pause
    /// execution. Overrides 'setPauseOnException' state.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub silent: Option<bool>,
    /// Whether the result is expected to be a JSON object which should be sent by value.
    /// Can be overriden by 'serializationOptions'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub returnByValue: Option<bool>,
    /// Whether preview should be generated for the result.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub generatePreview: Option<bool>,
    /// Whether execution should be treated as initiated by user in the UI.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub userGesture: Option<bool>,
    /// Whether execution should 'await' for resulting value and return once awaited promise is
    /// resolved.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub awaitPromise: Option<bool>,
    /// Specifies execution context which global object will be used to call function on. Either
    /// executionContextId or objectId should be specified.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
    /// Symbolic group name that can be used to release multiple objects. If objectGroup is not
    /// specified and objectId is, objectGroup will be inherited from object.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectGroup: Option<String>,
    /// Whether to throw an exception if side effect cannot be ruled out during evaluation.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub throwOnSideEffect: Option<bool>,
    /// An alternative way to specify the execution context to call function on.
    /// Compared to contextId that may be reused across processes, this is guaranteed to be
    /// system-unique, so it can be used to prevent accidental function call
    /// in context different than intended (e.g. as a result of navigation across process
    /// boundaries).
    /// This is mutually exclusive with 'executionContextId'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub uniqueContextId: Option<String>,
    /// Specifies the result serialization. If provided, overrides
    /// 'generatePreview' and 'returnByValue'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub serializationOptions: Option<SerializationOptions>,
}

/// Calls function with given declaration on the given object. Object group of the result is
/// inherited from the target object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CallFunctionOnReturns {
    /// Call result.

    pub result: RemoteObject,
    /// Exception details.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl CallFunctionOnParams { pub const METHOD: &'static str = "Runtime.callFunctionOn"; }

impl crate::CdpCommand for CallFunctionOnParams {
    const METHOD: &'static str = "Runtime.callFunctionOn";
    type Response = CallFunctionOnReturns;
}

/// Compiles expression.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompileScriptParams {
    /// Expression to compile.

    pub expression: String,
    /// Source url to be set for the script.

    pub sourceURL: String,
    /// Specifies whether the compiled script should be persisted.

    pub persistScript: bool,
    /// Specifies in which execution context to perform script run. If the parameter is omitted the
    /// evaluation will be performed in the context of the inspected page.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
}

/// Compiles expression.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CompileScriptReturns {
    /// Id of the script.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub scriptId: Option<ScriptId>,
    /// Exception details.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl CompileScriptParams { pub const METHOD: &'static str = "Runtime.compileScript"; }

impl crate::CdpCommand for CompileScriptParams {
    const METHOD: &'static str = "Runtime.compileScript";
    type Response = CompileScriptReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "Runtime.disable"; }

impl crate::CdpCommand for DisableParams {
    const METHOD: &'static str = "Runtime.disable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DiscardConsoleEntriesParams {}

impl DiscardConsoleEntriesParams { pub const METHOD: &'static str = "Runtime.discardConsoleEntries"; }

impl crate::CdpCommand for DiscardConsoleEntriesParams {
    const METHOD: &'static str = "Runtime.discardConsoleEntries";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "Runtime.enable"; }

impl crate::CdpCommand for EnableParams {
    const METHOD: &'static str = "Runtime.enable";
    type Response = crate::EmptyReturns;
}

/// Evaluates expression on global object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateParams {
    /// Expression to evaluate.

    pub expression: String,
    /// Symbolic group name that can be used to release multiple objects.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectGroup: Option<String>,
    /// Determines whether Command Line API should be available during the evaluation.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeCommandLineAPI: Option<bool>,
    /// In silent mode exceptions thrown during evaluation are not reported and do not pause
    /// execution. Overrides 'setPauseOnException' state.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub silent: Option<bool>,
    /// Specifies in which execution context to perform evaluation. If the parameter is omitted the
    /// evaluation will be performed in the context of the inspected page.
    /// This is mutually exclusive with 'uniqueContextId', which offers an
    /// alternative way to identify the execution context that is more reliable
    /// in a multi-process environment.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub contextId: Option<ExecutionContextId>,
    /// Whether the result is expected to be a JSON object that should be sent by value.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub returnByValue: Option<bool>,
    /// Whether preview should be generated for the result.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub generatePreview: Option<bool>,
    /// Whether execution should be treated as initiated by user in the UI.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub userGesture: Option<bool>,
    /// Whether execution should 'await' for resulting value and return once awaited promise is
    /// resolved.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub awaitPromise: Option<bool>,
    /// Whether to throw an exception if side effect cannot be ruled out during evaluation.
    /// This implies 'disableBreaks' below.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub throwOnSideEffect: Option<bool>,
    /// Terminate execution after timing out (number of milliseconds).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub timeout: Option<TimeDelta>,
    /// Disable breakpoints during execution.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub disableBreaks: Option<bool>,
    /// Setting this flag to true enables 'let' re-declaration and top-level 'await'.
    /// Note that 'let' variables can only be re-declared if they originate from
    /// 'replMode' themselves.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub replMode: Option<bool>,
    /// The Content Security Policy (CSP) for the target might block 'unsafe-eval'
    /// which includes eval(), Function(), setTimeout() and setInterval()
    /// when called with non-callable arguments. This flag bypasses CSP for this
    /// evaluation and allows unsafe-eval. Defaults to true.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub allowUnsafeEvalBlockedByCSP: Option<bool>,
    /// An alternative way to specify the execution context to evaluate in.
    /// Compared to contextId that may be reused across processes, this is guaranteed to be
    /// system-unique, so it can be used to prevent accidental evaluation of the expression
    /// in context different than intended (e.g. as a result of navigation across process
    /// boundaries).
    /// This is mutually exclusive with 'contextId'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub uniqueContextId: Option<String>,
    /// Specifies the result serialization. If provided, overrides
    /// 'generatePreview' and 'returnByValue'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub serializationOptions: Option<SerializationOptions>,
}

/// Evaluates expression on global object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EvaluateReturns {
    /// Evaluation result.

    pub result: RemoteObject,
    /// Exception details.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl EvaluateParams { pub const METHOD: &'static str = "Runtime.evaluate"; }

impl crate::CdpCommand for EvaluateParams {
    const METHOD: &'static str = "Runtime.evaluate";
    type Response = EvaluateReturns;
}

/// Returns the isolate id.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetIsolateIdReturns {
    /// The isolate id.

    pub id: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetIsolateIdParams {}

impl GetIsolateIdParams { pub const METHOD: &'static str = "Runtime.getIsolateId"; }

impl crate::CdpCommand for GetIsolateIdParams {
    const METHOD: &'static str = "Runtime.getIsolateId";
    type Response = GetIsolateIdReturns;
}

/// Returns the JavaScript heap usage.
/// It is the total usage of the corresponding isolate not scoped to a particular Runtime.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHeapUsageReturns {
    /// Used JavaScript heap size in bytes.

    pub usedSize: f64,
    /// Allocated JavaScript heap size in bytes.

    pub totalSize: f64,
    /// Used size in bytes in the embedder's garbage-collected heap.

    pub embedderHeapUsedSize: f64,
    /// Size in bytes of backing storage for array buffers and external strings.

    pub backingStorageSize: f64,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GetHeapUsageParams {}

impl GetHeapUsageParams { pub const METHOD: &'static str = "Runtime.getHeapUsage"; }

impl crate::CdpCommand for GetHeapUsageParams {
    const METHOD: &'static str = "Runtime.getHeapUsage";
    type Response = GetHeapUsageReturns;
}

/// Returns properties of a given object. Object group of the result is inherited from the target
/// object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetPropertiesParams {
    /// Identifier of the object to return properties for.

    pub objectId: RemoteObjectId,
    /// If true, returns properties belonging only to the element itself, not to its prototype
    /// chain.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ownProperties: Option<bool>,
    /// If true, returns accessor properties (with getter/setter) only; internal properties are not
    /// returned either.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub accessorPropertiesOnly: Option<bool>,
    /// Whether preview should be generated for the results.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub generatePreview: Option<bool>,
    /// If true, returns non-indexed properties only.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub nonIndexedPropertiesOnly: Option<bool>,
}

/// Returns properties of a given object. Object group of the result is inherited from the target
/// object.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetPropertiesReturns {
    /// Object properties.

    pub result: Vec<PropertyDescriptor>,
    /// Internal object properties (only of the element itself).

    #[serde(skip_serializing_if = "Option::is_none")]
    pub internalProperties: Option<Vec<InternalPropertyDescriptor>>,
    /// Object private properties.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub privateProperties: Option<Vec<PrivatePropertyDescriptor>>,
    /// Exception details.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl GetPropertiesParams { pub const METHOD: &'static str = "Runtime.getProperties"; }

impl crate::CdpCommand for GetPropertiesParams {
    const METHOD: &'static str = "Runtime.getProperties";
    type Response = GetPropertiesReturns;
}

/// Returns all let, const and class variables from global scope.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GlobalLexicalScopeNamesParams {
    /// Specifies in which execution context to lookup global scope variables.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
}

/// Returns all let, const and class variables from global scope.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GlobalLexicalScopeNamesReturns {

    pub names: Vec<String>,
}

impl GlobalLexicalScopeNamesParams { pub const METHOD: &'static str = "Runtime.globalLexicalScopeNames"; }

impl crate::CdpCommand for GlobalLexicalScopeNamesParams {
    const METHOD: &'static str = "Runtime.globalLexicalScopeNames";
    type Response = GlobalLexicalScopeNamesReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct QueryObjectsParams {
    /// Identifier of the prototype to return objects for.

    pub prototypeObjectId: RemoteObjectId,
    /// Symbolic group name that can be used to release the results.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectGroup: Option<String>,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct QueryObjectsReturns {
    /// Array with objects.

    pub objects: RemoteObject,
}

impl QueryObjectsParams { pub const METHOD: &'static str = "Runtime.queryObjects"; }

impl crate::CdpCommand for QueryObjectsParams {
    const METHOD: &'static str = "Runtime.queryObjects";
    type Response = QueryObjectsReturns;
}

/// Releases remote object with given id.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseObjectParams {
    /// Identifier of the object to release.

    pub objectId: RemoteObjectId,
}

impl ReleaseObjectParams { pub const METHOD: &'static str = "Runtime.releaseObject"; }

impl crate::CdpCommand for ReleaseObjectParams {
    const METHOD: &'static str = "Runtime.releaseObject";
    type Response = crate::EmptyReturns;
}

/// Releases all remote objects that belong to a given group.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReleaseObjectGroupParams {
    /// Symbolic object group name.

    pub objectGroup: String,
}

impl ReleaseObjectGroupParams { pub const METHOD: &'static str = "Runtime.releaseObjectGroup"; }

impl crate::CdpCommand for ReleaseObjectGroupParams {
    const METHOD: &'static str = "Runtime.releaseObjectGroup";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct RunIfWaitingForDebuggerParams {}

impl RunIfWaitingForDebuggerParams { pub const METHOD: &'static str = "Runtime.runIfWaitingForDebugger"; }

impl crate::CdpCommand for RunIfWaitingForDebuggerParams {
    const METHOD: &'static str = "Runtime.runIfWaitingForDebugger";
    type Response = crate::EmptyReturns;
}

/// Runs script with given id in a given context.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RunScriptParams {
    /// Id of the script to run.

    pub scriptId: ScriptId,
    /// Specifies in which execution context to perform script run. If the parameter is omitted the
    /// evaluation will be performed in the context of the inspected page.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
    /// Symbolic group name that can be used to release multiple objects.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub objectGroup: Option<String>,
    /// In silent mode exceptions thrown during evaluation are not reported and do not pause
    /// execution. Overrides 'setPauseOnException' state.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub silent: Option<bool>,
    /// Determines whether Command Line API should be available during the evaluation.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub includeCommandLineAPI: Option<bool>,
    /// Whether the result is expected to be a JSON object which should be sent by value.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub returnByValue: Option<bool>,
    /// Whether preview should be generated for the result.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub generatePreview: Option<bool>,
    /// Whether execution should 'await' for resulting value and return once awaited promise is
    /// resolved.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub awaitPromise: Option<bool>,
}

/// Runs script with given id in a given context.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RunScriptReturns {
    /// Run result.

    pub result: RemoteObject,
    /// Exception details.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl RunScriptParams { pub const METHOD: &'static str = "Runtime.runScript"; }

impl crate::CdpCommand for RunScriptParams {
    const METHOD: &'static str = "Runtime.runScript";
    type Response = RunScriptReturns;
}

/// Enables or disables async call stacks tracking.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetAsyncCallStackDepthParams {
    /// Maximum depth of async call stacks. Setting to '0' will effectively disable collecting async
    /// call stacks (default).

    pub maxDepth: i64,
}

impl SetAsyncCallStackDepthParams { pub const METHOD: &'static str = "Runtime.setAsyncCallStackDepth"; }

impl crate::CdpCommand for SetAsyncCallStackDepthParams {
    const METHOD: &'static str = "Runtime.setAsyncCallStackDepth";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetCustomObjectFormatterEnabledParams {

    pub enabled: bool,
}

impl SetCustomObjectFormatterEnabledParams { pub const METHOD: &'static str = "Runtime.setCustomObjectFormatterEnabled"; }

impl crate::CdpCommand for SetCustomObjectFormatterEnabledParams {
    const METHOD: &'static str = "Runtime.setCustomObjectFormatterEnabled";
    type Response = crate::EmptyReturns;
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetMaxCallStackSizeToCaptureParams {

    pub size: u64,
}

impl SetMaxCallStackSizeToCaptureParams { pub const METHOD: &'static str = "Runtime.setMaxCallStackSizeToCapture"; }

impl crate::CdpCommand for SetMaxCallStackSizeToCaptureParams {
    const METHOD: &'static str = "Runtime.setMaxCallStackSizeToCapture";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct TerminateExecutionParams {}

impl TerminateExecutionParams { pub const METHOD: &'static str = "Runtime.terminateExecution"; }

impl crate::CdpCommand for TerminateExecutionParams {
    const METHOD: &'static str = "Runtime.terminateExecution";
    type Response = crate::EmptyReturns;
}

/// If executionContextId is empty, adds binding with the given name on the
/// global objects of all inspected contexts, including those created later,
/// bindings survive reloads.
/// Binding function takes exactly one argument, this argument should be string,
/// in case of any other input, function throws an exception.
/// Each binding function call produces Runtime.bindingCalled notification.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AddBindingParams {

    pub name: String,
    /// If specified, the binding would only be exposed to the specified
    /// execution context. If omitted and 'executionContextName' is not set,
    /// the binding is exposed to all execution contexts of the target.
    /// This parameter is mutually exclusive with 'executionContextName'.
    /// Deprecated in favor of 'executionContextName' due to an unclear use case
    /// and bugs in implementation (crbug.com/1169639). 'executionContextId' will be
    /// removed in the future.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextId: Option<ExecutionContextId>,
    /// If specified, the binding is exposed to the executionContext with
    /// matching name, even for contexts created after the binding is added.
    /// See also 'ExecutionContext.name' and 'worldName' parameter to
    /// 'Page.addScriptToEvaluateOnNewDocument'.
    /// This parameter is mutually exclusive with 'executionContextId'.

    #[serde(skip_serializing_if = "Option::is_none")]
    pub executionContextName: Option<String>,
}

impl AddBindingParams { pub const METHOD: &'static str = "Runtime.addBinding"; }

impl crate::CdpCommand for AddBindingParams {
    const METHOD: &'static str = "Runtime.addBinding";
    type Response = crate::EmptyReturns;
}

/// This method does not remove binding function from global object but
/// unsubscribes current runtime agent from Runtime.bindingCalled notifications.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoveBindingParams {

    pub name: String,
}

impl RemoveBindingParams { pub const METHOD: &'static str = "Runtime.removeBinding"; }

impl crate::CdpCommand for RemoveBindingParams {
    const METHOD: &'static str = "Runtime.removeBinding";
    type Response = crate::EmptyReturns;
}

/// This method tries to lookup and populate exception details for a
/// JavaScript Error object.
/// Note that the stackTrace portion of the resulting exceptionDetails will
/// only be populated if the Runtime domain was enabled at the time when the
/// Error was thrown.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetExceptionDetailsParams {
    /// The error object for which to resolve the exception details.

    pub errorObjectId: RemoteObjectId,
}

/// This method tries to lookup and populate exception details for a
/// JavaScript Error object.
/// Note that the stackTrace portion of the resulting exceptionDetails will
/// only be populated if the Runtime domain was enabled at the time when the
/// Error was thrown.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetExceptionDetailsReturns {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exceptionDetails: Option<ExceptionDetails>,
}

impl GetExceptionDetailsParams { pub const METHOD: &'static str = "Runtime.getExceptionDetails"; }

impl crate::CdpCommand for GetExceptionDetailsParams {
    const METHOD: &'static str = "Runtime.getExceptionDetails";
    type Response = GetExceptionDetailsReturns;
}