cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! The `Storage` domain.
//!
//! Types, command parameters and event payloads for the `Storage`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
//!
//! This domain is experimental and may change without notice.

use serde::{Deserialize, Serialize};

pub type SerializedStorageKey = String;

/// Enum of possible storage types.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StorageType {
    /// `cookies`
    #[serde(rename = "cookies")]
    Cookies,
    /// `file_systems`
    #[serde(rename = "file_systems")]
    FileSystems,
    /// `indexeddb`
    #[serde(rename = "indexeddb")]
    Indexeddb,
    /// `local_storage`
    #[serde(rename = "local_storage")]
    LocalStorage,
    /// `shader_cache`
    #[serde(rename = "shader_cache")]
    ShaderCache,
    /// `websql`
    #[serde(rename = "websql")]
    Websql,
    /// `service_workers`
    #[serde(rename = "service_workers")]
    ServiceWorkers,
    /// `cache_storage`
    #[serde(rename = "cache_storage")]
    CacheStorage,
    /// `storage_buckets`
    #[serde(rename = "storage_buckets")]
    StorageBuckets,
    /// `all`
    #[serde(rename = "all")]
    All,
    /// `other`
    #[serde(rename = "other")]
    Other,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Usage for a storage type.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UsageForType {
    /// Name of storage type.
    #[serde(rename = "storageType")]
    pub storage_type: StorageType,
    /// Storage usage (bytes).
    pub usage: f64,
}

/// Pair of issuer origin and number of available (signed, but not used) Trust
/// Tokens from that issuer.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TrustTokens {
    #[serde(rename = "issuerOrigin")]
    pub issuer_origin: String,
    pub count: f64,
}

/// Details of a stored Private Verification Token.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PrivateVerificationToken {
    /// Unique identifier of the token in the database.
    pub id: String,
    /// Origin of the token issuer.
    #[serde(rename = "issuerOrigin")]
    pub issuer_origin: String,
    /// Public key ID used to issue the token.
    #[serde(rename = "keyId")]
    pub key_id: i64,
    /// Expiration timestamp in seconds since the epoch.
    pub expiration: crate::protocol::network::TimeSinceEpoch,
    /// Token creation timestamp in seconds since the epoch.
    #[serde(rename = "creationTime")]
    pub creation_time: crate::protocol::network::TimeSinceEpoch,
    /// Token protocol version.
    pub version: i64,
    /// Base64-encoded serialized token.
    pub token: String,
}

/// Configuration for a Private Verification Tokens issuer.
///
/// Experimental: may change without notice.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PrivateVerificationTokensIssuerConfig {
    /// Origin of the token issuer.
    #[serde(rename = "issuerOrigin")]
    pub issuer_origin: String,
    /// Origins authorized to redeem tokens from this issuer.
    #[serde(rename = "redeemerOrigins")]
    pub redeemer_origins: Vec<String>,
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum StorageBucketsDurability {
    /// `relaxed`
    #[serde(rename = "relaxed")]
    Relaxed,
    /// `strict`
    #[serde(rename = "strict")]
    Strict,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StorageBucket {
    #[serde(rename = "storageKey")]
    pub storage_key: SerializedStorageKey,
    /// If not specified, it is the default bucket of the storageKey.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StorageBucketInfo {
    pub bucket: StorageBucket,
    pub id: String,
    pub expiration: crate::protocol::network::TimeSinceEpoch,
    /// Storage quota (bytes).
    pub quota: f64,
    pub persistent: bool,
    pub durability: StorageBucketsDurability,
}

/// Returns a storage key given a frame id. Deprecated. Please use
/// Storage.getStorageKey instead.
///
/// Deprecated in the protocol.
///
/// Parameters of `Storage.getStorageKeyForFrame`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStorageKeyForFrameParams {
    #[serde(rename = "frameId")]
    pub frame_id: crate::protocol::page::FrameId,
}

/// What `Storage.getStorageKeyForFrame` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStorageKeyForFrameReturns {
    #[serde(rename = "storageKey")]
    pub storage_key: SerializedStorageKey,
}

