1use serde::{Deserialize, Serialize};
2#[doc = "Clears all entries from an object store.\n[clearObjectStore](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-clearObjectStore)"]
3#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4pub struct ClearObjectStoreParams {
5 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
6 #[serde(rename = "securityOrigin")]
7 #[serde(skip_serializing_if = "Option::is_none")]
8 #[serde(default)]
9 pub security_origin: Option<String>,
10 #[doc = "Storage key."]
11 #[serde(rename = "storageKey")]
12 #[serde(skip_serializing_if = "Option::is_none")]
13 #[serde(default)]
14 pub storage_key: Option<String>,
15 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
16 #[serde(rename = "storageBucket")]
17 #[serde(skip_serializing_if = "Option::is_none")]
18 #[serde(default)]
19 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
20 #[doc = "Database name."]
21 #[serde(rename = "databaseName")]
22 pub database_name: String,
23 #[doc = "Object store name."]
24 #[serde(rename = "objectStoreName")]
25 pub object_store_name: String,
26}
27impl ClearObjectStoreParams {
28 pub fn new(database_name: impl Into<String>, object_store_name: impl Into<String>) -> Self {
29 Self {
30 database_name: database_name.into(),
31 object_store_name: object_store_name.into(),
32 security_origin: None,
33 storage_key: None,
34 storage_bucket: None,
35 }
36 }
37}
38#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
39pub enum ClearObjectStoreMethod {
40 #[serde(rename = "IndexedDB.clearObjectStore")]
41 ClearObjectStore,
42}
43#[doc = "Clears all entries from an object store.\n[clearObjectStore](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-clearObjectStore)"]
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct ClearObjectStore {
46 pub method: ClearObjectStoreMethod,
47 pub params: ClearObjectStoreParams,
48}
49impl ClearObjectStore {
50 pub const IDENTIFIER: &'static str = "IndexedDB.clearObjectStore";
51 pub fn identifier(&self) -> &'static str {
52 Self::IDENTIFIER
53 }
54}
55impl crate::CommandResult for ClearObjectStore {
56 type Result = super::results::ClearObjectStoreResult;
57}
58#[doc = "Deletes a database.\n[deleteDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteDatabase)"]
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub struct DeleteDatabaseParams {
61 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
62 #[serde(rename = "securityOrigin")]
63 #[serde(skip_serializing_if = "Option::is_none")]
64 #[serde(default)]
65 pub security_origin: Option<String>,
66 #[doc = "Storage key."]
67 #[serde(rename = "storageKey")]
68 #[serde(skip_serializing_if = "Option::is_none")]
69 #[serde(default)]
70 pub storage_key: Option<String>,
71 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
72 #[serde(rename = "storageBucket")]
73 #[serde(skip_serializing_if = "Option::is_none")]
74 #[serde(default)]
75 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
76 #[doc = "Database name."]
77 #[serde(rename = "databaseName")]
78 pub database_name: String,
79}
80impl DeleteDatabaseParams {
81 pub fn new(database_name: impl Into<String>) -> Self {
82 Self {
83 database_name: database_name.into(),
84 security_origin: None,
85 storage_key: None,
86 storage_bucket: None,
87 }
88 }
89}
90impl<T: Into<String>> From<T> for DeleteDatabaseParams {
91 fn from(url: T) -> Self {
92 DeleteDatabaseParams::new(url)
93 }
94}
95#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
96pub enum DeleteDatabaseMethod {
97 #[serde(rename = "IndexedDB.deleteDatabase")]
98 DeleteDatabase,
99}
100#[doc = "Deletes a database.\n[deleteDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteDatabase)"]
101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
102pub struct DeleteDatabase {
103 pub method: DeleteDatabaseMethod,
104 pub params: DeleteDatabaseParams,
105}
106impl DeleteDatabase {
107 pub const IDENTIFIER: &'static str = "IndexedDB.deleteDatabase";
108 pub fn identifier(&self) -> &'static str {
109 Self::IDENTIFIER
110 }
111}
112impl crate::CommandResult for DeleteDatabase {
113 type Result = super::results::DeleteDatabaseResult;
114}
115#[doc = "Delete a range of entries from an object store\n[deleteObjectStoreEntries](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteObjectStoreEntries)"]
116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
117pub struct DeleteObjectStoreEntriesParams {
118 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
119 #[serde(rename = "securityOrigin")]
120 #[serde(skip_serializing_if = "Option::is_none")]
121 #[serde(default)]
122 pub security_origin: Option<String>,
123 #[doc = "Storage key."]
124 #[serde(rename = "storageKey")]
125 #[serde(skip_serializing_if = "Option::is_none")]
126 #[serde(default)]
127 pub storage_key: Option<String>,
128 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
129 #[serde(rename = "storageBucket")]
130 #[serde(skip_serializing_if = "Option::is_none")]
131 #[serde(default)]
132 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
133 #[serde(rename = "databaseName")]
134 pub database_name: String,
135 #[serde(rename = "objectStoreName")]
136 pub object_store_name: String,
137 #[doc = "Range of entry keys to delete"]
138 #[serde(rename = "keyRange")]
139 pub key_range: super::types::KeyRange,
140}
141impl DeleteObjectStoreEntriesParams {
142 pub fn new(
143 database_name: impl Into<String>,
144 object_store_name: impl Into<String>,
145 key_range: impl Into<super::types::KeyRange>,
146 ) -> Self {
147 Self {
148 database_name: database_name.into(),
149 object_store_name: object_store_name.into(),
150 key_range: key_range.into(),
151 security_origin: None,
152 storage_key: None,
153 storage_bucket: None,
154 }
155 }
156}
157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
158pub enum DeleteObjectStoreEntriesMethod {
159 #[serde(rename = "IndexedDB.deleteObjectStoreEntries")]
160 DeleteObjectStoreEntries,
161}
162#[doc = "Delete a range of entries from an object store\n[deleteObjectStoreEntries](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteObjectStoreEntries)"]
163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
164pub struct DeleteObjectStoreEntries {
165 pub method: DeleteObjectStoreEntriesMethod,
166 pub params: DeleteObjectStoreEntriesParams,
167}
168impl DeleteObjectStoreEntries {
169 pub const IDENTIFIER: &'static str = "IndexedDB.deleteObjectStoreEntries";
170 pub fn identifier(&self) -> &'static str {
171 Self::IDENTIFIER
172 }
173}
174impl crate::CommandResult for DeleteObjectStoreEntries {
175 type Result = super::results::DeleteObjectStoreEntriesResult;
176}
177#[doc = "Disables events from backend.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-disable)"]
178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
179pub struct DisableParams {}
180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
181pub enum DisableMethod {
182 #[serde(rename = "IndexedDB.disable")]
183 Disable,
184}
185#[doc = "Disables events from backend.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-disable)"]
186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
187pub struct Disable {
188 pub method: DisableMethod,
189 pub params: DisableParams,
190}
191impl Disable {
192 pub const IDENTIFIER: &'static str = "IndexedDB.disable";
193 pub fn identifier(&self) -> &'static str {
194 Self::IDENTIFIER
195 }
196}
197impl crate::CommandResult for Disable {
198 type Result = super::results::DisableResult;
199}
200#[doc = "Enables events from backend.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-enable)"]
201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
202pub struct EnableParams {}
203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
204pub enum EnableMethod {
205 #[serde(rename = "IndexedDB.enable")]
206 Enable,
207}
208#[doc = "Enables events from backend.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-enable)"]
209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
210pub struct Enable {
211 pub method: EnableMethod,
212 pub params: EnableParams,
213}
214impl Enable {
215 pub const IDENTIFIER: &'static str = "IndexedDB.enable";
216 pub fn identifier(&self) -> &'static str {
217 Self::IDENTIFIER
218 }
219}
220impl crate::CommandResult for Enable {
221 type Result = super::results::EnableResult;
222}
223#[doc = "Requests data from object store or index.\n[requestData](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestData)"]
224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
225pub struct RequestDataParams {
226 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
227 #[serde(rename = "securityOrigin")]
228 #[serde(skip_serializing_if = "Option::is_none")]
229 #[serde(default)]
230 pub security_origin: Option<String>,
231 #[doc = "Storage key."]
232 #[serde(rename = "storageKey")]
233 #[serde(skip_serializing_if = "Option::is_none")]
234 #[serde(default)]
235 pub storage_key: Option<String>,
236 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
237 #[serde(rename = "storageBucket")]
238 #[serde(skip_serializing_if = "Option::is_none")]
239 #[serde(default)]
240 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
241 #[doc = "Database name."]
242 #[serde(rename = "databaseName")]
243 pub database_name: String,
244 #[doc = "Object store name."]
245 #[serde(rename = "objectStoreName")]
246 pub object_store_name: String,
247 #[doc = "Index name. If not specified, it performs an object store data request."]
248 #[serde(rename = "indexName")]
249 #[serde(skip_serializing_if = "Option::is_none")]
250 #[serde(default)]
251 pub index_name: Option<String>,
252 #[doc = "Number of records to skip."]
253 #[serde(rename = "skipCount")]
254 pub skip_count: i64,
255 #[doc = "Number of records to fetch."]
256 #[serde(rename = "pageSize")]
257 pub page_size: i64,
258 #[doc = "Key range."]
259 #[serde(rename = "keyRange")]
260 #[serde(skip_serializing_if = "Option::is_none")]
261 #[serde(default)]
262 pub key_range: Option<super::types::KeyRange>,
263}
264impl RequestDataParams {
265 pub fn new(
266 database_name: impl Into<String>,
267 object_store_name: impl Into<String>,
268 skip_count: impl Into<i64>,
269 page_size: impl Into<i64>,
270 ) -> Self {
271 Self {
272 database_name: database_name.into(),
273 object_store_name: object_store_name.into(),
274 skip_count: skip_count.into(),
275 page_size: page_size.into(),
276 security_origin: None,
277 storage_key: None,
278 storage_bucket: None,
279 index_name: None,
280 key_range: None,
281 }
282 }
283}
284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
285pub enum RequestDataMethod {
286 #[serde(rename = "IndexedDB.requestData")]
287 RequestData,
288}
289#[doc = "Requests data from object store or index.\n[requestData](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestData)"]
290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
291pub struct RequestData {
292 pub method: RequestDataMethod,
293 pub params: RequestDataParams,
294}
295impl RequestData {
296 pub const IDENTIFIER: &'static str = "IndexedDB.requestData";
297 pub fn identifier(&self) -> &'static str {
298 Self::IDENTIFIER
299 }
300}
301impl crate::CommandResult for RequestData {
302 type Result = super::results::RequestDataResult;
303}
304#[doc = "Gets metadata of an object store.\n[getMetadata](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-getMetadata)"]
305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
306pub struct GetMetadataParams {
307 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
308 #[serde(rename = "securityOrigin")]
309 #[serde(skip_serializing_if = "Option::is_none")]
310 #[serde(default)]
311 pub security_origin: Option<String>,
312 #[doc = "Storage key."]
313 #[serde(rename = "storageKey")]
314 #[serde(skip_serializing_if = "Option::is_none")]
315 #[serde(default)]
316 pub storage_key: Option<String>,
317 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
318 #[serde(rename = "storageBucket")]
319 #[serde(skip_serializing_if = "Option::is_none")]
320 #[serde(default)]
321 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
322 #[doc = "Database name."]
323 #[serde(rename = "databaseName")]
324 pub database_name: String,
325 #[doc = "Object store name."]
326 #[serde(rename = "objectStoreName")]
327 pub object_store_name: String,
328}
329impl GetMetadataParams {
330 pub fn new(database_name: impl Into<String>, object_store_name: impl Into<String>) -> Self {
331 Self {
332 database_name: database_name.into(),
333 object_store_name: object_store_name.into(),
334 security_origin: None,
335 storage_key: None,
336 storage_bucket: None,
337 }
338 }
339}
340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
341pub enum GetMetadataMethod {
342 #[serde(rename = "IndexedDB.getMetadata")]
343 GetMetadata,
344}
345#[doc = "Gets metadata of an object store.\n[getMetadata](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-getMetadata)"]
346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
347pub struct GetMetadata {
348 pub method: GetMetadataMethod,
349 pub params: GetMetadataParams,
350}
351impl GetMetadata {
352 pub const IDENTIFIER: &'static str = "IndexedDB.getMetadata";
353 pub fn identifier(&self) -> &'static str {
354 Self::IDENTIFIER
355 }
356}
357impl crate::CommandResult for GetMetadata {
358 type Result = super::results::GetMetadataResult;
359}
360#[doc = "Requests database with given name in given frame.\n[requestDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabase)"]
361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
362pub struct RequestDatabaseParams {
363 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
364 #[serde(rename = "securityOrigin")]
365 #[serde(skip_serializing_if = "Option::is_none")]
366 #[serde(default)]
367 pub security_origin: Option<String>,
368 #[doc = "Storage key."]
369 #[serde(rename = "storageKey")]
370 #[serde(skip_serializing_if = "Option::is_none")]
371 #[serde(default)]
372 pub storage_key: Option<String>,
373 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
374 #[serde(rename = "storageBucket")]
375 #[serde(skip_serializing_if = "Option::is_none")]
376 #[serde(default)]
377 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
378 #[doc = "Database name."]
379 #[serde(rename = "databaseName")]
380 pub database_name: String,
381}
382impl RequestDatabaseParams {
383 pub fn new(database_name: impl Into<String>) -> Self {
384 Self {
385 database_name: database_name.into(),
386 security_origin: None,
387 storage_key: None,
388 storage_bucket: None,
389 }
390 }
391}
392impl<T: Into<String>> From<T> for RequestDatabaseParams {
393 fn from(url: T) -> Self {
394 RequestDatabaseParams::new(url)
395 }
396}
397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
398pub enum RequestDatabaseMethod {
399 #[serde(rename = "IndexedDB.requestDatabase")]
400 RequestDatabase,
401}
402#[doc = "Requests database with given name in given frame.\n[requestDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabase)"]
403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
404pub struct RequestDatabase {
405 pub method: RequestDatabaseMethod,
406 pub params: RequestDatabaseParams,
407}
408impl RequestDatabase {
409 pub const IDENTIFIER: &'static str = "IndexedDB.requestDatabase";
410 pub fn identifier(&self) -> &'static str {
411 Self::IDENTIFIER
412 }
413}
414impl crate::CommandResult for RequestDatabase {
415 type Result = super::results::RequestDatabaseResult;
416}
417#[doc = "Requests database names for given security origin.\n[requestDatabaseNames](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabaseNames)"]
418#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
419pub struct RequestDatabaseNamesParams {
420 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
421 #[serde(rename = "securityOrigin")]
422 #[serde(skip_serializing_if = "Option::is_none")]
423 #[serde(default)]
424 pub security_origin: Option<String>,
425 #[doc = "Storage key."]
426 #[serde(rename = "storageKey")]
427 #[serde(skip_serializing_if = "Option::is_none")]
428 #[serde(default)]
429 pub storage_key: Option<String>,
430 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
431 #[serde(rename = "storageBucket")]
432 #[serde(skip_serializing_if = "Option::is_none")]
433 #[serde(default)]
434 pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
435}
436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
437pub enum RequestDatabaseNamesMethod {
438 #[serde(rename = "IndexedDB.requestDatabaseNames")]
439 RequestDatabaseNames,
440}
441#[doc = "Requests database names for given security origin.\n[requestDatabaseNames](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabaseNames)"]
442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
443pub struct RequestDatabaseNames {
444 pub method: RequestDatabaseNamesMethod,
445 pub params: RequestDatabaseNamesParams,
446}
447impl RequestDatabaseNames {
448 pub const IDENTIFIER: &'static str = "IndexedDB.requestDatabaseNames";
449 pub fn identifier(&self) -> &'static str {
450 Self::IDENTIFIER
451 }
452}
453impl crate::CommandResult for RequestDatabaseNames {
454 type Result = super::results::RequestDatabaseNamesResult;
455}
456group_enum ! (IndexedDbCommands { ClearObjectStore (ClearObjectStore) , DeleteDatabase (DeleteDatabase) , DeleteObjectStoreEntries (DeleteObjectStoreEntries) , Disable (Disable) , Enable (Enable) , RequestData (RequestData) , GetMetadata (GetMetadata) , RequestDatabase (RequestDatabase) , RequestDatabaseNames (RequestDatabaseNames) } + identifiable);