Skip to main content

rustenium_cdp_definitions/browser_protocol/page/
command_builders.rs

1use super::commands::*;
2impl AddScriptToEvaluateOnNewDocument {
3    pub fn builder() -> AddScriptToEvaluateOnNewDocumentBuilder {
4        <AddScriptToEvaluateOnNewDocumentBuilder as Default>::default()
5    }
6}
7#[derive(Default, Clone)]
8pub struct AddScriptToEvaluateOnNewDocumentBuilder {
9    source: Option<String>,
10    world_name: Option<String>,
11    include_command_line_api: Option<bool>,
12    run_immediately: Option<bool>,
13}
14impl AddScriptToEvaluateOnNewDocumentBuilder {
15    pub fn source(mut self, source: impl Into<String>) -> Self {
16        self.source = Some(source.into());
17        self
18    }
19    pub fn world_name(mut self, world_name: impl Into<String>) -> Self {
20        self.world_name = Some(world_name.into());
21        self
22    }
23    pub fn include_command_line_api(mut self, include_command_line_api: impl Into<bool>) -> Self {
24        self.include_command_line_api = Some(include_command_line_api.into());
25        self
26    }
27    pub fn run_immediately(mut self, run_immediately: impl Into<bool>) -> Self {
28        self.run_immediately = Some(run_immediately.into());
29        self
30    }
31    pub fn build(self) -> Result<AddScriptToEvaluateOnNewDocument, String> {
32        Ok(AddScriptToEvaluateOnNewDocument {
33            method: AddScriptToEvaluateOnNewDocumentMethod::AddScriptToEvaluateOnNewDocument,
34            params: AddScriptToEvaluateOnNewDocumentParams {
35                source: self
36                    .source
37                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(source)))?,
38                world_name: self.world_name,
39                include_command_line_api: self.include_command_line_api,
40                run_immediately: self.run_immediately,
41            },
42        })
43    }
44}
45#[derive(Debug, Clone, Default)]
46pub struct BringToFrontBuilder;
47impl BringToFrontBuilder {
48    pub fn new() -> Self {
49        Self
50    }
51    pub fn build(self) -> BringToFront {
52        BringToFront {
53            method: BringToFrontMethod::BringToFront,
54            params: BringToFrontParams {},
55        }
56    }
57}
58impl BringToFront {
59    pub fn builder() -> BringToFrontBuilder {
60        BringToFrontBuilder
61    }
62}
63impl CaptureScreenshot {
64    pub fn builder() -> CaptureScreenshotBuilder {
65        <CaptureScreenshotBuilder as Default>::default()
66    }
67}
68#[derive(Default, Clone)]
69pub struct CaptureScreenshotBuilder {
70    format: Option<CaptureScreenshotFormat>,
71    quality: Option<i64>,
72    clip: Option<super::types::Viewport>,
73    from_surface: Option<bool>,
74    capture_beyond_viewport: Option<bool>,
75    optimize_for_speed: Option<bool>,
76}
77impl CaptureScreenshotBuilder {
78    pub fn format(mut self, format: impl Into<CaptureScreenshotFormat>) -> Self {
79        self.format = Some(format.into());
80        self
81    }
82    pub fn quality(mut self, quality: impl Into<i64>) -> Self {
83        self.quality = Some(quality.into());
84        self
85    }
86    pub fn clip(mut self, clip: impl Into<super::types::Viewport>) -> Self {
87        self.clip = Some(clip.into());
88        self
89    }
90    pub fn from_surface(mut self, from_surface: impl Into<bool>) -> Self {
91        self.from_surface = Some(from_surface.into());
92        self
93    }
94    pub fn capture_beyond_viewport(mut self, capture_beyond_viewport: impl Into<bool>) -> Self {
95        self.capture_beyond_viewport = Some(capture_beyond_viewport.into());
96        self
97    }
98    pub fn optimize_for_speed(mut self, optimize_for_speed: impl Into<bool>) -> Self {
99        self.optimize_for_speed = Some(optimize_for_speed.into());
100        self
101    }
102    pub fn build(self) -> CaptureScreenshot {
103        CaptureScreenshot {
104            method: CaptureScreenshotMethod::CaptureScreenshot,
105            params: CaptureScreenshotParams {
106                format: self.format,
107                quality: self.quality,
108                clip: self.clip,
109                from_surface: self.from_surface,
110                capture_beyond_viewport: self.capture_beyond_viewport,
111                optimize_for_speed: self.optimize_for_speed,
112            },
113        }
114    }
115}
116impl CaptureSnapshot {
117    pub fn builder() -> CaptureSnapshotBuilder {
118        <CaptureSnapshotBuilder as Default>::default()
119    }
120}
121#[derive(Default, Clone)]
122pub struct CaptureSnapshotBuilder {
123    format: Option<CaptureSnapshotFormat>,
124}
125impl CaptureSnapshotBuilder {
126    pub fn format(mut self, format: impl Into<CaptureSnapshotFormat>) -> Self {
127        self.format = Some(format.into());
128        self
129    }
130    pub fn build(self) -> CaptureSnapshot {
131        CaptureSnapshot {
132            method: CaptureSnapshotMethod::CaptureSnapshot,
133            params: CaptureSnapshotParams {
134                format: self.format,
135            },
136        }
137    }
138}
139impl CreateIsolatedWorld {
140    pub fn builder() -> CreateIsolatedWorldBuilder {
141        <CreateIsolatedWorldBuilder as Default>::default()
142    }
143}
144#[derive(Default, Clone)]
145pub struct CreateIsolatedWorldBuilder {
146    frame_id: Option<super::types::FrameId>,
147    world_name: Option<String>,
148    grant_univeral_access: Option<bool>,
149}
150impl CreateIsolatedWorldBuilder {
151    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
152        self.frame_id = Some(frame_id.into());
153        self
154    }
155    pub fn world_name(mut self, world_name: impl Into<String>) -> Self {
156        self.world_name = Some(world_name.into());
157        self
158    }
159    pub fn grant_univeral_access(mut self, grant_univeral_access: impl Into<bool>) -> Self {
160        self.grant_univeral_access = Some(grant_univeral_access.into());
161        self
162    }
163    pub fn build(self) -> Result<CreateIsolatedWorld, String> {
164        Ok(CreateIsolatedWorld {
165            method: CreateIsolatedWorldMethod::CreateIsolatedWorld,
166            params: CreateIsolatedWorldParams {
167                frame_id: Box::new(self.frame_id.ok_or_else(|| {
168                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
169                })?),
170                world_name: self.world_name,
171                grant_univeral_access: self.grant_univeral_access,
172            },
173        })
174    }
175}
176#[derive(Debug, Clone, Default)]
177pub struct DisableBuilder;
178impl DisableBuilder {
179    pub fn new() -> Self {
180        Self
181    }
182    pub fn build(self) -> Disable {
183        Disable {
184            method: DisableMethod::Disable,
185            params: DisableParams {},
186        }
187    }
188}
189impl Disable {
190    pub fn builder() -> DisableBuilder {
191        DisableBuilder
192    }
193}
194impl Enable {
195    pub fn builder() -> EnableBuilder {
196        <EnableBuilder as Default>::default()
197    }
198}
199#[derive(Default, Clone)]
200pub struct EnableBuilder {
201    enable_file_chooser_opened_event: Option<bool>,
202}
203impl EnableBuilder {
204    pub fn enable_file_chooser_opened_event(
205        mut self,
206        enable_file_chooser_opened_event: impl Into<bool>,
207    ) -> Self {
208        self.enable_file_chooser_opened_event = Some(enable_file_chooser_opened_event.into());
209        self
210    }
211    pub fn build(self) -> Enable {
212        Enable {
213            method: EnableMethod::Enable,
214            params: EnableParams {
215                enable_file_chooser_opened_event: self.enable_file_chooser_opened_event,
216            },
217        }
218    }
219}
220impl GetAppManifest {
221    pub fn builder() -> GetAppManifestBuilder {
222        <GetAppManifestBuilder as Default>::default()
223    }
224}
225#[derive(Default, Clone)]
226pub struct GetAppManifestBuilder {
227    manifest_id: Option<String>,
228}
229impl GetAppManifestBuilder {
230    pub fn manifest_id(mut self, manifest_id: impl Into<String>) -> Self {
231        self.manifest_id = Some(manifest_id.into());
232        self
233    }
234    pub fn build(self) -> GetAppManifest {
235        GetAppManifest {
236            method: GetAppManifestMethod::GetAppManifest,
237            params: GetAppManifestParams {
238                manifest_id: self.manifest_id,
239            },
240        }
241    }
242}
243#[derive(Debug, Clone, Default)]
244pub struct GetInstallabilityErrorsBuilder;
245impl GetInstallabilityErrorsBuilder {
246    pub fn new() -> Self {
247        Self
248    }
249    pub fn build(self) -> GetInstallabilityErrors {
250        GetInstallabilityErrors {
251            method: GetInstallabilityErrorsMethod::GetInstallabilityErrors,
252            params: GetInstallabilityErrorsParams {},
253        }
254    }
255}
256impl GetInstallabilityErrors {
257    pub fn builder() -> GetInstallabilityErrorsBuilder {
258        GetInstallabilityErrorsBuilder
259    }
260}
261#[derive(Debug, Clone, Default)]
262pub struct GetAppIdBuilder;
263impl GetAppIdBuilder {
264    pub fn new() -> Self {
265        Self
266    }
267    pub fn build(self) -> GetAppId {
268        GetAppId {
269            method: GetAppIdMethod::GetAppId,
270            params: GetAppIdParams {},
271        }
272    }
273}
274impl GetAppId {
275    pub fn builder() -> GetAppIdBuilder {
276        GetAppIdBuilder
277    }
278}
279impl GetAdScriptAncestry {
280    pub fn builder() -> GetAdScriptAncestryBuilder {
281        <GetAdScriptAncestryBuilder as Default>::default()
282    }
283}
284#[derive(Default, Clone)]
285pub struct GetAdScriptAncestryBuilder {
286    frame_id: Option<super::types::FrameId>,
287}
288impl GetAdScriptAncestryBuilder {
289    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
290        self.frame_id = Some(frame_id.into());
291        self
292    }
293    pub fn build(self) -> Result<GetAdScriptAncestry, String> {
294        Ok(GetAdScriptAncestry {
295            method: GetAdScriptAncestryMethod::GetAdScriptAncestry,
296            params: GetAdScriptAncestryParams {
297                frame_id: Box::new(self.frame_id.ok_or_else(|| {
298                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
299                })?),
300            },
301        })
302    }
303}
304#[derive(Debug, Clone, Default)]
305pub struct GetFrameTreeBuilder;
306impl GetFrameTreeBuilder {
307    pub fn new() -> Self {
308        Self
309    }
310    pub fn build(self) -> GetFrameTree {
311        GetFrameTree {
312            method: GetFrameTreeMethod::GetFrameTree,
313            params: GetFrameTreeParams {},
314        }
315    }
316}
317impl GetFrameTree {
318    pub fn builder() -> GetFrameTreeBuilder {
319        GetFrameTreeBuilder
320    }
321}
322#[derive(Debug, Clone, Default)]
323pub struct GetLayoutMetricsBuilder;
324impl GetLayoutMetricsBuilder {
325    pub fn new() -> Self {
326        Self
327    }
328    pub fn build(self) -> GetLayoutMetrics {
329        GetLayoutMetrics {
330            method: GetLayoutMetricsMethod::GetLayoutMetrics,
331            params: GetLayoutMetricsParams {},
332        }
333    }
334}
335impl GetLayoutMetrics {
336    pub fn builder() -> GetLayoutMetricsBuilder {
337        GetLayoutMetricsBuilder
338    }
339}
340#[derive(Debug, Clone, Default)]
341pub struct GetNavigationHistoryBuilder;
342impl GetNavigationHistoryBuilder {
343    pub fn new() -> Self {
344        Self
345    }
346    pub fn build(self) -> GetNavigationHistory {
347        GetNavigationHistory {
348            method: GetNavigationHistoryMethod::GetNavigationHistory,
349            params: GetNavigationHistoryParams {},
350        }
351    }
352}
353impl GetNavigationHistory {
354    pub fn builder() -> GetNavigationHistoryBuilder {
355        GetNavigationHistoryBuilder
356    }
357}
358#[derive(Debug, Clone, Default)]
359pub struct ResetNavigationHistoryBuilder;
360impl ResetNavigationHistoryBuilder {
361    pub fn new() -> Self {
362        Self
363    }
364    pub fn build(self) -> ResetNavigationHistory {
365        ResetNavigationHistory {
366            method: ResetNavigationHistoryMethod::ResetNavigationHistory,
367            params: ResetNavigationHistoryParams {},
368        }
369    }
370}
371impl ResetNavigationHistory {
372    pub fn builder() -> ResetNavigationHistoryBuilder {
373        ResetNavigationHistoryBuilder
374    }
375}
376impl GetResourceContent {
377    pub fn builder() -> GetResourceContentBuilder {
378        <GetResourceContentBuilder as Default>::default()
379    }
380}
381#[derive(Default, Clone)]
382pub struct GetResourceContentBuilder {
383    frame_id: Option<super::types::FrameId>,
384    url: Option<String>,
385}
386impl GetResourceContentBuilder {
387    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
388        self.frame_id = Some(frame_id.into());
389        self
390    }
391    pub fn url(mut self, url: impl Into<String>) -> Self {
392        self.url = Some(url.into());
393        self
394    }
395    pub fn build(self) -> Result<GetResourceContent, String> {
396        Ok(GetResourceContent {
397            method: GetResourceContentMethod::GetResourceContent,
398            params: GetResourceContentParams {
399                frame_id: Box::new(self.frame_id.ok_or_else(|| {
400                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
401                })?),
402                url: self
403                    .url
404                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(url)))?,
405            },
406        })
407    }
408}
409#[derive(Debug, Clone, Default)]
410pub struct GetResourceTreeBuilder;
411impl GetResourceTreeBuilder {
412    pub fn new() -> Self {
413        Self
414    }
415    pub fn build(self) -> GetResourceTree {
416        GetResourceTree {
417            method: GetResourceTreeMethod::GetResourceTree,
418            params: GetResourceTreeParams {},
419        }
420    }
421}
422impl GetResourceTree {
423    pub fn builder() -> GetResourceTreeBuilder {
424        GetResourceTreeBuilder
425    }
426}
427impl HandleJavaScriptDialog {
428    pub fn builder() -> HandleJavaScriptDialogBuilder {
429        <HandleJavaScriptDialogBuilder as Default>::default()
430    }
431}
432#[derive(Default, Clone)]
433pub struct HandleJavaScriptDialogBuilder {
434    accept: Option<bool>,
435    prompt_text: Option<String>,
436}
437impl HandleJavaScriptDialogBuilder {
438    pub fn accept(mut self, accept: impl Into<bool>) -> Self {
439        self.accept = Some(accept.into());
440        self
441    }
442    pub fn prompt_text(mut self, prompt_text: impl Into<String>) -> Self {
443        self.prompt_text = Some(prompt_text.into());
444        self
445    }
446    pub fn build(self) -> Result<HandleJavaScriptDialog, String> {
447        Ok(HandleJavaScriptDialog {
448            method: HandleJavaScriptDialogMethod::HandleJavaScriptDialog,
449            params: HandleJavaScriptDialogParams {
450                accept: self
451                    .accept
452                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(accept)))?,
453                prompt_text: self.prompt_text,
454            },
455        })
456    }
457}
458impl Navigate {
459    pub fn builder() -> NavigateBuilder {
460        <NavigateBuilder as Default>::default()
461    }
462}
463#[derive(Default, Clone)]
464pub struct NavigateBuilder {
465    url: Option<String>,
466    referrer: Option<String>,
467    transition_type: Option<super::types::TransitionType>,
468    frame_id: Option<super::types::FrameId>,
469    referrer_policy: Option<super::types::ReferrerPolicy>,
470}
471impl NavigateBuilder {
472    pub fn url(mut self, url: impl Into<String>) -> Self {
473        self.url = Some(url.into());
474        self
475    }
476    pub fn referrer(mut self, referrer: impl Into<String>) -> Self {
477        self.referrer = Some(referrer.into());
478        self
479    }
480    pub fn transition_type(
481        mut self,
482        transition_type: impl Into<super::types::TransitionType>,
483    ) -> Self {
484        self.transition_type = Some(transition_type.into());
485        self
486    }
487    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
488        self.frame_id = Some(frame_id.into());
489        self
490    }
491    pub fn referrer_policy(
492        mut self,
493        referrer_policy: impl Into<super::types::ReferrerPolicy>,
494    ) -> Self {
495        self.referrer_policy = Some(referrer_policy.into());
496        self
497    }
498    pub fn build(self) -> Result<Navigate, String> {
499        Ok(Navigate {
500            method: NavigateMethod::Navigate,
501            params: NavigateParams {
502                url: self
503                    .url
504                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(url)))?,
505                referrer: self.referrer,
506                transition_type: self.transition_type,
507                frame_id: self.frame_id.map(Box::new),
508                referrer_policy: self.referrer_policy,
509            },
510        })
511    }
512}
513impl NavigateToHistoryEntry {
514    pub fn builder() -> NavigateToHistoryEntryBuilder {
515        <NavigateToHistoryEntryBuilder as Default>::default()
516    }
517}
518#[derive(Default, Clone)]
519pub struct NavigateToHistoryEntryBuilder {
520    entry_id: Option<i64>,
521}
522impl NavigateToHistoryEntryBuilder {
523    pub fn entry_id(mut self, entry_id: impl Into<i64>) -> Self {
524        self.entry_id = Some(entry_id.into());
525        self
526    }
527    pub fn build(self) -> Result<NavigateToHistoryEntry, String> {
528        Ok(NavigateToHistoryEntry {
529            method: NavigateToHistoryEntryMethod::NavigateToHistoryEntry,
530            params: NavigateToHistoryEntryParams {
531                entry_id: self.entry_id.ok_or_else(|| {
532                    format!("Field `{}` is mandatory.", std::stringify!(entry_id))
533                })?,
534            },
535        })
536    }
537}
538impl PrintToPdf {
539    pub fn builder() -> PrintToPdfBuilder {
540        <PrintToPdfBuilder as Default>::default()
541    }
542}
543#[derive(Default, Clone)]
544pub struct PrintToPdfBuilder {
545    landscape: Option<bool>,
546    display_header_footer: Option<bool>,
547    print_background: Option<bool>,
548    scale: Option<f64>,
549    paper_width: Option<f64>,
550    paper_height: Option<f64>,
551    margin_top: Option<f64>,
552    margin_bottom: Option<f64>,
553    margin_left: Option<f64>,
554    margin_right: Option<f64>,
555    page_ranges: Option<String>,
556    header_template: Option<String>,
557    footer_template: Option<String>,
558    prefer_css_page_size: Option<bool>,
559    transfer_mode: Option<PrintToPdfTransferMode>,
560    generate_tagged_pdf: Option<bool>,
561    generate_document_outline: Option<bool>,
562}
563impl PrintToPdfBuilder {
564    pub fn landscape(mut self, landscape: impl Into<bool>) -> Self {
565        self.landscape = Some(landscape.into());
566        self
567    }
568    pub fn display_header_footer(mut self, display_header_footer: impl Into<bool>) -> Self {
569        self.display_header_footer = Some(display_header_footer.into());
570        self
571    }
572    pub fn print_background(mut self, print_background: impl Into<bool>) -> Self {
573        self.print_background = Some(print_background.into());
574        self
575    }
576    pub fn scale(mut self, scale: impl Into<f64>) -> Self {
577        self.scale = Some(scale.into());
578        self
579    }
580    pub fn paper_width(mut self, paper_width: impl Into<f64>) -> Self {
581        self.paper_width = Some(paper_width.into());
582        self
583    }
584    pub fn paper_height(mut self, paper_height: impl Into<f64>) -> Self {
585        self.paper_height = Some(paper_height.into());
586        self
587    }
588    pub fn margin_top(mut self, margin_top: impl Into<f64>) -> Self {
589        self.margin_top = Some(margin_top.into());
590        self
591    }
592    pub fn margin_bottom(mut self, margin_bottom: impl Into<f64>) -> Self {
593        self.margin_bottom = Some(margin_bottom.into());
594        self
595    }
596    pub fn margin_left(mut self, margin_left: impl Into<f64>) -> Self {
597        self.margin_left = Some(margin_left.into());
598        self
599    }
600    pub fn margin_right(mut self, margin_right: impl Into<f64>) -> Self {
601        self.margin_right = Some(margin_right.into());
602        self
603    }
604    pub fn page_ranges(mut self, page_ranges: impl Into<String>) -> Self {
605        self.page_ranges = Some(page_ranges.into());
606        self
607    }
608    pub fn header_template(mut self, header_template: impl Into<String>) -> Self {
609        self.header_template = Some(header_template.into());
610        self
611    }
612    pub fn footer_template(mut self, footer_template: impl Into<String>) -> Self {
613        self.footer_template = Some(footer_template.into());
614        self
615    }
616    pub fn prefer_css_page_size(mut self, prefer_css_page_size: impl Into<bool>) -> Self {
617        self.prefer_css_page_size = Some(prefer_css_page_size.into());
618        self
619    }
620    pub fn transfer_mode(mut self, transfer_mode: impl Into<PrintToPdfTransferMode>) -> Self {
621        self.transfer_mode = Some(transfer_mode.into());
622        self
623    }
624    pub fn generate_tagged_pdf(mut self, generate_tagged_pdf: impl Into<bool>) -> Self {
625        self.generate_tagged_pdf = Some(generate_tagged_pdf.into());
626        self
627    }
628    pub fn generate_document_outline(mut self, generate_document_outline: impl Into<bool>) -> Self {
629        self.generate_document_outline = Some(generate_document_outline.into());
630        self
631    }
632    pub fn build(self) -> PrintToPdf {
633        PrintToPdf {
634            method: PrintToPdfMethod::PrintToPdf,
635            params: PrintToPdfParams {
636                landscape: self.landscape,
637                display_header_footer: self.display_header_footer,
638                print_background: self.print_background,
639                scale: self.scale,
640                paper_width: self.paper_width,
641                paper_height: self.paper_height,
642                margin_top: self.margin_top,
643                margin_bottom: self.margin_bottom,
644                margin_left: self.margin_left,
645                margin_right: self.margin_right,
646                page_ranges: self.page_ranges,
647                header_template: self.header_template,
648                footer_template: self.footer_template,
649                prefer_css_page_size: self.prefer_css_page_size,
650                transfer_mode: self.transfer_mode,
651                generate_tagged_pdf: self.generate_tagged_pdf,
652                generate_document_outline: self.generate_document_outline,
653            },
654        }
655    }
656}
657impl Reload {
658    pub fn builder() -> ReloadBuilder {
659        <ReloadBuilder as Default>::default()
660    }
661}
662#[derive(Default, Clone)]
663pub struct ReloadBuilder {
664    ignore_cache: Option<bool>,
665    script_to_evaluate_on_load: Option<String>,
666    loader_id: Option<crate::browser_protocol::network::types::LoaderId>,
667}
668impl ReloadBuilder {
669    pub fn ignore_cache(mut self, ignore_cache: impl Into<bool>) -> Self {
670        self.ignore_cache = Some(ignore_cache.into());
671        self
672    }
673    pub fn script_to_evaluate_on_load(
674        mut self,
675        script_to_evaluate_on_load: impl Into<String>,
676    ) -> Self {
677        self.script_to_evaluate_on_load = Some(script_to_evaluate_on_load.into());
678        self
679    }
680    pub fn loader_id(
681        mut self,
682        loader_id: impl Into<crate::browser_protocol::network::types::LoaderId>,
683    ) -> Self {
684        self.loader_id = Some(loader_id.into());
685        self
686    }
687    pub fn build(self) -> Reload {
688        Reload {
689            method: ReloadMethod::Reload,
690            params: ReloadParams {
691                ignore_cache: self.ignore_cache,
692                script_to_evaluate_on_load: self.script_to_evaluate_on_load,
693                loader_id: self.loader_id,
694            },
695        }
696    }
697}
698impl RemoveScriptToEvaluateOnNewDocument {
699    pub fn builder() -> RemoveScriptToEvaluateOnNewDocumentBuilder {
700        <RemoveScriptToEvaluateOnNewDocumentBuilder as Default>::default()
701    }
702}
703#[derive(Default, Clone)]
704pub struct RemoveScriptToEvaluateOnNewDocumentBuilder {
705    identifier: Option<super::types::ScriptIdentifier>,
706}
707impl RemoveScriptToEvaluateOnNewDocumentBuilder {
708    pub fn identifier(mut self, identifier: impl Into<super::types::ScriptIdentifier>) -> Self {
709        self.identifier = Some(identifier.into());
710        self
711    }
712    pub fn build(self) -> Result<RemoveScriptToEvaluateOnNewDocument, String> {
713        Ok(RemoveScriptToEvaluateOnNewDocument {
714            method: RemoveScriptToEvaluateOnNewDocumentMethod::RemoveScriptToEvaluateOnNewDocument,
715            params: RemoveScriptToEvaluateOnNewDocumentParams {
716                identifier: self.identifier.ok_or_else(|| {
717                    format!("Field `{}` is mandatory.", std::stringify!(identifier))
718                })?,
719            },
720        })
721    }
722}
723impl ScreencastFrameAck {
724    pub fn builder() -> ScreencastFrameAckBuilder {
725        <ScreencastFrameAckBuilder as Default>::default()
726    }
727}
728#[derive(Default, Clone)]
729pub struct ScreencastFrameAckBuilder {
730    session_id: Option<i64>,
731}
732impl ScreencastFrameAckBuilder {
733    pub fn session_id(mut self, session_id: impl Into<i64>) -> Self {
734        self.session_id = Some(session_id.into());
735        self
736    }
737    pub fn build(self) -> Result<ScreencastFrameAck, String> {
738        Ok(ScreencastFrameAck {
739            method: ScreencastFrameAckMethod::ScreencastFrameAck,
740            params: ScreencastFrameAckParams {
741                session_id: self.session_id.ok_or_else(|| {
742                    format!("Field `{}` is mandatory.", std::stringify!(session_id))
743                })?,
744            },
745        })
746    }
747}
748impl SearchInResource {
749    pub fn builder() -> SearchInResourceBuilder {
750        <SearchInResourceBuilder as Default>::default()
751    }
752}
753#[derive(Default, Clone)]
754pub struct SearchInResourceBuilder {
755    frame_id: Option<super::types::FrameId>,
756    url: Option<String>,
757    query: Option<String>,
758    case_sensitive: Option<bool>,
759    is_regex: Option<bool>,
760}
761impl SearchInResourceBuilder {
762    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
763        self.frame_id = Some(frame_id.into());
764        self
765    }
766    pub fn url(mut self, url: impl Into<String>) -> Self {
767        self.url = Some(url.into());
768        self
769    }
770    pub fn query(mut self, query: impl Into<String>) -> Self {
771        self.query = Some(query.into());
772        self
773    }
774    pub fn case_sensitive(mut self, case_sensitive: impl Into<bool>) -> Self {
775        self.case_sensitive = Some(case_sensitive.into());
776        self
777    }
778    pub fn is_regex(mut self, is_regex: impl Into<bool>) -> Self {
779        self.is_regex = Some(is_regex.into());
780        self
781    }
782    pub fn build(self) -> Result<SearchInResource, String> {
783        Ok(SearchInResource {
784            method: SearchInResourceMethod::SearchInResource,
785            params: SearchInResourceParams {
786                frame_id: Box::new(self.frame_id.ok_or_else(|| {
787                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
788                })?),
789                url: self
790                    .url
791                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(url)))?,
792                query: self
793                    .query
794                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(query)))?,
795                case_sensitive: self.case_sensitive,
796                is_regex: self.is_regex,
797            },
798        })
799    }
800}
801impl SetAdBlockingEnabled {
802    pub fn builder() -> SetAdBlockingEnabledBuilder {
803        <SetAdBlockingEnabledBuilder as Default>::default()
804    }
805}
806#[derive(Default, Clone)]
807pub struct SetAdBlockingEnabledBuilder {
808    enabled: Option<bool>,
809}
810impl SetAdBlockingEnabledBuilder {
811    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
812        self.enabled = Some(enabled.into());
813        self
814    }
815    pub fn build(self) -> Result<SetAdBlockingEnabled, String> {
816        Ok(SetAdBlockingEnabled {
817            method: SetAdBlockingEnabledMethod::SetAdBlockingEnabled,
818            params: SetAdBlockingEnabledParams {
819                enabled: self
820                    .enabled
821                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
822            },
823        })
824    }
825}
826impl SetBypassCsp {
827    pub fn builder() -> SetBypassCspBuilder {
828        <SetBypassCspBuilder as Default>::default()
829    }
830}
831#[derive(Default, Clone)]
832pub struct SetBypassCspBuilder {
833    enabled: Option<bool>,
834}
835impl SetBypassCspBuilder {
836    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
837        self.enabled = Some(enabled.into());
838        self
839    }
840    pub fn build(self) -> Result<SetBypassCsp, String> {
841        Ok(SetBypassCsp {
842            method: SetBypassCspMethod::SetBypassCsp,
843            params: SetBypassCspParams {
844                enabled: self
845                    .enabled
846                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
847            },
848        })
849    }
850}
851impl GetPermissionsPolicyState {
852    pub fn builder() -> GetPermissionsPolicyStateBuilder {
853        <GetPermissionsPolicyStateBuilder as Default>::default()
854    }
855}
856#[derive(Default, Clone)]
857pub struct GetPermissionsPolicyStateBuilder {
858    frame_id: Option<super::types::FrameId>,
859}
860impl GetPermissionsPolicyStateBuilder {
861    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
862        self.frame_id = Some(frame_id.into());
863        self
864    }
865    pub fn build(self) -> Result<GetPermissionsPolicyState, String> {
866        Ok(GetPermissionsPolicyState {
867            method: GetPermissionsPolicyStateMethod::GetPermissionsPolicyState,
868            params: GetPermissionsPolicyStateParams {
869                frame_id: Box::new(self.frame_id.ok_or_else(|| {
870                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
871                })?),
872            },
873        })
874    }
875}
876impl GetOriginTrials {
877    pub fn builder() -> GetOriginTrialsBuilder {
878        <GetOriginTrialsBuilder as Default>::default()
879    }
880}
881#[derive(Default, Clone)]
882pub struct GetOriginTrialsBuilder {
883    frame_id: Option<super::types::FrameId>,
884}
885impl GetOriginTrialsBuilder {
886    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
887        self.frame_id = Some(frame_id.into());
888        self
889    }
890    pub fn build(self) -> Result<GetOriginTrials, String> {
891        Ok(GetOriginTrials {
892            method: GetOriginTrialsMethod::GetOriginTrials,
893            params: GetOriginTrialsParams {
894                frame_id: Box::new(self.frame_id.ok_or_else(|| {
895                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
896                })?),
897            },
898        })
899    }
900}
901impl SetFontFamilies {
902    pub fn builder() -> SetFontFamiliesBuilder {
903        <SetFontFamiliesBuilder as Default>::default()
904    }
905}
906#[derive(Default, Clone)]
907pub struct SetFontFamiliesBuilder {
908    font_families: Option<super::types::FontFamilies>,
909    for_scripts: Option<Vec<super::types::ScriptFontFamilies>>,
910}
911impl SetFontFamiliesBuilder {
912    pub fn font_families(mut self, font_families: impl Into<super::types::FontFamilies>) -> Self {
913        self.font_families = Some(font_families.into());
914        self
915    }
916    pub fn for_script(mut self, for_script: impl Into<super::types::ScriptFontFamilies>) -> Self {
917        let v = self.for_scripts.get_or_insert(Vec::new());
918        v.push(for_script.into());
919        self
920    }
921    pub fn for_scripts<I, S>(mut self, for_scripts: I) -> Self
922    where
923        I: IntoIterator<Item = S>,
924        S: Into<super::types::ScriptFontFamilies>,
925    {
926        let v = self.for_scripts.get_or_insert(Vec::new());
927        for val in for_scripts {
928            v.push(val.into());
929        }
930        self
931    }
932    pub fn build(self) -> Result<SetFontFamilies, String> {
933        Ok(SetFontFamilies {
934            method: SetFontFamiliesMethod::SetFontFamilies,
935            params: SetFontFamiliesParams {
936                font_families: self.font_families.ok_or_else(|| {
937                    format!("Field `{}` is mandatory.", std::stringify!(font_families))
938                })?,
939                for_scripts: self.for_scripts,
940            },
941        })
942    }
943}
944impl SetFontSizes {
945    pub fn builder() -> SetFontSizesBuilder {
946        <SetFontSizesBuilder as Default>::default()
947    }
948}
949#[derive(Default, Clone)]
950pub struct SetFontSizesBuilder {
951    font_sizes: Option<super::types::FontSizes>,
952}
953impl SetFontSizesBuilder {
954    pub fn font_sizes(mut self, font_sizes: impl Into<super::types::FontSizes>) -> Self {
955        self.font_sizes = Some(font_sizes.into());
956        self
957    }
958    pub fn build(self) -> Result<SetFontSizes, String> {
959        Ok(SetFontSizes {
960            method: SetFontSizesMethod::SetFontSizes,
961            params: SetFontSizesParams {
962                font_sizes: self.font_sizes.ok_or_else(|| {
963                    format!("Field `{}` is mandatory.", std::stringify!(font_sizes))
964                })?,
965            },
966        })
967    }
968}
969impl SetDocumentContent {
970    pub fn builder() -> SetDocumentContentBuilder {
971        <SetDocumentContentBuilder as Default>::default()
972    }
973}
974#[derive(Default, Clone)]
975pub struct SetDocumentContentBuilder {
976    frame_id: Option<super::types::FrameId>,
977    html: Option<String>,
978}
979impl SetDocumentContentBuilder {
980    pub fn frame_id(mut self, frame_id: impl Into<super::types::FrameId>) -> Self {
981        self.frame_id = Some(frame_id.into());
982        self
983    }
984    pub fn html(mut self, html: impl Into<String>) -> Self {
985        self.html = Some(html.into());
986        self
987    }
988    pub fn build(self) -> Result<SetDocumentContent, String> {
989        Ok(SetDocumentContent {
990            method: SetDocumentContentMethod::SetDocumentContent,
991            params: SetDocumentContentParams {
992                frame_id: Box::new(self.frame_id.ok_or_else(|| {
993                    format!("Field `{}` is mandatory.", std::stringify!(frame_id))
994                })?),
995                html: self
996                    .html
997                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(html)))?,
998            },
999        })
1000    }
1001}
1002impl SetLifecycleEventsEnabled {
1003    pub fn builder() -> SetLifecycleEventsEnabledBuilder {
1004        <SetLifecycleEventsEnabledBuilder as Default>::default()
1005    }
1006}
1007#[derive(Default, Clone)]
1008pub struct SetLifecycleEventsEnabledBuilder {
1009    enabled: Option<bool>,
1010}
1011impl SetLifecycleEventsEnabledBuilder {
1012    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
1013        self.enabled = Some(enabled.into());
1014        self
1015    }
1016    pub fn build(self) -> Result<SetLifecycleEventsEnabled, String> {
1017        Ok(SetLifecycleEventsEnabled {
1018            method: SetLifecycleEventsEnabledMethod::SetLifecycleEventsEnabled,
1019            params: SetLifecycleEventsEnabledParams {
1020                enabled: self
1021                    .enabled
1022                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
1023            },
1024        })
1025    }
1026}
1027impl StartScreencast {
1028    pub fn builder() -> StartScreencastBuilder {
1029        <StartScreencastBuilder as Default>::default()
1030    }
1031}
1032#[derive(Default, Clone)]
1033pub struct StartScreencastBuilder {
1034    format: Option<StartScreencastFormat>,
1035    quality: Option<i64>,
1036    max_width: Option<i64>,
1037    max_height: Option<i64>,
1038    every_nth_frame: Option<i64>,
1039}
1040impl StartScreencastBuilder {
1041    pub fn format(mut self, format: impl Into<StartScreencastFormat>) -> Self {
1042        self.format = Some(format.into());
1043        self
1044    }
1045    pub fn quality(mut self, quality: impl Into<i64>) -> Self {
1046        self.quality = Some(quality.into());
1047        self
1048    }
1049    pub fn max_width(mut self, max_width: impl Into<i64>) -> Self {
1050        self.max_width = Some(max_width.into());
1051        self
1052    }
1053    pub fn max_height(mut self, max_height: impl Into<i64>) -> Self {
1054        self.max_height = Some(max_height.into());
1055        self
1056    }
1057    pub fn every_nth_frame(mut self, every_nth_frame: impl Into<i64>) -> Self {
1058        self.every_nth_frame = Some(every_nth_frame.into());
1059        self
1060    }
1061    pub fn build(self) -> StartScreencast {
1062        StartScreencast {
1063            method: StartScreencastMethod::StartScreencast,
1064            params: StartScreencastParams {
1065                format: self.format,
1066                quality: self.quality,
1067                max_width: self.max_width,
1068                max_height: self.max_height,
1069                every_nth_frame: self.every_nth_frame,
1070            },
1071        }
1072    }
1073}
1074#[derive(Debug, Clone, Default)]
1075pub struct StopLoadingBuilder;
1076impl StopLoadingBuilder {
1077    pub fn new() -> Self {
1078        Self
1079    }
1080    pub fn build(self) -> StopLoading {
1081        StopLoading {
1082            method: StopLoadingMethod::StopLoading,
1083            params: StopLoadingParams {},
1084        }
1085    }
1086}
1087impl StopLoading {
1088    pub fn builder() -> StopLoadingBuilder {
1089        StopLoadingBuilder
1090    }
1091}
1092#[derive(Debug, Clone, Default)]
1093pub struct CrashBuilder;
1094impl CrashBuilder {
1095    pub fn new() -> Self {
1096        Self
1097    }
1098    pub fn build(self) -> Crash {
1099        Crash {
1100            method: CrashMethod::Crash,
1101            params: CrashParams {},
1102        }
1103    }
1104}
1105impl Crash {
1106    pub fn builder() -> CrashBuilder {
1107        CrashBuilder
1108    }
1109}
1110#[derive(Debug, Clone, Default)]
1111pub struct CloseBuilder;
1112impl CloseBuilder {
1113    pub fn new() -> Self {
1114        Self
1115    }
1116    pub fn build(self) -> Close {
1117        Close {
1118            method: CloseMethod::Close,
1119            params: CloseParams {},
1120        }
1121    }
1122}
1123impl Close {
1124    pub fn builder() -> CloseBuilder {
1125        CloseBuilder
1126    }
1127}
1128impl SetWebLifecycleState {
1129    pub fn builder() -> SetWebLifecycleStateBuilder {
1130        <SetWebLifecycleStateBuilder as Default>::default()
1131    }
1132}
1133#[derive(Default, Clone)]
1134pub struct SetWebLifecycleStateBuilder {
1135    state: Option<SetWebLifecycleStateState>,
1136}
1137impl SetWebLifecycleStateBuilder {
1138    pub fn state(mut self, state: impl Into<SetWebLifecycleStateState>) -> Self {
1139        self.state = Some(state.into());
1140        self
1141    }
1142    pub fn build(self) -> Result<SetWebLifecycleState, String> {
1143        Ok(SetWebLifecycleState {
1144            method: SetWebLifecycleStateMethod::SetWebLifecycleState,
1145            params: SetWebLifecycleStateParams {
1146                state: self
1147                    .state
1148                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(state)))?,
1149            },
1150        })
1151    }
1152}
1153#[derive(Debug, Clone, Default)]
1154pub struct StopScreencastBuilder;
1155impl StopScreencastBuilder {
1156    pub fn new() -> Self {
1157        Self
1158    }
1159    pub fn build(self) -> StopScreencast {
1160        StopScreencast {
1161            method: StopScreencastMethod::StopScreencast,
1162            params: StopScreencastParams {},
1163        }
1164    }
1165}
1166impl StopScreencast {
1167    pub fn builder() -> StopScreencastBuilder {
1168        StopScreencastBuilder
1169    }
1170}
1171impl ProduceCompilationCache {
1172    pub fn builder() -> ProduceCompilationCacheBuilder {
1173        <ProduceCompilationCacheBuilder as Default>::default()
1174    }
1175}
1176#[derive(Default, Clone)]
1177pub struct ProduceCompilationCacheBuilder {
1178    scripts: Option<Vec<super::types::CompilationCacheParams>>,
1179}
1180impl ProduceCompilationCacheBuilder {
1181    pub fn script(mut self, script: impl Into<super::types::CompilationCacheParams>) -> Self {
1182        let v = self.scripts.get_or_insert(Vec::new());
1183        v.push(script.into());
1184        self
1185    }
1186    pub fn scripts<I, S>(mut self, scripts: I) -> Self
1187    where
1188        I: IntoIterator<Item = S>,
1189        S: Into<super::types::CompilationCacheParams>,
1190    {
1191        let v = self.scripts.get_or_insert(Vec::new());
1192        for val in scripts {
1193            v.push(val.into());
1194        }
1195        self
1196    }
1197    pub fn build(self) -> Result<ProduceCompilationCache, String> {
1198        Ok(ProduceCompilationCache {
1199            method: ProduceCompilationCacheMethod::ProduceCompilationCache,
1200            params: ProduceCompilationCacheParams {
1201                scripts: self
1202                    .scripts
1203                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(scripts)))?,
1204            },
1205        })
1206    }
1207}
1208impl AddCompilationCache {
1209    pub fn builder() -> AddCompilationCacheBuilder {
1210        <AddCompilationCacheBuilder as Default>::default()
1211    }
1212}
1213#[derive(Default, Clone)]
1214pub struct AddCompilationCacheBuilder {
1215    url: Option<String>,
1216    data: Option<crate::Binary>,
1217}
1218impl AddCompilationCacheBuilder {
1219    pub fn url(mut self, url: impl Into<String>) -> Self {
1220        self.url = Some(url.into());
1221        self
1222    }
1223    pub fn data(mut self, data: impl Into<crate::Binary>) -> Self {
1224        self.data = Some(data.into());
1225        self
1226    }
1227    pub fn build(self) -> Result<AddCompilationCache, String> {
1228        Ok(AddCompilationCache {
1229            method: AddCompilationCacheMethod::AddCompilationCache,
1230            params: AddCompilationCacheParams {
1231                url: self
1232                    .url
1233                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(url)))?,
1234                data: self
1235                    .data
1236                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(data)))?,
1237            },
1238        })
1239    }
1240}
1241#[derive(Debug, Clone, Default)]
1242pub struct ClearCompilationCacheBuilder;
1243impl ClearCompilationCacheBuilder {
1244    pub fn new() -> Self {
1245        Self
1246    }
1247    pub fn build(self) -> ClearCompilationCache {
1248        ClearCompilationCache {
1249            method: ClearCompilationCacheMethod::ClearCompilationCache,
1250            params: ClearCompilationCacheParams {},
1251        }
1252    }
1253}
1254impl ClearCompilationCache {
1255    pub fn builder() -> ClearCompilationCacheBuilder {
1256        ClearCompilationCacheBuilder
1257    }
1258}
1259impl SetSpcTransactionMode {
1260    pub fn builder() -> SetSpcTransactionModeBuilder {
1261        <SetSpcTransactionModeBuilder as Default>::default()
1262    }
1263}
1264#[derive(Default, Clone)]
1265pub struct SetSpcTransactionModeBuilder {
1266    mode: Option<SetSpcTransactionModeMode>,
1267}
1268impl SetSpcTransactionModeBuilder {
1269    pub fn mode(mut self, mode: impl Into<SetSpcTransactionModeMode>) -> Self {
1270        self.mode = Some(mode.into());
1271        self
1272    }
1273    pub fn build(self) -> Result<SetSpcTransactionMode, String> {
1274        Ok(SetSpcTransactionMode {
1275            method: SetSpcTransactionModeMethod::SetSpcTransactionMode,
1276            params: SetSpcTransactionModeParams {
1277                mode: self
1278                    .mode
1279                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(mode)))?,
1280            },
1281        })
1282    }
1283}
1284impl SetRphRegistrationMode {
1285    pub fn builder() -> SetRphRegistrationModeBuilder {
1286        <SetRphRegistrationModeBuilder as Default>::default()
1287    }
1288}
1289#[derive(Default, Clone)]
1290pub struct SetRphRegistrationModeBuilder {
1291    mode: Option<SetRphRegistrationModeMode>,
1292}
1293impl SetRphRegistrationModeBuilder {
1294    pub fn mode(mut self, mode: impl Into<SetRphRegistrationModeMode>) -> Self {
1295        self.mode = Some(mode.into());
1296        self
1297    }
1298    pub fn build(self) -> Result<SetRphRegistrationMode, String> {
1299        Ok(SetRphRegistrationMode {
1300            method: SetRphRegistrationModeMethod::SetRphRegistrationMode,
1301            params: SetRphRegistrationModeParams {
1302                mode: self
1303                    .mode
1304                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(mode)))?,
1305            },
1306        })
1307    }
1308}
1309impl GenerateTestReport {
1310    pub fn builder() -> GenerateTestReportBuilder {
1311        <GenerateTestReportBuilder as Default>::default()
1312    }
1313}
1314#[derive(Default, Clone)]
1315pub struct GenerateTestReportBuilder {
1316    message: Option<String>,
1317    group: Option<String>,
1318}
1319impl GenerateTestReportBuilder {
1320    pub fn message(mut self, message: impl Into<String>) -> Self {
1321        self.message = Some(message.into());
1322        self
1323    }
1324    pub fn group(mut self, group: impl Into<String>) -> Self {
1325        self.group = Some(group.into());
1326        self
1327    }
1328    pub fn build(self) -> Result<GenerateTestReport, String> {
1329        Ok(GenerateTestReport {
1330            method: GenerateTestReportMethod::GenerateTestReport,
1331            params: GenerateTestReportParams {
1332                message: self
1333                    .message
1334                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(message)))?,
1335                group: self.group,
1336            },
1337        })
1338    }
1339}
1340#[derive(Debug, Clone, Default)]
1341pub struct WaitForDebuggerBuilder;
1342impl WaitForDebuggerBuilder {
1343    pub fn new() -> Self {
1344        Self
1345    }
1346    pub fn build(self) -> WaitForDebugger {
1347        WaitForDebugger {
1348            method: WaitForDebuggerMethod::WaitForDebugger,
1349            params: WaitForDebuggerParams {},
1350        }
1351    }
1352}
1353impl WaitForDebugger {
1354    pub fn builder() -> WaitForDebuggerBuilder {
1355        WaitForDebuggerBuilder
1356    }
1357}
1358impl SetInterceptFileChooserDialog {
1359    pub fn builder() -> SetInterceptFileChooserDialogBuilder {
1360        <SetInterceptFileChooserDialogBuilder as Default>::default()
1361    }
1362}
1363#[derive(Default, Clone)]
1364pub struct SetInterceptFileChooserDialogBuilder {
1365    enabled: Option<bool>,
1366    cancel: Option<bool>,
1367}
1368impl SetInterceptFileChooserDialogBuilder {
1369    pub fn enabled(mut self, enabled: impl Into<bool>) -> Self {
1370        self.enabled = Some(enabled.into());
1371        self
1372    }
1373    pub fn cancel(mut self, cancel: impl Into<bool>) -> Self {
1374        self.cancel = Some(cancel.into());
1375        self
1376    }
1377    pub fn build(self) -> Result<SetInterceptFileChooserDialog, String> {
1378        Ok(SetInterceptFileChooserDialog {
1379            method: SetInterceptFileChooserDialogMethod::SetInterceptFileChooserDialog,
1380            params: SetInterceptFileChooserDialogParams {
1381                enabled: self
1382                    .enabled
1383                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(enabled)))?,
1384                cancel: self.cancel,
1385            },
1386        })
1387    }
1388}
1389impl SetPrerenderingAllowed {
1390    pub fn builder() -> SetPrerenderingAllowedBuilder {
1391        <SetPrerenderingAllowedBuilder as Default>::default()
1392    }
1393}
1394#[derive(Default, Clone)]
1395pub struct SetPrerenderingAllowedBuilder {
1396    is_allowed: Option<bool>,
1397}
1398impl SetPrerenderingAllowedBuilder {
1399    pub fn is_allowed(mut self, is_allowed: impl Into<bool>) -> Self {
1400        self.is_allowed = Some(is_allowed.into());
1401        self
1402    }
1403    pub fn build(self) -> Result<SetPrerenderingAllowed, String> {
1404        Ok(SetPrerenderingAllowed {
1405            method: SetPrerenderingAllowedMethod::SetPrerenderingAllowed,
1406            params: SetPrerenderingAllowedParams {
1407                is_allowed: self.is_allowed.ok_or_else(|| {
1408                    format!("Field `{}` is mandatory.", std::stringify!(is_allowed))
1409                })?,
1410            },
1411        })
1412    }
1413}
1414impl GetAnnotatedPageContent {
1415    pub fn builder() -> GetAnnotatedPageContentBuilder {
1416        <GetAnnotatedPageContentBuilder as Default>::default()
1417    }
1418}
1419#[derive(Default, Clone)]
1420pub struct GetAnnotatedPageContentBuilder {
1421    include_actionable_information: Option<bool>,
1422}
1423impl GetAnnotatedPageContentBuilder {
1424    pub fn include_actionable_information(
1425        mut self,
1426        include_actionable_information: impl Into<bool>,
1427    ) -> Self {
1428        self.include_actionable_information = Some(include_actionable_information.into());
1429        self
1430    }
1431    pub fn build(self) -> GetAnnotatedPageContent {
1432        GetAnnotatedPageContent {
1433            method: GetAnnotatedPageContentMethod::GetAnnotatedPageContent,
1434            params: GetAnnotatedPageContentParams {
1435                include_actionable_information: self.include_actionable_information,
1436            },
1437        }
1438    }
1439}