rustenium-cdp-definitions 0.1.1

Generated Chrome DevTools Protocol type definitions for Rustenium
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
use super::commands::*;
impl SetAcceptedEncodings {
    pub fn builder() -> SetAcceptedEncodingsBuilder {
        <SetAcceptedEncodingsBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetAcceptedEncodingsBuilder {
    encodings: Option<Vec<super::types::ContentEncoding>>,
}
impl SetAcceptedEncodingsBuilder {
    pub fn encoding(mut self, encoding: impl Into<super::types::ContentEncoding>) -> Self {
        let v = self.encodings.get_or_insert(Vec::new());
        v.push(encoding.into());
        self
    }
    pub fn encodings<I, S>(mut self, encodings: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::ContentEncoding>,
    {
        let v = self.encodings.get_or_insert(Vec::new());
        for val in encodings {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<SetAcceptedEncodings, String> {
        Ok(SetAcceptedEncodings {
            method: SetAcceptedEncodingsMethod::SetAcceptedEncodings,
            params: SetAcceptedEncodingsParams {
                encodings: self.encodings.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(encodings))
                })?,
            },
        })
    }
}
#[derive(Debug, Clone, Default)]
pub struct ClearAcceptedEncodingsOverrideBuilder;
impl ClearAcceptedEncodingsOverrideBuilder {
    pub fn new() -> Self {
        Self
    }
    pub fn build(self) -> ClearAcceptedEncodingsOverride {
        ClearAcceptedEncodingsOverride {
            method: ClearAcceptedEncodingsOverrideMethod::ClearAcceptedEncodingsOverride,
            params: ClearAcceptedEncodingsOverrideParams {},
        }
    }
}
impl ClearAcceptedEncodingsOverride {
    pub fn builder() -> ClearAcceptedEncodingsOverrideBuilder {
        ClearAcceptedEncodingsOverrideBuilder
    }
}
#[derive(Debug, Clone, Default)]
pub struct ClearBrowserCacheBuilder;
impl ClearBrowserCacheBuilder {
    pub fn new() -> Self {
        Self
    }
    pub fn build(self) -> ClearBrowserCache {
        ClearBrowserCache {
            method: ClearBrowserCacheMethod::ClearBrowserCache,
            params: ClearBrowserCacheParams {},
        }
    }
}
impl ClearBrowserCache {
    pub fn builder() -> ClearBrowserCacheBuilder {
        ClearBrowserCacheBuilder
    }
}
#[derive(Debug, Clone, Default)]
pub struct ClearBrowserCookiesBuilder;
impl ClearBrowserCookiesBuilder {
    pub fn new() -> Self {
        Self
    }
    pub fn build(self) -> ClearBrowserCookies {
        ClearBrowserCookies {
            method: ClearBrowserCookiesMethod::ClearBrowserCookies,
            params: ClearBrowserCookiesParams {},
        }
    }
}
impl ClearBrowserCookies {
    pub fn builder() -> ClearBrowserCookiesBuilder {
        ClearBrowserCookiesBuilder
    }
}
impl DeleteCookies {
    pub fn builder() -> DeleteCookiesBuilder {
        <DeleteCookiesBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct DeleteCookiesBuilder {
    name: Option<String>,
    url: Option<String>,
    domain: Option<String>,
    path: Option<String>,
    partition_key: Option<super::types::CookiePartitionKey>,
}
impl DeleteCookiesBuilder {
    pub fn name(mut self, name: impl Into<String>) -> Self {
        self.name = Some(name.into());
        self
    }
    pub fn url(mut self, url: impl Into<String>) -> Self {
        self.url = Some(url.into());
        self
    }
    pub fn domain(mut self, domain: impl Into<String>) -> Self {
        self.domain = Some(domain.into());
        self
    }
    pub fn path(mut self, path: impl Into<String>) -> Self {
        self.path = Some(path.into());
        self
    }
    pub fn partition_key(
        mut self,
        partition_key: impl Into<super::types::CookiePartitionKey>,
    ) -> Self {
        self.partition_key = Some(partition_key.into());
        self
    }
    pub fn build(self) -> Result<DeleteCookies, String> {
        Ok(DeleteCookies {
            method: DeleteCookiesMethod::DeleteCookies,
            params: DeleteCookiesParams {
                name: self
                    .name
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
                url: self.url,
                domain: self.domain,
                path: self.path,
                partition_key: self.partition_key,
            },
        })
    }
}
#[derive(Debug, Clone, Default)]
pub struct DisableBuilder;
impl DisableBuilder {
    pub fn new() -> Self {
        Self
    }
    pub fn build(self) -> Disable {
        Disable {
            method: DisableMethod::Disable,
            params: DisableParams {},
        }
    }
}
impl Disable {
    pub fn builder() -> DisableBuilder {
        DisableBuilder
    }
}
impl EmulateNetworkConditionsByRule {
    pub fn builder() -> EmulateNetworkConditionsByRuleBuilder {
        <EmulateNetworkConditionsByRuleBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct EmulateNetworkConditionsByRuleBuilder {
    offline: Option<bool>,
    matched_network_conditions: Option<Vec<super::types::NetworkConditions>>,
}
impl EmulateNetworkConditionsByRuleBuilder {
    pub fn offline(mut self, offline: impl Into<bool>) -> Self {
        self.offline = Some(offline.into());
        self
    }
    pub fn matched_network_condition(
        mut self,
        matched_network_condition: impl Into<super::types::NetworkConditions>,
    ) -> Self {
        let v = self.matched_network_conditions.get_or_insert(Vec::new());
        v.push(matched_network_condition.into());
        self
    }
    pub fn matched_network_conditions<I, S>(mut self, matched_network_conditions: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::NetworkConditions>,
    {
        let v = self.matched_network_conditions.get_or_insert(Vec::new());
        for val in matched_network_conditions {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<EmulateNetworkConditionsByRule, String> {
        Ok(EmulateNetworkConditionsByRule {
            method: EmulateNetworkConditionsByRuleMethod::EmulateNetworkConditionsByRule,
            params: EmulateNetworkConditionsByRuleParams {
                offline: self
                    .offline
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(offline)))?,
                matched_network_conditions: self.matched_network_conditions.ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(matched_network_conditions)
                    )
                })?,
            },
        })
    }
}
impl OverrideNetworkState {
    pub fn builder() -> OverrideNetworkStateBuilder {
        <OverrideNetworkStateBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct OverrideNetworkStateBuilder {
    offline: Option<bool>,
    latency: Option<f64>,
    download_throughput: Option<f64>,
    upload_throughput: Option<f64>,
    connection_type: Option<super::types::ConnectionType>,
}
impl OverrideNetworkStateBuilder {
    pub fn offline(mut self, offline: impl Into<bool>) -> Self {
        self.offline = Some(offline.into());
        self
    }
    pub fn latency(mut self, latency: impl Into<f64>) -> Self {
        self.latency = Some(latency.into());
        self
    }
    pub fn download_throughput(mut self, download_throughput: impl Into<f64>) -> Self {
        self.download_throughput = Some(download_throughput.into());
        self
    }
    pub fn upload_throughput(mut self, upload_throughput: impl Into<f64>) -> Self {
        self.upload_throughput = Some(upload_throughput.into());
        self
    }
    pub fn connection_type(
        mut self,
        connection_type: impl Into<super::types::ConnectionType>,
    ) -> Self {
        self.connection_type = Some(connection_type.into());
        self
    }
    pub fn build(self) -> Result<OverrideNetworkState, String> {
        Ok(OverrideNetworkState {
            method: OverrideNetworkStateMethod::OverrideNetworkState,
            params: OverrideNetworkStateParams {
                offline: self
                    .offline
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(offline)))?,
                latency: self
                    .latency
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(latency)))?,
                download_throughput: self.download_throughput.ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(download_throughput)
                    )
                })?,
                upload_throughput: self.upload_throughput.ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(upload_throughput)
                    )
                })?,
                connection_type: self.connection_type,
            },
        })
    }
}
impl Enable {
    pub fn builder() -> EnableBuilder {
        <EnableBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct EnableBuilder {
    max_total_buffer_size: Option<i64>,
    max_resource_buffer_size: Option<i64>,
    max_post_data_size: Option<i64>,
    report_direct_socket_traffic: Option<bool>,
    enable_durable_messages: Option<bool>,
}
impl EnableBuilder {
    pub fn max_total_buffer_size(mut self, max_total_buffer_size: impl Into<i64>) -> Self {
        self.max_total_buffer_size = Some(max_total_buffer_size.into());
        self
    }
    pub fn max_resource_buffer_size(mut self, max_resource_buffer_size: impl Into<i64>) -> Self {
        self.max_resource_buffer_size = Some(max_resource_buffer_size.into());
        self
    }
    pub fn max_post_data_size(mut self, max_post_data_size: impl Into<i64>) -> Self {
        self.max_post_data_size = Some(max_post_data_size.into());
        self
    }
    pub fn report_direct_socket_traffic(
        mut self,
        report_direct_socket_traffic: impl Into<bool>,
    ) -> Self {
        self.report_direct_socket_traffic = Some(report_direct_socket_traffic.into());
        self
    }
    pub fn enable_durable_messages(mut self, enable_durable_messages: impl Into<bool>) -> Self {
        self.enable_durable_messages = Some(enable_durable_messages.into());
        self
    }
    pub fn build(self) -> Enable {
        Enable {
            method: EnableMethod::Enable,
            params: EnableParams {
                max_total_buffer_size: self.max_total_buffer_size,
                max_resource_buffer_size: self.max_resource_buffer_size,
                max_post_data_size: self.max_post_data_size,
                report_direct_socket_traffic: self.report_direct_socket_traffic,
                enable_durable_messages: self.enable_durable_messages,
            },
        }
    }
}
impl ConfigureDurableMessages {
    pub fn builder() -> ConfigureDurableMessagesBuilder {
        <ConfigureDurableMessagesBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ConfigureDurableMessagesBuilder {
    max_total_buffer_size: Option<i64>,
    max_resource_buffer_size: Option<i64>,
}
impl ConfigureDurableMessagesBuilder {
    pub fn max_total_buffer_size(mut self, max_total_buffer_size: impl Into<i64>) -> Self {
        self.max_total_buffer_size = Some(max_total_buffer_size.into());
        self
    }
    pub fn max_resource_buffer_size(mut self, max_resource_buffer_size: impl Into<i64>) -> Self {
        self.max_resource_buffer_size = Some(max_resource_buffer_size.into());
        self
    }
    pub fn build(self) -> ConfigureDurableMessages {
        ConfigureDurableMessages {
            method: ConfigureDurableMessagesMethod::ConfigureDurableMessages,
            params: ConfigureDurableMessagesParams {
                max_total_buffer_size: self.max_total_buffer_size,
                max_resource_buffer_size: self.max_resource_buffer_size,
            },
        }
    }
}
impl GetCertificate {
    pub fn builder() -> GetCertificateBuilder {
        <GetCertificateBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetCertificateBuilder {
    origin: Option<String>,
}
impl GetCertificateBuilder {
    pub fn origin(mut self, origin: impl Into<String>) -> Self {
        self.origin = Some(origin.into());
        self
    }
    pub fn build(self) -> Result<GetCertificate, String> {
        Ok(GetCertificate {
            method: GetCertificateMethod::GetCertificate,
            params: GetCertificateParams {
                origin: self
                    .origin
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
            },
        })
    }
}
impl GetCookies {
    pub fn builder() -> GetCookiesBuilder {
        <GetCookiesBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetCookiesBuilder {
    urls: Option<Vec<String>>,
}
impl GetCookiesBuilder {
    pub fn url(mut self, url: impl Into<String>) -> Self {
        let v = self.urls.get_or_insert(Vec::new());
        v.push(url.into());
        self
    }
    pub fn urls<I, S>(mut self, urls: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<String>,
    {
        let v = self.urls.get_or_insert(Vec::new());
        for val in urls {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> GetCookies {
        GetCookies {
            method: GetCookiesMethod::GetCookies,
            params: GetCookiesParams { urls: self.urls },
        }
    }
}
impl GetResponseBody {
    pub fn builder() -> GetResponseBodyBuilder {
        <GetResponseBodyBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetResponseBodyBuilder {
    request_id: Option<super::types::RequestId>,
}
impl GetResponseBodyBuilder {
    pub fn request_id(mut self, request_id: impl Into<super::types::RequestId>) -> Self {
        self.request_id = Some(request_id.into());
        self
    }
    pub fn build(self) -> Result<GetResponseBody, String> {
        Ok(GetResponseBody {
            method: GetResponseBodyMethod::GetResponseBody,
            params: GetResponseBodyParams {
                request_id: self.request_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(request_id))
                })?,
            },
        })
    }
}
impl GetRequestPostData {
    pub fn builder() -> GetRequestPostDataBuilder {
        <GetRequestPostDataBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetRequestPostDataBuilder {
    request_id: Option<super::types::RequestId>,
}
impl GetRequestPostDataBuilder {
    pub fn request_id(mut self, request_id: impl Into<super::types::RequestId>) -> Self {
        self.request_id = Some(request_id.into());
        self
    }
    pub fn build(self) -> Result<GetRequestPostData, String> {
        Ok(GetRequestPostData {
            method: GetRequestPostDataMethod::GetRequestPostData,
            params: GetRequestPostDataParams {
                request_id: self.request_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(request_id))
                })?,
            },
        })
    }
}
impl GetResponseBodyForInterception {
    pub fn builder() -> GetResponseBodyForInterceptionBuilder {
        <GetResponseBodyForInterceptionBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetResponseBodyForInterceptionBuilder {
    interception_id: Option<super::types::InterceptionId>,
}
impl GetResponseBodyForInterceptionBuilder {
    pub fn interception_id(
        mut self,
        interception_id: impl Into<super::types::InterceptionId>,
    ) -> Self {
        self.interception_id = Some(interception_id.into());
        self
    }
    pub fn build(self) -> Result<GetResponseBodyForInterception, String> {
        Ok(GetResponseBodyForInterception {
            method: GetResponseBodyForInterceptionMethod::GetResponseBodyForInterception,
            params: GetResponseBodyForInterceptionParams {
                interception_id: self.interception_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(interception_id))
                })?,
            },
        })
    }
}
impl TakeResponseBodyForInterceptionAsStream {
    pub fn builder() -> TakeResponseBodyForInterceptionAsStreamBuilder {
        <TakeResponseBodyForInterceptionAsStreamBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct TakeResponseBodyForInterceptionAsStreamBuilder {
    interception_id: Option<super::types::InterceptionId>,
}
impl TakeResponseBodyForInterceptionAsStreamBuilder {
    pub fn interception_id(
        mut self,
        interception_id: impl Into<super::types::InterceptionId>,
    ) -> Self {
        self.interception_id = Some(interception_id.into());
        self
    }
    pub fn build(self) -> Result<TakeResponseBodyForInterceptionAsStream, String> {
        Ok (TakeResponseBodyForInterceptionAsStream { method : TakeResponseBodyForInterceptionAsStreamMethod :: TakeResponseBodyForInterceptionAsStream , params : TakeResponseBodyForInterceptionAsStreamParams { interception_id : self . interception_id . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (interception_id))) ? , } , })
    }
}
impl ReplayXhr {
    pub fn builder() -> ReplayXhrBuilder {
        <ReplayXhrBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ReplayXhrBuilder {
    request_id: Option<super::types::RequestId>,
}
impl ReplayXhrBuilder {
    pub fn request_id(mut self, request_id: impl Into<super::types::RequestId>) -> Self {
        self.request_id = Some(request_id.into());
        self
    }
    pub fn build(self) -> Result<ReplayXhr, String> {
        Ok(ReplayXhr {
            method: ReplayXhrMethod::ReplayXhr,
            params: ReplayXhrParams {
                request_id: self.request_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(request_id))
                })?,
            },
        })
    }
}
impl SearchInResponseBody {
    pub fn builder() -> SearchInResponseBodyBuilder {
        <SearchInResponseBodyBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SearchInResponseBodyBuilder {
    request_id: Option<super::types::RequestId>,
    query: Option<String>,
    case_sensitive: Option<bool>,
    is_regex: Option<bool>,
}
impl SearchInResponseBodyBuilder {
    pub fn request_id(mut self, request_id: impl Into<super::types::RequestId>) -> Self {
        self.request_id = Some(request_id.into());
        self
    }
    pub fn query(mut self, query: impl Into<String>) -> Self {
        self.query = Some(query.into());
        self
    }
    pub fn case_sensitive(mut self, case_sensitive: impl Into<bool>) -> Self {
        self.case_sensitive = Some(case_sensitive.into());
        self
    }
    pub fn is_regex(mut self, is_regex: impl Into<bool>) -> Self {
        self.is_regex = Some(is_regex.into());
        self
    }
    pub fn build(self) -> Result<SearchInResponseBody, String> {
        Ok(SearchInResponseBody {
            method: SearchInResponseBodyMethod::SearchInResponseBody,
            params: SearchInResponseBodyParams {
                request_id: self.request_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(request_id))
                })?,
                query: self
                    .query
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(query)))?,
                case_sensitive: self.case_sensitive,
                is_regex: self.is_regex,
            },
        })
    }
}
impl SetBlockedUrLs {
    pub fn builder() -> SetBlockedUrLsBuilder {
        <SetBlockedUrLsBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetBlockedUrLsBuilder {
    url_patterns: Option<Vec<super::types::BlockPattern>>,
}
impl SetBlockedUrLsBuilder {
    pub fn url_pattern(mut self, url_pattern: impl Into<super::types::BlockPattern>) -> Self {
        let v = self.url_patterns.get_or_insert(Vec::new());
        v.push(url_pattern.into());
        self
    }
    pub fn url_patterns<I, S>(mut self, url_patterns: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::BlockPattern>,
    {
        let v = self.url_patterns.get_or_insert(Vec::new());
        for val in url_patterns {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> SetBlockedUrLs {
        SetBlockedUrLs {
            method: SetBlockedUrLsMethod::SetBlockedUrLs,
            params: SetBlockedUrLsParams {
                url_patterns: self.url_patterns,
            },
        }
    }
}
impl SetBypassServiceWorker {
    pub fn builder() -> SetBypassServiceWorkerBuilder {
        <SetBypassServiceWorkerBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetBypassServiceWorkerBuilder {
    bypass: Option<bool>,
}
impl SetBypassServiceWorkerBuilder {
    pub fn bypass(mut self, bypass: impl Into<bool>) -> Self {
        self.bypass = Some(bypass.into());
        self
    }
    pub fn build(self) -> Result<SetBypassServiceWorker, String> {
        Ok(SetBypassServiceWorker {
            method: SetBypassServiceWorkerMethod::SetBypassServiceWorker,
            params: SetBypassServiceWorkerParams {
                bypass: self
                    .bypass
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(bypass)))?,
            },
        })
    }
}
impl SetCacheDisabled {
    pub fn builder() -> SetCacheDisabledBuilder {
        <SetCacheDisabledBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetCacheDisabledBuilder {
    cache_disabled: Option<bool>,
}
impl SetCacheDisabledBuilder {
    pub fn cache_disabled(mut self, cache_disabled: impl Into<bool>) -> Self {
        self.cache_disabled = Some(cache_disabled.into());
        self
    }
    pub fn build(self) -> Result<SetCacheDisabled, String> {
        Ok(SetCacheDisabled {
            method: SetCacheDisabledMethod::SetCacheDisabled,
            params: SetCacheDisabledParams {
                cache_disabled: self.cache_disabled.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(cache_disabled))
                })?,
            },
        })
    }
}
impl SetCookie {
    pub fn builder() -> SetCookieBuilder {
        <SetCookieBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetCookieBuilder {
    name: Option<String>,
    value: Option<String>,
    url: Option<String>,
    domain: Option<String>,
    path: Option<String>,
    secure: Option<bool>,
    http_only: Option<bool>,
    same_site: Option<super::types::CookieSameSite>,
    expires: Option<super::types::TimeSinceEpoch>,
    priority: Option<super::types::CookiePriority>,
    source_scheme: Option<super::types::CookieSourceScheme>,
    source_port: Option<i64>,
    partition_key: Option<super::types::CookiePartitionKey>,
}
impl SetCookieBuilder {
    pub fn name(mut self, name: impl Into<String>) -> Self {
        self.name = Some(name.into());
        self
    }
    pub fn value(mut self, value: impl Into<String>) -> Self {
        self.value = Some(value.into());
        self
    }
    pub fn url(mut self, url: impl Into<String>) -> Self {
        self.url = Some(url.into());
        self
    }
    pub fn domain(mut self, domain: impl Into<String>) -> Self {
        self.domain = Some(domain.into());
        self
    }
    pub fn path(mut self, path: impl Into<String>) -> Self {
        self.path = Some(path.into());
        self
    }
    pub fn secure(mut self, secure: impl Into<bool>) -> Self {
        self.secure = Some(secure.into());
        self
    }
    pub fn http_only(mut self, http_only: impl Into<bool>) -> Self {
        self.http_only = Some(http_only.into());
        self
    }
    pub fn same_site(mut self, same_site: impl Into<super::types::CookieSameSite>) -> Self {
        self.same_site = Some(same_site.into());
        self
    }
    pub fn expires(mut self, expires: impl Into<super::types::TimeSinceEpoch>) -> Self {
        self.expires = Some(expires.into());
        self
    }
    pub fn priority(mut self, priority: impl Into<super::types::CookiePriority>) -> Self {
        self.priority = Some(priority.into());
        self
    }
    pub fn source_scheme(
        mut self,
        source_scheme: impl Into<super::types::CookieSourceScheme>,
    ) -> Self {
        self.source_scheme = Some(source_scheme.into());
        self
    }
    pub fn source_port(mut self, source_port: impl Into<i64>) -> Self {
        self.source_port = Some(source_port.into());
        self
    }
    pub fn partition_key(
        mut self,
        partition_key: impl Into<super::types::CookiePartitionKey>,
    ) -> Self {
        self.partition_key = Some(partition_key.into());
        self
    }
    pub fn build(self) -> Result<SetCookie, String> {
        Ok(SetCookie {
            method: SetCookieMethod::SetCookie,
            params: SetCookieParams {
                name: self
                    .name
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(name)))?,
                value: self
                    .value
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(value)))?,
                url: self.url,
                domain: self.domain,
                path: self.path,
                secure: self.secure,
                http_only: self.http_only,
                same_site: self.same_site,
                expires: self.expires,
                priority: self.priority,
                source_scheme: self.source_scheme,
                source_port: self.source_port,
                partition_key: self.partition_key,
            },
        })
    }
}
impl SetCookies {
    pub fn builder() -> SetCookiesBuilder {
        <SetCookiesBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetCookiesBuilder {
    cookies: Option<Vec<super::types::CookieParam>>,
}
impl SetCookiesBuilder {
    pub fn cookie(mut self, cookie: impl Into<super::types::CookieParam>) -> Self {
        let v = self.cookies.get_or_insert(Vec::new());
        v.push(cookie.into());
        self
    }
    pub fn cookies<I, S>(mut self, cookies: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::CookieParam>,
    {
        let v = self.cookies.get_or_insert(Vec::new());
        for val in cookies {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<SetCookies, String> {
        Ok(SetCookies {
            method: SetCookiesMethod::SetCookies,
            params: SetCookiesParams {
                cookies: self
                    .cookies
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(cookies)))?,
            },
        })
    }
}
impl SetExtraHttpHeaders {
    pub fn builder() -> SetExtraHttpHeadersBuilder {
        <SetExtraHttpHeadersBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetExtraHttpHeadersBuilder {
    headers: Option<super::types::Headers>,
}
impl SetExtraHttpHeadersBuilder {
    pub fn headers(mut self, headers: impl Into<super::types::Headers>) -> Self {
        self.headers = Some(headers.into());
        self
    }
    pub fn build(self) -> Result<SetExtraHttpHeaders, String> {
        Ok(SetExtraHttpHeaders {
            method: SetExtraHttpHeadersMethod::SetExtraHttpHeaders,
            params: SetExtraHttpHeadersParams {
                headers: self
                    .headers
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(headers)))?,
            },
        })
    }
}
impl SetAttachDebugStack {
    pub fn builder() -> SetAttachDebugStackBuilder {
        <SetAttachDebugStackBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetAttachDebugStackBuilder {
    enabled: Option<bool>,
}
impl SetAttachDebugStackBuilder {
    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
        self.enabled = Some(enabled.into());
        self
    }
    pub fn build(self) -> Result<SetAttachDebugStack, String> {
        Ok(SetAttachDebugStack {
            method: SetAttachDebugStackMethod::SetAttachDebugStack,
            params: SetAttachDebugStackParams {
                enabled: self
                    .enabled
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
            },
        })
    }
}
impl SetUserAgentOverride {
    pub fn builder() -> SetUserAgentOverrideBuilder {
        <SetUserAgentOverrideBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetUserAgentOverrideBuilder {
    user_agent: Option<String>,
    accept_language: Option<String>,
    platform: Option<String>,
    user_agent_metadata: Option<crate::browser_protocol::emulation::types::UserAgentMetadata>,
}
impl SetUserAgentOverrideBuilder {
    pub fn user_agent(mut self, user_agent: impl Into<String>) -> Self {
        self.user_agent = Some(user_agent.into());
        self
    }
    pub fn accept_language(mut self, accept_language: impl Into<String>) -> Self {
        self.accept_language = Some(accept_language.into());
        self
    }
    pub fn platform(mut self, platform: impl Into<String>) -> Self {
        self.platform = Some(platform.into());
        self
    }
    pub fn user_agent_metadata(
        mut self,
        user_agent_metadata: impl Into<crate::browser_protocol::emulation::types::UserAgentMetadata>,
    ) -> Self {
        self.user_agent_metadata = Some(user_agent_metadata.into());
        self
    }
    pub fn build(self) -> Result<SetUserAgentOverride, String> {
        Ok(SetUserAgentOverride {
            method: SetUserAgentOverrideMethod::SetUserAgentOverride,
            params: SetUserAgentOverrideParams {
                user_agent: self.user_agent.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(user_agent))
                })?,
                accept_language: self.accept_language,
                platform: self.platform,
                user_agent_metadata: self.user_agent_metadata,
            },
        })
    }
}
impl StreamResourceContent {
    pub fn builder() -> StreamResourceContentBuilder {
        <StreamResourceContentBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct StreamResourceContentBuilder {
    request_id: Option<super::types::RequestId>,
}
impl StreamResourceContentBuilder {
    pub fn request_id(mut self, request_id: impl Into<super::types::RequestId>) -> Self {
        self.request_id = Some(request_id.into());
        self
    }
    pub fn build(self) -> Result<StreamResourceContent, String> {
        Ok(StreamResourceContent {
            method: StreamResourceContentMethod::StreamResourceContent,
            params: StreamResourceContentParams {
                request_id: self.request_id.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(request_id))
                })?,
            },
        })
    }
}
impl GetSecurityIsolationStatus {
    pub fn builder() -> GetSecurityIsolationStatusBuilder {
        <GetSecurityIsolationStatusBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetSecurityIsolationStatusBuilder {
    frame_id: Option<crate::browser_protocol::page::types::FrameId>,
}
impl GetSecurityIsolationStatusBuilder {
    pub fn frame_id(
        mut self,
        frame_id: impl Into<crate::browser_protocol::page::types::FrameId>,
    ) -> Self {
        self.frame_id = Some(frame_id.into());
        self
    }
    pub fn build(self) -> GetSecurityIsolationStatus {
        GetSecurityIsolationStatus {
            method: GetSecurityIsolationStatusMethod::GetSecurityIsolationStatus,
            params: GetSecurityIsolationStatusParams {
                frame_id: self.frame_id,
            },
        }
    }
}
impl EnableReportingApi {
    pub fn builder() -> EnableReportingApiBuilder {
        <EnableReportingApiBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct EnableReportingApiBuilder {
    enable: Option<bool>,
}
impl EnableReportingApiBuilder {
    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
        self.enable = Some(enable.into());
        self
    }
    pub fn build(self) -> Result<EnableReportingApi, String> {
        Ok(EnableReportingApi {
            method: EnableReportingApiMethod::EnableReportingApi,
            params: EnableReportingApiParams {
                enable: self
                    .enable
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
            },
        })
    }
}
impl EnableDeviceBoundSessions {
    pub fn builder() -> EnableDeviceBoundSessionsBuilder {
        <EnableDeviceBoundSessionsBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct EnableDeviceBoundSessionsBuilder {
    enable: Option<bool>,
}
impl EnableDeviceBoundSessionsBuilder {
    pub fn enable(mut self, enable: impl Into<bool>) -> Self {
        self.enable = Some(enable.into());
        self
    }
    pub fn build(self) -> Result<EnableDeviceBoundSessions, String> {
        Ok(EnableDeviceBoundSessions {
            method: EnableDeviceBoundSessionsMethod::EnableDeviceBoundSessions,
            params: EnableDeviceBoundSessionsParams {
                enable: self
                    .enable
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enable)))?,
            },
        })
    }
}
impl FetchSchemefulSite {
    pub fn builder() -> FetchSchemefulSiteBuilder {
        <FetchSchemefulSiteBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct FetchSchemefulSiteBuilder {
    origin: Option<String>,
}
impl FetchSchemefulSiteBuilder {
    pub fn origin(mut self, origin: impl Into<String>) -> Self {
        self.origin = Some(origin.into());
        self
    }
    pub fn build(self) -> Result<FetchSchemefulSite, String> {
        Ok(FetchSchemefulSite {
            method: FetchSchemefulSiteMethod::FetchSchemefulSite,
            params: FetchSchemefulSiteParams {
                origin: self
                    .origin
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(origin)))?,
            },
        })
    }
}
impl LoadNetworkResource {
    pub fn builder() -> LoadNetworkResourceBuilder {
        <LoadNetworkResourceBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct LoadNetworkResourceBuilder {
    frame_id: Option<crate::browser_protocol::page::types::FrameId>,
    url: Option<String>,
    options: Option<super::types::LoadNetworkResourceOptions>,
}
impl LoadNetworkResourceBuilder {
    pub fn frame_id(
        mut self,
        frame_id: impl Into<crate::browser_protocol::page::types::FrameId>,
    ) -> Self {
        self.frame_id = Some(frame_id.into());
        self
    }
    pub fn url(mut self, url: impl Into<String>) -> Self {
        self.url = Some(url.into());
        self
    }
    pub fn options(mut self, options: impl Into<super::types::LoadNetworkResourceOptions>) -> Self {
        self.options = Some(options.into());
        self
    }
    pub fn build(self) -> Result<LoadNetworkResource, String> {
        Ok(LoadNetworkResource {
            method: LoadNetworkResourceMethod::LoadNetworkResource,
            params: LoadNetworkResourceParams {
                frame_id: self.frame_id,
                url: self
                    .url
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(url)))?,
                options: self
                    .options
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(options)))?,
            },
        })
    }
}
impl SetCookieControls {
    pub fn builder() -> SetCookieControlsBuilder {
        <SetCookieControlsBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetCookieControlsBuilder {
    enable_third_party_cookie_restriction: Option<bool>,
    disable_third_party_cookie_metadata: Option<bool>,
    disable_third_party_cookie_heuristics: Option<bool>,
}
impl SetCookieControlsBuilder {
    pub fn enable_third_party_cookie_restriction(
        mut self,
        enable_third_party_cookie_restriction: impl Into<bool>,
    ) -> Self {
        self.enable_third_party_cookie_restriction =
            Some(enable_third_party_cookie_restriction.into());
        self
    }
    pub fn disable_third_party_cookie_metadata(
        mut self,
        disable_third_party_cookie_metadata: impl Into<bool>,
    ) -> Self {
        self.disable_third_party_cookie_metadata = Some(disable_third_party_cookie_metadata.into());
        self
    }
    pub fn disable_third_party_cookie_heuristics(
        mut self,
        disable_third_party_cookie_heuristics: impl Into<bool>,
    ) -> Self {
        self.disable_third_party_cookie_heuristics =
            Some(disable_third_party_cookie_heuristics.into());
        self
    }
    pub fn build(self) -> Result<SetCookieControls, String> {
        Ok(SetCookieControls {
            method: SetCookieControlsMethod::SetCookieControls,
            params: SetCookieControlsParams {
                enable_third_party_cookie_restriction: self
                    .enable_third_party_cookie_restriction
                    .ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(enable_third_party_cookie_restriction)
                    )
                })?,
                disable_third_party_cookie_metadata: self
                    .disable_third_party_cookie_metadata
                    .ok_or_else(|| {
                        format!(
                            "Field `{}` is mandatory.",
                            std::stringify!(disable_third_party_cookie_metadata)
                        )
                    })?,
                disable_third_party_cookie_heuristics: self
                    .disable_third_party_cookie_heuristics
                    .ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(disable_third_party_cookie_heuristics)
                    )
                })?,
            },
        })
    }
}