browser-protocol 0.1.4

Generated Rust types and commands for the Chrome DevTools Protocol (browser-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
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
//! The Browser domain defines methods and events for browser managing.


use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;


pub type BrowserContextID<'a> = Cow<'a, str>;


pub type WindowID = i64;

/// The state of the browser window.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum WindowState {
    #[default]
    #[serde(rename = "normal")]
    Normal,
    #[serde(rename = "minimized")]
    Minimized,
    #[serde(rename = "maximized")]
    Maximized,
    #[serde(rename = "fullscreen")]
    Fullscreen,
}

/// Browser window bounds information

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Bounds {
    /// The offset from the left edge of the screen to the window in pixels.
    #[serde(skip_serializing_if = "Option::is_none")]
    left: Option<i64>,
    /// The offset from the top edge of the screen to the window in pixels.
    #[serde(skip_serializing_if = "Option::is_none")]
    top: Option<i64>,
    /// The window width in pixels.
    #[serde(skip_serializing_if = "Option::is_none")]
    width: Option<u64>,
    /// The window height in pixels.
    #[serde(skip_serializing_if = "Option::is_none")]
    height: Option<i64>,
    /// The window state. Default to normal.
    #[serde(skip_serializing_if = "Option::is_none", rename = "windowState")]
    window_state: Option<WindowState>,
}

impl Bounds {
    /// Creates a builder for this type.
    pub fn builder() -> BoundsBuilder {
        BoundsBuilder {
            left: None,
            top: None,
            width: None,
            height: None,
            window_state: None,
        }
    }
    /// The offset from the left edge of the screen to the window in pixels.
    pub fn left(&self) -> Option<i64> { self.left }
    /// The offset from the top edge of the screen to the window in pixels.
    pub fn top(&self) -> Option<i64> { self.top }
    /// The window width in pixels.
    pub fn width(&self) -> Option<u64> { self.width }
    /// The window height in pixels.
    pub fn height(&self) -> Option<i64> { self.height }
    /// The window state. Default to normal.
    pub fn window_state(&self) -> Option<&WindowState> { self.window_state.as_ref() }
}

#[derive(Default)]
pub struct BoundsBuilder {
    left: Option<i64>,
    top: Option<i64>,
    width: Option<u64>,
    height: Option<i64>,
    window_state: Option<WindowState>,
}