impl crate::typed::Command for GetStorageKeyForFrameParams {
    const METHOD: &'static str = "Storage.getStorageKeyForFrame";
    type Returns = GetStorageKeyForFrameReturns;
}

/// Returns storage key for the given frame. If no frame ID is provided, the
/// storage key of the target executing this command is returned.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.getStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStorageKeyParams {
    #[serde(rename = "frameId", default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<crate::protocol::page::FrameId>,
}

/// What `Storage.getStorageKey` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetStorageKeyReturns {
    #[serde(rename = "storageKey")]
    pub storage_key: SerializedStorageKey,
}

impl crate::typed::Command for GetStorageKeyParams {
    const METHOD: &'static str = "Storage.getStorageKey";
    type Returns = GetStorageKeyReturns;
}

/// Clears storage for origin.
///
/// Parameters of `Storage.clearDataForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearDataForOriginParams {
    /// Security origin.
    pub origin: String,
    /// Comma separated list of StorageType to clear.
    #[serde(rename = "storageTypes")]
    pub storage_types: String,
}

impl crate::typed::Command for ClearDataForOriginParams {
    const METHOD: &'static str = "Storage.clearDataForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Clears storage for storage key.
///
/// Parameters of `Storage.clearDataForStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearDataForStorageKeyParams {
    /// Storage key.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    /// Comma separated list of StorageType to clear.
    #[serde(rename = "storageTypes")]
    pub storage_types: String,
}

impl crate::typed::Command for ClearDataForStorageKeyParams {
    const METHOD: &'static str = "Storage.clearDataForStorageKey";
    type Returns = crate::typed::NoReturns;
}

/// Returns all browser cookies.
///
/// Parameters of `Storage.getCookies`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCookiesParams {
    /// Browser context to use when called on the browser endpoint.
    #[serde(
        rename = "browserContextId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
}

/// What `Storage.getCookies` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCookiesReturns {
    /// Array of cookie objects.
    pub cookies: Vec<crate::protocol::network::Cookie>,
}

impl crate::typed::Command for GetCookiesParams {
    const METHOD: &'static str = "Storage.getCookies";
    type Returns = GetCookiesReturns;
}

/// Sets given cookies.
///
/// Parameters of `Storage.setCookies`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetCookiesParams {
    /// Cookies to be set.
    pub cookies: Vec<crate::protocol::network::CookieParam>,
    /// Browser context to use when called on the browser endpoint.
    #[serde(
        rename = "browserContextId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
}

impl crate::typed::Command for SetCookiesParams {
    const METHOD: &'static str = "Storage.setCookies";
    type Returns = crate::typed::NoReturns;
}

/// Clears cookies.
///
/// Parameters of `Storage.clearCookies`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearCookiesParams {
    /// Browser context to use when called on the browser endpoint.
    #[serde(
        rename = "browserContextId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub browser_context_id: Option<crate::protocol::browser::BrowserContextId>,
}

impl crate::typed::Command for ClearCookiesParams {
    const METHOD: &'static str = "Storage.clearCookies";
    type Returns = crate::typed::NoReturns;
}

/// Returns usage and quota in bytes.
///
/// Parameters of `Storage.getUsageAndQuota`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetUsageAndQuotaParams {
    /// Security origin.
    pub origin: String,
}

/// What `Storage.getUsageAndQuota` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetUsageAndQuotaReturns {
    /// Storage usage (bytes).
    pub usage: f64,
    /// Storage quota (bytes).
    pub quota: f64,
    /// Whether or not the origin has an active storage quota override
    #[serde(rename = "overrideActive")]
    pub override_active: bool,
    /// Storage usage per type (bytes).
    #[serde(rename = "usageBreakdown")]
    pub usage_breakdown: Vec<UsageForType>,
}

impl crate::typed::Command for GetUsageAndQuotaParams {
    const METHOD: &'static str = "Storage.getUsageAndQuota";
    type Returns = GetUsageAndQuotaReturns;
}

