cdp_protocol/
indexed_db.rs

1// Auto-generated from Chrome at version 143.0.7499.110 domain: IndexedDB
2use super::runtime;
3use super::storage;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use serde::{Deserialize, Serialize};
8#[allow(unused_imports)]
9use serde_json::Value as Json;
10#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
11pub enum KeyType {
12    #[serde(rename = "number")]
13    Number,
14    #[serde(rename = "string")]
15    String,
16    #[serde(rename = "date")]
17    Date,
18    #[serde(rename = "array")]
19    Array,
20}
21#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
22pub enum KeyPathType {
23    #[serde(rename = "null")]
24    Null,
25    #[serde(rename = "string")]
26    String,
27    #[serde(rename = "array")]
28    Array,
29}
30#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
31pub struct DatabaseWithObjectStores {
32    #[serde(default)]
33    #[serde(rename = "name")]
34    pub name: String,
35    #[serde(default)]
36    #[serde(rename = "version")]
37    pub version: JsFloat,
38    #[serde(rename = "objectStores")]
39    pub object_stores: Vec<ObjectStore>,
40}
41#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
42pub struct ObjectStore {
43    #[serde(default)]
44    #[serde(rename = "name")]
45    pub name: String,
46    #[serde(rename = "keyPath")]
47    pub key_path: KeyPath,
48    #[serde(default)]
49    #[serde(rename = "autoIncrement")]
50    pub auto_increment: bool,
51    #[serde(rename = "indexes")]
52    pub indexes: Vec<ObjectStoreIndex>,
53}
54#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
55pub struct ObjectStoreIndex {
56    #[serde(default)]
57    #[serde(rename = "name")]
58    pub name: String,
59    #[serde(rename = "keyPath")]
60    pub key_path: KeyPath,
61    #[serde(default)]
62    #[serde(rename = "unique")]
63    pub unique: bool,
64    #[serde(default)]
65    #[serde(rename = "multiEntry")]
66    pub multi_entry: bool,
67}
68#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
69pub struct Key {
70    #[serde(rename = "type")]
71    pub r#type: KeyType,
72    #[serde(skip_serializing_if = "Option::is_none")]
73    #[serde(default)]
74    #[serde(rename = "number")]
75    pub number: Option<JsFloat>,
76    #[serde(skip_serializing_if = "Option::is_none")]
77    #[serde(default)]
78    #[serde(rename = "string")]
79    pub string: Option<String>,
80    #[serde(skip_serializing_if = "Option::is_none")]
81    #[serde(default)]
82    #[serde(rename = "date")]
83    pub date: Option<JsFloat>,
84    #[serde(skip_serializing_if = "Option::is_none")]
85    #[serde(rename = "array")]
86    pub array: Option<Vec<Key>>,
87}
88#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
89pub struct KeyRange {
90    #[serde(skip_serializing_if = "Option::is_none")]
91    #[serde(rename = "lower")]
92    pub lower: Option<Key>,
93    #[serde(skip_serializing_if = "Option::is_none")]
94    #[serde(rename = "upper")]
95    pub upper: Option<Key>,
96    #[serde(default)]
97    #[serde(rename = "lowerOpen")]
98    pub lower_open: bool,
99    #[serde(default)]
100    #[serde(rename = "upperOpen")]
101    pub upper_open: bool,
102}
103#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
104pub struct DataEntry {
105    #[serde(rename = "key")]
106    pub key: runtime::RemoteObject,
107    #[serde(rename = "primaryKey")]
108    pub primary_key: runtime::RemoteObject,
109    #[serde(rename = "value")]
110    pub value: runtime::RemoteObject,
111}
112#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
113pub struct KeyPath {
114    #[serde(rename = "type")]
115    pub r#type: KeyPathType,
116    #[serde(skip_serializing_if = "Option::is_none")]
117    #[serde(default)]
118    #[serde(rename = "string")]
119    pub string: Option<String>,
120    #[serde(skip_serializing_if = "Option::is_none")]
121    #[serde(default)]
122    #[serde(rename = "array")]
123    pub array: Option<Vec<String>>,
124}
125#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
126pub struct ClearObjectStore {
127    #[serde(skip_serializing_if = "Option::is_none")]
128    #[serde(default)]
129    #[serde(rename = "securityOrigin")]
130    pub security_origin: Option<String>,
131    #[serde(skip_serializing_if = "Option::is_none")]
132    #[serde(default)]
133    #[serde(rename = "storageKey")]
134    pub storage_key: Option<String>,
135    #[serde(skip_serializing_if = "Option::is_none")]
136    #[serde(rename = "storageBucket")]
137    pub storage_bucket: Option<storage::StorageBucket>,
138    #[serde(default)]
139    #[serde(rename = "databaseName")]
140    pub database_name: String,
141    #[serde(default)]
142    #[serde(rename = "objectStoreName")]
143    pub object_store_name: String,
144}
145#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
146pub struct DeleteDatabase {
147    #[serde(skip_serializing_if = "Option::is_none")]
148    #[serde(default)]
149    #[serde(rename = "securityOrigin")]
150    pub security_origin: Option<String>,
151    #[serde(skip_serializing_if = "Option::is_none")]
152    #[serde(default)]
153    #[serde(rename = "storageKey")]
154    pub storage_key: Option<String>,
155    #[serde(skip_serializing_if = "Option::is_none")]
156    #[serde(rename = "storageBucket")]
157    pub storage_bucket: Option<storage::StorageBucket>,
158    #[serde(default)]
159    #[serde(rename = "databaseName")]
160    pub database_name: String,
161}
162#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
163pub struct DeleteObjectStoreEntries {
164    #[serde(skip_serializing_if = "Option::is_none")]
165    #[serde(default)]
166    #[serde(rename = "securityOrigin")]
167    pub security_origin: Option<String>,
168    #[serde(skip_serializing_if = "Option::is_none")]
169    #[serde(default)]
170    #[serde(rename = "storageKey")]
171    pub storage_key: Option<String>,
172    #[serde(skip_serializing_if = "Option::is_none")]
173    #[serde(rename = "storageBucket")]
174    pub storage_bucket: Option<storage::StorageBucket>,
175    #[serde(default)]
176    #[serde(rename = "databaseName")]
177    pub database_name: String,
178    #[serde(default)]
179    #[serde(rename = "objectStoreName")]
180    pub object_store_name: String,
181    #[serde(rename = "keyRange")]
182    pub key_range: KeyRange,
183}
184#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
185#[serde(rename_all = "camelCase")]
186pub struct Disable(pub Option<serde_json::Value>);
187#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
188#[serde(rename_all = "camelCase")]
189pub struct Enable(pub Option<serde_json::Value>);
190#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
191pub struct RequestData {
192    #[serde(skip_serializing_if = "Option::is_none")]
193    #[serde(default)]
194    #[serde(rename = "securityOrigin")]
195    pub security_origin: Option<String>,
196    #[serde(skip_serializing_if = "Option::is_none")]
197    #[serde(default)]
198    #[serde(rename = "storageKey")]
199    pub storage_key: Option<String>,
200    #[serde(skip_serializing_if = "Option::is_none")]
201    #[serde(rename = "storageBucket")]
202    pub storage_bucket: Option<storage::StorageBucket>,
203    #[serde(default)]
204    #[serde(rename = "databaseName")]
205    pub database_name: String,
206    #[serde(default)]
207    #[serde(rename = "objectStoreName")]
208    pub object_store_name: String,
209    #[serde(skip_serializing_if = "Option::is_none")]
210    #[serde(default)]
211    #[serde(rename = "indexName")]
212    pub index_name: Option<String>,
213    #[serde(default)]
214    #[serde(rename = "skipCount")]
215    pub skip_count: JsUInt,
216    #[serde(default)]
217    #[serde(rename = "pageSize")]
218    pub page_size: JsUInt,
219    #[serde(skip_serializing_if = "Option::is_none")]
220    #[serde(rename = "keyRange")]
221    pub key_range: Option<KeyRange>,
222}
223#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
224pub struct GetMetadata {
225    #[serde(skip_serializing_if = "Option::is_none")]
226    #[serde(default)]
227    #[serde(rename = "securityOrigin")]
228    pub security_origin: Option<String>,
229    #[serde(skip_serializing_if = "Option::is_none")]
230    #[serde(default)]
231    #[serde(rename = "storageKey")]
232    pub storage_key: Option<String>,
233    #[serde(skip_serializing_if = "Option::is_none")]
234    #[serde(rename = "storageBucket")]
235    pub storage_bucket: Option<storage::StorageBucket>,
236    #[serde(default)]
237    #[serde(rename = "databaseName")]
238    pub database_name: String,
239    #[serde(default)]
240    #[serde(rename = "objectStoreName")]
241    pub object_store_name: String,
242}
243#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
244pub struct RequestDatabase {
245    #[serde(skip_serializing_if = "Option::is_none")]
246    #[serde(default)]
247    #[serde(rename = "securityOrigin")]
248    pub security_origin: Option<String>,
249    #[serde(skip_serializing_if = "Option::is_none")]
250    #[serde(default)]
251    #[serde(rename = "storageKey")]
252    pub storage_key: Option<String>,
253    #[serde(skip_serializing_if = "Option::is_none")]
254    #[serde(rename = "storageBucket")]
255    pub storage_bucket: Option<storage::StorageBucket>,
256    #[serde(default)]
257    #[serde(rename = "databaseName")]
258    pub database_name: String,
259}
260#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
261pub struct RequestDatabaseNames {
262    #[serde(skip_serializing_if = "Option::is_none")]
263    #[serde(default)]
264    #[serde(rename = "securityOrigin")]
265    pub security_origin: Option<String>,
266    #[serde(skip_serializing_if = "Option::is_none")]
267    #[serde(default)]
268    #[serde(rename = "storageKey")]
269    pub storage_key: Option<String>,
270    #[serde(skip_serializing_if = "Option::is_none")]
271    #[serde(rename = "storageBucket")]
272    pub storage_bucket: Option<storage::StorageBucket>,
273}
274#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
275#[serde(rename_all = "camelCase")]
276pub struct ClearObjectStoreReturnObject {}
277#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
278#[serde(rename_all = "camelCase")]
279pub struct DeleteDatabaseReturnObject {}
280#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
281#[serde(rename_all = "camelCase")]
282pub struct DeleteObjectStoreEntriesReturnObject {}
283#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
284#[serde(rename_all = "camelCase")]
285pub struct DisableReturnObject {}
286#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
287#[serde(rename_all = "camelCase")]
288pub struct EnableReturnObject {}
289#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
290pub struct RequestDataReturnObject {
291    #[serde(rename = "objectStoreDataEntries")]
292    pub object_store_data_entries: Vec<DataEntry>,
293    #[serde(default)]
294    #[serde(rename = "hasMore")]
295    pub has_more: bool,
296}
297#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
298pub struct GetMetadataReturnObject {
299    #[serde(default)]
300    #[serde(rename = "entriesCount")]
301    pub entries_count: JsFloat,
302    #[serde(default)]
303    #[serde(rename = "keyGeneratorValue")]
304    pub key_generator_value: JsFloat,
305}
306#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
307pub struct RequestDatabaseReturnObject {
308    #[serde(rename = "databaseWithObjectStores")]
309    pub database_with_object_stores: DatabaseWithObjectStores,
310}
311#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
312pub struct RequestDatabaseNamesReturnObject {
313    #[serde(rename = "databaseNames")]
314    pub database_names: Vec<String>,
315}
316impl Method for ClearObjectStore {
317    const NAME: &'static str = "IndexedDB.clearObjectStore";
318    type ReturnObject = ClearObjectStoreReturnObject;
319}
320impl Method for DeleteDatabase {
321    const NAME: &'static str = "IndexedDB.deleteDatabase";
322    type ReturnObject = DeleteDatabaseReturnObject;
323}
324impl Method for DeleteObjectStoreEntries {
325    const NAME: &'static str = "IndexedDB.deleteObjectStoreEntries";
326    type ReturnObject = DeleteObjectStoreEntriesReturnObject;
327}
328impl Method for Disable {
329    const NAME: &'static str = "IndexedDB.disable";
330    type ReturnObject = DisableReturnObject;
331}
332impl Method for Enable {
333    const NAME: &'static str = "IndexedDB.enable";
334    type ReturnObject = EnableReturnObject;
335}
336impl Method for RequestData {
337    const NAME: &'static str = "IndexedDB.requestData";
338    type ReturnObject = RequestDataReturnObject;
339}
340impl Method for GetMetadata {
341    const NAME: &'static str = "IndexedDB.getMetadata";
342    type ReturnObject = GetMetadataReturnObject;
343}
344impl Method for RequestDatabase {
345    const NAME: &'static str = "IndexedDB.requestDatabase";
346    type ReturnObject = RequestDatabaseReturnObject;
347}
348impl Method for RequestDatabaseNames {
349    const NAME: &'static str = "IndexedDB.requestDatabaseNames";
350    type ReturnObject = RequestDatabaseNamesReturnObject;
351}
352pub mod events {
353    #[allow(unused_imports)]
354    use super::super::types::*;
355    #[allow(unused_imports)]
356    use serde::{Deserialize, Serialize};
357}