impl BoundsBuilder {
    /// The offset from the left edge of the screen to the window in pixels.
    pub fn left(mut self, left: i64) -> Self { self.left = Some(left); self }
    /// The offset from the top edge of the screen to the window in pixels.
    pub fn top(mut self, top: i64) -> Self { self.top = Some(top); self }
    /// The window width in pixels.
    pub fn width(mut self, width: u64) -> Self { self.width = Some(width); self }
    /// The window height in pixels.
    pub fn height(mut self, height: i64) -> Self { self.height = Some(height); self }
    /// The window state. Default to normal.
    pub fn window_state(mut self, window_state: impl Into<WindowState>) -> Self { self.window_state = Some(window_state.into()); self }
    pub fn build(self) -> Bounds {
        Bounds {
            left: self.left,
            top: self.top,
            width: self.width,
            height: self.height,
            window_state: self.window_state,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum PermissionType {
    #[default]
    #[serde(rename = "ar")]
    Ar,
    #[serde(rename = "audioCapture")]
    AudioCapture,
    #[serde(rename = "automaticFullscreen")]
    AutomaticFullscreen,
    #[serde(rename = "backgroundFetch")]
    BackgroundFetch,
    #[serde(rename = "backgroundSync")]
    BackgroundSync,
    #[serde(rename = "cameraPanTiltZoom")]
    CameraPanTiltZoom,
    #[serde(rename = "capturedSurfaceControl")]
    CapturedSurfaceControl,
    #[serde(rename = "clipboardReadWrite")]
    ClipboardReadWrite,
    #[serde(rename = "clipboardSanitizedWrite")]
    ClipboardSanitizedWrite,
    #[serde(rename = "displayCapture")]
    DisplayCapture,
    #[serde(rename = "durableStorage")]
    DurableStorage,
    #[serde(rename = "geolocation")]
    Geolocation,
    #[serde(rename = "handTracking")]
    HandTracking,
    #[serde(rename = "idleDetection")]
    IdleDetection,
    #[serde(rename = "keyboardLock")]
    KeyboardLock,
    #[serde(rename = "localFonts")]
    LocalFonts,
    #[serde(rename = "localNetwork")]
    LocalNetwork,
    #[serde(rename = "localNetworkAccess")]
    LocalNetworkAccess,
    #[serde(rename = "loopbackNetwork")]
    LoopbackNetwork,
    #[serde(rename = "midi")]
    Midi,
    #[serde(rename = "midiSysex")]
    MidiSysex,
    #[serde(rename = "nfc")]
    Nfc,
    #[serde(rename = "notifications")]
    Notifications,
    #[serde(rename = "paymentHandler")]
    PaymentHandler,
    #[serde(rename = "periodicBackgroundSync")]
    PeriodicBackgroundSync,
    #[serde(rename = "pointerLock")]
    PointerLock,
    #[serde(rename = "protectedMediaIdentifier")]
    ProtectedMediaIdentifier,
    #[serde(rename = "sensors")]
    Sensors,
    #[serde(rename = "smartCard")]
    SmartCard,
    #[serde(rename = "speakerSelection")]
    SpeakerSelection,
    #[serde(rename = "storageAccess")]
    StorageAccess,
    #[serde(rename = "topLevelStorageAccess")]
    TopLevelStorageAccess,
    #[serde(rename = "videoCapture")]
    VideoCapture,
    #[serde(rename = "vr")]
    Vr,
    #[serde(rename = "wakeLockScreen")]
    WakeLockScreen,
    #[serde(rename = "wakeLockSystem")]
    WakeLockSystem,
    #[serde(rename = "webAppInstallation")]
    WebAppInstallation,
    #[serde(rename = "webPrinting")]
    WebPrinting,
    #[serde(rename = "windowManagement")]
    WindowManagement,
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum PermissionSetting {
    #[default]
    #[serde(rename = "granted")]
    Granted,
    #[serde(rename = "denied")]
    Denied,
    #[serde(rename = "prompt")]
    Prompt,
}

/// Definition of PermissionDescriptor defined in the Permissions API:
/// <https://w3c.github.io/permissions/#dom-permissiondescriptor>.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct PermissionDescriptor<'a> {
    /// Name of permission.
    /// See <https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl> for valid permission names.
    name: Cow<'a, str>,
    /// For "midi" permission, may also specify sysex control.
    #[serde(skip_serializing_if = "Option::is_none")]
    sysex: Option<bool>,
    /// For "push" permission, may specify userVisibleOnly.
    /// Note that userVisibleOnly = true is the only currently supported type.
    #[serde(skip_serializing_if = "Option::is_none", rename = "userVisibleOnly")]
    user_visible_only: Option<bool>,
    /// For "clipboard" permission, may specify allowWithoutSanitization.
    #[serde(skip_serializing_if = "Option::is_none", rename = "allowWithoutSanitization")]
    allow_without_sanitization: Option<bool>,
    /// For "fullscreen" permission, must specify allowWithoutGesture:true.
    #[serde(skip_serializing_if = "Option::is_none", rename = "allowWithoutGesture")]
    allow_without_gesture: Option<bool>,
    /// For "camera" permission, may specify panTiltZoom.
    #[serde(skip_serializing_if = "Option::is_none", rename = "panTiltZoom")]
    pan_tilt_zoom: Option<bool>,
}

impl<'a> PermissionDescriptor<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `name`: Name of permission. See <https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl> for valid permission names.
    pub fn builder(name: impl Into<Cow<'a, str>>) -> PermissionDescriptorBuilder<'a> {
        PermissionDescriptorBuilder {
            name: name.into(),
            sysex: None,
            user_visible_only: None,
            allow_without_sanitization: None,
            allow_without_gesture: None,
            pan_tilt_zoom: None,
        }
    }
    /// Name of permission.
    /// See <https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl> for valid permission names.
    pub fn name(&self) -> &str { self.name.as_ref() }
    /// For "midi" permission, may also specify sysex control.
    pub fn sysex(&self) -> Option<bool> { self.sysex }
    /// For "push" permission, may specify userVisibleOnly.
    /// Note that userVisibleOnly = true is the only currently supported type.
    pub fn user_visible_only(&self) -> Option<bool> { self.user_visible_only }
    /// For "clipboard" permission, may specify allowWithoutSanitization.
    pub fn allow_without_sanitization(&self) -> Option<bool> { self.allow_without_sanitization }
    /// For "fullscreen" permission, must specify allowWithoutGesture:true.
    pub fn allow_without_gesture(&self) -> Option<bool> { self.allow_without_gesture }
    /// For "camera" permission, may specify panTiltZoom.
    pub fn pan_tilt_zoom(&self) -> Option<bool> { self.pan_tilt_zoom }
}


pub struct PermissionDescriptorBuilder<'a> {
    name: Cow<'a, str>,
    sysex: Option<bool>,
    user_visible_only: Option<bool>,
    allow_without_sanitization: Option<bool>,
    allow_without_gesture: Option<bool>,
    pan_tilt_zoom: Option<bool>,
}

impl<'a> PermissionDescriptorBuilder<'a> {
    /// For "midi" permission, may also specify sysex control.
    pub fn sysex(mut self, sysex: bool) -> Self { self.sysex = Some(sysex); self }
    /// For "push" permission, may specify userVisibleOnly.
    /// Note that userVisibleOnly = true is the only currently supported type.
    pub fn user_visible_only(mut self, user_visible_only: bool) -> Self { self.user_visible_only = Some(user_visible_only); self }
    /// For "clipboard" permission, may specify allowWithoutSanitization.
    pub fn allow_without_sanitization(mut self, allow_without_sanitization: bool) -> Self { self.allow_without_sanitization = Some(allow_without_sanitization); self }
    /// For "fullscreen" permission, must specify allowWithoutGesture:true.
    pub fn allow_without_gesture(mut self, allow_without_gesture: bool) -> Self { self.allow_without_gesture = Some(allow_without_gesture); self }
    /// For "camera" permission, may specify panTiltZoom.
    pub fn pan_tilt_zoom(mut self, pan_tilt_zoom: bool) -> Self { self.pan_tilt_zoom = Some(pan_tilt_zoom); self }
    pub fn build(self) -> PermissionDescriptor<'a> {
        PermissionDescriptor {
            name: self.name,
            sysex: self.sysex,
            user_visible_only: self.user_visible_only,
            allow_without_sanitization: self.allow_without_sanitization,
            allow_without_gesture: self.allow_without_gesture,
            pan_tilt_zoom: self.pan_tilt_zoom,
        }
    }
}

/// Browser command ids used by executeBrowserCommand.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum BrowserCommandId {
    #[default]
    #[serde(rename = "openTabSearch")]
    OpenTabSearch,
    #[serde(rename = "closeTabSearch")]
    CloseTabSearch,
    #[serde(rename = "openGlic")]
    OpenGlic,
}

/// Chrome histogram bucket.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Bucket {
    /// Minimum value (inclusive).
    low: i64,
    /// Maximum value (exclusive).
    high: i64,
    /// Number of samples.
    count: u64,
}

impl Bucket {
    /// Creates a builder for this type with the required parameters:
    /// * `low`: Minimum value (inclusive).
    /// * `high`: Maximum value (exclusive).
    /// * `count`: Number of samples.
    pub fn builder(low: i64, high: i64, count: u64) -> BucketBuilder {
        BucketBuilder {
            low: low,
            high: high,
            count: count,
        }
    }
    /// Minimum value (inclusive).
    pub fn low(&self) -> i64 { self.low }
    /// Maximum value (exclusive).
    pub fn high(&self) -> i64 { self.high }
    /// Number of samples.
    pub fn count(&self) -> u64 { self.count }
}


pub struct BucketBuilder {
    low: i64,
    high: i64,
    count: u64,
}

impl BucketBuilder {
    pub fn build(self) -> Bucket {
        Bucket {
            low: self.low,
            high: self.high,
            count: self.count,
        }
    }
}

/// Chrome histogram.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Histogram<'a> {
    /// Name.
    name: Cow<'a, str>,
    /// Sum of sample values.
    sum: i64,
    /// Total number of samples.
    count: u64,
    /// Buckets.
    buckets: Vec<Bucket>,
}

impl<'a> Histogram<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `name`: Name.
    /// * `sum`: Sum of sample values.
    /// * `count`: Total number of samples.
    /// * `buckets`: Buckets.
    pub fn builder(name: impl Into<Cow<'a, str>>, sum: i64, count: u64, buckets: Vec<Bucket>) -> HistogramBuilder<'a> {
        HistogramBuilder {
            name: name.into(),
            sum: sum,
            count: count,
            buckets: buckets,
        }
    }
    /// Name.
    pub fn name(&self) -> &str { self.name.as_ref() }
    /// Sum of sample values.
    pub fn sum(&self) -> i64 { self.sum }
    /// Total number of samples.
    pub fn count(&self) -> u64 { self.count }
    /// Buckets.
    pub fn buckets(&self) -> &[Bucket] { &self.buckets }
}