/// Override quota for the specified origin
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.overrideQuotaForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct OverrideQuotaForOriginParams {
    /// Security origin.
    pub origin: String,
    /// The quota size (in bytes) to override the original quota with. If this is
    /// called multiple times, the overridden quota will be equal to the quotaSize
    /// provided in the final call. If this is called without specifying a
    /// quotaSize, the quota will be reset to the default value for the specified
    /// origin. If this is called multiple times with different origins, the
    /// override will be maintained for each origin until it is disabled (called
    /// without a quotaSize).
    #[serde(rename = "quotaSize", default, skip_serializing_if = "Option::is_none")]
    pub quota_size: Option<f64>,
}

impl crate::typed::Command for OverrideQuotaForOriginParams {
    const METHOD: &'static str = "Storage.overrideQuotaForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Registers origin to be notified when an update occurs to its cache storage
/// list.
///
/// Parameters of `Storage.trackCacheStorageForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TrackCacheStorageForOriginParams {
    /// Security origin.
    pub origin: String,
}

impl crate::typed::Command for TrackCacheStorageForOriginParams {
    const METHOD: &'static str = "Storage.trackCacheStorageForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Registers storage key to be notified when an update occurs to its cache
/// storage list.
///
/// Parameters of `Storage.trackCacheStorageForStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TrackCacheStorageForStorageKeyParams {
    /// Storage key.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
}

impl crate::typed::Command for TrackCacheStorageForStorageKeyParams {
    const METHOD: &'static str = "Storage.trackCacheStorageForStorageKey";
    type Returns = crate::typed::NoReturns;
}

/// Registers origin to be notified when an update occurs to its IndexedDB.
///
/// Parameters of `Storage.trackIndexedDBForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TrackIndexedDbForOriginParams {
    /// Security origin.
    pub origin: String,
}

impl crate::typed::Command for TrackIndexedDbForOriginParams {
    const METHOD: &'static str = "Storage.trackIndexedDBForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Registers storage key to be notified when an update occurs to its
/// IndexedDB.
///
/// Parameters of `Storage.trackIndexedDBForStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct TrackIndexedDbForStorageKeyParams {
    /// Storage key.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
}

impl crate::typed::Command for TrackIndexedDbForStorageKeyParams {
    const METHOD: &'static str = "Storage.trackIndexedDBForStorageKey";
    type Returns = crate::typed::NoReturns;
}

/// Unregisters origin from receiving notifications for cache storage.
///
/// Parameters of `Storage.untrackCacheStorageForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UntrackCacheStorageForOriginParams {
    /// Security origin.
    pub origin: String,
}

impl crate::typed::Command for UntrackCacheStorageForOriginParams {
    const METHOD: &'static str = "Storage.untrackCacheStorageForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Unregisters storage key from receiving notifications for cache storage.
///
/// Parameters of `Storage.untrackCacheStorageForStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UntrackCacheStorageForStorageKeyParams {
    /// Storage key.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
}

impl crate::typed::Command for UntrackCacheStorageForStorageKeyParams {
    const METHOD: &'static str = "Storage.untrackCacheStorageForStorageKey";
    type Returns = crate::typed::NoReturns;
}

/// Unregisters origin from receiving notifications for IndexedDB.
///
/// Parameters of `Storage.untrackIndexedDBForOrigin`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UntrackIndexedDbForOriginParams {
    /// Security origin.
    pub origin: String,
}

impl crate::typed::Command for UntrackIndexedDbForOriginParams {
    const METHOD: &'static str = "Storage.untrackIndexedDBForOrigin";
    type Returns = crate::typed::NoReturns;
}

/// Unregisters storage key from receiving notifications for IndexedDB.
///
/// Parameters of `Storage.untrackIndexedDBForStorageKey`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct UntrackIndexedDbForStorageKeyParams {
    /// Storage key.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
}

impl crate::typed::Command for UntrackIndexedDbForStorageKeyParams {
    const METHOD: &'static str = "Storage.untrackIndexedDBForStorageKey";
    type Returns = crate::typed::NoReturns;
}

/// Returns the number of stored Trust Tokens per issuer for the current
/// browsing context.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.getTrustTokens`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTrustTokensParams {}

