File: storage.go

package info (click to toggle)
golang-github-chromedp-cdproto 0.0~git20230109.6b041c6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,584 kB
  • sloc: makefile: 2
file content (882 lines) | stat: -rw-r--r-- 30,131 bytes parent folder | download | duplicates (3)
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
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
// Package storage provides the Chrome DevTools Protocol
// commands, types, and events for the Storage domain.
//
// Generated by the cdproto-gen command.
package storage

// Code generated by cdproto-gen. DO NOT EDIT.

import (
	"context"

	"github.com/chromedp/cdproto/cdp"
	"github.com/chromedp/cdproto/network"
)

// GetStorageKeyForFrameParams returns a storage key given a frame id.
type GetStorageKeyForFrameParams struct {
	FrameID cdp.FrameID `json:"frameId"`
}

// GetStorageKeyForFrame returns a storage key given a frame id.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getStorageKeyForFrame
//
// parameters:
//
//	frameID
func GetStorageKeyForFrame(frameID cdp.FrameID) *GetStorageKeyForFrameParams {
	return &GetStorageKeyForFrameParams{
		FrameID: frameID,
	}
}

// GetStorageKeyForFrameReturns return values.
type GetStorageKeyForFrameReturns struct {
	StorageKey SerializedStorageKey `json:"storageKey,omitempty"`
}

// Do executes Storage.getStorageKeyForFrame against the provided context.
//
// returns:
//
//	storageKey
func (p *GetStorageKeyForFrameParams) Do(ctx context.Context) (storageKey SerializedStorageKey, err error) {
	// execute
	var res GetStorageKeyForFrameReturns
	err = cdp.Execute(ctx, CommandGetStorageKeyForFrame, p, &res)
	if err != nil {
		return "", err
	}

	return res.StorageKey, nil
}

// ClearDataForOriginParams clears storage for origin.
type ClearDataForOriginParams struct {
	Origin       string `json:"origin"`       // Security origin.
	StorageTypes string `json:"storageTypes"` // Comma separated list of StorageType to clear.
}

// ClearDataForOrigin clears storage for origin.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-clearDataForOrigin
//
// parameters:
//
//	origin - Security origin.
//	storageTypes - Comma separated list of StorageType to clear.
func ClearDataForOrigin(origin string, storageTypes string) *ClearDataForOriginParams {
	return &ClearDataForOriginParams{
		Origin:       origin,
		StorageTypes: storageTypes,
	}
}

// Do executes Storage.clearDataForOrigin against the provided context.
func (p *ClearDataForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearDataForOrigin, p, nil)
}

// ClearDataForStorageKeyParams clears storage for storage key.
type ClearDataForStorageKeyParams struct {
	StorageKey   string `json:"storageKey"`   // Storage key.
	StorageTypes string `json:"storageTypes"` // Comma separated list of StorageType to clear.
}

// ClearDataForStorageKey clears storage for storage key.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-clearDataForStorageKey
//
// parameters:
//
//	storageKey - Storage key.
//	storageTypes - Comma separated list of StorageType to clear.
func ClearDataForStorageKey(storageKey string, storageTypes string) *ClearDataForStorageKeyParams {
	return &ClearDataForStorageKeyParams{
		StorageKey:   storageKey,
		StorageTypes: storageTypes,
	}
}

// Do executes Storage.clearDataForStorageKey against the provided context.
func (p *ClearDataForStorageKeyParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearDataForStorageKey, p, nil)
}

// GetCookiesParams returns all browser cookies.
type GetCookiesParams struct {
	BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // Browser context to use when called on the browser endpoint.
}

// GetCookies returns all browser cookies.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getCookies
//
// parameters:
func GetCookies() *GetCookiesParams {
	return &GetCookiesParams{}
}

