Skip to main content

browser_protocol/indexeddb/
mod.rs

1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5/// Database with an array of object stores.
6
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct DatabaseWithObjectStores<'a> {
10    /// Database name.
11    name: Cow<'a, str>,
12    /// Database version (type is not 'integer', as the standard
13    /// requires the version number to be 'unsigned long long')
14    version: f64,
15    /// Object stores in this database.
16    #[serde(rename = "objectStores")]
17    object_stores: Vec<ObjectStore<'a>>,
18}
19
20impl<'a> DatabaseWithObjectStores<'a> {
21    /// Creates a builder for this type with the required parameters:
22    /// * `name`: Database name.
23    /// * `version`: Database version (type is not 'integer', as the standard requires the version number to be 'unsigned long long')
24    /// * `object_stores`: Object stores in this database.
25    pub fn builder(name: impl Into<Cow<'a, str>>, version: f64, object_stores: Vec<ObjectStore<'a>>) -> DatabaseWithObjectStoresBuilder<'a> {
26        DatabaseWithObjectStoresBuilder {
27            name: name.into(),
28            version: version,
29            object_stores: object_stores,
30        }
31    }
32    /// Database name.
33    pub fn name(&self) -> &str { self.name.as_ref() }
34    /// Database version (type is not 'integer', as the standard
35    /// requires the version number to be 'unsigned long long')
36    pub fn version(&self) -> f64 { self.version }
37    /// Object stores in this database.
38    pub fn object_stores(&self) -> &[ObjectStore<'a>] { &self.object_stores }
39}
40
41
42pub struct DatabaseWithObjectStoresBuilder<'a> {
43    name: Cow<'a, str>,
44    version: f64,
45    object_stores: Vec<ObjectStore<'a>>,
46}
47
48impl<'a> DatabaseWithObjectStoresBuilder<'a> {
49    pub fn build(self) -> DatabaseWithObjectStores<'a> {
50        DatabaseWithObjectStores {
51            name: self.name,
52            version: self.version,
53            object_stores: self.object_stores,
54        }
55    }
56}
57
58/// Object store.
59
60#[derive(Debug, Clone, Serialize, Deserialize, Default)]
61#[serde(rename_all = "camelCase")]
62pub struct ObjectStore<'a> {
63    /// Object store name.
64    name: Cow<'a, str>,
65    /// Object store key path.
66    #[serde(rename = "keyPath")]
67    key_path: KeyPath<'a>,
68    /// If true, object store has auto increment flag set.
69    #[serde(rename = "autoIncrement")]
70    auto_increment: bool,
71    /// Indexes in this object store.
72    indexes: Vec<ObjectStoreIndex<'a>>,
73}
74
75impl<'a> ObjectStore<'a> {
76    /// Creates a builder for this type with the required parameters:
77    /// * `name`: Object store name.
78    /// * `key_path`: Object store key path.
79    /// * `auto_increment`: If true, object store has auto increment flag set.
80    /// * `indexes`: Indexes in this object store.
81    pub fn builder(name: impl Into<Cow<'a, str>>, key_path: KeyPath<'a>, auto_increment: bool, indexes: Vec<ObjectStoreIndex<'a>>) -> ObjectStoreBuilder<'a> {
82        ObjectStoreBuilder {
83            name: name.into(),
84            key_path: key_path,
85            auto_increment: auto_increment,
86            indexes: indexes,
87        }
88    }
89    /// Object store name.
90    pub fn name(&self) -> &str { self.name.as_ref() }
91    /// Object store key path.
92    pub fn key_path(&self) -> &KeyPath<'a> { &self.key_path }
93    /// If true, object store has auto increment flag set.
94    pub fn auto_increment(&self) -> bool { self.auto_increment }
95    /// Indexes in this object store.
96    pub fn indexes(&self) -> &[ObjectStoreIndex<'a>] { &self.indexes }
97}
98
99
100pub struct ObjectStoreBuilder<'a> {
101    name: Cow<'a, str>,
102    key_path: KeyPath<'a>,
103    auto_increment: bool,
104    indexes: Vec<ObjectStoreIndex<'a>>,
105}
106
107impl<'a> ObjectStoreBuilder<'a> {
108    pub fn build(self) -> ObjectStore<'a> {
109        ObjectStore {
110            name: self.name,
111            key_path: self.key_path,
112            auto_increment: self.auto_increment,
113            indexes: self.indexes,
114        }
115    }
116}
117
118/// Object store index.
119
120#[derive(Debug, Clone, Serialize, Deserialize, Default)]
121#[serde(rename_all = "camelCase")]
122pub struct ObjectStoreIndex<'a> {
123    /// Index name.
124    name: Cow<'a, str>,
125    /// Index key path.
126    #[serde(rename = "keyPath")]
127    key_path: KeyPath<'a>,
128    /// If true, index is unique.
129    unique: bool,
130    /// If true, index allows multiple entries for a key.
131    #[serde(rename = "multiEntry")]
132    multi_entry: bool,
133}
134
135impl<'a> ObjectStoreIndex<'a> {
136    /// Creates a builder for this type with the required parameters:
137    /// * `name`: Index name.
138    /// * `key_path`: Index key path.
139    /// * `unique`: If true, index is unique.
140    /// * `multi_entry`: If true, index allows multiple entries for a key.
141    pub fn builder(name: impl Into<Cow<'a, str>>, key_path: KeyPath<'a>, unique: bool, multi_entry: bool) -> ObjectStoreIndexBuilder<'a> {
142        ObjectStoreIndexBuilder {
143            name: name.into(),
144            key_path: key_path,
145            unique: unique,
146            multi_entry: multi_entry,
147        }
148    }
149    /// Index name.
150    pub fn name(&self) -> &str { self.name.as_ref() }
151    /// Index key path.
152    pub fn key_path(&self) -> &KeyPath<'a> { &self.key_path }
153    /// If true, index is unique.
154    pub fn unique(&self) -> bool { self.unique }
155    /// If true, index allows multiple entries for a key.
156    pub fn multi_entry(&self) -> bool { self.multi_entry }
157}
158
159
160pub struct ObjectStoreIndexBuilder<'a> {
161    name: Cow<'a, str>,
162    key_path: KeyPath<'a>,
163    unique: bool,
164    multi_entry: bool,
165}
166
167impl<'a> ObjectStoreIndexBuilder<'a> {
168    pub fn build(self) -> ObjectStoreIndex<'a> {
169        ObjectStoreIndex {
170            name: self.name,
171            key_path: self.key_path,
172            unique: self.unique,
173            multi_entry: self.multi_entry,
174        }
175    }
176}
177
178/// Key.
179
180#[derive(Debug, Clone, Serialize, Deserialize, Default)]
181#[serde(rename_all = "camelCase")]
182pub struct Key<'a> {
183    /// Key type.
184    #[serde(rename = "type")]
185    type_: Cow<'a, str>,
186    /// Number value.
187    #[serde(skip_serializing_if = "Option::is_none")]
188    number: Option<f64>,
189    /// String value.
190    #[serde(skip_serializing_if = "Option::is_none")]
191    string: Option<Cow<'a, str>>,
192    /// Date value.
193    #[serde(skip_serializing_if = "Option::is_none")]
194    date: Option<f64>,
195    /// Array value.
196    #[serde(skip_serializing_if = "Option::is_none")]
197    array: Option<Vec<Box<Key<'a>>>>,
198}
199
200impl<'a> Key<'a> {
201    /// Creates a builder for this type with the required parameters:
202    /// * `type_`: Key type.
203    pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyBuilder<'a> {
204        KeyBuilder {
205            type_: type_.into(),
206            number: None,
207            string: None,
208            date: None,
209            array: None,
210        }
211    }
212    /// Key type.
213    pub fn type_(&self) -> &str { self.type_.as_ref() }
214    /// Number value.
215    pub fn number(&self) -> Option<f64> { self.number }
216    /// String value.
217    pub fn string(&self) -> Option<&str> { self.string.as_deref() }
218    /// Date value.
219    pub fn date(&self) -> Option<f64> { self.date }
220    /// Array value.
221    pub fn array(&self) -> Option<&[Box<Key<'a>>]> { self.array.as_deref() }
222}
223
224
225pub struct KeyBuilder<'a> {
226    type_: Cow<'a, str>,
227    number: Option<f64>,
228    string: Option<Cow<'a, str>>,
229    date: Option<f64>,
230    array: Option<Vec<Box<Key<'a>>>>,
231}
232
233impl<'a> KeyBuilder<'a> {
234    /// Number value.
235    pub fn number(mut self, number: f64) -> Self { self.number = Some(number); self }
236    /// String value.
237    pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
238    /// Date value.
239    pub fn date(mut self, date: f64) -> Self { self.date = Some(date); self }
240    /// Array value.
241    pub fn array(mut self, array: Vec<Box<Key<'a>>>) -> Self { self.array = Some(array); self }
242    pub fn build(self) -> Key<'a> {
243        Key {
244            type_: self.type_,
245            number: self.number,
246            string: self.string,
247            date: self.date,
248            array: self.array,
249        }
250    }
251}
252
253/// Key range.
254
255#[derive(Debug, Clone, Serialize, Deserialize, Default)]
256#[serde(rename_all = "camelCase")]
257pub struct KeyRange<'a> {
258    /// Lower bound.
259    #[serde(skip_serializing_if = "Option::is_none")]
260    lower: Option<Key<'a>>,
261    /// Upper bound.
262    #[serde(skip_serializing_if = "Option::is_none")]
263    upper: Option<Key<'a>>,
264    /// If true lower bound is open.
265    #[serde(rename = "lowerOpen")]
266    lower_open: bool,
267    /// If true upper bound is open.
268    #[serde(rename = "upperOpen")]
269    upper_open: bool,
270}
271
272impl<'a> KeyRange<'a> {
273    /// Creates a builder for this type with the required parameters:
274    /// * `lower_open`: If true lower bound is open.
275    /// * `upper_open`: If true upper bound is open.
276    pub fn builder(lower_open: bool, upper_open: bool) -> KeyRangeBuilder<'a> {
277        KeyRangeBuilder {
278            lower: None,
279            upper: None,
280            lower_open: lower_open,
281            upper_open: upper_open,
282        }
283    }
284    /// Lower bound.
285    pub fn lower(&self) -> Option<&Key<'a>> { self.lower.as_ref() }
286    /// Upper bound.
287    pub fn upper(&self) -> Option<&Key<'a>> { self.upper.as_ref() }
288    /// If true lower bound is open.
289    pub fn lower_open(&self) -> bool { self.lower_open }
290    /// If true upper bound is open.
291    pub fn upper_open(&self) -> bool { self.upper_open }
292}
293
294
295pub struct KeyRangeBuilder<'a> {
296    lower: Option<Key<'a>>,
297    upper: Option<Key<'a>>,
298    lower_open: bool,
299    upper_open: bool,
300}
301
302impl<'a> KeyRangeBuilder<'a> {
303    /// Lower bound.
304    pub fn lower(mut self, lower: Key<'a>) -> Self { self.lower = Some(lower); self }
305    /// Upper bound.
306    pub fn upper(mut self, upper: Key<'a>) -> Self { self.upper = Some(upper); self }
307    pub fn build(self) -> KeyRange<'a> {
308        KeyRange {
309            lower: self.lower,
310            upper: self.upper,
311            lower_open: self.lower_open,
312            upper_open: self.upper_open,
313        }
314    }
315}
316
317/// Data entry.
318
319#[derive(Debug, Clone, Serialize, Deserialize, Default)]
320#[serde(rename_all = "camelCase")]
321pub struct DataEntry {
322    /// Key object.
323    key: crate::runtime::RemoteObject,
324    /// Primary key object.
325    #[serde(rename = "primaryKey")]
326    primary_key: crate::runtime::RemoteObject,
327    /// Value object.
328    value: crate::runtime::RemoteObject,
329}
330
331impl DataEntry {
332    /// Creates a builder for this type with the required parameters:
333    /// * `key`: Key object.
334    /// * `primary_key`: Primary key object.
335    /// * `value`: Value object.
336    pub fn builder(key: crate::runtime::RemoteObject, primary_key: crate::runtime::RemoteObject, value: crate::runtime::RemoteObject) -> DataEntryBuilder {
337        DataEntryBuilder {
338            key: key,
339            primary_key: primary_key,
340            value: value,
341        }
342    }
343    /// Key object.
344    pub fn key(&self) -> &crate::runtime::RemoteObject { &self.key }
345    /// Primary key object.
346    pub fn primary_key(&self) -> &crate::runtime::RemoteObject { &self.primary_key }
347    /// Value object.
348    pub fn value(&self) -> &crate::runtime::RemoteObject { &self.value }
349}
350
351
352pub struct DataEntryBuilder {
353    key: crate::runtime::RemoteObject,
354    primary_key: crate::runtime::RemoteObject,
355    value: crate::runtime::RemoteObject,
356}
357
358impl DataEntryBuilder {
359    pub fn build(self) -> DataEntry {
360        DataEntry {
361            key: self.key,
362            primary_key: self.primary_key,
363            value: self.value,
364        }
365    }
366}
367
368/// Key path.
369
370#[derive(Debug, Clone, Serialize, Deserialize, Default)]
371#[serde(rename_all = "camelCase")]
372pub struct KeyPath<'a> {
373    /// Key path type.
374    #[serde(rename = "type")]
375    type_: Cow<'a, str>,
376    /// String value.
377    #[serde(skip_serializing_if = "Option::is_none")]
378    string: Option<Cow<'a, str>>,
379    /// Array value.
380    #[serde(skip_serializing_if = "Option::is_none")]
381    array: Option<Vec<Cow<'a, str>>>,
382}
383
384impl<'a> KeyPath<'a> {
385    /// Creates a builder for this type with the required parameters:
386    /// * `type_`: Key path type.
387    pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyPathBuilder<'a> {
388        KeyPathBuilder {
389            type_: type_.into(),
390            string: None,
391            array: None,
392        }
393    }
394    /// Key path type.
395    pub fn type_(&self) -> &str { self.type_.as_ref() }
396    /// String value.
397    pub fn string(&self) -> Option<&str> { self.string.as_deref() }
398    /// Array value.
399    pub fn array(&self) -> Option<&[Cow<'a, str>]> { self.array.as_deref() }
400}
401
402
403pub struct KeyPathBuilder<'a> {
404    type_: Cow<'a, str>,
405    string: Option<Cow<'a, str>>,
406    array: Option<Vec<Cow<'a, str>>>,
407}
408
409impl<'a> KeyPathBuilder<'a> {
410    /// String value.
411    pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
412    /// Array value.
413    pub fn array(mut self, array: Vec<Cow<'a, str>>) -> Self { self.array = Some(array); self }
414    pub fn build(self) -> KeyPath<'a> {
415        KeyPath {
416            type_: self.type_,
417            string: self.string,
418            array: self.array,
419        }
420    }
421}
422
423/// Clears all entries from an object store.
424
425#[derive(Debug, Clone, Serialize, Deserialize, Default)]
426#[serde(rename_all = "camelCase")]
427pub struct ClearObjectStoreParams<'a> {
428    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
429    /// Security origin.
430    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
431    security_origin: Option<Cow<'a, str>>,
432    /// Storage key.
433    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
434    storage_key: Option<Cow<'a, str>>,
435    /// Storage bucket. If not specified, it uses the default bucket.
436    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
437    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
438    /// Database name.
439    #[serde(rename = "databaseName")]
440    database_name: Cow<'a, str>,
441    /// Object store name.
442    #[serde(rename = "objectStoreName")]
443    object_store_name: Cow<'a, str>,
444}
445
446impl<'a> ClearObjectStoreParams<'a> {
447    /// Creates a builder for this type with the required parameters:
448    /// * `database_name`: Database name.
449    /// * `object_store_name`: Object store name.
450    pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>) -> ClearObjectStoreParamsBuilder<'a> {
451        ClearObjectStoreParamsBuilder {
452            security_origin: None,
453            storage_key: None,
454            storage_bucket: None,
455            database_name: database_name.into(),
456            object_store_name: object_store_name.into(),
457        }
458    }
459    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
460    /// Security origin.
461    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
462    /// Storage key.
463    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
464    /// Storage bucket. If not specified, it uses the default bucket.
465    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
466    /// Database name.
467    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
468    /// Object store name.
469    pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
470}
471
472
473pub struct ClearObjectStoreParamsBuilder<'a> {
474    security_origin: Option<Cow<'a, str>>,
475    storage_key: Option<Cow<'a, str>>,
476    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
477    database_name: Cow<'a, str>,
478    object_store_name: Cow<'a, str>,
479}
480
481impl<'a> ClearObjectStoreParamsBuilder<'a> {
482    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
483    /// Security origin.
484    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
485    /// Storage key.
486    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
487    /// Storage bucket. If not specified, it uses the default bucket.
488    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
489    pub fn build(self) -> ClearObjectStoreParams<'a> {
490        ClearObjectStoreParams {
491            security_origin: self.security_origin,
492            storage_key: self.storage_key,
493            storage_bucket: self.storage_bucket,
494            database_name: self.database_name,
495            object_store_name: self.object_store_name,
496        }
497    }
498}
499
500impl<'a> ClearObjectStoreParams<'a> { pub const METHOD: &'static str = "IndexedDB.clearObjectStore"; }
501
502impl<'a> crate::CdpCommand<'a> for ClearObjectStoreParams<'a> {
503    const METHOD: &'static str = "IndexedDB.clearObjectStore";
504    type Response = crate::EmptyReturns;
505}
506
507/// Deletes a database.
508
509#[derive(Debug, Clone, Serialize, Deserialize, Default)]
510#[serde(rename_all = "camelCase")]
511pub struct DeleteDatabaseParams<'a> {
512    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
513    /// Security origin.
514    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
515    security_origin: Option<Cow<'a, str>>,
516    /// Storage key.
517    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
518    storage_key: Option<Cow<'a, str>>,
519    /// Storage bucket. If not specified, it uses the default bucket.
520    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
521    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
522    /// Database name.
523    #[serde(rename = "databaseName")]
524    database_name: Cow<'a, str>,
525}
526
527impl<'a> DeleteDatabaseParams<'a> {
528    /// Creates a builder for this type with the required parameters:
529    /// * `database_name`: Database name.
530    pub fn builder(database_name: impl Into<Cow<'a, str>>) -> DeleteDatabaseParamsBuilder<'a> {
531        DeleteDatabaseParamsBuilder {
532            security_origin: None,
533            storage_key: None,
534            storage_bucket: None,
535            database_name: database_name.into(),
536        }
537    }
538    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
539    /// Security origin.
540    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
541    /// Storage key.
542    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
543    /// Storage bucket. If not specified, it uses the default bucket.
544    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
545    /// Database name.
546    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
547}
548
549
550pub struct DeleteDatabaseParamsBuilder<'a> {
551    security_origin: Option<Cow<'a, str>>,
552    storage_key: Option<Cow<'a, str>>,
553    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
554    database_name: Cow<'a, str>,
555}
556
557impl<'a> DeleteDatabaseParamsBuilder<'a> {
558    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
559    /// Security origin.
560    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
561    /// Storage key.
562    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
563    /// Storage bucket. If not specified, it uses the default bucket.
564    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
565    pub fn build(self) -> DeleteDatabaseParams<'a> {
566        DeleteDatabaseParams {
567            security_origin: self.security_origin,
568            storage_key: self.storage_key,
569            storage_bucket: self.storage_bucket,
570            database_name: self.database_name,
571        }
572    }
573}
574
575impl<'a> DeleteDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteDatabase"; }
576
577impl<'a> crate::CdpCommand<'a> for DeleteDatabaseParams<'a> {
578    const METHOD: &'static str = "IndexedDB.deleteDatabase";
579    type Response = crate::EmptyReturns;
580}
581
582/// Delete a range of entries from an object store
583
584#[derive(Debug, Clone, Serialize, Deserialize, Default)]
585#[serde(rename_all = "camelCase")]
586pub struct DeleteObjectStoreEntriesParams<'a> {
587    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
588    /// Security origin.
589    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
590    security_origin: Option<Cow<'a, str>>,
591    /// Storage key.
592    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
593    storage_key: Option<Cow<'a, str>>,
594    /// Storage bucket. If not specified, it uses the default bucket.
595    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
596    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
597    #[serde(rename = "databaseName")]
598    database_name: Cow<'a, str>,
599    #[serde(rename = "objectStoreName")]
600    object_store_name: Cow<'a, str>,
601    /// Range of entry keys to delete
602    #[serde(rename = "keyRange")]
603    key_range: KeyRange<'a>,
604}
605
606impl<'a> DeleteObjectStoreEntriesParams<'a> {
607    /// Creates a builder for this type with the required parameters:
608    /// * `database_name`: 
609    /// * `object_store_name`: 
610    /// * `key_range`: Range of entry keys to delete
611    pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>, key_range: KeyRange<'a>) -> DeleteObjectStoreEntriesParamsBuilder<'a> {
612        DeleteObjectStoreEntriesParamsBuilder {
613            security_origin: None,
614            storage_key: None,
615            storage_bucket: None,
616            database_name: database_name.into(),
617            object_store_name: object_store_name.into(),
618            key_range: key_range,
619        }
620    }
621    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
622    /// Security origin.
623    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
624    /// Storage key.
625    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
626    /// Storage bucket. If not specified, it uses the default bucket.
627    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
628    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
629    pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
630    /// Range of entry keys to delete
631    pub fn key_range(&self) -> &KeyRange<'a> { &self.key_range }
632}
633
634
635pub struct DeleteObjectStoreEntriesParamsBuilder<'a> {
636    security_origin: Option<Cow<'a, str>>,
637    storage_key: Option<Cow<'a, str>>,
638    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
639    database_name: Cow<'a, str>,
640    object_store_name: Cow<'a, str>,
641    key_range: KeyRange<'a>,
642}
643
644impl<'a> DeleteObjectStoreEntriesParamsBuilder<'a> {
645    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
646    /// Security origin.
647    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
648    /// Storage key.
649    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
650    /// Storage bucket. If not specified, it uses the default bucket.
651    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
652    pub fn build(self) -> DeleteObjectStoreEntriesParams<'a> {
653        DeleteObjectStoreEntriesParams {
654            security_origin: self.security_origin,
655            storage_key: self.storage_key,
656            storage_bucket: self.storage_bucket,
657            database_name: self.database_name,
658            object_store_name: self.object_store_name,
659            key_range: self.key_range,
660        }
661    }
662}
663
664impl<'a> DeleteObjectStoreEntriesParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries"; }
665
666impl<'a> crate::CdpCommand<'a> for DeleteObjectStoreEntriesParams<'a> {
667    const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries";
668    type Response = crate::EmptyReturns;
669}
670
671#[derive(Debug, Clone, Serialize, Deserialize, Default)]
672pub struct DisableParams {}
673
674impl DisableParams { pub const METHOD: &'static str = "IndexedDB.disable"; }
675
676impl<'a> crate::CdpCommand<'a> for DisableParams {
677    const METHOD: &'static str = "IndexedDB.disable";
678    type Response = crate::EmptyReturns;
679}
680
681#[derive(Debug, Clone, Serialize, Deserialize, Default)]
682pub struct EnableParams {}
683
684impl EnableParams { pub const METHOD: &'static str = "IndexedDB.enable"; }
685
686impl<'a> crate::CdpCommand<'a> for EnableParams {
687    const METHOD: &'static str = "IndexedDB.enable";
688    type Response = crate::EmptyReturns;
689}
690
691/// Requests data from object store or index.
692
693#[derive(Debug, Clone, Serialize, Deserialize, Default)]
694#[serde(rename_all = "camelCase")]
695pub struct RequestDataParams<'a> {
696    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
697    /// Security origin.
698    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
699    security_origin: Option<Cow<'a, str>>,
700    /// Storage key.
701    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
702    storage_key: Option<Cow<'a, str>>,
703    /// Storage bucket. If not specified, it uses the default bucket.
704    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
705    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
706    /// Database name.
707    #[serde(rename = "databaseName")]
708    database_name: Cow<'a, str>,
709    /// Object store name.
710    #[serde(rename = "objectStoreName")]
711    object_store_name: Cow<'a, str>,
712    /// Index name. If not specified, it performs an object store data request.
713    #[serde(skip_serializing_if = "Option::is_none", rename = "indexName")]
714    index_name: Option<Cow<'a, str>>,
715    /// Number of records to skip.
716    #[serde(rename = "skipCount")]
717    skip_count: u64,
718    /// Number of records to fetch.
719    #[serde(rename = "pageSize")]
720    page_size: u64,
721    /// Key range.
722    #[serde(skip_serializing_if = "Option::is_none", rename = "keyRange")]
723    key_range: Option<KeyRange<'a>>,
724}
725
726impl<'a> RequestDataParams<'a> {
727    /// Creates a builder for this type with the required parameters:
728    /// * `database_name`: Database name.
729    /// * `object_store_name`: Object store name.
730    /// * `skip_count`: Number of records to skip.
731    /// * `page_size`: Number of records to fetch.
732    pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>, skip_count: u64, page_size: u64) -> RequestDataParamsBuilder<'a> {
733        RequestDataParamsBuilder {
734            security_origin: None,
735            storage_key: None,
736            storage_bucket: None,
737            database_name: database_name.into(),
738            object_store_name: object_store_name.into(),
739            index_name: None,
740            skip_count: skip_count,
741            page_size: page_size,
742            key_range: None,
743        }
744    }
745    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
746    /// Security origin.
747    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
748    /// Storage key.
749    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
750    /// Storage bucket. If not specified, it uses the default bucket.
751    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
752    /// Database name.
753    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
754    /// Object store name.
755    pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
756    /// Index name. If not specified, it performs an object store data request.
757    pub fn index_name(&self) -> Option<&str> { self.index_name.as_deref() }
758    /// Number of records to skip.
759    pub fn skip_count(&self) -> u64 { self.skip_count }
760    /// Number of records to fetch.
761    pub fn page_size(&self) -> u64 { self.page_size }
762    /// Key range.
763    pub fn key_range(&self) -> Option<&KeyRange<'a>> { self.key_range.as_ref() }
764}
765
766
767pub struct RequestDataParamsBuilder<'a> {
768    security_origin: Option<Cow<'a, str>>,
769    storage_key: Option<Cow<'a, str>>,
770    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
771    database_name: Cow<'a, str>,
772    object_store_name: Cow<'a, str>,
773    index_name: Option<Cow<'a, str>>,
774    skip_count: u64,
775    page_size: u64,
776    key_range: Option<KeyRange<'a>>,
777}
778
779impl<'a> RequestDataParamsBuilder<'a> {
780    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
781    /// Security origin.
782    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
783    /// Storage key.
784    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
785    /// Storage bucket. If not specified, it uses the default bucket.
786    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
787    /// Index name. If not specified, it performs an object store data request.
788    pub fn index_name(mut self, index_name: impl Into<Cow<'a, str>>) -> Self { self.index_name = Some(index_name.into()); self }
789    /// Key range.
790    pub fn key_range(mut self, key_range: KeyRange<'a>) -> Self { self.key_range = Some(key_range); self }
791    pub fn build(self) -> RequestDataParams<'a> {
792        RequestDataParams {
793            security_origin: self.security_origin,
794            storage_key: self.storage_key,
795            storage_bucket: self.storage_bucket,
796            database_name: self.database_name,
797            object_store_name: self.object_store_name,
798            index_name: self.index_name,
799            skip_count: self.skip_count,
800            page_size: self.page_size,
801            key_range: self.key_range,
802        }
803    }
804}
805
806/// Requests data from object store or index.
807
808#[derive(Debug, Clone, Serialize, Deserialize, Default)]
809#[serde(rename_all = "camelCase")]
810pub struct RequestDataReturns {
811    /// Array of object store data entries.
812    #[serde(rename = "objectStoreDataEntries")]
813    object_store_data_entries: Vec<DataEntry>,
814    /// If true, there are more entries to fetch in the given range.
815    #[serde(rename = "hasMore")]
816    has_more: bool,
817}
818
819impl RequestDataReturns {
820    /// Creates a builder for this type with the required parameters:
821    /// * `object_store_data_entries`: Array of object store data entries.
822    /// * `has_more`: If true, there are more entries to fetch in the given range.
823    pub fn builder(object_store_data_entries: Vec<DataEntry>, has_more: bool) -> RequestDataReturnsBuilder {
824        RequestDataReturnsBuilder {
825            object_store_data_entries: object_store_data_entries,
826            has_more: has_more,
827        }
828    }
829    /// Array of object store data entries.
830    pub fn object_store_data_entries(&self) -> &[DataEntry] { &self.object_store_data_entries }
831    /// If true, there are more entries to fetch in the given range.
832    pub fn has_more(&self) -> bool { self.has_more }
833}
834
835
836pub struct RequestDataReturnsBuilder {
837    object_store_data_entries: Vec<DataEntry>,
838    has_more: bool,
839}
840
841impl RequestDataReturnsBuilder {
842    pub fn build(self) -> RequestDataReturns {
843        RequestDataReturns {
844            object_store_data_entries: self.object_store_data_entries,
845            has_more: self.has_more,
846        }
847    }
848}
849
850impl<'a> RequestDataParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestData"; }
851
852impl<'a> crate::CdpCommand<'a> for RequestDataParams<'a> {
853    const METHOD: &'static str = "IndexedDB.requestData";
854    type Response = RequestDataReturns;
855}
856
857/// Gets metadata of an object store.
858
859#[derive(Debug, Clone, Serialize, Deserialize, Default)]
860#[serde(rename_all = "camelCase")]
861pub struct GetMetadataParams<'a> {
862    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
863    /// Security origin.
864    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
865    security_origin: Option<Cow<'a, str>>,
866    /// Storage key.
867    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
868    storage_key: Option<Cow<'a, str>>,
869    /// Storage bucket. If not specified, it uses the default bucket.
870    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
871    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
872    /// Database name.
873    #[serde(rename = "databaseName")]
874    database_name: Cow<'a, str>,
875    /// Object store name.
876    #[serde(rename = "objectStoreName")]
877    object_store_name: Cow<'a, str>,
878}
879
880impl<'a> GetMetadataParams<'a> {
881    /// Creates a builder for this type with the required parameters:
882    /// * `database_name`: Database name.
883    /// * `object_store_name`: Object store name.
884    pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>) -> GetMetadataParamsBuilder<'a> {
885        GetMetadataParamsBuilder {
886            security_origin: None,
887            storage_key: None,
888            storage_bucket: None,
889            database_name: database_name.into(),
890            object_store_name: object_store_name.into(),
891        }
892    }
893    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
894    /// Security origin.
895    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
896    /// Storage key.
897    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
898    /// Storage bucket. If not specified, it uses the default bucket.
899    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
900    /// Database name.
901    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
902    /// Object store name.
903    pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
904}
905
906
907pub struct GetMetadataParamsBuilder<'a> {
908    security_origin: Option<Cow<'a, str>>,
909    storage_key: Option<Cow<'a, str>>,
910    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
911    database_name: Cow<'a, str>,
912    object_store_name: Cow<'a, str>,
913}
914
915impl<'a> GetMetadataParamsBuilder<'a> {
916    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
917    /// Security origin.
918    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
919    /// Storage key.
920    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
921    /// Storage bucket. If not specified, it uses the default bucket.
922    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
923    pub fn build(self) -> GetMetadataParams<'a> {
924        GetMetadataParams {
925            security_origin: self.security_origin,
926            storage_key: self.storage_key,
927            storage_bucket: self.storage_bucket,
928            database_name: self.database_name,
929            object_store_name: self.object_store_name,
930        }
931    }
932}
933
934/// Gets metadata of an object store.
935
936#[derive(Debug, Clone, Serialize, Deserialize, Default)]
937#[serde(rename_all = "camelCase")]
938pub struct GetMetadataReturns {
939    /// the entries count
940    #[serde(rename = "entriesCount")]
941    entries_count: f64,
942    /// the current value of key generator, to become the next inserted
943    /// key into the object store. Valid if objectStore.autoIncrement
944    /// is true.
945    #[serde(rename = "keyGeneratorValue")]
946    key_generator_value: f64,
947}
948
949impl GetMetadataReturns {
950    /// Creates a builder for this type with the required parameters:
951    /// * `entries_count`: the entries count
952    /// * `key_generator_value`: the current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.
953    pub fn builder(entries_count: f64, key_generator_value: f64) -> GetMetadataReturnsBuilder {
954        GetMetadataReturnsBuilder {
955            entries_count: entries_count,
956            key_generator_value: key_generator_value,
957        }
958    }
959    /// the entries count
960    pub fn entries_count(&self) -> f64 { self.entries_count }
961    /// the current value of key generator, to become the next inserted
962    /// key into the object store. Valid if objectStore.autoIncrement
963    /// is true.
964    pub fn key_generator_value(&self) -> f64 { self.key_generator_value }
965}
966
967
968pub struct GetMetadataReturnsBuilder {
969    entries_count: f64,
970    key_generator_value: f64,
971}
972
973impl GetMetadataReturnsBuilder {
974    pub fn build(self) -> GetMetadataReturns {
975        GetMetadataReturns {
976            entries_count: self.entries_count,
977            key_generator_value: self.key_generator_value,
978        }
979    }
980}
981
982impl<'a> GetMetadataParams<'a> { pub const METHOD: &'static str = "IndexedDB.getMetadata"; }
983
984impl<'a> crate::CdpCommand<'a> for GetMetadataParams<'a> {
985    const METHOD: &'static str = "IndexedDB.getMetadata";
986    type Response = GetMetadataReturns;
987}
988
989/// Requests database with given name in given frame.
990
991#[derive(Debug, Clone, Serialize, Deserialize, Default)]
992#[serde(rename_all = "camelCase")]
993pub struct RequestDatabaseParams<'a> {
994    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
995    /// Security origin.
996    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
997    security_origin: Option<Cow<'a, str>>,
998    /// Storage key.
999    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
1000    storage_key: Option<Cow<'a, str>>,
1001    /// Storage bucket. If not specified, it uses the default bucket.
1002    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
1003    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
1004    /// Database name.
1005    #[serde(rename = "databaseName")]
1006    database_name: Cow<'a, str>,
1007}
1008
1009impl<'a> RequestDatabaseParams<'a> {
1010    /// Creates a builder for this type with the required parameters:
1011    /// * `database_name`: Database name.
1012    pub fn builder(database_name: impl Into<Cow<'a, str>>) -> RequestDatabaseParamsBuilder<'a> {
1013        RequestDatabaseParamsBuilder {
1014            security_origin: None,
1015            storage_key: None,
1016            storage_bucket: None,
1017            database_name: database_name.into(),
1018        }
1019    }
1020    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
1021    /// Security origin.
1022    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
1023    /// Storage key.
1024    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
1025    /// Storage bucket. If not specified, it uses the default bucket.
1026    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
1027    /// Database name.
1028    pub fn database_name(&self) -> &str { self.database_name.as_ref() }
1029}
1030
1031
1032pub struct RequestDatabaseParamsBuilder<'a> {
1033    security_origin: Option<Cow<'a, str>>,
1034    storage_key: Option<Cow<'a, str>>,
1035    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
1036    database_name: Cow<'a, str>,
1037}
1038
1039impl<'a> RequestDatabaseParamsBuilder<'a> {
1040    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
1041    /// Security origin.
1042    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
1043    /// Storage key.
1044    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
1045    /// Storage bucket. If not specified, it uses the default bucket.
1046    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
1047    pub fn build(self) -> RequestDatabaseParams<'a> {
1048        RequestDatabaseParams {
1049            security_origin: self.security_origin,
1050            storage_key: self.storage_key,
1051            storage_bucket: self.storage_bucket,
1052            database_name: self.database_name,
1053        }
1054    }
1055}
1056
1057/// Requests database with given name in given frame.
1058
1059#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1060#[serde(rename_all = "camelCase")]
1061pub struct RequestDatabaseReturns<'a> {
1062    /// Database with an array of object stores.
1063    #[serde(rename = "databaseWithObjectStores")]
1064    database_with_object_stores: DatabaseWithObjectStores<'a>,
1065}
1066
1067impl<'a> RequestDatabaseReturns<'a> {
1068    /// Creates a builder for this type with the required parameters:
1069    /// * `database_with_object_stores`: Database with an array of object stores.
1070    pub fn builder(database_with_object_stores: DatabaseWithObjectStores<'a>) -> RequestDatabaseReturnsBuilder<'a> {
1071        RequestDatabaseReturnsBuilder {
1072            database_with_object_stores: database_with_object_stores,
1073        }
1074    }
1075    /// Database with an array of object stores.
1076    pub fn database_with_object_stores(&self) -> &DatabaseWithObjectStores<'a> { &self.database_with_object_stores }
1077}
1078
1079
1080pub struct RequestDatabaseReturnsBuilder<'a> {
1081    database_with_object_stores: DatabaseWithObjectStores<'a>,
1082}
1083
1084impl<'a> RequestDatabaseReturnsBuilder<'a> {
1085    pub fn build(self) -> RequestDatabaseReturns<'a> {
1086        RequestDatabaseReturns {
1087            database_with_object_stores: self.database_with_object_stores,
1088        }
1089    }
1090}
1091
1092impl<'a> RequestDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabase"; }
1093
1094impl<'a> crate::CdpCommand<'a> for RequestDatabaseParams<'a> {
1095    const METHOD: &'static str = "IndexedDB.requestDatabase";
1096    type Response = RequestDatabaseReturns<'a>;
1097}
1098
1099/// Requests database names for given security origin.
1100
1101#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1102#[serde(rename_all = "camelCase")]
1103pub struct RequestDatabaseNamesParams<'a> {
1104    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
1105    /// Security origin.
1106    #[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
1107    security_origin: Option<Cow<'a, str>>,
1108    /// Storage key.
1109    #[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
1110    storage_key: Option<Cow<'a, str>>,
1111    /// Storage bucket. If not specified, it uses the default bucket.
1112    #[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
1113    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
1114}
1115
1116impl<'a> RequestDatabaseNamesParams<'a> {
1117    /// Creates a builder for this type.
1118    pub fn builder() -> RequestDatabaseNamesParamsBuilder<'a> {
1119        RequestDatabaseNamesParamsBuilder {
1120            security_origin: None,
1121            storage_key: None,
1122            storage_bucket: None,
1123        }
1124    }
1125    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
1126    /// Security origin.
1127    pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
1128    /// Storage key.
1129    pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
1130    /// Storage bucket. If not specified, it uses the default bucket.
1131    pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
1132}
1133
1134#[derive(Default)]
1135pub struct RequestDatabaseNamesParamsBuilder<'a> {
1136    security_origin: Option<Cow<'a, str>>,
1137    storage_key: Option<Cow<'a, str>>,
1138    storage_bucket: Option<crate::storage::StorageBucket<'a>>,
1139}
1140
1141impl<'a> RequestDatabaseNamesParamsBuilder<'a> {
1142    /// At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.
1143    /// Security origin.
1144    pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
1145    /// Storage key.
1146    pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
1147    /// Storage bucket. If not specified, it uses the default bucket.
1148    pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
1149    pub fn build(self) -> RequestDatabaseNamesParams<'a> {
1150        RequestDatabaseNamesParams {
1151            security_origin: self.security_origin,
1152            storage_key: self.storage_key,
1153            storage_bucket: self.storage_bucket,
1154        }
1155    }
1156}
1157
1158/// Requests database names for given security origin.
1159
1160#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1161#[serde(rename_all = "camelCase")]
1162pub struct RequestDatabaseNamesReturns<'a> {
1163    /// Database names for origin.
1164    #[serde(rename = "databaseNames")]
1165    database_names: Vec<Cow<'a, str>>,
1166}
1167
1168impl<'a> RequestDatabaseNamesReturns<'a> {
1169    /// Creates a builder for this type with the required parameters:
1170    /// * `database_names`: Database names for origin.
1171    pub fn builder(database_names: Vec<Cow<'a, str>>) -> RequestDatabaseNamesReturnsBuilder<'a> {
1172        RequestDatabaseNamesReturnsBuilder {
1173            database_names: database_names,
1174        }
1175    }
1176    /// Database names for origin.
1177    pub fn database_names(&self) -> &[Cow<'a, str>] { &self.database_names }
1178}
1179
1180
1181pub struct RequestDatabaseNamesReturnsBuilder<'a> {
1182    database_names: Vec<Cow<'a, str>>,
1183}
1184
1185impl<'a> RequestDatabaseNamesReturnsBuilder<'a> {
1186    pub fn build(self) -> RequestDatabaseNamesReturns<'a> {
1187        RequestDatabaseNamesReturns {
1188            database_names: self.database_names,
1189        }
1190    }
1191}
1192
1193impl<'a> RequestDatabaseNamesParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabaseNames"; }
1194
1195impl<'a> crate::CdpCommand<'a> for RequestDatabaseNamesParams<'a> {
1196    const METHOD: &'static str = "IndexedDB.requestDatabaseNames";
1197    type Response = RequestDatabaseNamesReturns<'a>;
1198}