use serde::{Deserialize, Serialize};
#[doc = "Clears all entries from an object store.\n[clearObjectStore](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-clearObjectStore)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ClearObjectStoreParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[doc = "Database name."]
#[serde(rename = "databaseName")]
pub database_name: String,
#[doc = "Object store name."]
#[serde(rename = "objectStoreName")]
pub object_store_name: String,
}
impl ClearObjectStoreParams {
pub fn new(database_name: impl Into<String>, object_store_name: impl Into<String>) -> Self {
Self {
database_name: database_name.into(),
object_store_name: object_store_name.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum ClearObjectStoreMethod {
#[serde(rename = "IndexedDB.clearObjectStore")]
ClearObjectStore,
}
#[doc = "Clears all entries from an object store.\n[clearObjectStore](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-clearObjectStore)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ClearObjectStore {
pub method: ClearObjectStoreMethod,
pub params: ClearObjectStoreParams,
}
impl ClearObjectStore {
pub const IDENTIFIER: &'static str = "IndexedDB.clearObjectStore";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for ClearObjectStore {
type Result = super::results::ClearObjectStoreResult;
}
#[doc = "Deletes a database.\n[deleteDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteDatabase)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteDatabaseParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[doc = "Database name."]
#[serde(rename = "databaseName")]
pub database_name: String,
}
impl DeleteDatabaseParams {
pub fn new(database_name: impl Into<String>) -> Self {
Self {
database_name: database_name.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
}
impl<T: Into<String>> From<T> for DeleteDatabaseParams {
fn from(url: T) -> Self {
DeleteDatabaseParams::new(url)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DeleteDatabaseMethod {
#[serde(rename = "IndexedDB.deleteDatabase")]
DeleteDatabase,
}
#[doc = "Deletes a database.\n[deleteDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteDatabase)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteDatabase {
pub method: DeleteDatabaseMethod,
pub params: DeleteDatabaseParams,
}
impl DeleteDatabase {
pub const IDENTIFIER: &'static str = "IndexedDB.deleteDatabase";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DeleteDatabase {
type Result = super::results::DeleteDatabaseResult;
}
#[doc = "Delete a range of entries from an object store\n[deleteObjectStoreEntries](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteObjectStoreEntries)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteObjectStoreEntriesParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[serde(rename = "databaseName")]
pub database_name: String,
#[serde(rename = "objectStoreName")]
pub object_store_name: String,
#[doc = "Range of entry keys to delete"]
#[serde(rename = "keyRange")]
pub key_range: super::types::KeyRange,
}
impl DeleteObjectStoreEntriesParams {
pub fn new(
database_name: impl Into<String>,
object_store_name: impl Into<String>,
key_range: impl Into<super::types::KeyRange>,
) -> Self {
Self {
database_name: database_name.into(),
object_store_name: object_store_name.into(),
key_range: key_range.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DeleteObjectStoreEntriesMethod {
#[serde(rename = "IndexedDB.deleteObjectStoreEntries")]
DeleteObjectStoreEntries,
}
#[doc = "Delete a range of entries from an object store\n[deleteObjectStoreEntries](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-deleteObjectStoreEntries)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteObjectStoreEntries {
pub method: DeleteObjectStoreEntriesMethod,
pub params: DeleteObjectStoreEntriesParams,
}
impl DeleteObjectStoreEntries {
pub const IDENTIFIER: &'static str = "IndexedDB.deleteObjectStoreEntries";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for DeleteObjectStoreEntries {
type Result = super::results::DeleteObjectStoreEntriesResult;
}
#[doc = "Disables events from backend.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-disable)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum DisableMethod {
#[serde(rename = "IndexedDB.disable")]
Disable,
}
#[doc = "Disables events from backend.\n[disable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-disable)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Disable {
pub method: DisableMethod,
pub params: DisableParams,
}
impl Disable {
pub const IDENTIFIER: &'static str = "IndexedDB.disable";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for Disable {
type Result = super::results::DisableResult;
}
#[doc = "Enables events from backend.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-enable)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum EnableMethod {
#[serde(rename = "IndexedDB.enable")]
Enable,
}
#[doc = "Enables events from backend.\n[enable](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-enable)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Enable {
pub method: EnableMethod,
pub params: EnableParams,
}
impl Enable {
pub const IDENTIFIER: &'static str = "IndexedDB.enable";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for Enable {
type Result = super::results::EnableResult;
}
#[doc = "Requests data from object store or index.\n[requestData](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestData)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RequestDataParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[doc = "Database name."]
#[serde(rename = "databaseName")]
pub database_name: String,
#[doc = "Object store name."]
#[serde(rename = "objectStoreName")]
pub object_store_name: String,
#[doc = "Index name. If not specified, it performs an object store data request."]
#[serde(rename = "indexName")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub index_name: Option<String>,
#[doc = "Number of records to skip."]
#[serde(rename = "skipCount")]
pub skip_count: i64,
#[doc = "Number of records to fetch."]
#[serde(rename = "pageSize")]
pub page_size: i64,
#[doc = "Key range."]
#[serde(rename = "keyRange")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub key_range: Option<super::types::KeyRange>,
}
impl RequestDataParams {
pub fn new(
database_name: impl Into<String>,
object_store_name: impl Into<String>,
skip_count: impl Into<i64>,
page_size: impl Into<i64>,
) -> Self {
Self {
database_name: database_name.into(),
object_store_name: object_store_name.into(),
skip_count: skip_count.into(),
page_size: page_size.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
index_name: None,
key_range: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RequestDataMethod {
#[serde(rename = "IndexedDB.requestData")]
RequestData,
}
#[doc = "Requests data from object store or index.\n[requestData](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestData)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RequestData {
pub method: RequestDataMethod,
pub params: RequestDataParams,
}
impl RequestData {
pub const IDENTIFIER: &'static str = "IndexedDB.requestData";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for RequestData {
type Result = super::results::RequestDataResult;
}
#[doc = "Gets metadata of an object store.\n[getMetadata](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-getMetadata)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GetMetadataParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[doc = "Database name."]
#[serde(rename = "databaseName")]
pub database_name: String,
#[doc = "Object store name."]
#[serde(rename = "objectStoreName")]
pub object_store_name: String,
}
impl GetMetadataParams {
pub fn new(database_name: impl Into<String>, object_store_name: impl Into<String>) -> Self {
Self {
database_name: database_name.into(),
object_store_name: object_store_name.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum GetMetadataMethod {
#[serde(rename = "IndexedDB.getMetadata")]
GetMetadata,
}
#[doc = "Gets metadata of an object store.\n[getMetadata](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-getMetadata)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct GetMetadata {
pub method: GetMetadataMethod,
pub params: GetMetadataParams,
}
impl GetMetadata {
pub const IDENTIFIER: &'static str = "IndexedDB.getMetadata";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for GetMetadata {
type Result = super::results::GetMetadataResult;
}
#[doc = "Requests database with given name in given frame.\n[requestDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabase)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RequestDatabaseParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
#[doc = "Database name."]
#[serde(rename = "databaseName")]
pub database_name: String,
}
impl RequestDatabaseParams {
pub fn new(database_name: impl Into<String>) -> Self {
Self {
database_name: database_name.into(),
security_origin: None,
storage_key: None,
storage_bucket: None,
}
}
}
impl<T: Into<String>> From<T> for RequestDatabaseParams {
fn from(url: T) -> Self {
RequestDatabaseParams::new(url)
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RequestDatabaseMethod {
#[serde(rename = "IndexedDB.requestDatabase")]
RequestDatabase,
}
#[doc = "Requests database with given name in given frame.\n[requestDatabase](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabase)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RequestDatabase {
pub method: RequestDatabaseMethod,
pub params: RequestDatabaseParams,
}
impl RequestDatabase {
pub const IDENTIFIER: &'static str = "IndexedDB.requestDatabase";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for RequestDatabase {
type Result = super::results::RequestDatabaseResult;
}
#[doc = "Requests database names for given security origin.\n[requestDatabaseNames](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabaseNames)"]
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct RequestDatabaseNamesParams {
#[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\nSecurity origin."]
#[serde(rename = "securityOrigin")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub security_origin: Option<String>,
#[doc = "Storage key."]
#[serde(rename = "storageKey")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_key: Option<String>,
#[doc = "Storage bucket. If not specified, it uses the default bucket."]
#[serde(rename = "storageBucket")]
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub storage_bucket: Option<crate::browser_protocol::storage::types::StorageBucket>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum RequestDatabaseNamesMethod {
#[serde(rename = "IndexedDB.requestDatabaseNames")]
RequestDatabaseNames,
}
#[doc = "Requests database names for given security origin.\n[requestDatabaseNames](https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB/#method-requestDatabaseNames)"]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RequestDatabaseNames {
pub method: RequestDatabaseNamesMethod,
pub params: RequestDatabaseNamesParams,
}
impl RequestDatabaseNames {
pub const IDENTIFIER: &'static str = "IndexedDB.requestDatabaseNames";
pub fn identifier(&self) -> &'static str {
Self::IDENTIFIER
}
}
impl crate::CommandResult for RequestDatabaseNames {
type Result = super::results::RequestDatabaseNamesResult;
}
group_enum ! (IndexedDbCommands { ClearObjectStore (ClearObjectStore) , DeleteDatabase (DeleteDatabase) , DeleteObjectStoreEntries (DeleteObjectStoreEntries) , Disable (Disable) , Enable (Enable) , RequestData (RequestData) , GetMetadata (GetMetadata) , RequestDatabase (RequestDatabase) , RequestDatabaseNames (RequestDatabaseNames) } + identifiable);