// WithBrowserContextID browser context to use when called on the browser
// endpoint.
func (p GetCookiesParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *GetCookiesParams {
	p.BrowserContextID = browserContextID
	return &p
}

// GetCookiesReturns return values.
type GetCookiesReturns struct {
	Cookies []*network.Cookie `json:"cookies,omitempty"` // Array of cookie objects.
}

// Do executes Storage.getCookies against the provided context.
//
// returns:
//
//	cookies - Array of cookie objects.
func (p *GetCookiesParams) Do(ctx context.Context) (cookies []*network.Cookie, err error) {
	// execute
	var res GetCookiesReturns
	err = cdp.Execute(ctx, CommandGetCookies, p, &res)
	if err != nil {
		return nil, err
	}

	return res.Cookies, nil
}

// SetCookiesParams sets given cookies.
type SetCookiesParams struct {
	Cookies          []*network.CookieParam `json:"cookies"`                    // Cookies to be set.
	BrowserContextID cdp.BrowserContextID   `json:"browserContextId,omitempty"` // Browser context to use when called on the browser endpoint.
}

// SetCookies sets given cookies.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-setCookies
//
// parameters:
//
//	cookies - Cookies to be set.
func SetCookies(cookies []*network.CookieParam) *SetCookiesParams {
	return &SetCookiesParams{
		Cookies: cookies,
	}
}

// WithBrowserContextID browser context to use when called on the browser
// endpoint.
func (p SetCookiesParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *SetCookiesParams {
	p.BrowserContextID = browserContextID
	return &p
}

// Do executes Storage.setCookies against the provided context.
func (p *SetCookiesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetCookies, p, nil)
}

// ClearCookiesParams clears cookies.
type ClearCookiesParams struct {
	BrowserContextID cdp.BrowserContextID `json:"browserContextId,omitempty"` // Browser context to use when called on the browser endpoint.
}

// ClearCookies clears cookies.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-clearCookies
//
// parameters:
func ClearCookies() *ClearCookiesParams {
	return &ClearCookiesParams{}
}

// WithBrowserContextID browser context to use when called on the browser
// endpoint.
func (p ClearCookiesParams) WithBrowserContextID(browserContextID cdp.BrowserContextID) *ClearCookiesParams {
	p.BrowserContextID = browserContextID
	return &p
}

// Do executes Storage.clearCookies against the provided context.
func (p *ClearCookiesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearCookies, p, nil)
}

// GetUsageAndQuotaParams returns usage and quota in bytes.
type GetUsageAndQuotaParams struct {
	Origin string `json:"origin"` // Security origin.
}

// GetUsageAndQuota returns usage and quota in bytes.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getUsageAndQuota
//
// parameters:
//
//	origin - Security origin.
func GetUsageAndQuota(origin string) *GetUsageAndQuotaParams {
	return &GetUsageAndQuotaParams{
		Origin: origin,
	}
}

// GetUsageAndQuotaReturns return values.
type GetUsageAndQuotaReturns struct {
	Usage          float64         `json:"usage,omitempty"`          // Storage usage (bytes).
	Quota          float64         `json:"quota,omitempty"`          // Storage quota (bytes).
	OverrideActive bool            `json:"overrideActive,omitempty"` // Whether or not the origin has an active storage quota override
	UsageBreakdown []*UsageForType `json:"usageBreakdown,omitempty"` // Storage usage per type (bytes).
}

// Do executes Storage.getUsageAndQuota against the provided context.
//
// returns:
//
//	usage - Storage usage (bytes).
//	quota - Storage quota (bytes).
//	overrideActive - Whether or not the origin has an active storage quota override
//	usageBreakdown - Storage usage per type (bytes).
func (p *GetUsageAndQuotaParams) Do(ctx context.Context) (usage float64, quota float64, overrideActive bool, usageBreakdown []*UsageForType, err error) {
	// execute
	var res GetUsageAndQuotaReturns
	err = cdp.Execute(ctx, CommandGetUsageAndQuota, p, &res)
	if err != nil {
		return 0, 0, false, nil, err
	}

	return res.Usage, res.Quota, res.OverrideActive, res.UsageBreakdown, nil
}

// OverrideQuotaForOriginParams override quota for the specified origin.
type OverrideQuotaForOriginParams struct {
	Origin    string  `json:"origin"`              // Security origin.
	QuotaSize float64 `json:"quotaSize,omitempty"` // 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).
}

