1use serde::{Serialize, Deserialize};
2use serde_json::Value as JsonValue;
3use std::borrow::Cow;
4
5#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct DatabaseWithObjectStores<'a> {
10 name: Cow<'a, str>,
12 version: f64,
15 objectStores: Vec<ObjectStore<'a>>,
17}
18
19impl<'a> DatabaseWithObjectStores<'a> {
20 pub fn builder(name: impl Into<Cow<'a, str>>, version: f64, objectStores: Vec<ObjectStore<'a>>) -> DatabaseWithObjectStoresBuilder<'a> {
21 DatabaseWithObjectStoresBuilder {
22 name: name.into(),
23 version: version,
24 objectStores: objectStores,
25 }
26 }
27 pub fn name(&self) -> &str { self.name.as_ref() }
28 pub fn version(&self) -> f64 { self.version }
29 pub fn objectStores(&self) -> &[ObjectStore<'a>] { &self.objectStores }
30}
31
32
33pub struct DatabaseWithObjectStoresBuilder<'a> {
34 name: Cow<'a, str>,
35 version: f64,
36 objectStores: Vec<ObjectStore<'a>>,
37}
38
39impl<'a> DatabaseWithObjectStoresBuilder<'a> {
40 pub fn build(self) -> DatabaseWithObjectStores<'a> {
41 DatabaseWithObjectStores {
42 name: self.name,
43 version: self.version,
44 objectStores: self.objectStores,
45 }
46 }
47}
48
49#[derive(Debug, Clone, Serialize, Deserialize, Default)]
52#[serde(rename_all = "camelCase")]
53pub struct ObjectStore<'a> {
54 name: Cow<'a, str>,
56 keyPath: KeyPath<'a>,
58 autoIncrement: bool,
60 indexes: Vec<ObjectStoreIndex<'a>>,
62}
63
64impl<'a> ObjectStore<'a> {
65 pub fn builder(name: impl Into<Cow<'a, str>>, keyPath: KeyPath<'a>, autoIncrement: bool, indexes: Vec<ObjectStoreIndex<'a>>) -> ObjectStoreBuilder<'a> {
66 ObjectStoreBuilder {
67 name: name.into(),
68 keyPath: keyPath,
69 autoIncrement: autoIncrement,
70 indexes: indexes,
71 }
72 }
73 pub fn name(&self) -> &str { self.name.as_ref() }
74 pub fn keyPath(&self) -> &KeyPath<'a> { &self.keyPath }
75 pub fn autoIncrement(&self) -> bool { self.autoIncrement }
76 pub fn indexes(&self) -> &[ObjectStoreIndex<'a>] { &self.indexes }
77}
78
79
80pub struct ObjectStoreBuilder<'a> {
81 name: Cow<'a, str>,
82 keyPath: KeyPath<'a>,
83 autoIncrement: bool,
84 indexes: Vec<ObjectStoreIndex<'a>>,
85}
86
87impl<'a> ObjectStoreBuilder<'a> {
88 pub fn build(self) -> ObjectStore<'a> {
89 ObjectStore {
90 name: self.name,
91 keyPath: self.keyPath,
92 autoIncrement: self.autoIncrement,
93 indexes: self.indexes,
94 }
95 }
96}
97
98#[derive(Debug, Clone, Serialize, Deserialize, Default)]
101#[serde(rename_all = "camelCase")]
102pub struct ObjectStoreIndex<'a> {
103 name: Cow<'a, str>,
105 keyPath: KeyPath<'a>,
107 unique: bool,
109 multiEntry: bool,
111}
112
113impl<'a> ObjectStoreIndex<'a> {
114 pub fn builder(name: impl Into<Cow<'a, str>>, keyPath: KeyPath<'a>, unique: bool, multiEntry: bool) -> ObjectStoreIndexBuilder<'a> {
115 ObjectStoreIndexBuilder {
116 name: name.into(),
117 keyPath: keyPath,
118 unique: unique,
119 multiEntry: multiEntry,
120 }
121 }
122 pub fn name(&self) -> &str { self.name.as_ref() }
123 pub fn keyPath(&self) -> &KeyPath<'a> { &self.keyPath }
124 pub fn unique(&self) -> bool { self.unique }
125 pub fn multiEntry(&self) -> bool { self.multiEntry }
126}
127
128
129pub struct ObjectStoreIndexBuilder<'a> {
130 name: Cow<'a, str>,
131 keyPath: KeyPath<'a>,
132 unique: bool,
133 multiEntry: bool,
134}
135
136impl<'a> ObjectStoreIndexBuilder<'a> {
137 pub fn build(self) -> ObjectStoreIndex<'a> {
138 ObjectStoreIndex {
139 name: self.name,
140 keyPath: self.keyPath,
141 unique: self.unique,
142 multiEntry: self.multiEntry,
143 }
144 }
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize, Default)]
150#[serde(rename_all = "camelCase")]
151pub struct Key<'a> {
152 #[serde(rename = "type")]
154 type_: Cow<'a, str>,
155 #[serde(skip_serializing_if = "Option::is_none")]
157 number: Option<f64>,
158 #[serde(skip_serializing_if = "Option::is_none")]
160 string: Option<Cow<'a, str>>,
161 #[serde(skip_serializing_if = "Option::is_none")]
163 date: Option<f64>,
164 #[serde(skip_serializing_if = "Option::is_none")]
166 array: Option<Vec<Box<Key<'a>>>>,
167}
168
169impl<'a> Key<'a> {
170 pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyBuilder<'a> {
171 KeyBuilder {
172 type_: type_.into(),
173 number: None,
174 string: None,
175 date: None,
176 array: None,
177 }
178 }
179 pub fn type_(&self) -> &str { self.type_.as_ref() }
180 pub fn number(&self) -> Option<f64> { self.number }
181 pub fn string(&self) -> Option<&str> { self.string.as_deref() }
182 pub fn date(&self) -> Option<f64> { self.date }
183 pub fn array(&self) -> Option<&[Box<Key<'a>>]> { self.array.as_deref() }
184}
185
186
187pub struct KeyBuilder<'a> {
188 type_: Cow<'a, str>,
189 number: Option<f64>,
190 string: Option<Cow<'a, str>>,
191 date: Option<f64>,
192 array: Option<Vec<Box<Key<'a>>>>,
193}
194
195impl<'a> KeyBuilder<'a> {
196 pub fn number(mut self, number: f64) -> Self { self.number = Some(number); self }
198 pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
200 pub fn date(mut self, date: f64) -> Self { self.date = Some(date); self }
202 pub fn array(mut self, array: Vec<Box<Key<'a>>>) -> Self { self.array = Some(array); self }
204 pub fn build(self) -> Key<'a> {
205 Key {
206 type_: self.type_,
207 number: self.number,
208 string: self.string,
209 date: self.date,
210 array: self.array,
211 }
212 }
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize, Default)]
218#[serde(rename_all = "camelCase")]
219pub struct KeyRange<'a> {
220 #[serde(skip_serializing_if = "Option::is_none")]
222 lower: Option<Key<'a>>,
223 #[serde(skip_serializing_if = "Option::is_none")]
225 upper: Option<Key<'a>>,
226 lowerOpen: bool,
228 upperOpen: bool,
230}
231
232impl<'a> KeyRange<'a> {
233 pub fn builder(lowerOpen: bool, upperOpen: bool) -> KeyRangeBuilder<'a> {
234 KeyRangeBuilder {
235 lower: None,
236 upper: None,
237 lowerOpen: lowerOpen,
238 upperOpen: upperOpen,
239 }
240 }
241 pub fn lower(&self) -> Option<&Key<'a>> { self.lower.as_ref() }
242 pub fn upper(&self) -> Option<&Key<'a>> { self.upper.as_ref() }
243 pub fn lowerOpen(&self) -> bool { self.lowerOpen }
244 pub fn upperOpen(&self) -> bool { self.upperOpen }
245}
246
247
248pub struct KeyRangeBuilder<'a> {
249 lower: Option<Key<'a>>,
250 upper: Option<Key<'a>>,
251 lowerOpen: bool,
252 upperOpen: bool,
253}
254
255impl<'a> KeyRangeBuilder<'a> {
256 pub fn lower(mut self, lower: Key<'a>) -> Self { self.lower = Some(lower); self }
258 pub fn upper(mut self, upper: Key<'a>) -> Self { self.upper = Some(upper); self }
260 pub fn build(self) -> KeyRange<'a> {
261 KeyRange {
262 lower: self.lower,
263 upper: self.upper,
264 lowerOpen: self.lowerOpen,
265 upperOpen: self.upperOpen,
266 }
267 }
268}
269
270#[derive(Debug, Clone, Serialize, Deserialize, Default)]
273#[serde(rename_all = "camelCase")]
274pub struct DataEntry {
275 key: crate::runtime::RemoteObject,
277 primaryKey: crate::runtime::RemoteObject,
279 value: crate::runtime::RemoteObject,
281}
282
283impl DataEntry {
284 pub fn builder(key: crate::runtime::RemoteObject, primaryKey: crate::runtime::RemoteObject, value: crate::runtime::RemoteObject) -> DataEntryBuilder {
285 DataEntryBuilder {
286 key: key,
287 primaryKey: primaryKey,
288 value: value,
289 }
290 }
291 pub fn key(&self) -> &crate::runtime::RemoteObject { &self.key }
292 pub fn primaryKey(&self) -> &crate::runtime::RemoteObject { &self.primaryKey }
293 pub fn value(&self) -> &crate::runtime::RemoteObject { &self.value }
294}
295
296
297pub struct DataEntryBuilder {
298 key: crate::runtime::RemoteObject,
299 primaryKey: crate::runtime::RemoteObject,
300 value: crate::runtime::RemoteObject,
301}
302
303impl DataEntryBuilder {
304 pub fn build(self) -> DataEntry {
305 DataEntry {
306 key: self.key,
307 primaryKey: self.primaryKey,
308 value: self.value,
309 }
310 }
311}
312
313#[derive(Debug, Clone, Serialize, Deserialize, Default)]
316#[serde(rename_all = "camelCase")]
317pub struct KeyPath<'a> {
318 #[serde(rename = "type")]
320 type_: Cow<'a, str>,
321 #[serde(skip_serializing_if = "Option::is_none")]
323 string: Option<Cow<'a, str>>,
324 #[serde(skip_serializing_if = "Option::is_none")]
326 array: Option<Vec<Cow<'a, str>>>,
327}
328
329impl<'a> KeyPath<'a> {
330 pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyPathBuilder<'a> {
331 KeyPathBuilder {
332 type_: type_.into(),
333 string: None,
334 array: None,
335 }
336 }
337 pub fn type_(&self) -> &str { self.type_.as_ref() }
338 pub fn string(&self) -> Option<&str> { self.string.as_deref() }
339 pub fn array(&self) -> Option<&[Cow<'a, str>]> { self.array.as_deref() }
340}
341
342
343pub struct KeyPathBuilder<'a> {
344 type_: Cow<'a, str>,
345 string: Option<Cow<'a, str>>,
346 array: Option<Vec<Cow<'a, str>>>,
347}
348
349impl<'a> KeyPathBuilder<'a> {
350 pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
352 pub fn array(mut self, array: Vec<Cow<'a, str>>) -> Self { self.array = Some(array); self }
354 pub fn build(self) -> KeyPath<'a> {
355 KeyPath {
356 type_: self.type_,
357 string: self.string,
358 array: self.array,
359 }
360 }
361}
362
363#[derive(Debug, Clone, Serialize, Deserialize, Default)]
366#[serde(rename_all = "camelCase")]
367pub struct ClearObjectStoreParams<'a> {
368 #[serde(skip_serializing_if = "Option::is_none")]
371 securityOrigin: Option<Cow<'a, str>>,
372 #[serde(skip_serializing_if = "Option::is_none")]
374 storageKey: Option<Cow<'a, str>>,
375 #[serde(skip_serializing_if = "Option::is_none")]
377 storageBucket: Option<crate::storage::StorageBucket<'a>>,
378 databaseName: Cow<'a, str>,
380 objectStoreName: Cow<'a, str>,
382}
383
384impl<'a> ClearObjectStoreParams<'a> {
385 pub fn builder(databaseName: impl Into<Cow<'a, str>>, objectStoreName: impl Into<Cow<'a, str>>) -> ClearObjectStoreParamsBuilder<'a> {
386 ClearObjectStoreParamsBuilder {
387 securityOrigin: None,
388 storageKey: None,
389 storageBucket: None,
390 databaseName: databaseName.into(),
391 objectStoreName: objectStoreName.into(),
392 }
393 }
394 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
395 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
396 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
397 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
398 pub fn objectStoreName(&self) -> &str { self.objectStoreName.as_ref() }
399}
400
401
402pub struct ClearObjectStoreParamsBuilder<'a> {
403 securityOrigin: Option<Cow<'a, str>>,
404 storageKey: Option<Cow<'a, str>>,
405 storageBucket: Option<crate::storage::StorageBucket<'a>>,
406 databaseName: Cow<'a, str>,
407 objectStoreName: Cow<'a, str>,
408}
409
410impl<'a> ClearObjectStoreParamsBuilder<'a> {
411 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
414 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
416 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
418 pub fn build(self) -> ClearObjectStoreParams<'a> {
419 ClearObjectStoreParams {
420 securityOrigin: self.securityOrigin,
421 storageKey: self.storageKey,
422 storageBucket: self.storageBucket,
423 databaseName: self.databaseName,
424 objectStoreName: self.objectStoreName,
425 }
426 }
427}
428
429impl<'a> ClearObjectStoreParams<'a> { pub const METHOD: &'static str = "IndexedDB.clearObjectStore"; }
430
431impl<'a> crate::CdpCommand<'a> for ClearObjectStoreParams<'a> {
432 const METHOD: &'static str = "IndexedDB.clearObjectStore";
433 type Response = crate::EmptyReturns;
434}
435
436#[derive(Debug, Clone, Serialize, Deserialize, Default)]
439#[serde(rename_all = "camelCase")]
440pub struct DeleteDatabaseParams<'a> {
441 #[serde(skip_serializing_if = "Option::is_none")]
444 securityOrigin: Option<Cow<'a, str>>,
445 #[serde(skip_serializing_if = "Option::is_none")]
447 storageKey: Option<Cow<'a, str>>,
448 #[serde(skip_serializing_if = "Option::is_none")]
450 storageBucket: Option<crate::storage::StorageBucket<'a>>,
451 databaseName: Cow<'a, str>,
453}
454
455impl<'a> DeleteDatabaseParams<'a> {
456 pub fn builder(databaseName: impl Into<Cow<'a, str>>) -> DeleteDatabaseParamsBuilder<'a> {
457 DeleteDatabaseParamsBuilder {
458 securityOrigin: None,
459 storageKey: None,
460 storageBucket: None,
461 databaseName: databaseName.into(),
462 }
463 }
464 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
465 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
466 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
467 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
468}
469
470
471pub struct DeleteDatabaseParamsBuilder<'a> {
472 securityOrigin: Option<Cow<'a, str>>,
473 storageKey: Option<Cow<'a, str>>,
474 storageBucket: Option<crate::storage::StorageBucket<'a>>,
475 databaseName: Cow<'a, str>,
476}
477
478impl<'a> DeleteDatabaseParamsBuilder<'a> {
479 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
482 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
484 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
486 pub fn build(self) -> DeleteDatabaseParams<'a> {
487 DeleteDatabaseParams {
488 securityOrigin: self.securityOrigin,
489 storageKey: self.storageKey,
490 storageBucket: self.storageBucket,
491 databaseName: self.databaseName,
492 }
493 }
494}
495
496impl<'a> DeleteDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteDatabase"; }
497
498impl<'a> crate::CdpCommand<'a> for DeleteDatabaseParams<'a> {
499 const METHOD: &'static str = "IndexedDB.deleteDatabase";
500 type Response = crate::EmptyReturns;
501}
502
503#[derive(Debug, Clone, Serialize, Deserialize, Default)]
506#[serde(rename_all = "camelCase")]
507pub struct DeleteObjectStoreEntriesParams<'a> {
508 #[serde(skip_serializing_if = "Option::is_none")]
511 securityOrigin: Option<Cow<'a, str>>,
512 #[serde(skip_serializing_if = "Option::is_none")]
514 storageKey: Option<Cow<'a, str>>,
515 #[serde(skip_serializing_if = "Option::is_none")]
517 storageBucket: Option<crate::storage::StorageBucket<'a>>,
518 databaseName: Cow<'a, str>,
519 objectStoreName: Cow<'a, str>,
520 keyRange: KeyRange<'a>,
522}
523
524impl<'a> DeleteObjectStoreEntriesParams<'a> {
525 pub fn builder(databaseName: impl Into<Cow<'a, str>>, objectStoreName: impl Into<Cow<'a, str>>, keyRange: KeyRange<'a>) -> DeleteObjectStoreEntriesParamsBuilder<'a> {
526 DeleteObjectStoreEntriesParamsBuilder {
527 securityOrigin: None,
528 storageKey: None,
529 storageBucket: None,
530 databaseName: databaseName.into(),
531 objectStoreName: objectStoreName.into(),
532 keyRange: keyRange,
533 }
534 }
535 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
536 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
537 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
538 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
539 pub fn objectStoreName(&self) -> &str { self.objectStoreName.as_ref() }
540 pub fn keyRange(&self) -> &KeyRange<'a> { &self.keyRange }
541}
542
543
544pub struct DeleteObjectStoreEntriesParamsBuilder<'a> {
545 securityOrigin: Option<Cow<'a, str>>,
546 storageKey: Option<Cow<'a, str>>,
547 storageBucket: Option<crate::storage::StorageBucket<'a>>,
548 databaseName: Cow<'a, str>,
549 objectStoreName: Cow<'a, str>,
550 keyRange: KeyRange<'a>,
551}
552
553impl<'a> DeleteObjectStoreEntriesParamsBuilder<'a> {
554 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
557 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
559 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
561 pub fn build(self) -> DeleteObjectStoreEntriesParams<'a> {
562 DeleteObjectStoreEntriesParams {
563 securityOrigin: self.securityOrigin,
564 storageKey: self.storageKey,
565 storageBucket: self.storageBucket,
566 databaseName: self.databaseName,
567 objectStoreName: self.objectStoreName,
568 keyRange: self.keyRange,
569 }
570 }
571}
572
573impl<'a> DeleteObjectStoreEntriesParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries"; }
574
575impl<'a> crate::CdpCommand<'a> for DeleteObjectStoreEntriesParams<'a> {
576 const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries";
577 type Response = crate::EmptyReturns;
578}
579
580#[derive(Debug, Clone, Serialize, Deserialize, Default)]
581pub struct DisableParams {}
582
583impl DisableParams { pub const METHOD: &'static str = "IndexedDB.disable"; }
584
585impl<'a> crate::CdpCommand<'a> for DisableParams {
586 const METHOD: &'static str = "IndexedDB.disable";
587 type Response = crate::EmptyReturns;
588}
589
590#[derive(Debug, Clone, Serialize, Deserialize, Default)]
591pub struct EnableParams {}
592
593impl EnableParams { pub const METHOD: &'static str = "IndexedDB.enable"; }
594
595impl<'a> crate::CdpCommand<'a> for EnableParams {
596 const METHOD: &'static str = "IndexedDB.enable";
597 type Response = crate::EmptyReturns;
598}
599
600#[derive(Debug, Clone, Serialize, Deserialize, Default)]
603#[serde(rename_all = "camelCase")]
604pub struct RequestDataParams<'a> {
605 #[serde(skip_serializing_if = "Option::is_none")]
608 securityOrigin: Option<Cow<'a, str>>,
609 #[serde(skip_serializing_if = "Option::is_none")]
611 storageKey: Option<Cow<'a, str>>,
612 #[serde(skip_serializing_if = "Option::is_none")]
614 storageBucket: Option<crate::storage::StorageBucket<'a>>,
615 databaseName: Cow<'a, str>,
617 objectStoreName: Cow<'a, str>,
619 #[serde(skip_serializing_if = "Option::is_none")]
621 indexName: Option<Cow<'a, str>>,
622 skipCount: u64,
624 pageSize: u64,
626 #[serde(skip_serializing_if = "Option::is_none")]
628 keyRange: Option<KeyRange<'a>>,
629}
630
631impl<'a> RequestDataParams<'a> {
632 pub fn builder(databaseName: impl Into<Cow<'a, str>>, objectStoreName: impl Into<Cow<'a, str>>, skipCount: u64, pageSize: u64) -> RequestDataParamsBuilder<'a> {
633 RequestDataParamsBuilder {
634 securityOrigin: None,
635 storageKey: None,
636 storageBucket: None,
637 databaseName: databaseName.into(),
638 objectStoreName: objectStoreName.into(),
639 indexName: None,
640 skipCount: skipCount,
641 pageSize: pageSize,
642 keyRange: None,
643 }
644 }
645 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
646 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
647 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
648 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
649 pub fn objectStoreName(&self) -> &str { self.objectStoreName.as_ref() }
650 pub fn indexName(&self) -> Option<&str> { self.indexName.as_deref() }
651 pub fn skipCount(&self) -> u64 { self.skipCount }
652 pub fn pageSize(&self) -> u64 { self.pageSize }
653 pub fn keyRange(&self) -> Option<&KeyRange<'a>> { self.keyRange.as_ref() }
654}
655
656
657pub struct RequestDataParamsBuilder<'a> {
658 securityOrigin: Option<Cow<'a, str>>,
659 storageKey: Option<Cow<'a, str>>,
660 storageBucket: Option<crate::storage::StorageBucket<'a>>,
661 databaseName: Cow<'a, str>,
662 objectStoreName: Cow<'a, str>,
663 indexName: Option<Cow<'a, str>>,
664 skipCount: u64,
665 pageSize: u64,
666 keyRange: Option<KeyRange<'a>>,
667}
668
669impl<'a> RequestDataParamsBuilder<'a> {
670 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
673 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
675 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
677 pub fn indexName(mut self, indexName: impl Into<Cow<'a, str>>) -> Self { self.indexName = Some(indexName.into()); self }
679 pub fn keyRange(mut self, keyRange: KeyRange<'a>) -> Self { self.keyRange = Some(keyRange); self }
681 pub fn build(self) -> RequestDataParams<'a> {
682 RequestDataParams {
683 securityOrigin: self.securityOrigin,
684 storageKey: self.storageKey,
685 storageBucket: self.storageBucket,
686 databaseName: self.databaseName,
687 objectStoreName: self.objectStoreName,
688 indexName: self.indexName,
689 skipCount: self.skipCount,
690 pageSize: self.pageSize,
691 keyRange: self.keyRange,
692 }
693 }
694}
695
696#[derive(Debug, Clone, Serialize, Deserialize, Default)]
699#[serde(rename_all = "camelCase")]
700pub struct RequestDataReturns {
701 objectStoreDataEntries: Vec<DataEntry>,
703 hasMore: bool,
705}
706
707impl RequestDataReturns {
708 pub fn builder(objectStoreDataEntries: Vec<DataEntry>, hasMore: bool) -> RequestDataReturnsBuilder {
709 RequestDataReturnsBuilder {
710 objectStoreDataEntries: objectStoreDataEntries,
711 hasMore: hasMore,
712 }
713 }
714 pub fn objectStoreDataEntries(&self) -> &[DataEntry] { &self.objectStoreDataEntries }
715 pub fn hasMore(&self) -> bool { self.hasMore }
716}
717
718
719pub struct RequestDataReturnsBuilder {
720 objectStoreDataEntries: Vec<DataEntry>,
721 hasMore: bool,
722}
723
724impl RequestDataReturnsBuilder {
725 pub fn build(self) -> RequestDataReturns {
726 RequestDataReturns {
727 objectStoreDataEntries: self.objectStoreDataEntries,
728 hasMore: self.hasMore,
729 }
730 }
731}
732
733impl<'a> RequestDataParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestData"; }
734
735impl<'a> crate::CdpCommand<'a> for RequestDataParams<'a> {
736 const METHOD: &'static str = "IndexedDB.requestData";
737 type Response = RequestDataReturns;
738}
739
740#[derive(Debug, Clone, Serialize, Deserialize, Default)]
743#[serde(rename_all = "camelCase")]
744pub struct GetMetadataParams<'a> {
745 #[serde(skip_serializing_if = "Option::is_none")]
748 securityOrigin: Option<Cow<'a, str>>,
749 #[serde(skip_serializing_if = "Option::is_none")]
751 storageKey: Option<Cow<'a, str>>,
752 #[serde(skip_serializing_if = "Option::is_none")]
754 storageBucket: Option<crate::storage::StorageBucket<'a>>,
755 databaseName: Cow<'a, str>,
757 objectStoreName: Cow<'a, str>,
759}
760
761impl<'a> GetMetadataParams<'a> {
762 pub fn builder(databaseName: impl Into<Cow<'a, str>>, objectStoreName: impl Into<Cow<'a, str>>) -> GetMetadataParamsBuilder<'a> {
763 GetMetadataParamsBuilder {
764 securityOrigin: None,
765 storageKey: None,
766 storageBucket: None,
767 databaseName: databaseName.into(),
768 objectStoreName: objectStoreName.into(),
769 }
770 }
771 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
772 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
773 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
774 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
775 pub fn objectStoreName(&self) -> &str { self.objectStoreName.as_ref() }
776}
777
778
779pub struct GetMetadataParamsBuilder<'a> {
780 securityOrigin: Option<Cow<'a, str>>,
781 storageKey: Option<Cow<'a, str>>,
782 storageBucket: Option<crate::storage::StorageBucket<'a>>,
783 databaseName: Cow<'a, str>,
784 objectStoreName: Cow<'a, str>,
785}
786
787impl<'a> GetMetadataParamsBuilder<'a> {
788 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
791 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
793 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
795 pub fn build(self) -> GetMetadataParams<'a> {
796 GetMetadataParams {
797 securityOrigin: self.securityOrigin,
798 storageKey: self.storageKey,
799 storageBucket: self.storageBucket,
800 databaseName: self.databaseName,
801 objectStoreName: self.objectStoreName,
802 }
803 }
804}
805
806#[derive(Debug, Clone, Serialize, Deserialize, Default)]
809#[serde(rename_all = "camelCase")]
810pub struct GetMetadataReturns {
811 entriesCount: f64,
813 keyGeneratorValue: f64,
817}
818
819impl GetMetadataReturns {
820 pub fn builder(entriesCount: f64, keyGeneratorValue: f64) -> GetMetadataReturnsBuilder {
821 GetMetadataReturnsBuilder {
822 entriesCount: entriesCount,
823 keyGeneratorValue: keyGeneratorValue,
824 }
825 }
826 pub fn entriesCount(&self) -> f64 { self.entriesCount }
827 pub fn keyGeneratorValue(&self) -> f64 { self.keyGeneratorValue }
828}
829
830
831pub struct GetMetadataReturnsBuilder {
832 entriesCount: f64,
833 keyGeneratorValue: f64,
834}
835
836impl GetMetadataReturnsBuilder {
837 pub fn build(self) -> GetMetadataReturns {
838 GetMetadataReturns {
839 entriesCount: self.entriesCount,
840 keyGeneratorValue: self.keyGeneratorValue,
841 }
842 }
843}
844
845impl<'a> GetMetadataParams<'a> { pub const METHOD: &'static str = "IndexedDB.getMetadata"; }
846
847impl<'a> crate::CdpCommand<'a> for GetMetadataParams<'a> {
848 const METHOD: &'static str = "IndexedDB.getMetadata";
849 type Response = GetMetadataReturns;
850}
851
852#[derive(Debug, Clone, Serialize, Deserialize, Default)]
855#[serde(rename_all = "camelCase")]
856pub struct RequestDatabaseParams<'a> {
857 #[serde(skip_serializing_if = "Option::is_none")]
860 securityOrigin: Option<Cow<'a, str>>,
861 #[serde(skip_serializing_if = "Option::is_none")]
863 storageKey: Option<Cow<'a, str>>,
864 #[serde(skip_serializing_if = "Option::is_none")]
866 storageBucket: Option<crate::storage::StorageBucket<'a>>,
867 databaseName: Cow<'a, str>,
869}
870
871impl<'a> RequestDatabaseParams<'a> {
872 pub fn builder(databaseName: impl Into<Cow<'a, str>>) -> RequestDatabaseParamsBuilder<'a> {
873 RequestDatabaseParamsBuilder {
874 securityOrigin: None,
875 storageKey: None,
876 storageBucket: None,
877 databaseName: databaseName.into(),
878 }
879 }
880 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
881 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
882 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
883 pub fn databaseName(&self) -> &str { self.databaseName.as_ref() }
884}
885
886
887pub struct RequestDatabaseParamsBuilder<'a> {
888 securityOrigin: Option<Cow<'a, str>>,
889 storageKey: Option<Cow<'a, str>>,
890 storageBucket: Option<crate::storage::StorageBucket<'a>>,
891 databaseName: Cow<'a, str>,
892}
893
894impl<'a> RequestDatabaseParamsBuilder<'a> {
895 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
898 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
900 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
902 pub fn build(self) -> RequestDatabaseParams<'a> {
903 RequestDatabaseParams {
904 securityOrigin: self.securityOrigin,
905 storageKey: self.storageKey,
906 storageBucket: self.storageBucket,
907 databaseName: self.databaseName,
908 }
909 }
910}
911
912#[derive(Debug, Clone, Serialize, Deserialize, Default)]
915#[serde(rename_all = "camelCase")]
916pub struct RequestDatabaseReturns<'a> {
917 databaseWithObjectStores: DatabaseWithObjectStores<'a>,
919}
920
921impl<'a> RequestDatabaseReturns<'a> {
922 pub fn builder(databaseWithObjectStores: DatabaseWithObjectStores<'a>) -> RequestDatabaseReturnsBuilder<'a> {
923 RequestDatabaseReturnsBuilder {
924 databaseWithObjectStores: databaseWithObjectStores,
925 }
926 }
927 pub fn databaseWithObjectStores(&self) -> &DatabaseWithObjectStores<'a> { &self.databaseWithObjectStores }
928}
929
930
931pub struct RequestDatabaseReturnsBuilder<'a> {
932 databaseWithObjectStores: DatabaseWithObjectStores<'a>,
933}
934
935impl<'a> RequestDatabaseReturnsBuilder<'a> {
936 pub fn build(self) -> RequestDatabaseReturns<'a> {
937 RequestDatabaseReturns {
938 databaseWithObjectStores: self.databaseWithObjectStores,
939 }
940 }
941}
942
943impl<'a> RequestDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabase"; }
944
945impl<'a> crate::CdpCommand<'a> for RequestDatabaseParams<'a> {
946 const METHOD: &'static str = "IndexedDB.requestDatabase";
947 type Response = RequestDatabaseReturns<'a>;
948}
949
950#[derive(Debug, Clone, Serialize, Deserialize, Default)]
953#[serde(rename_all = "camelCase")]
954pub struct RequestDatabaseNamesParams<'a> {
955 #[serde(skip_serializing_if = "Option::is_none")]
958 securityOrigin: Option<Cow<'a, str>>,
959 #[serde(skip_serializing_if = "Option::is_none")]
961 storageKey: Option<Cow<'a, str>>,
962 #[serde(skip_serializing_if = "Option::is_none")]
964 storageBucket: Option<crate::storage::StorageBucket<'a>>,
965}
966
967impl<'a> RequestDatabaseNamesParams<'a> {
968 pub fn builder() -> RequestDatabaseNamesParamsBuilder<'a> {
969 RequestDatabaseNamesParamsBuilder {
970 securityOrigin: None,
971 storageKey: None,
972 storageBucket: None,
973 }
974 }
975 pub fn securityOrigin(&self) -> Option<&str> { self.securityOrigin.as_deref() }
976 pub fn storageKey(&self) -> Option<&str> { self.storageKey.as_deref() }
977 pub fn storageBucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storageBucket.as_ref() }
978}
979
980#[derive(Default)]
981pub struct RequestDatabaseNamesParamsBuilder<'a> {
982 securityOrigin: Option<Cow<'a, str>>,
983 storageKey: Option<Cow<'a, str>>,
984 storageBucket: Option<crate::storage::StorageBucket<'a>>,
985}
986
987impl<'a> RequestDatabaseNamesParamsBuilder<'a> {
988 pub fn securityOrigin(mut self, securityOrigin: impl Into<Cow<'a, str>>) -> Self { self.securityOrigin = Some(securityOrigin.into()); self }
991 pub fn storageKey(mut self, storageKey: impl Into<Cow<'a, str>>) -> Self { self.storageKey = Some(storageKey.into()); self }
993 pub fn storageBucket(mut self, storageBucket: crate::storage::StorageBucket<'a>) -> Self { self.storageBucket = Some(storageBucket); self }
995 pub fn build(self) -> RequestDatabaseNamesParams<'a> {
996 RequestDatabaseNamesParams {
997 securityOrigin: self.securityOrigin,
998 storageKey: self.storageKey,
999 storageBucket: self.storageBucket,
1000 }
1001 }
1002}
1003
1004#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1007#[serde(rename_all = "camelCase")]
1008pub struct RequestDatabaseNamesReturns<'a> {
1009 databaseNames: Vec<Cow<'a, str>>,
1011}
1012
1013impl<'a> RequestDatabaseNamesReturns<'a> {
1014 pub fn builder(databaseNames: Vec<Cow<'a, str>>) -> RequestDatabaseNamesReturnsBuilder<'a> {
1015 RequestDatabaseNamesReturnsBuilder {
1016 databaseNames: databaseNames,
1017 }
1018 }
1019 pub fn databaseNames(&self) -> &[Cow<'a, str>] { &self.databaseNames }
1020}
1021
1022
1023pub struct RequestDatabaseNamesReturnsBuilder<'a> {
1024 databaseNames: Vec<Cow<'a, str>>,
1025}
1026
1027impl<'a> RequestDatabaseNamesReturnsBuilder<'a> {
1028 pub fn build(self) -> RequestDatabaseNamesReturns<'a> {
1029 RequestDatabaseNamesReturns {
1030 databaseNames: self.databaseNames,
1031 }
1032 }
1033}
1034
1035impl<'a> RequestDatabaseNamesParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabaseNames"; }
1036
1037impl<'a> crate::CdpCommand<'a> for RequestDatabaseNamesParams<'a> {
1038 const METHOD: &'static str = "IndexedDB.requestDatabaseNames";
1039 type Response = RequestDatabaseNamesReturns<'a>;
1040}