1#![allow(dead_code)]
3use super::runtime;
4use super::storage;
5#[allow(unused_imports)]
6use super::types::*;
7#[allow(unused_imports)]
8use derive_builder::Builder;
9#[allow(unused_imports)]
10use serde::{Deserialize, Serialize};
11#[allow(unused_imports)]
12use serde_json::Value as Json;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum KeyType {
16 #[serde(rename = "number")]
17 Number,
18 #[serde(rename = "string")]
19 String,
20 #[serde(rename = "date")]
21 Date,
22 #[serde(rename = "array")]
23 Array,
24}
25#[allow(deprecated)]
26#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
27pub enum KeyPathType {
28 #[serde(rename = "null")]
29 Null,
30 #[serde(rename = "string")]
31 String,
32 #[serde(rename = "array")]
33 Array,
34}
35#[allow(deprecated)]
36#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
37#[builder(setter(into, strip_option))]
38#[serde(rename_all = "camelCase")]
39#[doc = "Database with an array of object stores."]
40pub struct DatabaseWithObjectStores {
41 #[serde(default)]
42 #[doc = "Database name."]
43 pub name: String,
44 #[serde(default)]
45 #[doc = "Database version (type is not 'integer', as the standard\n requires the version number to be 'unsigned long long')"]
46 pub version: JsFloat,
47 #[doc = "Object stores in this database."]
48 pub object_stores: Vec<ObjectStore>,
49}
50#[allow(deprecated)]
51#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
52#[builder(setter(into, strip_option))]
53#[serde(rename_all = "camelCase")]
54#[doc = "Object store."]
55pub struct ObjectStore {
56 #[serde(default)]
57 #[doc = "Object store name."]
58 pub name: String,
59 #[doc = "Object store key path."]
60 pub key_path: KeyPath,
61 #[serde(default)]
62 #[doc = "If true, object store has auto increment flag set."]
63 pub auto_increment: bool,
64 #[doc = "Indexes in this object store."]
65 pub indexes: Vec<ObjectStoreIndex>,
66}
67#[allow(deprecated)]
68#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
69#[builder(setter(into, strip_option))]
70#[serde(rename_all = "camelCase")]
71#[doc = "Object store index."]
72pub struct ObjectStoreIndex {
73 #[serde(default)]
74 #[doc = "Index name."]
75 pub name: String,
76 #[doc = "Index key path."]
77 pub key_path: KeyPath,
78 #[serde(default)]
79 #[doc = "If true, index is unique."]
80 pub unique: bool,
81 #[serde(default)]
82 #[doc = "If true, index allows multiple entries for a key."]
83 pub multi_entry: bool,
84}
85#[allow(deprecated)]
86#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
87#[builder(setter(into, strip_option))]
88#[serde(rename_all = "camelCase")]
89#[doc = "Key."]
90pub struct Key {
91 #[doc = "Key type."]
92 pub r#type: KeyType,
93 #[builder(default)]
94 #[serde(skip_serializing_if = "Option::is_none")]
95 #[serde(default)]
96 #[doc = "Number value."]
97 pub number: Option<JsFloat>,
98 #[builder(default)]
99 #[serde(skip_serializing_if = "Option::is_none")]
100 #[serde(default)]
101 #[doc = "String value."]
102 pub string: Option<String>,
103 #[builder(default)]
104 #[serde(skip_serializing_if = "Option::is_none")]
105 #[serde(default)]
106 #[doc = "Date value."]
107 pub date: Option<JsFloat>,
108 #[builder(default)]
109 #[serde(skip_serializing_if = "Option::is_none")]
110 #[doc = "Array value."]
111 pub array: Option<Vec<Key>>,
112}
113#[allow(deprecated)]
114#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
115#[builder(setter(into, strip_option))]
116#[serde(rename_all = "camelCase")]
117#[doc = "Key range."]
118pub struct KeyRange {
119 #[builder(default)]
120 #[serde(skip_serializing_if = "Option::is_none")]
121 #[doc = "Lower bound."]
122 pub lower: Option<Key>,
123 #[builder(default)]
124 #[serde(skip_serializing_if = "Option::is_none")]
125 #[doc = "Upper bound."]
126 pub upper: Option<Key>,
127 #[serde(default)]
128 #[doc = "If true lower bound is open."]
129 pub lower_open: bool,
130 #[serde(default)]
131 #[doc = "If true upper bound is open."]
132 pub upper_open: bool,
133}
134#[allow(deprecated)]
135#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
136#[builder(setter(into, strip_option))]
137#[serde(rename_all = "camelCase")]
138#[doc = "Data entry."]
139pub struct DataEntry {
140 #[doc = "Key object."]
141 pub key: runtime::RemoteObject,
142 #[doc = "Primary key object."]
143 pub primary_key: runtime::RemoteObject,
144 #[doc = "Value object."]
145 pub value: runtime::RemoteObject,
146}
147#[allow(deprecated)]
148#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
149#[builder(setter(into, strip_option))]
150#[serde(rename_all = "camelCase")]
151#[doc = "Key path."]
152pub struct KeyPath {
153 #[doc = "Key path type."]
154 pub r#type: KeyPathType,
155 #[builder(default)]
156 #[serde(skip_serializing_if = "Option::is_none")]
157 #[serde(default)]
158 #[doc = "String value."]
159 pub string: Option<String>,
160 #[builder(default)]
161 #[serde(skip_serializing_if = "Option::is_none")]
162 #[serde(default)]
163 #[doc = "Array value."]
164 pub array: Option<Vec<String>>,
165}
166#[allow(deprecated)]
167#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
168#[builder(setter(into, strip_option))]
169#[serde(rename_all = "camelCase")]
170#[doc = "Clears all entries from an object store."]
171pub struct ClearObjectStore {
172 #[builder(default)]
173 #[serde(skip_serializing_if = "Option::is_none")]
174 #[serde(default)]
175 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
176 pub security_origin: Option<String>,
177 #[builder(default)]
178 #[serde(skip_serializing_if = "Option::is_none")]
179 #[serde(default)]
180 #[doc = "Storage key."]
181 pub storage_key: Option<String>,
182 #[builder(default)]
183 #[serde(skip_serializing_if = "Option::is_none")]
184 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
185 pub storage_bucket: Option<storage::StorageBucket>,
186 #[serde(default)]
187 #[doc = "Database name."]
188 pub database_name: String,
189 #[serde(default)]
190 #[doc = "Object store name."]
191 pub object_store_name: String,
192}
193#[allow(deprecated)]
194#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
195#[builder(setter(into, strip_option))]
196#[serde(rename_all = "camelCase")]
197#[doc = "Deletes a database."]
198pub struct DeleteDatabase {
199 #[builder(default)]
200 #[serde(skip_serializing_if = "Option::is_none")]
201 #[serde(default)]
202 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
203 pub security_origin: Option<String>,
204 #[builder(default)]
205 #[serde(skip_serializing_if = "Option::is_none")]
206 #[serde(default)]
207 #[doc = "Storage key."]
208 pub storage_key: Option<String>,
209 #[builder(default)]
210 #[serde(skip_serializing_if = "Option::is_none")]
211 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
212 pub storage_bucket: Option<storage::StorageBucket>,
213 #[serde(default)]
214 #[doc = "Database name."]
215 pub database_name: String,
216}
217#[allow(deprecated)]
218#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
219#[builder(setter(into, strip_option))]
220#[serde(rename_all = "camelCase")]
221#[doc = "Delete a range of entries from an object store"]
222pub struct DeleteObjectStoreEntries {
223 #[builder(default)]
224 #[serde(skip_serializing_if = "Option::is_none")]
225 #[serde(default)]
226 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
227 pub security_origin: Option<String>,
228 #[builder(default)]
229 #[serde(skip_serializing_if = "Option::is_none")]
230 #[serde(default)]
231 #[doc = "Storage key."]
232 pub storage_key: Option<String>,
233 #[builder(default)]
234 #[serde(skip_serializing_if = "Option::is_none")]
235 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
236 pub storage_bucket: Option<storage::StorageBucket>,
237 #[serde(default)]
238 pub database_name: String,
239 #[serde(default)]
240 pub object_store_name: String,
241 #[doc = "Range of entry keys to delete"]
242 pub key_range: KeyRange,
243}
244#[allow(deprecated)]
245#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
246pub struct Disable(pub Option<Json>);
247#[allow(deprecated)]
248#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
249pub struct Enable(pub Option<Json>);
250#[allow(deprecated)]
251#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
252#[builder(setter(into, strip_option))]
253#[serde(rename_all = "camelCase")]
254#[doc = "Requests data from object store or index."]
255pub struct RequestData {
256 #[builder(default)]
257 #[serde(skip_serializing_if = "Option::is_none")]
258 #[serde(default)]
259 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
260 pub security_origin: Option<String>,
261 #[builder(default)]
262 #[serde(skip_serializing_if = "Option::is_none")]
263 #[serde(default)]
264 #[doc = "Storage key."]
265 pub storage_key: Option<String>,
266 #[builder(default)]
267 #[serde(skip_serializing_if = "Option::is_none")]
268 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
269 pub storage_bucket: Option<storage::StorageBucket>,
270 #[serde(default)]
271 #[doc = "Database name."]
272 pub database_name: String,
273 #[serde(default)]
274 #[doc = "Object store name."]
275 pub object_store_name: String,
276 #[builder(default)]
277 #[serde(skip_serializing_if = "Option::is_none")]
278 #[serde(default)]
279 #[doc = "Index name. If not specified, it performs an object store data request."]
280 pub index_name: Option<String>,
281 #[serde(default)]
282 #[doc = "Number of records to skip."]
283 pub skip_count: JsUInt,
284 #[serde(default)]
285 #[doc = "Number of records to fetch."]
286 pub page_size: JsUInt,
287 #[builder(default)]
288 #[serde(skip_serializing_if = "Option::is_none")]
289 #[doc = "Key range."]
290 pub key_range: Option<KeyRange>,
291}
292#[allow(deprecated)]
293#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
294#[builder(setter(into, strip_option))]
295#[serde(rename_all = "camelCase")]
296#[doc = "Gets metadata of an object store."]
297pub struct GetMetadata {
298 #[builder(default)]
299 #[serde(skip_serializing_if = "Option::is_none")]
300 #[serde(default)]
301 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
302 pub security_origin: Option<String>,
303 #[builder(default)]
304 #[serde(skip_serializing_if = "Option::is_none")]
305 #[serde(default)]
306 #[doc = "Storage key."]
307 pub storage_key: Option<String>,
308 #[builder(default)]
309 #[serde(skip_serializing_if = "Option::is_none")]
310 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
311 pub storage_bucket: Option<storage::StorageBucket>,
312 #[serde(default)]
313 #[doc = "Database name."]
314 pub database_name: String,
315 #[serde(default)]
316 #[doc = "Object store name."]
317 pub object_store_name: String,
318}
319#[allow(deprecated)]
320#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
321#[builder(setter(into, strip_option))]
322#[serde(rename_all = "camelCase")]
323#[doc = "Requests database with given name in given frame."]
324pub struct RequestDatabase {
325 #[builder(default)]
326 #[serde(skip_serializing_if = "Option::is_none")]
327 #[serde(default)]
328 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
329 pub security_origin: Option<String>,
330 #[builder(default)]
331 #[serde(skip_serializing_if = "Option::is_none")]
332 #[serde(default)]
333 #[doc = "Storage key."]
334 pub storage_key: Option<String>,
335 #[builder(default)]
336 #[serde(skip_serializing_if = "Option::is_none")]
337 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
338 pub storage_bucket: Option<storage::StorageBucket>,
339 #[serde(default)]
340 #[doc = "Database name."]
341 pub database_name: String,
342}
343#[allow(deprecated)]
344#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
345#[builder(setter(into, strip_option))]
346#[serde(rename_all = "camelCase")]
347#[doc = "Requests database names for given security origin."]
348pub struct RequestDatabaseNames {
349 #[builder(default)]
350 #[serde(skip_serializing_if = "Option::is_none")]
351 #[serde(default)]
352 #[doc = "At least and at most one of securityOrigin, storageKey, or storageBucket must be specified.\n Security origin."]
353 pub security_origin: Option<String>,
354 #[builder(default)]
355 #[serde(skip_serializing_if = "Option::is_none")]
356 #[serde(default)]
357 #[doc = "Storage key."]
358 pub storage_key: Option<String>,
359 #[builder(default)]
360 #[serde(skip_serializing_if = "Option::is_none")]
361 #[doc = "Storage bucket. If not specified, it uses the default bucket."]
362 pub storage_bucket: Option<storage::StorageBucket>,
363}
364#[allow(deprecated)]
365#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
366#[doc = "Clears all entries from an object store."]
367pub struct ClearObjectStoreReturnObject(pub Option<Json>);
368#[allow(deprecated)]
369#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
370#[doc = "Deletes a database."]
371pub struct DeleteDatabaseReturnObject(pub Option<Json>);
372#[allow(deprecated)]
373#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
374#[doc = "Delete a range of entries from an object store"]
375pub struct DeleteObjectStoreEntriesReturnObject(pub Option<Json>);
376#[allow(deprecated)]
377#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
378#[doc = "Disables events from backend."]
379pub struct DisableReturnObject(pub Option<Json>);
380#[allow(deprecated)]
381#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
382#[doc = "Enables events from backend."]
383pub struct EnableReturnObject(pub Option<Json>);
384#[allow(deprecated)]
385#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
386#[serde(rename_all = "camelCase")]
387#[doc = "Requests data from object store or index."]
388pub struct RequestDataReturnObject {
389 #[doc = "Array of object store data entries."]
390 pub object_store_data_entries: Vec<DataEntry>,
391 #[serde(default)]
392 #[doc = "If true, there are more entries to fetch in the given range."]
393 pub has_more: bool,
394}
395#[allow(deprecated)]
396#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
397#[serde(rename_all = "camelCase")]
398#[doc = "Gets metadata of an object store."]
399pub struct GetMetadataReturnObject {
400 #[serde(default)]
401 #[doc = "the entries count"]
402 pub entries_count: JsFloat,
403 #[serde(default)]
404 #[doc = "the current value of key generator, to become the next inserted\n key into the object store. Valid if objectStore.autoIncrement\n is true."]
405 pub key_generator_value: JsFloat,
406}
407#[allow(deprecated)]
408#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
409#[serde(rename_all = "camelCase")]
410#[doc = "Requests database with given name in given frame."]
411pub struct RequestDatabaseReturnObject {
412 #[doc = "Database with an array of object stores."]
413 pub database_with_object_stores: DatabaseWithObjectStores,
414}
415#[allow(deprecated)]
416#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
417#[serde(rename_all = "camelCase")]
418#[doc = "Requests database names for given security origin."]
419pub struct RequestDatabaseNamesReturnObject {
420 #[doc = "Database names for origin."]
421 pub database_names: Vec<String>,
422}
423#[allow(deprecated)]
424impl Method for ClearObjectStore {
425 const NAME: &'static str = "IndexedDB.clearObjectStore";
426 type ReturnObject = ClearObjectStoreReturnObject;
427}
428#[allow(deprecated)]
429impl Method for DeleteDatabase {
430 const NAME: &'static str = "IndexedDB.deleteDatabase";
431 type ReturnObject = DeleteDatabaseReturnObject;
432}
433#[allow(deprecated)]
434impl Method for DeleteObjectStoreEntries {
435 const NAME: &'static str = "IndexedDB.deleteObjectStoreEntries";
436 type ReturnObject = DeleteObjectStoreEntriesReturnObject;
437}
438#[allow(deprecated)]
439impl Method for Disable {
440 const NAME: &'static str = "IndexedDB.disable";
441 type ReturnObject = DisableReturnObject;
442}
443#[allow(deprecated)]
444impl Method for Enable {
445 const NAME: &'static str = "IndexedDB.enable";
446 type ReturnObject = EnableReturnObject;
447}
448#[allow(deprecated)]
449impl Method for RequestData {
450 const NAME: &'static str = "IndexedDB.requestData";
451 type ReturnObject = RequestDataReturnObject;
452}
453#[allow(deprecated)]
454impl Method for GetMetadata {
455 const NAME: &'static str = "IndexedDB.getMetadata";
456 type ReturnObject = GetMetadataReturnObject;
457}
458#[allow(deprecated)]
459impl Method for RequestDatabase {
460 const NAME: &'static str = "IndexedDB.requestDatabase";
461 type ReturnObject = RequestDatabaseReturnObject;
462}
463#[allow(deprecated)]
464impl Method for RequestDatabaseNames {
465 const NAME: &'static str = "IndexedDB.requestDatabaseNames";
466 type ReturnObject = RequestDatabaseNamesReturnObject;
467}
468#[allow(dead_code)]
469pub mod events {
470 #[allow(unused_imports)]
471 use super::super::types::*;
472 #[allow(unused_imports)]
473 use derive_builder::Builder;
474 #[allow(unused_imports)]
475 use serde::{Deserialize, Serialize};
476 #[allow(unused_imports)]
477 use serde_json::Value as Json;
478}