pub struct HistogramBuilder<'a> {
    name: Cow<'a, str>,
    sum: i64,
    count: u64,
    buckets: Vec<Bucket>,
}

impl<'a> HistogramBuilder<'a> {
    pub fn build(self) -> Histogram<'a> {
        Histogram {
            name: self.name,
            sum: self.sum,
            count: self.count,
            buckets: self.buckets,
        }
    }
}


#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum PrivacySandboxAPI {
    #[default]
    #[serde(rename = "BiddingAndAuctionServices")]
    BiddingAndAuctionServices,
    #[serde(rename = "TrustedKeyValue")]
    TrustedKeyValue,
}

/// Set permission settings for given embedding and embedded origins.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetPermissionParams<'a> {
    /// Descriptor of permission to override.
    permission: PermissionDescriptor<'a>,
    /// Setting of the permission.
    setting: PermissionSetting,
    /// Embedding origin the permission applies to, all origins if not specified.
    #[serde(skip_serializing_if = "Option::is_none")]
    origin: Option<Cow<'a, str>>,
    /// Embedded origin the permission applies to. It is ignored unless the embedding origin is
    /// present and valid. If the embedding origin is provided but the embedded origin isn't, the
    /// embedding origin is used as the embedded origin.
    #[serde(skip_serializing_if = "Option::is_none", rename = "embeddedOrigin")]
    embedded_origin: Option<Cow<'a, str>>,
    /// Context to override. When omitted, default browser context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> SetPermissionParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `permission`: Descriptor of permission to override.
    /// * `setting`: Setting of the permission.
    pub fn builder(permission: PermissionDescriptor<'a>, setting: impl Into<PermissionSetting>) -> SetPermissionParamsBuilder<'a> {
        SetPermissionParamsBuilder {
            permission: permission,
            setting: setting.into(),
            origin: None,
            embedded_origin: None,
            browser_context_id: None,
        }
    }
    /// Descriptor of permission to override.
    pub fn permission(&self) -> &PermissionDescriptor<'a> { &self.permission }
    /// Setting of the permission.
    pub fn setting(&self) -> &PermissionSetting { &self.setting }
    /// Embedding origin the permission applies to, all origins if not specified.
    pub fn origin(&self) -> Option<&str> { self.origin.as_deref() }
    /// Embedded origin the permission applies to. It is ignored unless the embedding origin is
    /// present and valid. If the embedding origin is provided but the embedded origin isn't, the
    /// embedding origin is used as the embedded origin.
    pub fn embedded_origin(&self) -> Option<&str> { self.embedded_origin.as_deref() }
    /// Context to override. When omitted, default browser context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
}


pub struct SetPermissionParamsBuilder<'a> {
    permission: PermissionDescriptor<'a>,
    setting: PermissionSetting,
    origin: Option<Cow<'a, str>>,
    embedded_origin: Option<Cow<'a, str>>,
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> SetPermissionParamsBuilder<'a> {
    /// Embedding origin the permission applies to, all origins if not specified.
    pub fn origin(mut self, origin: impl Into<Cow<'a, str>>) -> Self { self.origin = Some(origin.into()); self }
    /// Embedded origin the permission applies to. It is ignored unless the embedding origin is
    /// present and valid. If the embedding origin is provided but the embedded origin isn't, the
    /// embedding origin is used as the embedded origin.
    pub fn embedded_origin(mut self, embedded_origin: impl Into<Cow<'a, str>>) -> Self { self.embedded_origin = Some(embedded_origin.into()); self }
    /// Context to override. When omitted, default browser context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    pub fn build(self) -> SetPermissionParams<'a> {
        SetPermissionParams {
            permission: self.permission,
            setting: self.setting,
            origin: self.origin,
            embedded_origin: self.embedded_origin,
            browser_context_id: self.browser_context_id,
        }
    }
}

impl<'a> SetPermissionParams<'a> { pub const METHOD: &'static str = "Browser.setPermission"; }

impl<'a> crate::CdpCommand<'a> for SetPermissionParams<'a> {
    const METHOD: &'static str = "Browser.setPermission";
    type Response = crate::EmptyReturns;
}

/// Grant specific permissions to the given origin and reject all others. Deprecated. Use
/// setPermission instead.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GrantPermissionsParams<'a> {
    permissions: Vec<PermissionType>,
    /// Origin the permission applies to, all origins if not specified.
    #[serde(skip_serializing_if = "Option::is_none")]
    origin: Option<Cow<'a, str>>,
    /// BrowserContext to override permissions. When omitted, default browser context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> GrantPermissionsParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `permissions`: 
    pub fn builder(permissions: Vec<PermissionType>) -> GrantPermissionsParamsBuilder<'a> {
        GrantPermissionsParamsBuilder {
            permissions: permissions,
            origin: None,
            browser_context_id: None,
        }
    }
    pub fn permissions(&self) -> &[PermissionType] { &self.permissions }
    /// Origin the permission applies to, all origins if not specified.
    pub fn origin(&self) -> Option<&str> { self.origin.as_deref() }
    /// BrowserContext to override permissions. When omitted, default browser context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
}


pub struct GrantPermissionsParamsBuilder<'a> {
    permissions: Vec<PermissionType>,
    origin: Option<Cow<'a, str>>,
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> GrantPermissionsParamsBuilder<'a> {
    /// Origin the permission applies to, all origins if not specified.
    pub fn origin(mut self, origin: impl Into<Cow<'a, str>>) -> Self { self.origin = Some(origin.into()); self }
    /// BrowserContext to override permissions. When omitted, default browser context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    pub fn build(self) -> GrantPermissionsParams<'a> {
        GrantPermissionsParams {
            permissions: self.permissions,
            origin: self.origin,
            browser_context_id: self.browser_context_id,
        }
    }
}

impl<'a> GrantPermissionsParams<'a> { pub const METHOD: &'static str = "Browser.grantPermissions"; }

impl<'a> crate::CdpCommand<'a> for GrantPermissionsParams<'a> {
    const METHOD: &'static str = "Browser.grantPermissions";
    type Response = crate::EmptyReturns;
}