/// What `Storage.getTrustTokens` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetTrustTokensReturns {
    pub tokens: Vec<TrustTokens>,
}

impl crate::typed::Command for GetTrustTokensParams {
    const METHOD: &'static str = "Storage.getTrustTokens";
    type Returns = GetTrustTokensReturns;
}

/// Removes all Trust Tokens issued by the provided issuerOrigin. Leaves other
/// stored data, including the issuer's Redemption Records, intact.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.clearTrustTokens`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearTrustTokensParams {
    #[serde(rename = "issuerOrigin")]
    pub issuer_origin: String,
}

/// What `Storage.clearTrustTokens` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearTrustTokensReturns {
    /// True if any tokens were deleted, false otherwise.
    #[serde(rename = "didDeleteTokens")]
    pub did_delete_tokens: bool,
}

impl crate::typed::Command for ClearTrustTokensParams {
    const METHOD: &'static str = "Storage.clearTrustTokens";
    type Returns = ClearTrustTokensReturns;
}

/// Returns all stored Private Verification Tokens for the current browsing
/// context.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.getPrivateVerificationTokens`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPrivateVerificationTokensParams {}

/// What `Storage.getPrivateVerificationTokens` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPrivateVerificationTokensReturns {
    pub tokens: Vec<PrivateVerificationToken>,
}

impl crate::typed::Command for GetPrivateVerificationTokensParams {
    const METHOD: &'static str = "Storage.getPrivateVerificationTokens";
    type Returns = GetPrivateVerificationTokensReturns;
}

/// Returns the configured Private Verification Tokens issuers and their
/// redeemer origins.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.getPrivateVerificationTokensIssuerConfigs`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPrivateVerificationTokensIssuerConfigsParams {}

/// What `Storage.getPrivateVerificationTokensIssuerConfigs` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetPrivateVerificationTokensIssuerConfigsReturns {
    pub configs: Vec<PrivateVerificationTokensIssuerConfig>,
}

impl crate::typed::Command for GetPrivateVerificationTokensIssuerConfigsParams {
    const METHOD: &'static str = "Storage.getPrivateVerificationTokensIssuerConfigs";
    type Returns = GetPrivateVerificationTokensIssuerConfigsReturns;
}

/// Removes all Private Verification Tokens issued by the provided
/// issuerOrigin.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.clearPrivateVerificationTokens`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearPrivateVerificationTokensParams {
    #[serde(rename = "issuerOrigin")]
    pub issuer_origin: String,
}

impl crate::typed::Command for ClearPrivateVerificationTokensParams {
    const METHOD: &'static str = "Storage.clearPrivateVerificationTokens";
    type Returns = crate::typed::NoReturns;
}

/// Removes a specific Private Verification Token by its ID.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.deletePrivateVerificationToken`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DeletePrivateVerificationTokenParams {
    #[serde(rename = "tokenId")]
    pub token_id: String,
}

impl crate::typed::Command for DeletePrivateVerificationTokenParams {
    const METHOD: &'static str = "Storage.deletePrivateVerificationToken";
    type Returns = crate::typed::NoReturns;
}

/// Set tracking for Private Verification Tokens.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.setPrivateVerificationTokensTracking`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetPrivateVerificationTokensTrackingParams {
    pub enable: bool,
}

impl crate::typed::Command for SetPrivateVerificationTokensTrackingParams {
    const METHOD: &'static str = "Storage.setPrivateVerificationTokensTracking";
    type Returns = crate::typed::NoReturns;
}

/// Set tracking for a storage key's buckets.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.setStorageBucketTracking`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetStorageBucketTrackingParams {
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    pub enable: bool,
}

impl crate::typed::Command for SetStorageBucketTrackingParams {
    const METHOD: &'static str = "Storage.setStorageBucketTracking";
    type Returns = crate::typed::NoReturns;
}

/// Deletes the Storage Bucket with the given storage key and bucket name.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.deleteStorageBucket`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DeleteStorageBucketParams {
    pub bucket: StorageBucket,
}

impl crate::typed::Command for DeleteStorageBucketParams {
    const METHOD: &'static str = "Storage.deleteStorageBucket";
    type Returns = crate::typed::NoReturns;
}

