/
domstorage.go
171 lines (147 loc) · 4.7 KB
/
domstorage.go
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
// Package domstorage provides the Chrome DevTools Protocol
// commands, types, and events for the DOMStorage domain.
//
// Query and modify DOM storage.
//
// Generated by the cdproto-gen command.
package domstorage
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/goconnectx/cdproto/cdp"
)
// ClearParams [no description].
type ClearParams struct {
StorageID *StorageID `json:"storageId"`
}
// Clear [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-clear
//
// parameters:
// storageID
func Clear(storageID *StorageID) *ClearParams {
return &ClearParams{
StorageID: storageID,
}
}
// Do executes DOMStorage.clear against the provided context.
func (p *ClearParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClear, p, nil)
}
// DisableParams disables storage tracking, prevents storage events from
// being sent to the client.
type DisableParams struct{}
// Disable disables storage tracking, prevents storage events from being sent
// to the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes DOMStorage.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables storage tracking, storage events will now be
// delivered to the client.
type EnableParams struct{}
// Enable enables storage tracking, storage events will now be delivered to
// the client.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes DOMStorage.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// GetDOMStorageItemsParams [no description].
type GetDOMStorageItemsParams struct {
StorageID *StorageID `json:"storageId"`
}
// GetDOMStorageItems [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-getDOMStorageItems
//
// parameters:
// storageID
func GetDOMStorageItems(storageID *StorageID) *GetDOMStorageItemsParams {
return &GetDOMStorageItemsParams{
StorageID: storageID,
}
}
// GetDOMStorageItemsReturns return values.
type GetDOMStorageItemsReturns struct {
Entries []Item `json:"entries,omitempty"`
}
// Do executes DOMStorage.getDOMStorageItems against the provided context.
//
// returns:
// entries
func (p *GetDOMStorageItemsParams) Do(ctx context.Context) (entries []Item, err error) {
// execute
var res GetDOMStorageItemsReturns
err = cdp.Execute(ctx, CommandGetDOMStorageItems, p, &res)
if err != nil {
return nil, err
}
return res.Entries, nil
}
// RemoveDOMStorageItemParams [no description].
type RemoveDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
}
// RemoveDOMStorageItem [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-removeDOMStorageItem
//
// parameters:
// storageID
// key
func RemoveDOMStorageItem(storageID *StorageID, key string) *RemoveDOMStorageItemParams {
return &RemoveDOMStorageItemParams{
StorageID: storageID,
Key: key,
}
}
// Do executes DOMStorage.removeDOMStorageItem against the provided context.
func (p *RemoveDOMStorageItemParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandRemoveDOMStorageItem, p, nil)
}
// SetDOMStorageItemParams [no description].
type SetDOMStorageItemParams struct {
StorageID *StorageID `json:"storageId"`
Key string `json:"key"`
Value string `json:"value"`
}
// SetDOMStorageItem [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOMStorage#method-setDOMStorageItem
//
// parameters:
// storageID
// key
// value
func SetDOMStorageItem(storageID *StorageID, key string, value string) *SetDOMStorageItemParams {
return &SetDOMStorageItemParams{
StorageID: storageID,
Key: key,
Value: value,
}
}
// Do executes DOMStorage.setDOMStorageItem against the provided context.
func (p *SetDOMStorageItemParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandSetDOMStorageItem, p, nil)
}
// Command names.
const (
CommandClear = "DOMStorage.clear"
CommandDisable = "DOMStorage.disable"
CommandEnable = "DOMStorage.enable"
CommandGetDOMStorageItems = "DOMStorage.getDOMStorageItems"
CommandRemoveDOMStorageItem = "DOMStorage.removeDOMStorageItem"
CommandSetDOMStorageItem = "DOMStorage.setDOMStorageItem"
)