/// Reset all permission management for all origins.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ResetPermissionsParams<'a> {
    /// BrowserContext to reset permissions. When omitted, default browser context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> ResetPermissionsParams<'a> {
    /// Creates a builder for this type.
    pub fn builder() -> ResetPermissionsParamsBuilder<'a> {
        ResetPermissionsParamsBuilder {
            browser_context_id: None,
        }
    }
    /// BrowserContext to reset permissions. When omitted, default browser context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
}

#[derive(Default)]
pub struct ResetPermissionsParamsBuilder<'a> {
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> ResetPermissionsParamsBuilder<'a> {
    /// BrowserContext to reset permissions. When omitted, default browser context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    pub fn build(self) -> ResetPermissionsParams<'a> {
        ResetPermissionsParams {
            browser_context_id: self.browser_context_id,
        }
    }
}

impl<'a> ResetPermissionsParams<'a> { pub const METHOD: &'static str = "Browser.resetPermissions"; }

impl<'a> crate::CdpCommand<'a> for ResetPermissionsParams<'a> {
    const METHOD: &'static str = "Browser.resetPermissions";
    type Response = crate::EmptyReturns;
}

/// Set the behavior when downloading a file.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetDownloadBehaviorParams<'a> {
    /// Whether to allow all or deny all download requests, or use default Chrome behavior if
    /// available (otherwise deny). |allowAndName| allows download and names files according to
    /// their download guids.
    behavior: Cow<'a, str>,
    /// BrowserContext to set download behavior. When omitted, default browser context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
    /// or 'allowAndName'.
    #[serde(skip_serializing_if = "Option::is_none", rename = "downloadPath")]
    download_path: Option<Cow<'a, str>>,
    /// Whether to emit download events (defaults to false).
    #[serde(skip_serializing_if = "Option::is_none", rename = "eventsEnabled")]
    events_enabled: Option<bool>,
}

impl<'a> SetDownloadBehaviorParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `behavior`: Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). |allowAndName| allows download and names files according to their download guids.
    pub fn builder(behavior: impl Into<Cow<'a, str>>) -> SetDownloadBehaviorParamsBuilder<'a> {
        SetDownloadBehaviorParamsBuilder {
            behavior: behavior.into(),
            browser_context_id: None,
            download_path: None,
            events_enabled: None,
        }
    }
    /// Whether to allow all or deny all download requests, or use default Chrome behavior if
    /// available (otherwise deny). |allowAndName| allows download and names files according to
    /// their download guids.
    pub fn behavior(&self) -> &str { self.behavior.as_ref() }
    /// BrowserContext to set download behavior. When omitted, default browser context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
    /// or 'allowAndName'.
    pub fn download_path(&self) -> Option<&str> { self.download_path.as_deref() }
    /// Whether to emit download events (defaults to false).
    pub fn events_enabled(&self) -> Option<bool> { self.events_enabled }
}


pub struct SetDownloadBehaviorParamsBuilder<'a> {
    behavior: Cow<'a, str>,
    browser_context_id: Option<BrowserContextID<'a>>,
    download_path: Option<Cow<'a, str>>,
    events_enabled: Option<bool>,
}

impl<'a> SetDownloadBehaviorParamsBuilder<'a> {
    /// BrowserContext to set download behavior. When omitted, default browser context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    /// The default path to save downloaded files to. This is required if behavior is set to 'allow'
    /// or 'allowAndName'.
    pub fn download_path(mut self, download_path: impl Into<Cow<'a, str>>) -> Self { self.download_path = Some(download_path.into()); self }
    /// Whether to emit download events (defaults to false).
    pub fn events_enabled(mut self, events_enabled: bool) -> Self { self.events_enabled = Some(events_enabled); self }
    pub fn build(self) -> SetDownloadBehaviorParams<'a> {
        SetDownloadBehaviorParams {
            behavior: self.behavior,
            browser_context_id: self.browser_context_id,
            download_path: self.download_path,
            events_enabled: self.events_enabled,
        }
    }
}

impl<'a> SetDownloadBehaviorParams<'a> { pub const METHOD: &'static str = "Browser.setDownloadBehavior"; }

impl<'a> crate::CdpCommand<'a> for SetDownloadBehaviorParams<'a> {
    const METHOD: &'static str = "Browser.setDownloadBehavior";
    type Response = crate::EmptyReturns;
}

/// Cancel a download if in progress

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct CancelDownloadParams<'a> {
    /// Global unique identifier of the download.
    guid: Cow<'a, str>,
    /// BrowserContext to perform the action in. When omitted, default browser context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> CancelDownloadParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `guid`: Global unique identifier of the download.
    pub fn builder(guid: impl Into<Cow<'a, str>>) -> CancelDownloadParamsBuilder<'a> {
        CancelDownloadParamsBuilder {
            guid: guid.into(),
            browser_context_id: None,
        }
    }
    /// Global unique identifier of the download.
    pub fn guid(&self) -> &str { self.guid.as_ref() }
    /// BrowserContext to perform the action in. When omitted, default browser context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
}


pub struct CancelDownloadParamsBuilder<'a> {
    guid: Cow<'a, str>,
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> CancelDownloadParamsBuilder<'a> {
    /// BrowserContext to perform the action in. When omitted, default browser context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    pub fn build(self) -> CancelDownloadParams<'a> {
        CancelDownloadParams {
            guid: self.guid,
            browser_context_id: self.browser_context_id,
        }
    }
}

impl<'a> CancelDownloadParams<'a> { pub const METHOD: &'static str = "Browser.cancelDownload"; }

impl<'a> crate::CdpCommand<'a> for CancelDownloadParams<'a> {
    const METHOD: &'static str = "Browser.cancelDownload";
    type Response = crate::EmptyReturns;
}

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