/// Deletes state for sites identified as potential bounce trackers,
/// immediately.
///
/// Experimental: may change without notice.
///
/// Parameters of `Storage.runBounceTrackingMitigations`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RunBounceTrackingMitigationsParams {}

/// What `Storage.runBounceTrackingMitigations` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RunBounceTrackingMitigationsReturns {
    #[serde(rename = "deletedSites")]
    pub deleted_sites: Vec<String>,
}

impl crate::typed::Command for RunBounceTrackingMitigationsParams {
    const METHOD: &'static str = "Storage.runBounceTrackingMitigations";
    type Returns = RunBounceTrackingMitigationsReturns;
}

/// A cache's contents have been modified.
///
/// Payload of the `Storage.cacheStorageContentUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CacheStorageContentUpdatedEvent {
    /// Origin to update.
    pub origin: String,
    /// Storage key to update.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    /// Storage bucket to update.
    #[serde(rename = "bucketId")]
    pub bucket_id: String,
    /// Name of cache in origin.
    #[serde(rename = "cacheName")]
    pub cache_name: String,
}

impl crate::typed::Event for CacheStorageContentUpdatedEvent {
    const METHOD: &'static str = "Storage.cacheStorageContentUpdated";
}

/// A cache has been added/deleted.
///
/// Payload of the `Storage.cacheStorageListUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CacheStorageListUpdatedEvent {
    /// Origin to update.
    pub origin: String,
    /// Storage key to update.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    /// Storage bucket to update.
    #[serde(rename = "bucketId")]
    pub bucket_id: String,
}

impl crate::typed::Event for CacheStorageListUpdatedEvent {
    const METHOD: &'static str = "Storage.cacheStorageListUpdated";
}

/// The origin's IndexedDB object store has been modified.
///
/// Payload of the `Storage.indexedDBContentUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct IndexedDbContentUpdatedEvent {
    /// Origin to update.
    pub origin: String,
    /// Storage key to update.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    /// Storage bucket to update.
    #[serde(rename = "bucketId")]
    pub bucket_id: String,
    /// Database to update.
    #[serde(rename = "databaseName")]
    pub database_name: String,
    /// ObjectStore to update.
    #[serde(rename = "objectStoreName")]
    pub object_store_name: String,
}

impl crate::typed::Event for IndexedDbContentUpdatedEvent {
    const METHOD: &'static str = "Storage.indexedDBContentUpdated";
}

/// The origin's IndexedDB database list has been modified.
///
/// Payload of the `Storage.indexedDBListUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct IndexedDbListUpdatedEvent {
    /// Origin to update.
    pub origin: String,
    /// Storage key to update.
    #[serde(rename = "storageKey")]
    pub storage_key: String,
    /// Storage bucket to update.
    #[serde(rename = "bucketId")]
    pub bucket_id: String,
}

impl crate::typed::Event for IndexedDbListUpdatedEvent {
    const METHOD: &'static str = "Storage.indexedDBListUpdated";
}

/// Payload of the `Storage.storageBucketCreatedOrUpdated` event.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct StorageBucketCreatedOrUpdatedEvent {
    #[serde(rename = "bucketInfo")]
    pub bucket_info: StorageBucketInfo,
}

impl crate::typed::Event for StorageBucketCreatedOrUpdatedEvent {
    const METHOD: &'static str = "Storage.storageBucketCreatedOrUpdated";
}

/// Payload of the `Storage.storageBucketDeleted` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct StorageBucketDeletedEvent {
    #[serde(rename = "bucketId")]
    pub bucket_id: String,
}

impl crate::typed::Event for StorageBucketDeletedEvent {
    const METHOD: &'static str = "Storage.storageBucketDeleted";
}

/// Private Verification Tokens have been stored or deleted.
///
/// Experimental: may change without notice.
///
/// Payload of the `Storage.privateVerificationTokensUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PrivateVerificationTokensUpdatedEvent {}

impl crate::typed::Event for PrivateVerificationTokensUpdatedEvent {
    const METHOD: &'static str = "Storage.privateVerificationTokensUpdated";
}