rustenium_bidi_definitions/browser/
commands.rs1use serde::{Deserialize, Serialize};
2#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3pub struct CloseParams {}
4#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5pub enum CloseMethod {
6 #[serde(rename = "browser.close")]
7 Close,
8}
9#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10pub struct Close {
11 pub method: CloseMethod,
12 pub params: CloseParams,
13}
14impl Close {
15 pub const IDENTIFIER: &'static str = "browser.close";
16 pub const DOMAIN_DIRECTION: &'static str = "remote";
17 pub fn identifier(&self) -> &'static str {
18 Self::IDENTIFIER
19 }
20}
21impl crate::CommandResult for Close {
22 type Result = super::results::CloseResult;
23}
24#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
25pub struct CreateUserContextParams {
26 #[serde(rename = "acceptInsecureCerts")]
27 #[serde(skip_serializing_if = "Option::is_none")]
28 #[serde(default)]
29 pub accept_insecure_certs: Option<bool>,
30 #[serde(rename = "proxy")]
31 #[serde(skip_serializing_if = "Option::is_none")]
32 #[serde(default)]
33 pub proxy: Option<crate::session::types::ProxyConfiguration>,
34 #[serde(rename = "unhandledPromptBehavior")]
35 #[serde(skip_serializing_if = "Option::is_none")]
36 #[serde(default)]
37 pub unhandled_prompt_behavior: Option<crate::session::types::UserPromptHandler>,
38}
39#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
40pub enum CreateUserContextMethod {
41 #[serde(rename = "browser.createUserContext")]
42 CreateUserContext,
43}
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct CreateUserContext {
46 pub method: CreateUserContextMethod,
47 pub params: CreateUserContextParams,
48}
49impl CreateUserContext {
50 pub const IDENTIFIER: &'static str = "browser.createUserContext";
51 pub const DOMAIN_DIRECTION: &'static str = "remote";
52 pub fn identifier(&self) -> &'static str {
53 Self::IDENTIFIER
54 }
55}
56impl crate::CommandResult for CreateUserContext {
57 type Result = super::results::CreateUserContextResult;
58}
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub struct GetClientWindowsParams {}
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
62pub enum GetClientWindowsMethod {
63 #[serde(rename = "browser.getClientWindows")]
64 GetClientWindows,
65}
66#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
67pub struct GetClientWindows {
68 pub method: GetClientWindowsMethod,
69 pub params: GetClientWindowsParams,
70}
71impl GetClientWindows {
72 pub const IDENTIFIER: &'static str = "browser.getClientWindows";
73 pub const DOMAIN_DIRECTION: &'static str = "remote";
74 pub fn identifier(&self) -> &'static str {
75 Self::IDENTIFIER
76 }
77}
78impl crate::CommandResult for GetClientWindows {
79 type Result = super::results::GetClientWindowsResult;
80}
81#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
82pub struct GetUserContextsParams {}
83#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
84pub enum GetUserContextsMethod {
85 #[serde(rename = "browser.getUserContexts")]
86 GetUserContexts,
87}
88#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
89pub struct GetUserContexts {
90 pub method: GetUserContextsMethod,
91 pub params: GetUserContextsParams,
92}
93impl GetUserContexts {
94 pub const IDENTIFIER: &'static str = "browser.getUserContexts";
95 pub const DOMAIN_DIRECTION: &'static str = "remote";
96 pub fn identifier(&self) -> &'static str {
97 Self::IDENTIFIER
98 }
99}
100impl crate::CommandResult for GetUserContexts {
101 type Result = super::results::GetUserContextsResult;
102}
103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
104pub struct RemoveUserContextParams {
105 #[serde(rename = "userContext")]
106 pub user_context: super::types::UserContext,
107}
108impl RemoveUserContextParams {
109 pub fn new(user_context: impl Into<super::types::UserContext>) -> Self {
110 Self {
111 user_context: user_context.into(),
112 }
113 }
114}
115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
116pub enum RemoveUserContextMethod {
117 #[serde(rename = "browser.removeUserContext")]
118 RemoveUserContext,
119}
120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
121pub struct RemoveUserContext {
122 pub method: RemoveUserContextMethod,
123 pub params: RemoveUserContextParams,
124}
125impl RemoveUserContext {
126 pub const IDENTIFIER: &'static str = "browser.removeUserContext";
127 pub const DOMAIN_DIRECTION: &'static str = "remote";
128 pub fn identifier(&self) -> &'static str {
129 Self::IDENTIFIER
130 }
131}
132impl crate::CommandResult for RemoveUserContext {
133 type Result = super::results::RemoveUserContextResult;
134}
135#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
136pub struct SetClientWindowStateParams {
137 #[serde(rename = "clientWindow")]
138 pub client_window: super::types::ClientWindow,
139 #[serde(flatten)]
140 #[serde(default)]
141 pub client_window_named_state_client_window_rect_state_union:
142 super::types::ClientWindowNamedStateClientWindowRectStateUnion,
143}
144impl SetClientWindowStateParams {
145 pub fn new(
146 client_window: impl Into<super::types::ClientWindow>,
147 client_window_named_state_client_window_rect_state_union: impl Into<
148 super::types::ClientWindowNamedStateClientWindowRectStateUnion,
149 >,
150 ) -> Self {
151 Self {
152 client_window: client_window.into(),
153 client_window_named_state_client_window_rect_state_union:
154 client_window_named_state_client_window_rect_state_union.into(),
155 }
156 }
157}
158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
159pub enum SetClientWindowStateMethod {
160 #[serde(rename = "browser.setClientWindowState")]
161 SetClientWindowState,
162}
163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
164pub struct SetClientWindowState {
165 pub method: SetClientWindowStateMethod,
166 pub params: SetClientWindowStateParams,
167}
168impl SetClientWindowState {
169 pub const IDENTIFIER: &'static str = "browser.setClientWindowState";
170 pub const DOMAIN_DIRECTION: &'static str = "remote";
171 pub fn identifier(&self) -> &'static str {
172 Self::IDENTIFIER
173 }
174}
175impl crate::CommandResult for SetClientWindowState {
176 type Result = super::results::SetClientWindowStateResult;
177}
178#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
179pub struct SetDownloadBehaviorParams {
180 #[serde(rename = "downloadBehavior")]
181 #[serde(skip_serializing_if = "Option::is_none")]
182 #[serde(default)]
183 pub download_behavior: Option<super::types::DownloadBehavior>,
184 #[serde(rename = "userContexts")]
185 #[serde(skip_serializing_if = "Option::is_none")]
186 #[serde(default)]
187 pub user_contexts: Option<Vec<super::types::UserContext>>,
188}
189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
190pub enum SetDownloadBehaviorMethod {
191 #[serde(rename = "browser.setDownloadBehavior")]
192 SetDownloadBehavior,
193}
194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
195pub struct SetDownloadBehavior {
196 pub method: SetDownloadBehaviorMethod,
197 pub params: SetDownloadBehaviorParams,
198}
199impl SetDownloadBehavior {
200 pub const IDENTIFIER: &'static str = "browser.setDownloadBehavior";
201 pub const DOMAIN_DIRECTION: &'static str = "remote";
202 pub fn identifier(&self) -> &'static str {
203 Self::IDENTIFIER
204 }
205}
206impl crate::CommandResult for SetDownloadBehavior {
207 type Result = super::results::SetDownloadBehaviorResult;
208}
209group_enum ! (BrowserCommand { Close (Close) , CreateUserContext (CreateUserContext) , GetClientWindows (GetClientWindows) , GetUserContexts (GetUserContexts) , RemoveUserContext (RemoveUserContext) , SetClientWindowState (SetClientWindowState) , SetDownloadBehavior (SetDownloadBehavior) } + identifiable);