impl CloseParams { pub const METHOD: &'static str = "Browser.close"; }

impl<'a> crate::CdpCommand<'a> for CloseParams {
    const METHOD: &'static str = "Browser.close";
    type Response = crate::EmptyReturns;
}

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

impl CrashParams { pub const METHOD: &'static str = "Browser.crash"; }

impl<'a> crate::CdpCommand<'a> for CrashParams {
    const METHOD: &'static str = "Browser.crash";
    type Response = crate::EmptyReturns;
}

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

impl CrashGpuProcessParams { pub const METHOD: &'static str = "Browser.crashGpuProcess"; }

impl<'a> crate::CdpCommand<'a> for CrashGpuProcessParams {
    const METHOD: &'static str = "Browser.crashGpuProcess";
    type Response = crate::EmptyReturns;
}

/// Returns version information.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetVersionReturns<'a> {
    /// Protocol version.
    #[serde(rename = "protocolVersion")]
    protocol_version: Cow<'a, str>,
    /// Product name.
    product: Cow<'a, str>,
    /// Product revision.
    revision: Cow<'a, str>,
    /// User-Agent.
    #[serde(rename = "userAgent")]
    user_agent: Cow<'a, str>,
    /// V8 version.
    #[serde(rename = "jsVersion")]
    js_version: Cow<'a, str>,
}

impl<'a> GetVersionReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `protocol_version`: Protocol version.
    /// * `product`: Product name.
    /// * `revision`: Product revision.
    /// * `user_agent`: User-Agent.
    /// * `js_version`: V8 version.
    pub fn builder(protocol_version: impl Into<Cow<'a, str>>, product: impl Into<Cow<'a, str>>, revision: impl Into<Cow<'a, str>>, user_agent: impl Into<Cow<'a, str>>, js_version: impl Into<Cow<'a, str>>) -> GetVersionReturnsBuilder<'a> {
        GetVersionReturnsBuilder {
            protocol_version: protocol_version.into(),
            product: product.into(),
            revision: revision.into(),
            user_agent: user_agent.into(),
            js_version: js_version.into(),
        }
    }
    /// Protocol version.
    pub fn protocol_version(&self) -> &str { self.protocol_version.as_ref() }
    /// Product name.
    pub fn product(&self) -> &str { self.product.as_ref() }
    /// Product revision.
    pub fn revision(&self) -> &str { self.revision.as_ref() }
    /// User-Agent.
    pub fn user_agent(&self) -> &str { self.user_agent.as_ref() }
    /// V8 version.
    pub fn js_version(&self) -> &str { self.js_version.as_ref() }
}


pub struct GetVersionReturnsBuilder<'a> {
    protocol_version: Cow<'a, str>,
    product: Cow<'a, str>,
    revision: Cow<'a, str>,
    user_agent: Cow<'a, str>,
    js_version: Cow<'a, str>,
}

impl<'a> GetVersionReturnsBuilder<'a> {
    pub fn build(self) -> GetVersionReturns<'a> {
        GetVersionReturns {
            protocol_version: self.protocol_version,
            product: self.product,
            revision: self.revision,
            user_agent: self.user_agent,
            js_version: self.js_version,
        }
    }
}

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

impl GetVersionParams { pub const METHOD: &'static str = "Browser.getVersion"; }

impl<'a> crate::CdpCommand<'a> for GetVersionParams {
    const METHOD: &'static str = "Browser.getVersion";
    type Response = GetVersionReturns<'a>;
}

/// Returns the command line switches for the browser process if, and only if
/// --enable-automation is on the commandline.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetBrowserCommandLineReturns<'a> {
    /// Commandline parameters
    arguments: Vec<Cow<'a, str>>,
}

impl<'a> GetBrowserCommandLineReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `arguments`: Commandline parameters
    pub fn builder(arguments: Vec<Cow<'a, str>>) -> GetBrowserCommandLineReturnsBuilder<'a> {
        GetBrowserCommandLineReturnsBuilder {
            arguments: arguments,
        }
    }
    /// Commandline parameters
    pub fn arguments(&self) -> &[Cow<'a, str>] { &self.arguments }
}


pub struct GetBrowserCommandLineReturnsBuilder<'a> {
    arguments: Vec<Cow<'a, str>>,
}

impl<'a> GetBrowserCommandLineReturnsBuilder<'a> {
    pub fn build(self) -> GetBrowserCommandLineReturns<'a> {
        GetBrowserCommandLineReturns {
            arguments: self.arguments,
        }
    }
}

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

impl GetBrowserCommandLineParams { pub const METHOD: &'static str = "Browser.getBrowserCommandLine"; }

impl<'a> crate::CdpCommand<'a> for GetBrowserCommandLineParams {
    const METHOD: &'static str = "Browser.getBrowserCommandLine";
    type Response = GetBrowserCommandLineReturns<'a>;
}

/// Get Chrome histograms.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHistogramsParams<'a> {
    /// Requested substring in name. Only histograms which have query as a
    /// substring in their name are extracted. An empty or absent query returns
    /// all histograms.
    #[serde(skip_serializing_if = "Option::is_none")]
    query: Option<Cow<'a, str>>,
    /// If true, retrieve delta since last delta call.
    #[serde(skip_serializing_if = "Option::is_none")]
    delta: Option<bool>,
}

impl<'a> GetHistogramsParams<'a> {
    /// Creates a builder for this type.
    pub fn builder() -> GetHistogramsParamsBuilder<'a> {
        GetHistogramsParamsBuilder {
            query: None,
            delta: None,
        }
    }
    /// Requested substring in name. Only histograms which have query as a
    /// substring in their name are extracted. An empty or absent query returns
    /// all histograms.
    pub fn query(&self) -> Option<&str> { self.query.as_deref() }
    /// If true, retrieve delta since last delta call.
    pub fn delta(&self) -> Option<bool> { self.delta }
}

#[derive(Default)]
pub struct GetHistogramsParamsBuilder<'a> {
    query: Option<Cow<'a, str>>,
    delta: Option<bool>,
}

impl<'a> GetHistogramsParamsBuilder<'a> {
    /// Requested substring in name. Only histograms which have query as a
    /// substring in their name are extracted. An empty or absent query returns
    /// all histograms.
    pub fn query(mut self, query: impl Into<Cow<'a, str>>) -> Self { self.query = Some(query.into()); self }
    /// If true, retrieve delta since last delta call.
    pub fn delta(mut self, delta: bool) -> Self { self.delta = Some(delta); self }
    pub fn build(self) -> GetHistogramsParams<'a> {
        GetHistogramsParams {
            query: self.query,
            delta: self.delta,
        }
    }
}

/// Get Chrome histograms.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHistogramsReturns<'a> {
    /// Histograms.
    histograms: Vec<Histogram<'a>>,
}

impl<'a> GetHistogramsReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `histograms`: Histograms.
    pub fn builder(histograms: Vec<Histogram<'a>>) -> GetHistogramsReturnsBuilder<'a> {
        GetHistogramsReturnsBuilder {
            histograms: histograms,
        }
    }
    /// Histograms.
    pub fn histograms(&self) -> &[Histogram<'a>] { &self.histograms }
}


pub struct GetHistogramsReturnsBuilder<'a> {
    histograms: Vec<Histogram<'a>>,
}

impl<'a> GetHistogramsReturnsBuilder<'a> {
    pub fn build(self) -> GetHistogramsReturns<'a> {
        GetHistogramsReturns {
            histograms: self.histograms,
        }
    }
}

