1use serde::{Deserialize, Serialize};
2#[doc = "Runs an extension default action.\nAvailable if the client is connected using the --remote-debugging-pipe\nflag and the --enable-unsafe-extension-debugging flag is set.\n[triggerAction](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-triggerAction)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct TriggerActionParams {
5 #[doc = "Extension id."]
6 #[serde(rename = "id")]
7 pub id: String,
8 #[doc = "A tab target ID to trigger the default extension action on."]
9 #[serde(rename = "targetId")]
10 pub target_id: String,
11}
12impl TriggerActionParams {
13 pub fn new(id: impl Into<String>, target_id: impl Into<String>) -> Self {
14 Self {
15 id: id.into(),
16 target_id: target_id.into(),
17 }
18 }
19}
20#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
21pub enum TriggerActionMethod {
22 #[serde(rename = "Extensions.triggerAction")]
23 TriggerAction,
24}
25#[doc = "Runs an extension default action.\nAvailable if the client is connected using the --remote-debugging-pipe\nflag and the --enable-unsafe-extension-debugging flag is set.\n[triggerAction](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-triggerAction)"]
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27pub struct TriggerAction {
28 pub method: TriggerActionMethod,
29 pub params: TriggerActionParams,
30}
31impl TriggerAction {
32 pub const IDENTIFIER: &'static str = "Extensions.triggerAction";
33 pub fn identifier(&self) -> &'static str {
34 Self::IDENTIFIER
35 }
36}
37impl crate::CommandResult for TriggerAction {
38 type Result = super::results::TriggerActionResult;
39}
40#[doc = "Installs an unpacked extension from the filesystem similar to\n--load-extension CLI flags. Returns extension ID once the extension\nhas been installed. Available if the client is connected using the\n--remote-debugging-pipe flag and the --enable-unsafe-extension-debugging\nflag is set.\n[loadUnpacked](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-loadUnpacked)"]
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42pub struct LoadUnpackedParams {
43 #[doc = "Absolute file path."]
44 #[serde(rename = "path")]
45 pub path: String,
46 #[doc = "Enable the extension in incognito"]
47 #[serde(rename = "enableInIncognito")]
48 #[serde(skip_serializing_if = "Option::is_none")]
49 #[serde(default)]
50 pub enable_in_incognito: Option<bool>,
51}
52impl LoadUnpackedParams {
53 pub fn new(path: impl Into<String>) -> Self {
54 Self {
55 path: path.into(),
56 enable_in_incognito: None,
57 }
58 }
59}
60impl<T: Into<String>> From<T> for LoadUnpackedParams {
61 fn from(url: T) -> Self {
62 LoadUnpackedParams::new(url)
63 }
64}
65#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
66pub enum LoadUnpackedMethod {
67 #[serde(rename = "Extensions.loadUnpacked")]
68 LoadUnpacked,
69}
70#[doc = "Installs an unpacked extension from the filesystem similar to\n--load-extension CLI flags. Returns extension ID once the extension\nhas been installed. Available if the client is connected using the\n--remote-debugging-pipe flag and the --enable-unsafe-extension-debugging\nflag is set.\n[loadUnpacked](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-loadUnpacked)"]
71#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
72pub struct LoadUnpacked {
73 pub method: LoadUnpackedMethod,
74 pub params: LoadUnpackedParams,
75}
76impl LoadUnpacked {
77 pub const IDENTIFIER: &'static str = "Extensions.loadUnpacked";
78 pub fn identifier(&self) -> &'static str {
79 Self::IDENTIFIER
80 }
81}
82impl crate::CommandResult for LoadUnpacked {
83 type Result = super::results::LoadUnpackedResult;
84}
85#[doc = "Gets a list of all unpacked extensions.\nAvailable if the client is connected using the --remote-debugging-pipe flag\nand the --enable-unsafe-extension-debugging flag is set.\n[getExtensions](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-getExtensions)"]
86#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
87pub struct GetExtensionsParams {}
88#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
89pub enum GetExtensionsMethod {
90 #[serde(rename = "Extensions.getExtensions")]
91 GetExtensions,
92}
93#[doc = "Gets a list of all unpacked extensions.\nAvailable if the client is connected using the --remote-debugging-pipe flag\nand the --enable-unsafe-extension-debugging flag is set.\n[getExtensions](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-getExtensions)"]
94#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
95pub struct GetExtensions {
96 pub method: GetExtensionsMethod,
97 pub params: GetExtensionsParams,
98}
99impl GetExtensions {
100 pub const IDENTIFIER: &'static str = "Extensions.getExtensions";
101 pub fn identifier(&self) -> &'static str {
102 Self::IDENTIFIER
103 }
104}
105impl crate::CommandResult for GetExtensions {
106 type Result = super::results::GetExtensionsResult;
107}
108#[doc = "Uninstalls an unpacked extension (others not supported) from the profile.\nAvailable if the client is connected using the --remote-debugging-pipe flag\nand the --enable-unsafe-extension-debugging.\n[uninstall](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-uninstall)"]
109#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
110pub struct UninstallParams {
111 #[doc = "Extension id."]
112 #[serde(rename = "id")]
113 pub id: String,
114}
115impl UninstallParams {
116 pub fn new(id: impl Into<String>) -> Self {
117 Self { id: id.into() }
118 }
119}
120impl<T: Into<String>> From<T> for UninstallParams {
121 fn from(url: T) -> Self {
122 UninstallParams::new(url)
123 }
124}
125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
126pub enum UninstallMethod {
127 #[serde(rename = "Extensions.uninstall")]
128 Uninstall,
129}
130#[doc = "Uninstalls an unpacked extension (others not supported) from the profile.\nAvailable if the client is connected using the --remote-debugging-pipe flag\nand the --enable-unsafe-extension-debugging.\n[uninstall](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-uninstall)"]
131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
132pub struct Uninstall {
133 pub method: UninstallMethod,
134 pub params: UninstallParams,
135}
136impl Uninstall {
137 pub const IDENTIFIER: &'static str = "Extensions.uninstall";
138 pub fn identifier(&self) -> &'static str {
139 Self::IDENTIFIER
140 }
141}
142impl crate::CommandResult for Uninstall {
143 type Result = super::results::UninstallResult;
144}
145#[doc = "Gets data from extension storage in the given `storageArea`. If `keys` is\nspecified, these are used to filter the result.\n[getStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-getStorageItems)"]
146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
147pub struct GetStorageItemsParams {
148 #[doc = "ID of extension."]
149 #[serde(rename = "id")]
150 pub id: String,
151 #[doc = "StorageArea to retrieve data from."]
152 #[serde(rename = "storageArea")]
153 pub storage_area: super::types::StorageArea,
154 #[doc = "Keys to retrieve."]
155 #[serde(rename = "keys")]
156 #[serde(skip_serializing_if = "Option::is_none")]
157 #[serde(default)]
158 pub keys: Option<Vec<String>>,
159}
160impl GetStorageItemsParams {
161 pub fn new(id: impl Into<String>, storage_area: impl Into<super::types::StorageArea>) -> Self {
162 Self {
163 id: id.into(),
164 storage_area: storage_area.into(),
165 keys: None,
166 }
167 }
168}
169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
170pub enum GetStorageItemsMethod {
171 #[serde(rename = "Extensions.getStorageItems")]
172 GetStorageItems,
173}
174#[doc = "Gets data from extension storage in the given `storageArea`. If `keys` is\nspecified, these are used to filter the result.\n[getStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-getStorageItems)"]
175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
176pub struct GetStorageItems {
177 pub method: GetStorageItemsMethod,
178 pub params: GetStorageItemsParams,
179}
180impl GetStorageItems {
181 pub const IDENTIFIER: &'static str = "Extensions.getStorageItems";
182 pub fn identifier(&self) -> &'static str {
183 Self::IDENTIFIER
184 }
185}
186impl crate::CommandResult for GetStorageItems {
187 type Result = super::results::GetStorageItemsResult;
188}
189#[doc = "Removes `keys` from extension storage in the given `storageArea`.\n[removeStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-removeStorageItems)"]
190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
191pub struct RemoveStorageItemsParams {
192 #[doc = "ID of extension."]
193 #[serde(rename = "id")]
194 pub id: String,
195 #[doc = "StorageArea to remove data from."]
196 #[serde(rename = "storageArea")]
197 pub storage_area: super::types::StorageArea,
198 #[doc = "Keys to remove."]
199 #[serde(rename = "keys")]
200 #[serde(skip_serializing_if = "Vec::is_empty")]
201 pub keys: Vec<String>,
202}
203impl RemoveStorageItemsParams {
204 pub fn new(
205 id: impl Into<String>,
206 storage_area: impl Into<super::types::StorageArea>,
207 keys: Vec<String>,
208 ) -> Self {
209 Self {
210 id: id.into(),
211 storage_area: storage_area.into(),
212 keys,
213 }
214 }
215}
216#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
217pub enum RemoveStorageItemsMethod {
218 #[serde(rename = "Extensions.removeStorageItems")]
219 RemoveStorageItems,
220}
221#[doc = "Removes `keys` from extension storage in the given `storageArea`.\n[removeStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-removeStorageItems)"]
222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
223pub struct RemoveStorageItems {
224 pub method: RemoveStorageItemsMethod,
225 pub params: RemoveStorageItemsParams,
226}
227impl RemoveStorageItems {
228 pub const IDENTIFIER: &'static str = "Extensions.removeStorageItems";
229 pub fn identifier(&self) -> &'static str {
230 Self::IDENTIFIER
231 }
232}
233impl crate::CommandResult for RemoveStorageItems {
234 type Result = super::results::RemoveStorageItemsResult;
235}
236#[doc = "Clears extension storage in the given `storageArea`.\n[clearStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-clearStorageItems)"]
237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
238pub struct ClearStorageItemsParams {
239 #[doc = "ID of extension."]
240 #[serde(rename = "id")]
241 pub id: String,
242 #[doc = "StorageArea to remove data from."]
243 #[serde(rename = "storageArea")]
244 pub storage_area: super::types::StorageArea,
245}
246impl ClearStorageItemsParams {
247 pub fn new(id: impl Into<String>, storage_area: impl Into<super::types::StorageArea>) -> Self {
248 Self {
249 id: id.into(),
250 storage_area: storage_area.into(),
251 }
252 }
253}
254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
255pub enum ClearStorageItemsMethod {
256 #[serde(rename = "Extensions.clearStorageItems")]
257 ClearStorageItems,
258}
259#[doc = "Clears extension storage in the given `storageArea`.\n[clearStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-clearStorageItems)"]
260#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
261pub struct ClearStorageItems {
262 pub method: ClearStorageItemsMethod,
263 pub params: ClearStorageItemsParams,
264}
265impl ClearStorageItems {
266 pub const IDENTIFIER: &'static str = "Extensions.clearStorageItems";
267 pub fn identifier(&self) -> &'static str {
268 Self::IDENTIFIER
269 }
270}
271impl crate::CommandResult for ClearStorageItems {
272 type Result = super::results::ClearStorageItemsResult;
273}
274#[doc = "Sets `values` in extension storage in the given `storageArea`. The provided `values`\nwill be merged with existing values in the storage area.\n[setStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-setStorageItems)"]
275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
276pub struct SetStorageItemsParams {
277 #[doc = "ID of extension."]
278 #[serde(rename = "id")]
279 pub id: String,
280 #[doc = "StorageArea to set data in."]
281 #[serde(rename = "storageArea")]
282 pub storage_area: super::types::StorageArea,
283 #[doc = "Values to set."]
284 #[serde(rename = "values")]
285 pub values: serde_json::Value,
286}
287impl SetStorageItemsParams {
288 pub fn new(
289 id: impl Into<String>,
290 storage_area: impl Into<super::types::StorageArea>,
291 values: impl Into<serde_json::Value>,
292 ) -> Self {
293 Self {
294 id: id.into(),
295 storage_area: storage_area.into(),
296 values: values.into(),
297 }
298 }
299}
300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
301pub enum SetStorageItemsMethod {
302 #[serde(rename = "Extensions.setStorageItems")]
303 SetStorageItems,
304}
305#[doc = "Sets `values` in extension storage in the given `storageArea`. The provided `values`\nwill be merged with existing values in the storage area.\n[setStorageItems](https://chromedevtools.github.io/devtools-protocol/tot/Extensions/#method-setStorageItems)"]
306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
307pub struct SetStorageItems {
308 pub method: SetStorageItemsMethod,
309 pub params: SetStorageItemsParams,
310}
311impl SetStorageItems {
312 pub const IDENTIFIER: &'static str = "Extensions.setStorageItems";
313 pub fn identifier(&self) -> &'static str {
314 Self::IDENTIFIER
315 }
316}
317impl crate::CommandResult for SetStorageItems {
318 type Result = super::results::SetStorageItemsResult;
319}
320group_enum ! (ExtensionsCommands { TriggerAction (TriggerAction) , LoadUnpacked (LoadUnpacked) , GetExtensions (GetExtensions) , Uninstall (Uninstall) , GetStorageItems (GetStorageItems) , RemoveStorageItems (RemoveStorageItems) , ClearStorageItems (ClearStorageItems) , SetStorageItems (SetStorageItems) } + identifiable);