// OverrideQuotaForOrigin override quota for the specified origin.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-overrideQuotaForOrigin
//
// parameters:
//
//	origin - Security origin.
func OverrideQuotaForOrigin(origin string) *OverrideQuotaForOriginParams {
	return &OverrideQuotaForOriginParams{
		Origin: origin,
	}
}

// WithQuotaSize 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).
func (p OverrideQuotaForOriginParams) WithQuotaSize(quotaSize float64) *OverrideQuotaForOriginParams {
	p.QuotaSize = quotaSize
	return &p
}

// Do executes Storage.overrideQuotaForOrigin against the provided context.
func (p *OverrideQuotaForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandOverrideQuotaForOrigin, p, nil)
}

// TrackCacheStorageForOriginParams registers origin to be notified when an
// update occurs to its cache storage list.
type TrackCacheStorageForOriginParams struct {
	Origin string `json:"origin"` // Security origin.
}

// TrackCacheStorageForOrigin registers origin to be notified when an update
// occurs to its cache storage list.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-trackCacheStorageForOrigin
//
// parameters:
//
//	origin - Security origin.
func TrackCacheStorageForOrigin(origin string) *TrackCacheStorageForOriginParams {
	return &TrackCacheStorageForOriginParams{
		Origin: origin,
	}
}

// Do executes Storage.trackCacheStorageForOrigin against the provided context.
func (p *TrackCacheStorageForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackCacheStorageForOrigin, p, nil)
}

// TrackCacheStorageForStorageKeyParams registers storage key to be notified
// when an update occurs to its cache storage list.
type TrackCacheStorageForStorageKeyParams struct {
	StorageKey string `json:"storageKey"` // Storage key.
}

// TrackCacheStorageForStorageKey registers storage key to be notified when
// an update occurs to its cache storage list.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-trackCacheStorageForStorageKey
//
// parameters:
//
//	storageKey - Storage key.
func TrackCacheStorageForStorageKey(storageKey string) *TrackCacheStorageForStorageKeyParams {
	return &TrackCacheStorageForStorageKeyParams{
		StorageKey: storageKey,
	}
}

// Do executes Storage.trackCacheStorageForStorageKey against the provided context.
func (p *TrackCacheStorageForStorageKeyParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackCacheStorageForStorageKey, p, nil)
}

// TrackIndexedDBForOriginParams registers origin to be notified when an
// update occurs to its IndexedDB.
type TrackIndexedDBForOriginParams struct {
	Origin string `json:"origin"` // Security origin.
}

// TrackIndexedDBForOrigin registers origin to be notified when an update
// occurs to its IndexedDB.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-trackIndexedDBForOrigin
//
// parameters:
//
//	origin - Security origin.
func TrackIndexedDBForOrigin(origin string) *TrackIndexedDBForOriginParams {
	return &TrackIndexedDBForOriginParams{
		Origin: origin,
	}
}

// Do executes Storage.trackIndexedDBForOrigin against the provided context.
func (p *TrackIndexedDBForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackIndexedDBForOrigin, p, nil)
}

// TrackIndexedDBForStorageKeyParams registers storage key to be notified
// when an update occurs to its IndexedDB.
type TrackIndexedDBForStorageKeyParams struct {
	StorageKey string `json:"storageKey"` // Storage key.
}

// TrackIndexedDBForStorageKey registers storage key to be notified when an
// update occurs to its IndexedDB.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-trackIndexedDBForStorageKey
//
// parameters:
//
//	storageKey - Storage key.
func TrackIndexedDBForStorageKey(storageKey string) *TrackIndexedDBForStorageKeyParams {
	return &TrackIndexedDBForStorageKeyParams{
		StorageKey: storageKey,
	}
}

// Do executes Storage.trackIndexedDBForStorageKey against the provided context.
func (p *TrackIndexedDBForStorageKeyParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackIndexedDBForStorageKey, p, nil)
}

// UntrackCacheStorageForOriginParams unregisters origin from receiving
// notifications for cache storage.
type UntrackCacheStorageForOriginParams struct {
	Origin string `json:"origin"` // Security origin.
}