impl<'a> GetHistogramsParams<'a> { pub const METHOD: &'static str = "Browser.getHistograms"; }

impl<'a> crate::CdpCommand<'a> for GetHistogramsParams<'a> {
    const METHOD: &'static str = "Browser.getHistograms";
    type Response = GetHistogramsReturns<'a>;
}

/// Get a Chrome histogram by name.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHistogramParams<'a> {
    /// Requested histogram name.
    name: Cow<'a, str>,
    /// If true, retrieve delta since last delta call.
    #[serde(skip_serializing_if = "Option::is_none")]
    delta: Option<bool>,
}

impl<'a> GetHistogramParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `name`: Requested histogram name.
    pub fn builder(name: impl Into<Cow<'a, str>>) -> GetHistogramParamsBuilder<'a> {
        GetHistogramParamsBuilder {
            name: name.into(),
            delta: None,
        }
    }
    /// Requested histogram name.
    pub fn name(&self) -> &str { self.name.as_ref() }
    /// If true, retrieve delta since last delta call.
    pub fn delta(&self) -> Option<bool> { self.delta }
}


pub struct GetHistogramParamsBuilder<'a> {
    name: Cow<'a, str>,
    delta: Option<bool>,
}

impl<'a> GetHistogramParamsBuilder<'a> {
    /// If true, retrieve delta since last delta call.
    pub fn delta(mut self, delta: bool) -> Self { self.delta = Some(delta); self }
    pub fn build(self) -> GetHistogramParams<'a> {
        GetHistogramParams {
            name: self.name,
            delta: self.delta,
        }
    }
}

/// Get a Chrome histogram by name.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetHistogramReturns<'a> {
    /// Histogram.
    histogram: Histogram<'a>,
}

impl<'a> GetHistogramReturns<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `histogram`: Histogram.
    pub fn builder(histogram: Histogram<'a>) -> GetHistogramReturnsBuilder<'a> {
        GetHistogramReturnsBuilder {
            histogram: histogram,
        }
    }
    /// Histogram.
    pub fn histogram(&self) -> &Histogram<'a> { &self.histogram }
}


pub struct GetHistogramReturnsBuilder<'a> {
    histogram: Histogram<'a>,
}

impl<'a> GetHistogramReturnsBuilder<'a> {
    pub fn build(self) -> GetHistogramReturns<'a> {
        GetHistogramReturns {
            histogram: self.histogram,
        }
    }
}

impl<'a> GetHistogramParams<'a> { pub const METHOD: &'static str = "Browser.getHistogram"; }

impl<'a> crate::CdpCommand<'a> for GetHistogramParams<'a> {
    const METHOD: &'static str = "Browser.getHistogram";
    type Response = GetHistogramReturns<'a>;
}

/// Get position and size of the browser window.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetWindowBoundsParams {
    /// Browser window id.
    #[serde(rename = "windowId")]
    window_id: WindowID,
}

impl GetWindowBoundsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `window_id`: Browser window id.
    pub fn builder(window_id: WindowID) -> GetWindowBoundsParamsBuilder {
        GetWindowBoundsParamsBuilder {
            window_id: window_id,
        }
    }
    /// Browser window id.
    pub fn window_id(&self) -> &WindowID { &self.window_id }
}


pub struct GetWindowBoundsParamsBuilder {
    window_id: WindowID,
}

impl GetWindowBoundsParamsBuilder {
    pub fn build(self) -> GetWindowBoundsParams {
        GetWindowBoundsParams {
            window_id: self.window_id,
        }
    }
}

/// Get position and size of the browser window.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetWindowBoundsReturns {
    /// Bounds information of the window. When window state is 'minimized', the restored window
    /// position and size are returned.
    bounds: Bounds,
}

impl GetWindowBoundsReturns {
    /// Creates a builder for this type with the required parameters:
    /// * `bounds`: Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
    pub fn builder(bounds: Bounds) -> GetWindowBoundsReturnsBuilder {
        GetWindowBoundsReturnsBuilder {
            bounds: bounds,
        }
    }
    /// Bounds information of the window. When window state is 'minimized', the restored window
    /// position and size are returned.
    pub fn bounds(&self) -> &Bounds { &self.bounds }
}


pub struct GetWindowBoundsReturnsBuilder {
    bounds: Bounds,
}

impl GetWindowBoundsReturnsBuilder {
    pub fn build(self) -> GetWindowBoundsReturns {
        GetWindowBoundsReturns {
            bounds: self.bounds,
        }
    }
}

impl GetWindowBoundsParams { pub const METHOD: &'static str = "Browser.getWindowBounds"; }

impl<'a> crate::CdpCommand<'a> for GetWindowBoundsParams {
    const METHOD: &'static str = "Browser.getWindowBounds";
    type Response = GetWindowBoundsReturns;
}

/// Get the browser window that contains the devtools target.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetWindowForTargetParams<'a> {
    /// Devtools agent host id. If called as a part of the session, associated targetId is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "targetId")]
    target_id: Option<crate::target::TargetID<'a>>,
}

impl<'a> GetWindowForTargetParams<'a> {
    /// Creates a builder for this type.
    pub fn builder() -> GetWindowForTargetParamsBuilder<'a> {
        GetWindowForTargetParamsBuilder {
            target_id: None,
        }
    }
    /// Devtools agent host id. If called as a part of the session, associated targetId is used.
    pub fn target_id(&self) -> Option<&crate::target::TargetID<'a>> { self.target_id.as_ref() }
}

#[derive(Default)]
pub struct GetWindowForTargetParamsBuilder<'a> {
    target_id: Option<crate::target::TargetID<'a>>,
}

impl<'a> GetWindowForTargetParamsBuilder<'a> {
    /// Devtools agent host id. If called as a part of the session, associated targetId is used.
    pub fn target_id(mut self, target_id: crate::target::TargetID<'a>) -> Self { self.target_id = Some(target_id); self }
    pub fn build(self) -> GetWindowForTargetParams<'a> {
        GetWindowForTargetParams {
            target_id: self.target_id,
        }
    }
}

/// Get the browser window that contains the devtools target.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetWindowForTargetReturns {
    /// Browser window id.
    #[serde(rename = "windowId")]
    window_id: WindowID,
    /// Bounds information of the window. When window state is 'minimized', the restored window
    /// position and size are returned.
    bounds: Bounds,
}

