rustenium-bidi-definitions 0.1.1

Generated WebDriver BiDi 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
use super::commands::*;
impl AddDataCollector {
    pub fn builder() -> AddDataCollectorBuilder {
        <AddDataCollectorBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct AddDataCollectorBuilder {
    data_types: Option<Vec<super::types::DataType>>,
    max_encoded_data_size: Option<u64>,
    collector_type: Option<super::types::CollectorType>,
    contexts: Option<Vec<crate::browsing_context::types::BrowsingContext>>,
    user_contexts: Option<Vec<crate::browser::types::UserContext>>,
}
impl AddDataCollectorBuilder {
    pub fn data_type(mut self, data_type: impl Into<super::types::DataType>) -> Self {
        let v = self.data_types.get_or_insert(Vec::new());
        v.push(data_type.into());
        self
    }
    pub fn data_types<I, S>(mut self, data_types: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::DataType>,
    {
        let v = self.data_types.get_or_insert(Vec::new());
        for val in data_types {
            v.push(val.into());
        }
        self
    }
    pub fn max_encoded_data_size(mut self, max_encoded_data_size: impl Into<u64>) -> Self {
        self.max_encoded_data_size = Some(max_encoded_data_size.into());
        self
    }
    pub fn collector_type(
        mut self,
        collector_type: impl Into<super::types::CollectorType>,
    ) -> Self {
        self.collector_type = Some(collector_type.into());
        self
    }
    pub fn context(
        mut self,
        context: impl Into<crate::browsing_context::types::BrowsingContext>,
    ) -> Self {
        let v = self.contexts.get_or_insert(Vec::new());
        v.push(context.into());
        self
    }
    pub fn contexts<I, S>(mut self, contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browsing_context::types::BrowsingContext>,
    {
        let v = self.contexts.get_or_insert(Vec::new());
        for val in contexts {
            v.push(val.into());
        }
        self
    }
    pub fn user_context(
        mut self,
        user_context: impl Into<crate::browser::types::UserContext>,
    ) -> Self {
        let v = self.user_contexts.get_or_insert(Vec::new());
        v.push(user_context.into());
        self
    }
    pub fn user_contexts<I, S>(mut self, user_contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browser::types::UserContext>,
    {
        let v = self.user_contexts.get_or_insert(Vec::new());
        for val in user_contexts {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<AddDataCollector, String> {
        Ok(AddDataCollector {
            method: AddDataCollectorMethod::AddDataCollector,
            params: AddDataCollectorParams {
                data_types: self.data_types.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(data_types))
                })?,
                max_encoded_data_size: self.max_encoded_data_size.ok_or_else(|| {
                    format!(
                        "Field `{}` is mandatory.",
                        std::stringify!(max_encoded_data_size)
                    )
                })?,
                collector_type: self.collector_type,
                contexts: self.contexts,
                user_contexts: self.user_contexts,
            },
        })
    }
}
impl AddIntercept {
    pub fn builder() -> AddInterceptBuilder {
        <AddInterceptBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct AddInterceptBuilder {
    phases: Option<Vec<super::types::InterceptPhase>>,
    contexts: Option<Vec<crate::browsing_context::types::BrowsingContext>>,
    url_patterns: Option<Vec<super::types::UrlPattern>>,
}
impl AddInterceptBuilder {
    pub fn phase(mut self, phase: impl Into<super::types::InterceptPhase>) -> Self {
        let v = self.phases.get_or_insert(Vec::new());
        v.push(phase.into());
        self
    }
    pub fn phases<I, S>(mut self, phases: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::InterceptPhase>,
    {
        let v = self.phases.get_or_insert(Vec::new());
        for val in phases {
            v.push(val.into());
        }
        self
    }
    pub fn context(
        mut self,
        context: impl Into<crate::browsing_context::types::BrowsingContext>,
    ) -> Self {
        let v = self.contexts.get_or_insert(Vec::new());
        v.push(context.into());
        self
    }
    pub fn contexts<I, S>(mut self, contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browsing_context::types::BrowsingContext>,
    {
        let v = self.contexts.get_or_insert(Vec::new());
        for val in contexts {
            v.push(val.into());
        }
        self
    }
    pub fn url_pattern(mut self, url_pattern: impl Into<super::types::UrlPattern>) -> 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::UrlPattern>,
    {
        let v = self.url_patterns.get_or_insert(Vec::new());
        for val in url_patterns {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<AddIntercept, String> {
        Ok(AddIntercept {
            method: AddInterceptMethod::AddIntercept,
            params: AddInterceptParams {
                phases: self
                    .phases
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(phases)))?,
                contexts: self.contexts,
                url_patterns: self.url_patterns,
            },
        })
    }
}
impl ContinueRequest {
    pub fn builder() -> ContinueRequestBuilder {
        <ContinueRequestBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ContinueRequestBuilder {
    request: Option<super::types::Request>,
    body: Option<super::types::BytesValue>,
    cookies: Option<Vec<super::types::CookieHeader>>,
    headers: Option<Vec<super::types::Header>>,
    method: Option<String>,
    url: Option<String>,
}
impl ContinueRequestBuilder {
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn body(mut self, body: impl Into<super::types::BytesValue>) -> Self {
        self.body = Some(body.into());
        self
    }
    pub fn cookie(mut self, cookie: impl Into<super::types::CookieHeader>) -> 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::CookieHeader>,
    {
        let v = self.cookies.get_or_insert(Vec::new());
        for val in cookies {
            v.push(val.into());
        }
        self
    }
    pub fn header(mut self, header: impl Into<super::types::Header>) -> Self {
        let v = self.headers.get_or_insert(Vec::new());
        v.push(header.into());
        self
    }
    pub fn headers<I, S>(mut self, headers: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::Header>,
    {
        let v = self.headers.get_or_insert(Vec::new());
        for val in headers {
            v.push(val.into());
        }
        self
    }
    pub fn method(mut self, method: impl Into<String>) -> Self {
        self.method = Some(method.into());
        self
    }
    pub fn url(mut self, url: impl Into<String>) -> Self {
        self.url = Some(url.into());
        self
    }
    pub fn build(self) -> Result<ContinueRequest, String> {
        Ok(ContinueRequest {
            method: ContinueRequestMethod::ContinueRequest,
            params: ContinueRequestParams {
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
                body: self.body,
                cookies: self.cookies,
                headers: self.headers,
                method: self.method,
                url: self.url,
            },
        })
    }
}
impl ContinueResponse {
    pub fn builder() -> ContinueResponseBuilder {
        <ContinueResponseBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ContinueResponseBuilder {
    request: Option<super::types::Request>,
    cookies: Option<Vec<super::types::SetCookieHeader>>,
    credentials: Option<super::types::AuthCredentials>,
    headers: Option<Vec<super::types::Header>>,
    reason_phrase: Option<String>,
    status_code: Option<u64>,
}
impl ContinueResponseBuilder {
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn cookie(mut self, cookie: impl Into<super::types::SetCookieHeader>) -> 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::SetCookieHeader>,
    {
        let v = self.cookies.get_or_insert(Vec::new());
        for val in cookies {
            v.push(val.into());
        }
        self
    }
    pub fn credentials(mut self, credentials: impl Into<super::types::AuthCredentials>) -> Self {
        self.credentials = Some(credentials.into());
        self
    }
    pub fn header(mut self, header: impl Into<super::types::Header>) -> Self {
        let v = self.headers.get_or_insert(Vec::new());
        v.push(header.into());
        self
    }
    pub fn headers<I, S>(mut self, headers: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::Header>,
    {
        let v = self.headers.get_or_insert(Vec::new());
        for val in headers {
            v.push(val.into());
        }
        self
    }
    pub fn reason_phrase(mut self, reason_phrase: impl Into<String>) -> Self {
        self.reason_phrase = Some(reason_phrase.into());
        self
    }
    pub fn status_code(mut self, status_code: impl Into<u64>) -> Self {
        self.status_code = Some(status_code.into());
        self
    }
    pub fn build(self) -> Result<ContinueResponse, String> {
        Ok(ContinueResponse {
            method: ContinueResponseMethod::ContinueResponse,
            params: ContinueResponseParams {
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
                cookies: self.cookies,
                credentials: self.credentials,
                headers: self.headers,
                reason_phrase: self.reason_phrase,
                status_code: self.status_code,
            },
        })
    }
}
impl ContinueWithAuth {
    pub fn builder() -> ContinueWithAuthBuilder {
        <ContinueWithAuthBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ContinueWithAuthBuilder {
    request: Option<super::types::Request>,
    continue_with_auth_credentials_continue_with_auth_no_credentials_union:
        Option<super::types::ContinueWithAuthCredentialsContinueWithAuthNoCredentialsUnion>,
}
impl ContinueWithAuthBuilder {
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn continue_with_auth_credentials_continue_with_auth_no_credentials_union(
        mut self,
        continue_with_auth_credentials_continue_with_auth_no_credentials_union: impl Into<
            super::types::ContinueWithAuthCredentialsContinueWithAuthNoCredentialsUnion,
        >,
    ) -> Self {
        self.continue_with_auth_credentials_continue_with_auth_no_credentials_union =
            Some(continue_with_auth_credentials_continue_with_auth_no_credentials_union.into());
        self
    }
    pub fn build(self) -> Result<ContinueWithAuth, String> {
        Ok (ContinueWithAuth { method : ContinueWithAuthMethod :: ContinueWithAuth , params : ContinueWithAuthParams { request : self . request . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (request))) ? , continue_with_auth_credentials_continue_with_auth_no_credentials_union : self . continue_with_auth_credentials_continue_with_auth_no_credentials_union . ok_or_else (|| format ! ("Field `{}` is mandatory." , std :: stringify ! (continue_with_auth_credentials_continue_with_auth_no_credentials_union))) ? , } , })
    }
}
impl DisownData {
    pub fn builder() -> DisownDataBuilder {
        <DisownDataBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct DisownDataBuilder {
    data_type: Option<super::types::DataType>,
    collector: Option<super::types::Collector>,
    request: Option<super::types::Request>,
}
impl DisownDataBuilder {
    pub fn data_type(mut self, data_type: impl Into<super::types::DataType>) -> Self {
        self.data_type = Some(data_type.into());
        self
    }
    pub fn collector(mut self, collector: impl Into<super::types::Collector>) -> Self {
        self.collector = Some(collector.into());
        self
    }
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn build(self) -> Result<DisownData, String> {
        Ok(DisownData {
            method: DisownDataMethod::DisownData,
            params: DisownDataParams {
                data_type: self.data_type.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(data_type))
                })?,
                collector: self.collector.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(collector))
                })?,
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
            },
        })
    }
}
impl FailRequest {
    pub fn builder() -> FailRequestBuilder {
        <FailRequestBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct FailRequestBuilder {
    request: Option<super::types::Request>,
}
impl FailRequestBuilder {
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn build(self) -> Result<FailRequest, String> {
        Ok(FailRequest {
            method: FailRequestMethod::FailRequest,
            params: FailRequestParams {
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
            },
        })
    }
}
impl GetData {
    pub fn builder() -> GetDataBuilder {
        <GetDataBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct GetDataBuilder {
    data_type: Option<super::types::DataType>,
    collector: Option<super::types::Collector>,
    disown: Option<bool>,
    request: Option<super::types::Request>,
}
impl GetDataBuilder {
    pub fn data_type(mut self, data_type: impl Into<super::types::DataType>) -> Self {
        self.data_type = Some(data_type.into());
        self
    }
    pub fn collector(mut self, collector: impl Into<super::types::Collector>) -> Self {
        self.collector = Some(collector.into());
        self
    }
    pub fn disown(mut self, disown: impl Into<bool>) -> Self {
        self.disown = Some(disown.into());
        self
    }
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn build(self) -> Result<GetData, String> {
        Ok(GetData {
            method: GetDataMethod::GetData,
            params: GetDataParams {
                data_type: self.data_type.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(data_type))
                })?,
                collector: self.collector,
                disown: self.disown,
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
            },
        })
    }
}
impl ProvideResponse {
    pub fn builder() -> ProvideResponseBuilder {
        <ProvideResponseBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct ProvideResponseBuilder {
    request: Option<super::types::Request>,
    body: Option<super::types::BytesValue>,
    cookies: Option<Vec<super::types::SetCookieHeader>>,
    headers: Option<Vec<super::types::Header>>,
    reason_phrase: Option<String>,
    status_code: Option<u64>,
}
impl ProvideResponseBuilder {
    pub fn request(mut self, request: impl Into<super::types::Request>) -> Self {
        self.request = Some(request.into());
        self
    }
    pub fn body(mut self, body: impl Into<super::types::BytesValue>) -> Self {
        self.body = Some(body.into());
        self
    }
    pub fn cookie(mut self, cookie: impl Into<super::types::SetCookieHeader>) -> 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::SetCookieHeader>,
    {
        let v = self.cookies.get_or_insert(Vec::new());
        for val in cookies {
            v.push(val.into());
        }
        self
    }
    pub fn header(mut self, header: impl Into<super::types::Header>) -> Self {
        let v = self.headers.get_or_insert(Vec::new());
        v.push(header.into());
        self
    }
    pub fn headers<I, S>(mut self, headers: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::Header>,
    {
        let v = self.headers.get_or_insert(Vec::new());
        for val in headers {
            v.push(val.into());
        }
        self
    }
    pub fn reason_phrase(mut self, reason_phrase: impl Into<String>) -> Self {
        self.reason_phrase = Some(reason_phrase.into());
        self
    }
    pub fn status_code(mut self, status_code: impl Into<u64>) -> Self {
        self.status_code = Some(status_code.into());
        self
    }
    pub fn build(self) -> Result<ProvideResponse, String> {
        Ok(ProvideResponse {
            method: ProvideResponseMethod::ProvideResponse,
            params: ProvideResponseParams {
                request: self
                    .request
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(request)))?,
                body: self.body,
                cookies: self.cookies,
                headers: self.headers,
                reason_phrase: self.reason_phrase,
                status_code: self.status_code,
            },
        })
    }
}
impl RemoveDataCollector {
    pub fn builder() -> RemoveDataCollectorBuilder {
        <RemoveDataCollectorBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct RemoveDataCollectorBuilder {
    collector: Option<super::types::Collector>,
}
impl RemoveDataCollectorBuilder {
    pub fn collector(mut self, collector: impl Into<super::types::Collector>) -> Self {
        self.collector = Some(collector.into());
        self
    }
    pub fn build(self) -> Result<RemoveDataCollector, String> {
        Ok(RemoveDataCollector {
            method: RemoveDataCollectorMethod::RemoveDataCollector,
            params: RemoveDataCollectorParams {
                collector: self.collector.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(collector))
                })?,
            },
        })
    }
}
impl RemoveIntercept {
    pub fn builder() -> RemoveInterceptBuilder {
        <RemoveInterceptBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct RemoveInterceptBuilder {
    intercept: Option<super::types::Intercept>,
}
impl RemoveInterceptBuilder {
    pub fn intercept(mut self, intercept: impl Into<super::types::Intercept>) -> Self {
        self.intercept = Some(intercept.into());
        self
    }
    pub fn build(self) -> Result<RemoveIntercept, String> {
        Ok(RemoveIntercept {
            method: RemoveInterceptMethod::RemoveIntercept,
            params: RemoveInterceptParams {
                intercept: self.intercept.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(intercept))
                })?,
            },
        })
    }
}
impl SetCacheBehavior {
    pub fn builder() -> SetCacheBehaviorBuilder {
        <SetCacheBehaviorBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetCacheBehaviorBuilder {
    cache_behavior: Option<SetCacheBehaviorCacheBehavior>,
    contexts: Option<Vec<crate::browsing_context::types::BrowsingContext>>,
}
impl SetCacheBehaviorBuilder {
    pub fn cache_behavior(
        mut self,
        cache_behavior: impl Into<SetCacheBehaviorCacheBehavior>,
    ) -> Self {
        self.cache_behavior = Some(cache_behavior.into());
        self
    }
    pub fn context(
        mut self,
        context: impl Into<crate::browsing_context::types::BrowsingContext>,
    ) -> Self {
        let v = self.contexts.get_or_insert(Vec::new());
        v.push(context.into());
        self
    }
    pub fn contexts<I, S>(mut self, contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browsing_context::types::BrowsingContext>,
    {
        let v = self.contexts.get_or_insert(Vec::new());
        for val in contexts {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<SetCacheBehavior, String> {
        Ok(SetCacheBehavior {
            method: SetCacheBehaviorMethod::SetCacheBehavior,
            params: SetCacheBehaviorParams {
                cache_behavior: self.cache_behavior.ok_or_else(|| {
                    format!("Field `{}` is mandatory.", std::stringify!(cache_behavior))
                })?,
                contexts: self.contexts,
            },
        })
    }
}
impl SetExtraHeaders {
    pub fn builder() -> SetExtraHeadersBuilder {
        <SetExtraHeadersBuilder as Default>::default()
    }
}
#[derive(Default, Clone)]
pub struct SetExtraHeadersBuilder {
    headers: Option<Vec<super::types::Header>>,
    contexts: Option<Vec<crate::browsing_context::types::BrowsingContext>>,
    user_contexts: Option<Vec<crate::browser::types::UserContext>>,
}
impl SetExtraHeadersBuilder {
    pub fn header(mut self, header: impl Into<super::types::Header>) -> Self {
        let v = self.headers.get_or_insert(Vec::new());
        v.push(header.into());
        self
    }
    pub fn headers<I, S>(mut self, headers: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<super::types::Header>,
    {
        let v = self.headers.get_or_insert(Vec::new());
        for val in headers {
            v.push(val.into());
        }
        self
    }
    pub fn context(
        mut self,
        context: impl Into<crate::browsing_context::types::BrowsingContext>,
    ) -> Self {
        let v = self.contexts.get_or_insert(Vec::new());
        v.push(context.into());
        self
    }
    pub fn contexts<I, S>(mut self, contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browsing_context::types::BrowsingContext>,
    {
        let v = self.contexts.get_or_insert(Vec::new());
        for val in contexts {
            v.push(val.into());
        }
        self
    }
    pub fn user_context(
        mut self,
        user_context: impl Into<crate::browser::types::UserContext>,
    ) -> Self {
        let v = self.user_contexts.get_or_insert(Vec::new());
        v.push(user_context.into());
        self
    }
    pub fn user_contexts<I, S>(mut self, user_contexts: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: Into<crate::browser::types::UserContext>,
    {
        let v = self.user_contexts.get_or_insert(Vec::new());
        for val in user_contexts {
            v.push(val.into());
        }
        self
    }
    pub fn build(self) -> Result<SetExtraHeaders, String> {
        Ok(SetExtraHeaders {
            method: SetExtraHeadersMethod::SetExtraHeaders,
            params: SetExtraHeadersParams {
                headers: self
                    .headers
                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(headers)))?,
                contexts: self.contexts,
                user_contexts: self.user_contexts,
            },
        })
    }
}