use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
use std::borrow::Cow;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DatabaseWithObjectStores<'a> {
name: Cow<'a, str>,
version: f64,
#[serde(rename = "objectStores")]
object_stores: Vec<ObjectStore<'a>>,
}
impl<'a> DatabaseWithObjectStores<'a> {
pub fn builder(name: impl Into<Cow<'a, str>>, version: f64, object_stores: Vec<ObjectStore<'a>>) -> DatabaseWithObjectStoresBuilder<'a> {
DatabaseWithObjectStoresBuilder {
name: name.into(),
version: version,
object_stores: object_stores,
}
}
pub fn name(&self) -> &str { self.name.as_ref() }
pub fn version(&self) -> f64 { self.version }
pub fn object_stores(&self) -> &[ObjectStore<'a>] { &self.object_stores }
}
pub struct DatabaseWithObjectStoresBuilder<'a> {
name: Cow<'a, str>,
version: f64,
object_stores: Vec<ObjectStore<'a>>,
}
impl<'a> DatabaseWithObjectStoresBuilder<'a> {
pub fn build(self) -> DatabaseWithObjectStores<'a> {
DatabaseWithObjectStores {
name: self.name,
version: self.version,
object_stores: self.object_stores,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ObjectStore<'a> {
name: Cow<'a, str>,
#[serde(rename = "keyPath")]
key_path: KeyPath<'a>,
#[serde(rename = "autoIncrement")]
auto_increment: bool,
indexes: Vec<ObjectStoreIndex<'a>>,
}
impl<'a> ObjectStore<'a> {
pub fn builder(name: impl Into<Cow<'a, str>>, key_path: KeyPath<'a>, auto_increment: bool, indexes: Vec<ObjectStoreIndex<'a>>) -> ObjectStoreBuilder<'a> {
ObjectStoreBuilder {
name: name.into(),
key_path: key_path,
auto_increment: auto_increment,
indexes: indexes,
}
}
pub fn name(&self) -> &str { self.name.as_ref() }
pub fn key_path(&self) -> &KeyPath<'a> { &self.key_path }
pub fn auto_increment(&self) -> bool { self.auto_increment }
pub fn indexes(&self) -> &[ObjectStoreIndex<'a>] { &self.indexes }
}
pub struct ObjectStoreBuilder<'a> {
name: Cow<'a, str>,
key_path: KeyPath<'a>,
auto_increment: bool,
indexes: Vec<ObjectStoreIndex<'a>>,
}
impl<'a> ObjectStoreBuilder<'a> {
pub fn build(self) -> ObjectStore<'a> {
ObjectStore {
name: self.name,
key_path: self.key_path,
auto_increment: self.auto_increment,
indexes: self.indexes,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ObjectStoreIndex<'a> {
name: Cow<'a, str>,
#[serde(rename = "keyPath")]
key_path: KeyPath<'a>,
unique: bool,
#[serde(rename = "multiEntry")]
multi_entry: bool,
}
impl<'a> ObjectStoreIndex<'a> {
pub fn builder(name: impl Into<Cow<'a, str>>, key_path: KeyPath<'a>, unique: bool, multi_entry: bool) -> ObjectStoreIndexBuilder<'a> {
ObjectStoreIndexBuilder {
name: name.into(),
key_path: key_path,
unique: unique,
multi_entry: multi_entry,
}
}
pub fn name(&self) -> &str { self.name.as_ref() }
pub fn key_path(&self) -> &KeyPath<'a> { &self.key_path }
pub fn unique(&self) -> bool { self.unique }
pub fn multi_entry(&self) -> bool { self.multi_entry }
}
pub struct ObjectStoreIndexBuilder<'a> {
name: Cow<'a, str>,
key_path: KeyPath<'a>,
unique: bool,
multi_entry: bool,
}
impl<'a> ObjectStoreIndexBuilder<'a> {
pub fn build(self) -> ObjectStoreIndex<'a> {
ObjectStoreIndex {
name: self.name,
key_path: self.key_path,
unique: self.unique,
multi_entry: self.multi_entry,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct Key<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none")]
number: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
string: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
date: Option<f64>,
#[serde(skip_serializing_if = "Option::is_none")]
array: Option<Vec<Box<Key<'a>>>>,
}
impl<'a> Key<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyBuilder<'a> {
KeyBuilder {
type_: type_.into(),
number: None,
string: None,
date: None,
array: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn number(&self) -> Option<f64> { self.number }
pub fn string(&self) -> Option<&str> { self.string.as_deref() }
pub fn date(&self) -> Option<f64> { self.date }
pub fn array(&self) -> Option<&[Box<Key<'a>>]> { self.array.as_deref() }
}
pub struct KeyBuilder<'a> {
type_: Cow<'a, str>,
number: Option<f64>,
string: Option<Cow<'a, str>>,
date: Option<f64>,
array: Option<Vec<Box<Key<'a>>>>,
}
impl<'a> KeyBuilder<'a> {
pub fn number(mut self, number: f64) -> Self { self.number = Some(number); self }
pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
pub fn date(mut self, date: f64) -> Self { self.date = Some(date); self }
pub fn array(mut self, array: Vec<Box<Key<'a>>>) -> Self { self.array = Some(array); self }
pub fn build(self) -> Key<'a> {
Key {
type_: self.type_,
number: self.number,
string: self.string,
date: self.date,
array: self.array,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct KeyRange<'a> {
#[serde(skip_serializing_if = "Option::is_none")]
lower: Option<Key<'a>>,
#[serde(skip_serializing_if = "Option::is_none")]
upper: Option<Key<'a>>,
#[serde(rename = "lowerOpen")]
lower_open: bool,
#[serde(rename = "upperOpen")]
upper_open: bool,
}
impl<'a> KeyRange<'a> {
pub fn builder(lower_open: bool, upper_open: bool) -> KeyRangeBuilder<'a> {
KeyRangeBuilder {
lower: None,
upper: None,
lower_open: lower_open,
upper_open: upper_open,
}
}
pub fn lower(&self) -> Option<&Key<'a>> { self.lower.as_ref() }
pub fn upper(&self) -> Option<&Key<'a>> { self.upper.as_ref() }
pub fn lower_open(&self) -> bool { self.lower_open }
pub fn upper_open(&self) -> bool { self.upper_open }
}
pub struct KeyRangeBuilder<'a> {
lower: Option<Key<'a>>,
upper: Option<Key<'a>>,
lower_open: bool,
upper_open: bool,
}
impl<'a> KeyRangeBuilder<'a> {
pub fn lower(mut self, lower: Key<'a>) -> Self { self.lower = Some(lower); self }
pub fn upper(mut self, upper: Key<'a>) -> Self { self.upper = Some(upper); self }
pub fn build(self) -> KeyRange<'a> {
KeyRange {
lower: self.lower,
upper: self.upper,
lower_open: self.lower_open,
upper_open: self.upper_open,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DataEntry {
key: crate::runtime::RemoteObject,
#[serde(rename = "primaryKey")]
primary_key: crate::runtime::RemoteObject,
value: crate::runtime::RemoteObject,
}
impl DataEntry {
pub fn builder(key: crate::runtime::RemoteObject, primary_key: crate::runtime::RemoteObject, value: crate::runtime::RemoteObject) -> DataEntryBuilder {
DataEntryBuilder {
key: key,
primary_key: primary_key,
value: value,
}
}
pub fn key(&self) -> &crate::runtime::RemoteObject { &self.key }
pub fn primary_key(&self) -> &crate::runtime::RemoteObject { &self.primary_key }
pub fn value(&self) -> &crate::runtime::RemoteObject { &self.value }
}
pub struct DataEntryBuilder {
key: crate::runtime::RemoteObject,
primary_key: crate::runtime::RemoteObject,
value: crate::runtime::RemoteObject,
}
impl DataEntryBuilder {
pub fn build(self) -> DataEntry {
DataEntry {
key: self.key,
primary_key: self.primary_key,
value: self.value,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct KeyPath<'a> {
#[serde(rename = "type")]
type_: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none")]
string: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none")]
array: Option<Vec<Cow<'a, str>>>,
}
impl<'a> KeyPath<'a> {
pub fn builder(type_: impl Into<Cow<'a, str>>) -> KeyPathBuilder<'a> {
KeyPathBuilder {
type_: type_.into(),
string: None,
array: None,
}
}
pub fn type_(&self) -> &str { self.type_.as_ref() }
pub fn string(&self) -> Option<&str> { self.string.as_deref() }
pub fn array(&self) -> Option<&[Cow<'a, str>]> { self.array.as_deref() }
}
pub struct KeyPathBuilder<'a> {
type_: Cow<'a, str>,
string: Option<Cow<'a, str>>,
array: Option<Vec<Cow<'a, str>>>,
}
impl<'a> KeyPathBuilder<'a> {
pub fn string(mut self, string: impl Into<Cow<'a, str>>) -> Self { self.string = Some(string.into()); self }
pub fn array(mut self, array: Vec<Cow<'a, str>>) -> Self { self.array = Some(array); self }
pub fn build(self) -> KeyPath<'a> {
KeyPath {
type_: self.type_,
string: self.string,
array: self.array,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ClearObjectStoreParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
#[serde(rename = "objectStoreName")]
object_store_name: Cow<'a, str>,
}
impl<'a> ClearObjectStoreParams<'a> {
pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>) -> ClearObjectStoreParamsBuilder<'a> {
ClearObjectStoreParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
object_store_name: object_store_name.into(),
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
}
pub struct ClearObjectStoreParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
object_store_name: Cow<'a, str>,
}
impl<'a> ClearObjectStoreParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> ClearObjectStoreParams<'a> {
ClearObjectStoreParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
object_store_name: self.object_store_name,
}
}
}
impl<'a> ClearObjectStoreParams<'a> { pub const METHOD: &'static str = "IndexedDB.clearObjectStore"; }
impl<'a> crate::CdpCommand<'a> for ClearObjectStoreParams<'a> {
const METHOD: &'static str = "IndexedDB.clearObjectStore";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DeleteDatabaseParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
}
impl<'a> DeleteDatabaseParams<'a> {
pub fn builder(database_name: impl Into<Cow<'a, str>>) -> DeleteDatabaseParamsBuilder<'a> {
DeleteDatabaseParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
}
pub struct DeleteDatabaseParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
}
impl<'a> DeleteDatabaseParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> DeleteDatabaseParams<'a> {
DeleteDatabaseParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
}
}
}
impl<'a> DeleteDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteDatabase"; }
impl<'a> crate::CdpCommand<'a> for DeleteDatabaseParams<'a> {
const METHOD: &'static str = "IndexedDB.deleteDatabase";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct DeleteObjectStoreEntriesParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
#[serde(rename = "objectStoreName")]
object_store_name: Cow<'a, str>,
#[serde(rename = "keyRange")]
key_range: KeyRange<'a>,
}
impl<'a> DeleteObjectStoreEntriesParams<'a> {
pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>, key_range: KeyRange<'a>) -> DeleteObjectStoreEntriesParamsBuilder<'a> {
DeleteObjectStoreEntriesParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
object_store_name: object_store_name.into(),
key_range: key_range,
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
pub fn key_range(&self) -> &KeyRange<'a> { &self.key_range }
}
pub struct DeleteObjectStoreEntriesParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
object_store_name: Cow<'a, str>,
key_range: KeyRange<'a>,
}
impl<'a> DeleteObjectStoreEntriesParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> DeleteObjectStoreEntriesParams<'a> {
DeleteObjectStoreEntriesParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
object_store_name: self.object_store_name,
key_range: self.key_range,
}
}
}
impl<'a> DeleteObjectStoreEntriesParams<'a> { pub const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries"; }
impl<'a> crate::CdpCommand<'a> for DeleteObjectStoreEntriesParams<'a> {
const METHOD: &'static str = "IndexedDB.deleteObjectStoreEntries";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}
impl DisableParams { pub const METHOD: &'static str = "IndexedDB.disable"; }
impl<'a> crate::CdpCommand<'a> for DisableParams {
const METHOD: &'static str = "IndexedDB.disable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}
impl EnableParams { pub const METHOD: &'static str = "IndexedDB.enable"; }
impl<'a> crate::CdpCommand<'a> for EnableParams {
const METHOD: &'static str = "IndexedDB.enable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDataParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
#[serde(rename = "objectStoreName")]
object_store_name: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none", rename = "indexName")]
index_name: Option<Cow<'a, str>>,
#[serde(rename = "skipCount")]
skip_count: u64,
#[serde(rename = "pageSize")]
page_size: u64,
#[serde(skip_serializing_if = "Option::is_none", rename = "keyRange")]
key_range: Option<KeyRange<'a>>,
}
impl<'a> RequestDataParams<'a> {
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> {
RequestDataParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
object_store_name: object_store_name.into(),
index_name: None,
skip_count: skip_count,
page_size: page_size,
key_range: None,
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
pub fn index_name(&self) -> Option<&str> { self.index_name.as_deref() }
pub fn skip_count(&self) -> u64 { self.skip_count }
pub fn page_size(&self) -> u64 { self.page_size }
pub fn key_range(&self) -> Option<&KeyRange<'a>> { self.key_range.as_ref() }
}
pub struct RequestDataParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
object_store_name: Cow<'a, str>,
index_name: Option<Cow<'a, str>>,
skip_count: u64,
page_size: u64,
key_range: Option<KeyRange<'a>>,
}
impl<'a> RequestDataParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn index_name(mut self, index_name: impl Into<Cow<'a, str>>) -> Self { self.index_name = Some(index_name.into()); self }
pub fn key_range(mut self, key_range: KeyRange<'a>) -> Self { self.key_range = Some(key_range); self }
pub fn build(self) -> RequestDataParams<'a> {
RequestDataParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
object_store_name: self.object_store_name,
index_name: self.index_name,
skip_count: self.skip_count,
page_size: self.page_size,
key_range: self.key_range,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDataReturns {
#[serde(rename = "objectStoreDataEntries")]
object_store_data_entries: Vec<DataEntry>,
#[serde(rename = "hasMore")]
has_more: bool,
}
impl RequestDataReturns {
pub fn builder(object_store_data_entries: Vec<DataEntry>, has_more: bool) -> RequestDataReturnsBuilder {
RequestDataReturnsBuilder {
object_store_data_entries: object_store_data_entries,
has_more: has_more,
}
}
pub fn object_store_data_entries(&self) -> &[DataEntry] { &self.object_store_data_entries }
pub fn has_more(&self) -> bool { self.has_more }
}
pub struct RequestDataReturnsBuilder {
object_store_data_entries: Vec<DataEntry>,
has_more: bool,
}
impl RequestDataReturnsBuilder {
pub fn build(self) -> RequestDataReturns {
RequestDataReturns {
object_store_data_entries: self.object_store_data_entries,
has_more: self.has_more,
}
}
}
impl<'a> RequestDataParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestData"; }
impl<'a> crate::CdpCommand<'a> for RequestDataParams<'a> {
const METHOD: &'static str = "IndexedDB.requestData";
type Response = RequestDataReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetMetadataParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
#[serde(rename = "objectStoreName")]
object_store_name: Cow<'a, str>,
}
impl<'a> GetMetadataParams<'a> {
pub fn builder(database_name: impl Into<Cow<'a, str>>, object_store_name: impl Into<Cow<'a, str>>) -> GetMetadataParamsBuilder<'a> {
GetMetadataParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
object_store_name: object_store_name.into(),
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
pub fn object_store_name(&self) -> &str { self.object_store_name.as_ref() }
}
pub struct GetMetadataParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
object_store_name: Cow<'a, str>,
}
impl<'a> GetMetadataParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> GetMetadataParams<'a> {
GetMetadataParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
object_store_name: self.object_store_name,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetMetadataReturns {
#[serde(rename = "entriesCount")]
entries_count: f64,
#[serde(rename = "keyGeneratorValue")]
key_generator_value: f64,
}
impl GetMetadataReturns {
pub fn builder(entries_count: f64, key_generator_value: f64) -> GetMetadataReturnsBuilder {
GetMetadataReturnsBuilder {
entries_count: entries_count,
key_generator_value: key_generator_value,
}
}
pub fn entries_count(&self) -> f64 { self.entries_count }
pub fn key_generator_value(&self) -> f64 { self.key_generator_value }
}
pub struct GetMetadataReturnsBuilder {
entries_count: f64,
key_generator_value: f64,
}
impl GetMetadataReturnsBuilder {
pub fn build(self) -> GetMetadataReturns {
GetMetadataReturns {
entries_count: self.entries_count,
key_generator_value: self.key_generator_value,
}
}
}
impl<'a> GetMetadataParams<'a> { pub const METHOD: &'static str = "IndexedDB.getMetadata"; }
impl<'a> crate::CdpCommand<'a> for GetMetadataParams<'a> {
const METHOD: &'static str = "IndexedDB.getMetadata";
type Response = GetMetadataReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDatabaseParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
#[serde(rename = "databaseName")]
database_name: Cow<'a, str>,
}
impl<'a> RequestDatabaseParams<'a> {
pub fn builder(database_name: impl Into<Cow<'a, str>>) -> RequestDatabaseParamsBuilder<'a> {
RequestDatabaseParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
database_name: database_name.into(),
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
pub fn database_name(&self) -> &str { self.database_name.as_ref() }
}
pub struct RequestDatabaseParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
database_name: Cow<'a, str>,
}
impl<'a> RequestDatabaseParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> RequestDatabaseParams<'a> {
RequestDatabaseParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
database_name: self.database_name,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDatabaseReturns<'a> {
#[serde(rename = "databaseWithObjectStores")]
database_with_object_stores: DatabaseWithObjectStores<'a>,
}
impl<'a> RequestDatabaseReturns<'a> {
pub fn builder(database_with_object_stores: DatabaseWithObjectStores<'a>) -> RequestDatabaseReturnsBuilder<'a> {
RequestDatabaseReturnsBuilder {
database_with_object_stores: database_with_object_stores,
}
}
pub fn database_with_object_stores(&self) -> &DatabaseWithObjectStores<'a> { &self.database_with_object_stores }
}
pub struct RequestDatabaseReturnsBuilder<'a> {
database_with_object_stores: DatabaseWithObjectStores<'a>,
}
impl<'a> RequestDatabaseReturnsBuilder<'a> {
pub fn build(self) -> RequestDatabaseReturns<'a> {
RequestDatabaseReturns {
database_with_object_stores: self.database_with_object_stores,
}
}
}
impl<'a> RequestDatabaseParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabase"; }
impl<'a> crate::CdpCommand<'a> for RequestDatabaseParams<'a> {
const METHOD: &'static str = "IndexedDB.requestDatabase";
type Response = RequestDatabaseReturns<'a>;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDatabaseNamesParams<'a> {
#[serde(skip_serializing_if = "Option::is_none", rename = "securityOrigin")]
security_origin: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageKey")]
storage_key: Option<Cow<'a, str>>,
#[serde(skip_serializing_if = "Option::is_none", rename = "storageBucket")]
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
}
impl<'a> RequestDatabaseNamesParams<'a> {
pub fn builder() -> RequestDatabaseNamesParamsBuilder<'a> {
RequestDatabaseNamesParamsBuilder {
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
pub fn security_origin(&self) -> Option<&str> { self.security_origin.as_deref() }
pub fn storage_key(&self) -> Option<&str> { self.storage_key.as_deref() }
pub fn storage_bucket(&self) -> Option<&crate::storage::StorageBucket<'a>> { self.storage_bucket.as_ref() }
}
#[derive(Default)]
pub struct RequestDatabaseNamesParamsBuilder<'a> {
security_origin: Option<Cow<'a, str>>,
storage_key: Option<Cow<'a, str>>,
storage_bucket: Option<crate::storage::StorageBucket<'a>>,
}
impl<'a> RequestDatabaseNamesParamsBuilder<'a> {
pub fn security_origin(mut self, security_origin: impl Into<Cow<'a, str>>) -> Self { self.security_origin = Some(security_origin.into()); self }
pub fn storage_key(mut self, storage_key: impl Into<Cow<'a, str>>) -> Self { self.storage_key = Some(storage_key.into()); self }
pub fn storage_bucket(mut self, storage_bucket: crate::storage::StorageBucket<'a>) -> Self { self.storage_bucket = Some(storage_bucket); self }
pub fn build(self) -> RequestDatabaseNamesParams<'a> {
RequestDatabaseNamesParams {
security_origin: self.security_origin,
storage_key: self.storage_key,
storage_bucket: self.storage_bucket,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestDatabaseNamesReturns<'a> {
#[serde(rename = "databaseNames")]
database_names: Vec<Cow<'a, str>>,
}
impl<'a> RequestDatabaseNamesReturns<'a> {
pub fn builder(database_names: Vec<Cow<'a, str>>) -> RequestDatabaseNamesReturnsBuilder<'a> {
RequestDatabaseNamesReturnsBuilder {
database_names: database_names,
}
}
pub fn database_names(&self) -> &[Cow<'a, str>] { &self.database_names }
}
pub struct RequestDatabaseNamesReturnsBuilder<'a> {
database_names: Vec<Cow<'a, str>>,
}
impl<'a> RequestDatabaseNamesReturnsBuilder<'a> {
pub fn build(self) -> RequestDatabaseNamesReturns<'a> {
RequestDatabaseNamesReturns {
database_names: self.database_names,
}
}
}
impl<'a> RequestDatabaseNamesParams<'a> { pub const METHOD: &'static str = "IndexedDB.requestDatabaseNames"; }
impl<'a> crate::CdpCommand<'a> for RequestDatabaseNamesParams<'a> {
const METHOD: &'static str = "IndexedDB.requestDatabaseNames";
type Response = RequestDatabaseNamesReturns<'a>;
}