impl GetWindowForTargetReturns {
    /// Creates a builder for this type with the required parameters:
    /// * `window_id`: Browser window id.
    /// * `bounds`: Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
    pub fn builder(window_id: WindowID, bounds: Bounds) -> GetWindowForTargetReturnsBuilder {
        GetWindowForTargetReturnsBuilder {
            window_id: window_id,
            bounds: bounds,
        }
    }
    /// Browser window id.
    pub fn window_id(&self) -> &WindowID { &self.window_id }
    /// Bounds information of the window. When window state is 'minimized', the restored window
    /// position and size are returned.
    pub fn bounds(&self) -> &Bounds { &self.bounds }
}


pub struct GetWindowForTargetReturnsBuilder {
    window_id: WindowID,
    bounds: Bounds,
}

impl GetWindowForTargetReturnsBuilder {
    pub fn build(self) -> GetWindowForTargetReturns {
        GetWindowForTargetReturns {
            window_id: self.window_id,
            bounds: self.bounds,
        }
    }
}

impl<'a> GetWindowForTargetParams<'a> { pub const METHOD: &'static str = "Browser.getWindowForTarget"; }

impl<'a> crate::CdpCommand<'a> for GetWindowForTargetParams<'a> {
    const METHOD: &'static str = "Browser.getWindowForTarget";
    type Response = GetWindowForTargetReturns;
}

/// Set position and/or size of the browser window.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetWindowBoundsParams {
    /// Browser window id.
    #[serde(rename = "windowId")]
    window_id: WindowID,
    /// New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
    /// with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
    bounds: Bounds,
}

impl SetWindowBoundsParams {
    /// Creates a builder for this type with the required parameters:
    /// * `window_id`: Browser window id.
    /// * `bounds`: New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
    pub fn builder(window_id: WindowID, bounds: Bounds) -> SetWindowBoundsParamsBuilder {
        SetWindowBoundsParamsBuilder {
            window_id: window_id,
            bounds: bounds,
        }
    }
    /// Browser window id.
    pub fn window_id(&self) -> &WindowID { &self.window_id }
    /// New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined
    /// with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
    pub fn bounds(&self) -> &Bounds { &self.bounds }
}


pub struct SetWindowBoundsParamsBuilder {
    window_id: WindowID,
    bounds: Bounds,
}

impl SetWindowBoundsParamsBuilder {
    pub fn build(self) -> SetWindowBoundsParams {
        SetWindowBoundsParams {
            window_id: self.window_id,
            bounds: self.bounds,
        }
    }
}

impl SetWindowBoundsParams { pub const METHOD: &'static str = "Browser.setWindowBounds"; }

impl<'a> crate::CdpCommand<'a> for SetWindowBoundsParams {
    const METHOD: &'static str = "Browser.setWindowBounds";
    type Response = crate::EmptyReturns;
}

/// Set size of the browser contents resizing browser window as necessary.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetContentsSizeParams {
    /// Browser window id.
    #[serde(rename = "windowId")]
    window_id: WindowID,
    /// The window contents width in DIP. Assumes current width if omitted.
    /// Must be specified if 'height' is omitted.
    #[serde(skip_serializing_if = "Option::is_none")]
    width: Option<u64>,
    /// The window contents height in DIP. Assumes current height if omitted.
    /// Must be specified if 'width' is omitted.
    #[serde(skip_serializing_if = "Option::is_none")]
    height: Option<i64>,
}

impl SetContentsSizeParams {
    /// Creates a builder for this type with the required parameters:
    /// * `window_id`: Browser window id.
    pub fn builder(window_id: WindowID) -> SetContentsSizeParamsBuilder {
        SetContentsSizeParamsBuilder {
            window_id: window_id,
            width: None,
            height: None,
        }
    }
    /// Browser window id.
    pub fn window_id(&self) -> &WindowID { &self.window_id }
    /// The window contents width in DIP. Assumes current width if omitted.
    /// Must be specified if 'height' is omitted.
    pub fn width(&self) -> Option<u64> { self.width }
    /// The window contents height in DIP. Assumes current height if omitted.
    /// Must be specified if 'width' is omitted.
    pub fn height(&self) -> Option<i64> { self.height }
}


pub struct SetContentsSizeParamsBuilder {
    window_id: WindowID,
    width: Option<u64>,
    height: Option<i64>,
}

impl SetContentsSizeParamsBuilder {
    /// The window contents width in DIP. Assumes current width if omitted.
    /// Must be specified if 'height' is omitted.
    pub fn width(mut self, width: u64) -> Self { self.width = Some(width); self }
    /// The window contents height in DIP. Assumes current height if omitted.
    /// Must be specified if 'width' is omitted.
    pub fn height(mut self, height: i64) -> Self { self.height = Some(height); self }
    pub fn build(self) -> SetContentsSizeParams {
        SetContentsSizeParams {
            window_id: self.window_id,
            width: self.width,
            height: self.height,
        }
    }
}

impl SetContentsSizeParams { pub const METHOD: &'static str = "Browser.setContentsSize"; }

impl<'a> crate::CdpCommand<'a> for SetContentsSizeParams {
    const METHOD: &'static str = "Browser.setContentsSize";
    type Response = crate::EmptyReturns;
}

/// Set dock tile details, platform-specific.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetDockTileParams<'a> {
    #[serde(skip_serializing_if = "Option::is_none", rename = "badgeLabel")]
    badge_label: Option<Cow<'a, str>>,
    /// Png encoded image. (Encoded as a base64 string when passed over JSON)
    #[serde(skip_serializing_if = "Option::is_none")]
    image: Option<Cow<'a, str>>,
}

impl<'a> SetDockTileParams<'a> {
    /// Creates a builder for this type.
    pub fn builder() -> SetDockTileParamsBuilder<'a> {
        SetDockTileParamsBuilder {
            badge_label: None,
            image: None,
        }
    }
    pub fn badge_label(&self) -> Option<&str> { self.badge_label.as_deref() }
    /// Png encoded image. (Encoded as a base64 string when passed over JSON)
    pub fn image(&self) -> Option<&str> { self.image.as_deref() }
}

#[derive(Default)]
pub struct SetDockTileParamsBuilder<'a> {
    badge_label: Option<Cow<'a, str>>,
    image: Option<Cow<'a, str>>,
}

