/
domain.go
333 lines (293 loc) · 12 KB
/
domain.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
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
// Code generated by cdpgen. DO NOT EDIT.
// Package storage implements the Storage domain.
package storage
import (
"context"
"github.com/mafredri/cdp/protocol/internal"
"github.com/mafredri/cdp/rpcc"
)
// domainClient is a client for the Storage domain.
type domainClient struct{ conn *rpcc.Conn }
// NewClient returns a client for the Storage domain with the connection set to conn.
func NewClient(conn *rpcc.Conn) *domainClient {
return &domainClient{conn: conn}
}
// GetStorageKeyForFrame invokes the Storage method. Returns a storage key
// given a frame id.
func (d *domainClient) GetStorageKeyForFrame(ctx context.Context, args *GetStorageKeyForFrameArgs) (reply *GetStorageKeyForFrameReply, err error) {
reply = new(GetStorageKeyForFrameReply)
if args != nil {
err = rpcc.Invoke(ctx, "Storage.getStorageKeyForFrame", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.getStorageKeyForFrame", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "GetStorageKeyForFrame", Err: err}
}
return
}
// ClearDataForOrigin invokes the Storage method. Clears storage for origin.
func (d *domainClient) ClearDataForOrigin(ctx context.Context, args *ClearDataForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.clearDataForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.clearDataForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "ClearDataForOrigin", Err: err}
}
return
}
// GetCookies invokes the Storage method. Returns all browser cookies.
func (d *domainClient) GetCookies(ctx context.Context, args *GetCookiesArgs) (reply *GetCookiesReply, err error) {
reply = new(GetCookiesReply)
if args != nil {
err = rpcc.Invoke(ctx, "Storage.getCookies", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.getCookies", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "GetCookies", Err: err}
}
return
}
// SetCookies invokes the Storage method. Sets given cookies.
func (d *domainClient) SetCookies(ctx context.Context, args *SetCookiesArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.setCookies", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.setCookies", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "SetCookies", Err: err}
}
return
}
// ClearCookies invokes the Storage method. Clears cookies.
func (d *domainClient) ClearCookies(ctx context.Context, args *ClearCookiesArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.clearCookies", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.clearCookies", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "ClearCookies", Err: err}
}
return
}
// GetUsageAndQuota invokes the Storage method. Returns usage and quota in
// bytes.
func (d *domainClient) GetUsageAndQuota(ctx context.Context, args *GetUsageAndQuotaArgs) (reply *GetUsageAndQuotaReply, err error) {
reply = new(GetUsageAndQuotaReply)
if args != nil {
err = rpcc.Invoke(ctx, "Storage.getUsageAndQuota", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.getUsageAndQuota", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "GetUsageAndQuota", Err: err}
}
return
}
// OverrideQuotaForOrigin invokes the Storage method. Override quota for the
// specified origin
func (d *domainClient) OverrideQuotaForOrigin(ctx context.Context, args *OverrideQuotaForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.overrideQuotaForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.overrideQuotaForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "OverrideQuotaForOrigin", Err: err}
}
return
}
// TrackCacheStorageForOrigin invokes the Storage method. Registers origin to
// be notified when an update occurs to its cache storage list.
func (d *domainClient) TrackCacheStorageForOrigin(ctx context.Context, args *TrackCacheStorageForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.trackCacheStorageForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.trackCacheStorageForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "TrackCacheStorageForOrigin", Err: err}
}
return
}
// TrackIndexedDBForOrigin invokes the Storage method. Registers origin to be
// notified when an update occurs to its IndexedDB.
func (d *domainClient) TrackIndexedDBForOrigin(ctx context.Context, args *TrackIndexedDBForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.trackIndexedDBForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.trackIndexedDBForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "TrackIndexedDBForOrigin", Err: err}
}
return
}
// UntrackCacheStorageForOrigin invokes the Storage method. Unregisters origin
// from receiving notifications for cache storage.
func (d *domainClient) UntrackCacheStorageForOrigin(ctx context.Context, args *UntrackCacheStorageForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.untrackCacheStorageForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.untrackCacheStorageForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "UntrackCacheStorageForOrigin", Err: err}
}
return
}
// UntrackIndexedDBForOrigin invokes the Storage method. Unregisters origin
// from receiving notifications for IndexedDB.
func (d *domainClient) UntrackIndexedDBForOrigin(ctx context.Context, args *UntrackIndexedDBForOriginArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.untrackIndexedDBForOrigin", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.untrackIndexedDBForOrigin", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "UntrackIndexedDBForOrigin", Err: err}
}
return
}
// GetTrustTokens invokes the Storage method. Returns the number of stored
// Trust Tokens per issuer for the current browsing context.
func (d *domainClient) GetTrustTokens(ctx context.Context) (reply *GetTrustTokensReply, err error) {
reply = new(GetTrustTokensReply)
err = rpcc.Invoke(ctx, "Storage.getTrustTokens", nil, reply, d.conn)
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "GetTrustTokens", Err: err}
}
return
}
// ClearTrustTokens invokes the Storage method. Removes all Trust Tokens
// issued by the provided issuerOrigin. Leaves other stored data, including the
// issuer's Redemption Records, intact.
func (d *domainClient) ClearTrustTokens(ctx context.Context, args *ClearTrustTokensArgs) (reply *ClearTrustTokensReply, err error) {
reply = new(ClearTrustTokensReply)
if args != nil {
err = rpcc.Invoke(ctx, "Storage.clearTrustTokens", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.clearTrustTokens", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "ClearTrustTokens", Err: err}
}
return
}
// GetInterestGroupDetails invokes the Storage method. Gets details for a
// named interest group.
func (d *domainClient) GetInterestGroupDetails(ctx context.Context, args *GetInterestGroupDetailsArgs) (reply *GetInterestGroupDetailsReply, err error) {
reply = new(GetInterestGroupDetailsReply)
if args != nil {
err = rpcc.Invoke(ctx, "Storage.getInterestGroupDetails", args, reply, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.getInterestGroupDetails", nil, reply, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "GetInterestGroupDetails", Err: err}
}
return
}
// SetInterestGroupTracking invokes the Storage method. Enables/Disables
// issuing of interestGroupAccessed events.
func (d *domainClient) SetInterestGroupTracking(ctx context.Context, args *SetInterestGroupTrackingArgs) (err error) {
if args != nil {
err = rpcc.Invoke(ctx, "Storage.setInterestGroupTracking", args, nil, d.conn)
} else {
err = rpcc.Invoke(ctx, "Storage.setInterestGroupTracking", nil, nil, d.conn)
}
if err != nil {
err = &internal.OpError{Domain: "Storage", Op: "SetInterestGroupTracking", Err: err}
}
return
}
func (d *domainClient) CacheStorageContentUpdated(ctx context.Context) (CacheStorageContentUpdatedClient, error) {
s, err := rpcc.NewStream(ctx, "Storage.cacheStorageContentUpdated", d.conn)
if err != nil {
return nil, err
}
return &cacheStorageContentUpdatedClient{Stream: s}, nil
}
type cacheStorageContentUpdatedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *cacheStorageContentUpdatedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *cacheStorageContentUpdatedClient) Recv() (*CacheStorageContentUpdatedReply, error) {
event := new(CacheStorageContentUpdatedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "Storage", Op: "CacheStorageContentUpdated Recv", Err: err}
}
return event, nil
}
func (d *domainClient) CacheStorageListUpdated(ctx context.Context) (CacheStorageListUpdatedClient, error) {
s, err := rpcc.NewStream(ctx, "Storage.cacheStorageListUpdated", d.conn)
if err != nil {
return nil, err
}
return &cacheStorageListUpdatedClient{Stream: s}, nil
}
type cacheStorageListUpdatedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *cacheStorageListUpdatedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *cacheStorageListUpdatedClient) Recv() (*CacheStorageListUpdatedReply, error) {
event := new(CacheStorageListUpdatedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "Storage", Op: "CacheStorageListUpdated Recv", Err: err}
}
return event, nil
}
func (d *domainClient) IndexedDBContentUpdated(ctx context.Context) (IndexedDBContentUpdatedClient, error) {
s, err := rpcc.NewStream(ctx, "Storage.indexedDBContentUpdated", d.conn)
if err != nil {
return nil, err
}
return &indexedDBContentUpdatedClient{Stream: s}, nil
}
type indexedDBContentUpdatedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *indexedDBContentUpdatedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *indexedDBContentUpdatedClient) Recv() (*IndexedDBContentUpdatedReply, error) {
event := new(IndexedDBContentUpdatedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "Storage", Op: "IndexedDBContentUpdated Recv", Err: err}
}
return event, nil
}
func (d *domainClient) IndexedDBListUpdated(ctx context.Context) (IndexedDBListUpdatedClient, error) {
s, err := rpcc.NewStream(ctx, "Storage.indexedDBListUpdated", d.conn)
if err != nil {
return nil, err
}
return &indexedDBListUpdatedClient{Stream: s}, nil
}
type indexedDBListUpdatedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *indexedDBListUpdatedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *indexedDBListUpdatedClient) Recv() (*IndexedDBListUpdatedReply, error) {
event := new(IndexedDBListUpdatedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "Storage", Op: "IndexedDBListUpdated Recv", Err: err}
}
return event, nil
}
func (d *domainClient) InterestGroupAccessed(ctx context.Context) (InterestGroupAccessedClient, error) {
s, err := rpcc.NewStream(ctx, "Storage.interestGroupAccessed", d.conn)
if err != nil {
return nil, err
}
return &interestGroupAccessedClient{Stream: s}, nil
}
type interestGroupAccessedClient struct{ rpcc.Stream }
// GetStream returns the original Stream for use with cdp.Sync.
func (c *interestGroupAccessedClient) GetStream() rpcc.Stream { return c.Stream }
func (c *interestGroupAccessedClient) Recv() (*InterestGroupAccessedReply, error) {
event := new(InterestGroupAccessedReply)
if err := c.RecvMsg(event); err != nil {
return nil, &internal.OpError{Domain: "Storage", Op: "InterestGroupAccessed Recv", Err: err}
}
return event, nil
}