// UntrackCacheStorageForOrigin unregisters origin from receiving
// notifications for cache storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-untrackCacheStorageForOrigin
//
// parameters:
//
//	origin - Security origin.
func UntrackCacheStorageForOrigin(origin string) *UntrackCacheStorageForOriginParams {
	return &UntrackCacheStorageForOriginParams{
		Origin: origin,
	}
}

// Do executes Storage.untrackCacheStorageForOrigin against the provided context.
func (p *UntrackCacheStorageForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackCacheStorageForOrigin, p, nil)
}

// UntrackCacheStorageForStorageKeyParams unregisters storage key from
// receiving notifications for cache storage.
type UntrackCacheStorageForStorageKeyParams struct {
	StorageKey string `json:"storageKey"` // Storage key.
}

// UntrackCacheStorageForStorageKey unregisters storage key from receiving
// notifications for cache storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-untrackCacheStorageForStorageKey
//
// parameters:
//
//	storageKey - Storage key.
func UntrackCacheStorageForStorageKey(storageKey string) *UntrackCacheStorageForStorageKeyParams {
	return &UntrackCacheStorageForStorageKeyParams{
		StorageKey: storageKey,
	}
}

// Do executes Storage.untrackCacheStorageForStorageKey against the provided context.
func (p *UntrackCacheStorageForStorageKeyParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackCacheStorageForStorageKey, p, nil)
}

// UntrackIndexedDBForOriginParams unregisters origin from receiving
// notifications for IndexedDB.
type UntrackIndexedDBForOriginParams struct {
	Origin string `json:"origin"` // Security origin.
}

// UntrackIndexedDBForOrigin unregisters origin from receiving notifications
// for IndexedDB.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-untrackIndexedDBForOrigin
//
// parameters:
//
//	origin - Security origin.
func UntrackIndexedDBForOrigin(origin string) *UntrackIndexedDBForOriginParams {
	return &UntrackIndexedDBForOriginParams{
		Origin: origin,
	}
}

// Do executes Storage.untrackIndexedDBForOrigin against the provided context.
func (p *UntrackIndexedDBForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackIndexedDBForOrigin, p, nil)
}

// UntrackIndexedDBForStorageKeyParams unregisters storage key from receiving
// notifications for IndexedDB.
type UntrackIndexedDBForStorageKeyParams struct {
	StorageKey string `json:"storageKey"` // Storage key.
}

// UntrackIndexedDBForStorageKey unregisters storage key from receiving
// notifications for IndexedDB.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-untrackIndexedDBForStorageKey
//
// parameters:
//
//	storageKey - Storage key.
func UntrackIndexedDBForStorageKey(storageKey string) *UntrackIndexedDBForStorageKeyParams {
	return &UntrackIndexedDBForStorageKeyParams{
		StorageKey: storageKey,
	}
}

// Do executes Storage.untrackIndexedDBForStorageKey against the provided context.
func (p *UntrackIndexedDBForStorageKeyParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackIndexedDBForStorageKey, p, nil)
}

// GetTrustTokensParams returns the number of stored Trust Tokens per issuer
// for the current browsing context.
type GetTrustTokensParams struct{}

// GetTrustTokens returns the number of stored Trust Tokens per issuer for
// the current browsing context.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getTrustTokens
func GetTrustTokens() *GetTrustTokensParams {
	return &GetTrustTokensParams{}
}

// GetTrustTokensReturns return values.
type GetTrustTokensReturns struct {
	Tokens []*TrustTokens `json:"tokens,omitempty"`
}

// Do executes Storage.getTrustTokens against the provided context.
//
// returns:
//
//	tokens
func (p *GetTrustTokensParams) Do(ctx context.Context) (tokens []*TrustTokens, err error) {
	// execute
	var res GetTrustTokensReturns
	err = cdp.Execute(ctx, CommandGetTrustTokens, nil, &res)
	if err != nil {
		return nil, err
	}

	return res.Tokens, nil
}