impl<'a> SetDockTileParamsBuilder<'a> {
    pub fn badge_label(mut self, badge_label: impl Into<Cow<'a, str>>) -> Self { self.badge_label = Some(badge_label.into()); self }
    /// Png encoded image. (Encoded as a base64 string when passed over JSON)
    pub fn image(mut self, image: impl Into<Cow<'a, str>>) -> Self { self.image = Some(image.into()); self }
    pub fn build(self) -> SetDockTileParams<'a> {
        SetDockTileParams {
            badge_label: self.badge_label,
            image: self.image,
        }
    }
}

impl<'a> SetDockTileParams<'a> { pub const METHOD: &'static str = "Browser.setDockTile"; }

impl<'a> crate::CdpCommand<'a> for SetDockTileParams<'a> {
    const METHOD: &'static str = "Browser.setDockTile";
    type Response = crate::EmptyReturns;
}

/// Invoke custom browser commands used by telemetry.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ExecuteBrowserCommandParams {
    #[serde(rename = "commandId")]
    command_id: BrowserCommandId,
}

impl ExecuteBrowserCommandParams {
    /// Creates a builder for this type with the required parameters:
    /// * `command_id`: 
    pub fn builder(command_id: impl Into<BrowserCommandId>) -> ExecuteBrowserCommandParamsBuilder {
        ExecuteBrowserCommandParamsBuilder {
            command_id: command_id.into(),
        }
    }
    pub fn command_id(&self) -> &BrowserCommandId { &self.command_id }
}


pub struct ExecuteBrowserCommandParamsBuilder {
    command_id: BrowserCommandId,
}

impl ExecuteBrowserCommandParamsBuilder {
    pub fn build(self) -> ExecuteBrowserCommandParams {
        ExecuteBrowserCommandParams {
            command_id: self.command_id,
        }
    }
}

impl ExecuteBrowserCommandParams { pub const METHOD: &'static str = "Browser.executeBrowserCommand"; }

impl<'a> crate::CdpCommand<'a> for ExecuteBrowserCommandParams {
    const METHOD: &'static str = "Browser.executeBrowserCommand";
    type Response = crate::EmptyReturns;
}

/// Allows a site to use privacy sandbox features that require enrollment
/// without the site actually being enrolled. Only supported on page targets.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AddPrivacySandboxEnrollmentOverrideParams<'a> {
    url: Cow<'a, str>,
}

impl<'a> AddPrivacySandboxEnrollmentOverrideParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `url`: 
    pub fn builder(url: impl Into<Cow<'a, str>>) -> AddPrivacySandboxEnrollmentOverrideParamsBuilder<'a> {
        AddPrivacySandboxEnrollmentOverrideParamsBuilder {
            url: url.into(),
        }
    }
    pub fn url(&self) -> &str { self.url.as_ref() }
}


pub struct AddPrivacySandboxEnrollmentOverrideParamsBuilder<'a> {
    url: Cow<'a, str>,
}

impl<'a> AddPrivacySandboxEnrollmentOverrideParamsBuilder<'a> {
    pub fn build(self) -> AddPrivacySandboxEnrollmentOverrideParams<'a> {
        AddPrivacySandboxEnrollmentOverrideParams {
            url: self.url,
        }
    }
}

impl<'a> AddPrivacySandboxEnrollmentOverrideParams<'a> { pub const METHOD: &'static str = "Browser.addPrivacySandboxEnrollmentOverride"; }

impl<'a> crate::CdpCommand<'a> for AddPrivacySandboxEnrollmentOverrideParams<'a> {
    const METHOD: &'static str = "Browser.addPrivacySandboxEnrollmentOverride";
    type Response = crate::EmptyReturns;
}

/// Configures encryption keys used with a given privacy sandbox API to talk
/// to a trusted coordinator.  Since this is intended for test automation only,
/// coordinatorOrigin must be a .test domain. No existing coordinator
/// configuration for the origin may exist.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AddPrivacySandboxCoordinatorKeyConfigParams<'a> {
    api: PrivacySandboxAPI,
    #[serde(rename = "coordinatorOrigin")]
    coordinator_origin: Cow<'a, str>,
    #[serde(rename = "keyConfig")]
    key_config: Cow<'a, str>,
    /// BrowserContext to perform the action in. When omitted, default browser
    /// context is used.
    #[serde(skip_serializing_if = "Option::is_none", rename = "browserContextId")]
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> AddPrivacySandboxCoordinatorKeyConfigParams<'a> {
    /// Creates a builder for this type with the required parameters:
    /// * `api`: 
    /// * `coordinator_origin`: 
    /// * `key_config`: 
    pub fn builder(api: impl Into<PrivacySandboxAPI>, coordinator_origin: impl Into<Cow<'a, str>>, key_config: impl Into<Cow<'a, str>>) -> AddPrivacySandboxCoordinatorKeyConfigParamsBuilder<'a> {
        AddPrivacySandboxCoordinatorKeyConfigParamsBuilder {
            api: api.into(),
            coordinator_origin: coordinator_origin.into(),
            key_config: key_config.into(),
            browser_context_id: None,
        }
    }
    pub fn api(&self) -> &PrivacySandboxAPI { &self.api }
    pub fn coordinator_origin(&self) -> &str { self.coordinator_origin.as_ref() }
    pub fn key_config(&self) -> &str { self.key_config.as_ref() }
    /// BrowserContext to perform the action in. When omitted, default browser
    /// context is used.
    pub fn browser_context_id(&self) -> Option<&BrowserContextID<'a>> { self.browser_context_id.as_ref() }
}


pub struct AddPrivacySandboxCoordinatorKeyConfigParamsBuilder<'a> {
    api: PrivacySandboxAPI,
    coordinator_origin: Cow<'a, str>,
    key_config: Cow<'a, str>,
    browser_context_id: Option<BrowserContextID<'a>>,
}

impl<'a> AddPrivacySandboxCoordinatorKeyConfigParamsBuilder<'a> {
    /// BrowserContext to perform the action in. When omitted, default browser
    /// context is used.
    pub fn browser_context_id(mut self, browser_context_id: impl Into<BrowserContextID<'a>>) -> Self { self.browser_context_id = Some(browser_context_id.into()); self }
    pub fn build(self) -> AddPrivacySandboxCoordinatorKeyConfigParams<'a> {
        AddPrivacySandboxCoordinatorKeyConfigParams {
            api: self.api,
            coordinator_origin: self.coordinator_origin,
            key_config: self.key_config,
            browser_context_id: self.browser_context_id,
        }
    }
}

impl<'a> AddPrivacySandboxCoordinatorKeyConfigParams<'a> { pub const METHOD: &'static str = "Browser.addPrivacySandboxCoordinatorKeyConfig"; }

impl<'a> crate::CdpCommand<'a> for AddPrivacySandboxCoordinatorKeyConfigParams<'a> {
    const METHOD: &'static str = "Browser.addPrivacySandboxCoordinatorKeyConfig";
    type Response = crate::EmptyReturns;
}