Skip to main content

rustenium_cdp_definitions/browser_protocol/security/
command_builders.rs

1use super::commands::*;
2#[derive(Debug, Clone, Default)]
3pub struct DisableBuilder;
4impl DisableBuilder {
5    pub fn new() -> Self {
6        Self
7    }
8    pub fn build(self) -> Disable {
9        Disable {
10            method: DisableMethod::Disable,
11            params: DisableParams {},
12        }
13    }
14}
15impl Disable {
16    pub fn builder() -> DisableBuilder {
17        DisableBuilder
18    }
19}
20#[derive(Debug, Clone, Default)]
21pub struct EnableBuilder;
22impl EnableBuilder {
23    pub fn new() -> Self {
24        Self
25    }
26    pub fn build(self) -> Enable {
27        Enable {
28            method: EnableMethod::Enable,
29            params: EnableParams {},
30        }
31    }
32}
33impl Enable {
34    pub fn builder() -> EnableBuilder {
35        EnableBuilder
36    }
37}
38impl SetIgnoreCertificateErrors {
39    pub fn builder() -> SetIgnoreCertificateErrorsBuilder {
40        <SetIgnoreCertificateErrorsBuilder as Default>::default()
41    }
42}
43#[derive(Default, Clone)]
44pub struct SetIgnoreCertificateErrorsBuilder {
45    ignore: Option<bool>,
46}
47impl SetIgnoreCertificateErrorsBuilder {
48    pub fn ignore(mut self, ignore: impl Into<bool>) -> Self {
49        self.ignore = Some(ignore.into());
50        self
51    }
52    pub fn build(self) -> Result<SetIgnoreCertificateErrors, String> {
53        Ok(SetIgnoreCertificateErrors {
54            method: SetIgnoreCertificateErrorsMethod::SetIgnoreCertificateErrors,
55            params: SetIgnoreCertificateErrorsParams {
56                ignore: self
57                    .ignore
58                    .ok_or_else(|| format!("Field `{}` is mandatory.", std::stringify!(ignore)))?,
59            },
60        })
61    }
62}