// ClearTrustTokensParams removes all Trust Tokens issued by the provided
// issuerOrigin. Leaves other stored data, including the issuer's Redemption
// Records, intact.
type ClearTrustTokensParams struct {
	IssuerOrigin string `json:"issuerOrigin"`
}

// ClearTrustTokens removes all Trust Tokens issued by the provided
// issuerOrigin. Leaves other stored data, including the issuer's Redemption
// Records, intact.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-clearTrustTokens
//
// parameters:
//
//	issuerOrigin
func ClearTrustTokens(issuerOrigin string) *ClearTrustTokensParams {
	return &ClearTrustTokensParams{
		IssuerOrigin: issuerOrigin,
	}
}

// ClearTrustTokensReturns return values.
type ClearTrustTokensReturns struct {
	DidDeleteTokens bool `json:"didDeleteTokens,omitempty"` // True if any tokens were deleted, false otherwise.
}

// Do executes Storage.clearTrustTokens against the provided context.
//
// returns:
//
//	didDeleteTokens - True if any tokens were deleted, false otherwise.
func (p *ClearTrustTokensParams) Do(ctx context.Context) (didDeleteTokens bool, err error) {
	// execute
	var res ClearTrustTokensReturns
	err = cdp.Execute(ctx, CommandClearTrustTokens, p, &res)
	if err != nil {
		return false, err
	}

	return res.DidDeleteTokens, nil
}

// GetInterestGroupDetailsParams gets details for a named interest group.
type GetInterestGroupDetailsParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
	Name        string `json:"name"`
}

// GetInterestGroupDetails gets details for a named interest group.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getInterestGroupDetails
//
// parameters:
//
//	ownerOrigin
//	name
func GetInterestGroupDetails(ownerOrigin string, name string) *GetInterestGroupDetailsParams {
	return &GetInterestGroupDetailsParams{
		OwnerOrigin: ownerOrigin,
		Name:        name,
	}
}

// GetInterestGroupDetailsReturns return values.
type GetInterestGroupDetailsReturns struct {
	Details *InterestGroupDetails `json:"details,omitempty"`
}

// Do executes Storage.getInterestGroupDetails against the provided context.
//
// returns:
//
//	details
func (p *GetInterestGroupDetailsParams) Do(ctx context.Context) (details *InterestGroupDetails, err error) {
	// execute
	var res GetInterestGroupDetailsReturns
	err = cdp.Execute(ctx, CommandGetInterestGroupDetails, p, &res)
	if err != nil {
		return nil, err
	}

	return res.Details, nil
}

// SetInterestGroupTrackingParams enables/Disables issuing of
// interestGroupAccessed events.
type SetInterestGroupTrackingParams struct {
	Enable bool `json:"enable"`
}

// SetInterestGroupTracking enables/Disables issuing of interestGroupAccessed
// events.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-setInterestGroupTracking
//
// parameters:
//
//	enable
func SetInterestGroupTracking(enable bool) *SetInterestGroupTrackingParams {
	return &SetInterestGroupTrackingParams{
		Enable: enable,
	}
}

// Do executes Storage.setInterestGroupTracking against the provided context.
func (p *SetInterestGroupTrackingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetInterestGroupTracking, p, nil)
}

// GetSharedStorageMetadataParams gets metadata for an origin's shared
// storage.
type GetSharedStorageMetadataParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
}

// GetSharedStorageMetadata gets metadata for an origin's shared storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getSharedStorageMetadata
//
// parameters:
//
//	ownerOrigin
func GetSharedStorageMetadata(ownerOrigin string) *GetSharedStorageMetadataParams {
	return &GetSharedStorageMetadataParams{
		OwnerOrigin: ownerOrigin,
	}
}

// GetSharedStorageMetadataReturns return values.
type GetSharedStorageMetadataReturns struct {
	Metadata *SharedStorageMetadata `json:"metadata,omitempty"`
}

// Do executes Storage.getSharedStorageMetadata against the provided context.
//
// returns:
//
//	metadata
func (p *GetSharedStorageMetadataParams) Do(ctx context.Context) (metadata *SharedStorageMetadata, err error) {
	// execute
	var res GetSharedStorageMetadataReturns
	err = cdp.Execute(ctx, CommandGetSharedStorageMetadata, p, &res)
	if err != nil {
		return nil, err
	}

	return res.Metadata, nil
}

// GetSharedStorageEntriesParams gets the entries in an given origin's shared
// storage.
type GetSharedStorageEntriesParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
}

// GetSharedStorageEntries gets the entries in an given origin's shared
// storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-getSharedStorageEntries
//
// parameters:
//
//	ownerOrigin
func GetSharedStorageEntries(ownerOrigin string) *GetSharedStorageEntriesParams {
	return &GetSharedStorageEntriesParams{
		OwnerOrigin: ownerOrigin,
	}
}

// GetSharedStorageEntriesReturns return values.
type GetSharedStorageEntriesReturns struct {
	Entries []*SharedStorageEntry `json:"entries,omitempty"`
}

// Do executes Storage.getSharedStorageEntries against the provided context.
//
// returns:
//
//	entries
func (p *GetSharedStorageEntriesParams) Do(ctx context.Context) (entries []*SharedStorageEntry, err error) {
	// execute
	var res GetSharedStorageEntriesReturns
	err = cdp.Execute(ctx, CommandGetSharedStorageEntries, p, &res)
	if err != nil {
		return nil, err
	}

	return res.Entries, nil
}

// SetSharedStorageEntryParams sets entry with key and value for a given
// origin's shared storage.
type SetSharedStorageEntryParams struct {
	OwnerOrigin     string `json:"ownerOrigin"`
	Key             string `json:"key"`
	Value           string `json:"value"`
	IgnoreIfPresent bool   `json:"ignoreIfPresent,omitempty"` // If ignoreIfPresent is included and true, then only sets the entry if key doesn't already exist.
}

// SetSharedStorageEntry sets entry with key and value for a given origin's
// shared storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-setSharedStorageEntry
//
// parameters:
//
//	ownerOrigin
//	key
//	value
func SetSharedStorageEntry(ownerOrigin string, key string, value string) *SetSharedStorageEntryParams {
	return &SetSharedStorageEntryParams{
		OwnerOrigin: ownerOrigin,
		Key:         key,
		Value:       value,
	}
}

// WithIgnoreIfPresent if ignoreIfPresent is included and true, then only
// sets the entry if key doesn't already exist.
func (p SetSharedStorageEntryParams) WithIgnoreIfPresent(ignoreIfPresent bool) *SetSharedStorageEntryParams {
	p.IgnoreIfPresent = ignoreIfPresent
	return &p
}

// Do executes Storage.setSharedStorageEntry against the provided context.
func (p *SetSharedStorageEntryParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetSharedStorageEntry, p, nil)
}

// DeleteSharedStorageEntryParams deletes entry for key (if it exists) for a
// given origin's shared storage.
type DeleteSharedStorageEntryParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
	Key         string `json:"key"`
}

// DeleteSharedStorageEntry deletes entry for key (if it exists) for a given
// origin's shared storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-deleteSharedStorageEntry
//
// parameters:
//
//	ownerOrigin
//	key
func DeleteSharedStorageEntry(ownerOrigin string, key string) *DeleteSharedStorageEntryParams {
	return &DeleteSharedStorageEntryParams{
		OwnerOrigin: ownerOrigin,
		Key:         key,
	}
}

// Do executes Storage.deleteSharedStorageEntry against the provided context.
func (p *DeleteSharedStorageEntryParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeleteSharedStorageEntry, p, nil)
}

// ClearSharedStorageEntriesParams clears all entries for a given origin's
// shared storage.
type ClearSharedStorageEntriesParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
}

// ClearSharedStorageEntries clears all entries for a given origin's shared
// storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-clearSharedStorageEntries
//
// parameters:
//
//	ownerOrigin
func ClearSharedStorageEntries(ownerOrigin string) *ClearSharedStorageEntriesParams {
	return &ClearSharedStorageEntriesParams{
		OwnerOrigin: ownerOrigin,
	}
}

// Do executes Storage.clearSharedStorageEntries against the provided context.
func (p *ClearSharedStorageEntriesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearSharedStorageEntries, p, nil)
}

// ResetSharedStorageBudgetParams resets the budget for ownerOrigin by
// clearing all budget withdrawals.
type ResetSharedStorageBudgetParams struct {
	OwnerOrigin string `json:"ownerOrigin"`
}

// ResetSharedStorageBudget resets the budget for ownerOrigin by clearing all
// budget withdrawals.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-resetSharedStorageBudget
//
// parameters:
//
//	ownerOrigin
func ResetSharedStorageBudget(ownerOrigin string) *ResetSharedStorageBudgetParams {
	return &ResetSharedStorageBudgetParams{
		OwnerOrigin: ownerOrigin,
	}
}

// Do executes Storage.resetSharedStorageBudget against the provided context.
func (p *ResetSharedStorageBudgetParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandResetSharedStorageBudget, p, nil)
}

// SetSharedStorageTrackingParams enables/disables issuing of
// sharedStorageAccessed events.
type SetSharedStorageTrackingParams struct {
	Enable bool `json:"enable"`
}

// SetSharedStorageTracking enables/disables issuing of sharedStorageAccessed
// events.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#method-setSharedStorageTracking
//
// parameters:
//
//	enable
func SetSharedStorageTracking(enable bool) *SetSharedStorageTrackingParams {
	return &SetSharedStorageTrackingParams{
		Enable: enable,
	}
}

// Do executes Storage.setSharedStorageTracking against the provided context.
func (p *SetSharedStorageTrackingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetSharedStorageTracking, p, nil)
}

// Command names.
const (
	CommandGetStorageKeyForFrame            = "Storage.getStorageKeyForFrame"
	CommandClearDataForOrigin               = "Storage.clearDataForOrigin"
	CommandClearDataForStorageKey           = "Storage.clearDataForStorageKey"
	CommandGetCookies                       = "Storage.getCookies"
	CommandSetCookies                       = "Storage.setCookies"
	CommandClearCookies                     = "Storage.clearCookies"
	CommandGetUsageAndQuota                 = "Storage.getUsageAndQuota"
	CommandOverrideQuotaForOrigin           = "Storage.overrideQuotaForOrigin"
	CommandTrackCacheStorageForOrigin       = "Storage.trackCacheStorageForOrigin"
	CommandTrackCacheStorageForStorageKey   = "Storage.trackCacheStorageForStorageKey"
	CommandTrackIndexedDBForOrigin          = "Storage.trackIndexedDBForOrigin"
	CommandTrackIndexedDBForStorageKey      = "Storage.trackIndexedDBForStorageKey"
	CommandUntrackCacheStorageForOrigin     = "Storage.untrackCacheStorageForOrigin"
	CommandUntrackCacheStorageForStorageKey = "Storage.untrackCacheStorageForStorageKey"
	CommandUntrackIndexedDBForOrigin        = "Storage.untrackIndexedDBForOrigin"
	CommandUntrackIndexedDBForStorageKey    = "Storage.untrackIndexedDBForStorageKey"
	CommandGetTrustTokens                   = "Storage.getTrustTokens"
	CommandClearTrustTokens                 = "Storage.clearTrustTokens"
	CommandGetInterestGroupDetails          = "Storage.getInterestGroupDetails"
	CommandSetInterestGroupTracking         = "Storage.setInterestGroupTracking"
	CommandGetSharedStorageMetadata         = "Storage.getSharedStorageMetadata"
	CommandGetSharedStorageEntries          = "Storage.getSharedStorageEntries"
	CommandSetSharedStorageEntry            = "Storage.setSharedStorageEntry"
	CommandDeleteSharedStorageEntry         = "Storage.deleteSharedStorageEntry"
	CommandClearSharedStorageEntries        = "Storage.clearSharedStorageEntries"
	CommandResetSharedStorageBudget         = "Storage.resetSharedStorageBudget"
	CommandSetSharedStorageTracking         = "Storage.setSharedStorageTracking"
)