File: types.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 (337 lines) | stat: -rw-r--r-- 13,996 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
package storage

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

import (
	"fmt"

	"github.com/chromedp/cdproto/cdp"
	"github.com/mailru/easyjson"
	"github.com/mailru/easyjson/jlexer"
	"github.com/mailru/easyjson/jwriter"
)

// SerializedStorageKey [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SerializedStorageKey
type SerializedStorageKey string

// String returns the SerializedStorageKey as string value.
func (t SerializedStorageKey) String() string {
	return string(t)
}

// Type enum of possible storage types.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-StorageType
type Type string

// String returns the Type as string value.
func (t Type) String() string {
	return string(t)
}

// Type values.
const (
	TypeAppcache       Type = "appcache"
	TypeCookies        Type = "cookies"
	TypeFileSystems    Type = "file_systems"
	TypeIndexeddb      Type = "indexeddb"
	TypeLocalStorage   Type = "local_storage"
	TypeShaderCache    Type = "shader_cache"
	TypeWebsql         Type = "websql"
	TypeServiceWorkers Type = "service_workers"
	TypeCacheStorage   Type = "cache_storage"
	TypeInterestGroups Type = "interest_groups"
	TypeSharedStorage  Type = "shared_storage"
	TypeAll            Type = "all"
	TypeOther          Type = "other"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t Type) MarshalEasyJSON(out *jwriter.Writer) {
	out.String(string(t))
}

// MarshalJSON satisfies json.Marshaler.
func (t Type) MarshalJSON() ([]byte, error) {
	return easyjson.Marshal(t)
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *Type) UnmarshalEasyJSON(in *jlexer.Lexer) {
	v := in.String()
	switch Type(v) {
	case TypeAppcache:
		*t = TypeAppcache
	case TypeCookies:
		*t = TypeCookies
	case TypeFileSystems:
		*t = TypeFileSystems
	case TypeIndexeddb:
		*t = TypeIndexeddb
	case TypeLocalStorage:
		*t = TypeLocalStorage
	case TypeShaderCache:
		*t = TypeShaderCache
	case TypeWebsql:
		*t = TypeWebsql
	case TypeServiceWorkers:
		*t = TypeServiceWorkers
	case TypeCacheStorage:
		*t = TypeCacheStorage
	case TypeInterestGroups:
		*t = TypeInterestGroups
	case TypeSharedStorage:
		*t = TypeSharedStorage
	case TypeAll:
		*t = TypeAll
	case TypeOther:
		*t = TypeOther

	default:
		in.AddError(fmt.Errorf("unknown Type value: %v", v))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func (t *Type) UnmarshalJSON(buf []byte) error {
	return easyjson.Unmarshal(buf, t)
}

// UsageForType usage for a storage type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-UsageForType
type UsageForType struct {
	StorageType Type    `json:"storageType"` // Name of storage type.
	Usage       float64 `json:"usage"`       // Storage usage (bytes).
}

// TrustTokens pair of issuer origin and number of available (signed, but not
// used) Trust Tokens from that issuer.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-TrustTokens
type TrustTokens struct {
	IssuerOrigin string  `json:"issuerOrigin"`
	Count        float64 `json:"count"`
}

// InterestGroupAccessType enum of interest group access types.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-InterestGroupAccessType
type InterestGroupAccessType string

// String returns the InterestGroupAccessType as string value.
func (t InterestGroupAccessType) String() string {
	return string(t)
}

// InterestGroupAccessType values.
const (
	InterestGroupAccessTypeJoin   InterestGroupAccessType = "join"
	InterestGroupAccessTypeLeave  InterestGroupAccessType = "leave"
	InterestGroupAccessTypeUpdate InterestGroupAccessType = "update"
	InterestGroupAccessTypeLoaded InterestGroupAccessType = "loaded"
	InterestGroupAccessTypeBid    InterestGroupAccessType = "bid"
	InterestGroupAccessTypeWin    InterestGroupAccessType = "win"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InterestGroupAccessType) MarshalEasyJSON(out *jwriter.Writer) {
	out.String(string(t))
}

// MarshalJSON satisfies json.Marshaler.
func (t InterestGroupAccessType) MarshalJSON() ([]byte, error) {
	return easyjson.Marshal(t)
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InterestGroupAccessType) UnmarshalEasyJSON(in *jlexer.Lexer) {
	v := in.String()
	switch InterestGroupAccessType(v) {
	case InterestGroupAccessTypeJoin:
		*t = InterestGroupAccessTypeJoin
	case InterestGroupAccessTypeLeave:
		*t = InterestGroupAccessTypeLeave
	case InterestGroupAccessTypeUpdate:
		*t = InterestGroupAccessTypeUpdate
	case InterestGroupAccessTypeLoaded:
		*t = InterestGroupAccessTypeLoaded
	case InterestGroupAccessTypeBid:
		*t = InterestGroupAccessTypeBid
	case InterestGroupAccessTypeWin:
		*t = InterestGroupAccessTypeWin

	default:
		in.AddError(fmt.Errorf("unknown InterestGroupAccessType value: %v", v))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InterestGroupAccessType) UnmarshalJSON(buf []byte) error {
	return easyjson.Unmarshal(buf, t)
}

// InterestGroupAd ad advertising element inside an interest group.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-InterestGroupAd
type InterestGroupAd struct {
	RenderURL string `json:"renderUrl"`
	Metadata  string `json:"metadata,omitempty"`
}

// InterestGroupDetails the full details of an interest group.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-InterestGroupDetails
type InterestGroupDetails struct {
	OwnerOrigin               string              `json:"ownerOrigin"`
	Name                      string              `json:"name"`
	ExpirationTime            *cdp.TimeSinceEpoch `json:"expirationTime"`
	JoiningOrigin             string              `json:"joiningOrigin"`
	BiddingURL                string              `json:"biddingUrl,omitempty"`
	BiddingWasmHelperURL      string              `json:"biddingWasmHelperUrl,omitempty"`
	UpdateURL                 string              `json:"updateUrl,omitempty"`
	TrustedBiddingSignalsURL  string              `json:"trustedBiddingSignalsUrl,omitempty"`
	TrustedBiddingSignalsKeys []string            `json:"trustedBiddingSignalsKeys"`
	UserBiddingSignals        string              `json:"userBiddingSignals,omitempty"`
	Ads                       []*InterestGroupAd  `json:"ads"`
	AdComponents              []*InterestGroupAd  `json:"adComponents"`
}

// SharedStorageAccessType enum of shared storage access types.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageAccessType
type SharedStorageAccessType string

// String returns the SharedStorageAccessType as string value.
func (t SharedStorageAccessType) String() string {
	return string(t)
}

// SharedStorageAccessType values.
const (
	SharedStorageAccessTypeDocumentAddModule      SharedStorageAccessType = "documentAddModule"
	SharedStorageAccessTypeDocumentSelectURL      SharedStorageAccessType = "documentSelectURL"
	SharedStorageAccessTypeDocumentRun            SharedStorageAccessType = "documentRun"
	SharedStorageAccessTypeDocumentSet            SharedStorageAccessType = "documentSet"
	SharedStorageAccessTypeDocumentAppend         SharedStorageAccessType = "documentAppend"
	SharedStorageAccessTypeDocumentDelete         SharedStorageAccessType = "documentDelete"
	SharedStorageAccessTypeDocumentClear          SharedStorageAccessType = "documentClear"
	SharedStorageAccessTypeWorkletSet             SharedStorageAccessType = "workletSet"
	SharedStorageAccessTypeWorkletAppend          SharedStorageAccessType = "workletAppend"
	SharedStorageAccessTypeWorkletDelete          SharedStorageAccessType = "workletDelete"
	SharedStorageAccessTypeWorkletClear           SharedStorageAccessType = "workletClear"
	SharedStorageAccessTypeWorkletGet             SharedStorageAccessType = "workletGet"
	SharedStorageAccessTypeWorkletKeys            SharedStorageAccessType = "workletKeys"
	SharedStorageAccessTypeWorkletEntries         SharedStorageAccessType = "workletEntries"
	SharedStorageAccessTypeWorkletLength          SharedStorageAccessType = "workletLength"
	SharedStorageAccessTypeWorkletRemainingBudget SharedStorageAccessType = "workletRemainingBudget"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t SharedStorageAccessType) MarshalEasyJSON(out *jwriter.Writer) {
	out.String(string(t))
}

// MarshalJSON satisfies json.Marshaler.
func (t SharedStorageAccessType) MarshalJSON() ([]byte, error) {
	return easyjson.Marshal(t)
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *SharedStorageAccessType) UnmarshalEasyJSON(in *jlexer.Lexer) {
	v := in.String()
	switch SharedStorageAccessType(v) {
	case SharedStorageAccessTypeDocumentAddModule:
		*t = SharedStorageAccessTypeDocumentAddModule
	case SharedStorageAccessTypeDocumentSelectURL:
		*t = SharedStorageAccessTypeDocumentSelectURL
	case SharedStorageAccessTypeDocumentRun:
		*t = SharedStorageAccessTypeDocumentRun
	case SharedStorageAccessTypeDocumentSet:
		*t = SharedStorageAccessTypeDocumentSet
	case SharedStorageAccessTypeDocumentAppend:
		*t = SharedStorageAccessTypeDocumentAppend
	case SharedStorageAccessTypeDocumentDelete:
		*t = SharedStorageAccessTypeDocumentDelete
	case SharedStorageAccessTypeDocumentClear:
		*t = SharedStorageAccessTypeDocumentClear
	case SharedStorageAccessTypeWorkletSet:
		*t = SharedStorageAccessTypeWorkletSet
	case SharedStorageAccessTypeWorkletAppend:
		*t = SharedStorageAccessTypeWorkletAppend
	case SharedStorageAccessTypeWorkletDelete:
		*t = SharedStorageAccessTypeWorkletDelete
	case SharedStorageAccessTypeWorkletClear:
		*t = SharedStorageAccessTypeWorkletClear
	case SharedStorageAccessTypeWorkletGet:
		*t = SharedStorageAccessTypeWorkletGet
	case SharedStorageAccessTypeWorkletKeys:
		*t = SharedStorageAccessTypeWorkletKeys
	case SharedStorageAccessTypeWorkletEntries:
		*t = SharedStorageAccessTypeWorkletEntries
	case SharedStorageAccessTypeWorkletLength:
		*t = SharedStorageAccessTypeWorkletLength
	case SharedStorageAccessTypeWorkletRemainingBudget:
		*t = SharedStorageAccessTypeWorkletRemainingBudget

	default:
		in.AddError(fmt.Errorf("unknown SharedStorageAccessType value: %v", v))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func (t *SharedStorageAccessType) UnmarshalJSON(buf []byte) error {
	return easyjson.Unmarshal(buf, t)
}

// SharedStorageEntry struct for a single key-value pair in an origin's
// shared storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageEntry
type SharedStorageEntry struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

// SharedStorageMetadata details for an origin's shared storage.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageMetadata
type SharedStorageMetadata struct {
	CreationTime    *cdp.TimeSinceEpoch `json:"creationTime"`
	Length          int64               `json:"length"`
	RemainingBudget float64             `json:"remainingBudget"`
}

// SharedStorageReportingMetadata pair of reporting metadata details for a
// candidate URL for selectURL().
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageReportingMetadata
type SharedStorageReportingMetadata struct {
	EventType    string `json:"eventType"`
	ReportingURL string `json:"reportingUrl"`
}

// SharedStorageURLWithMetadata bundles a candidate URL with its reporting
// metadata.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageUrlWithMetadata
type SharedStorageURLWithMetadata struct {
	URL               string                            `json:"url"`               // Spec of candidate URL.
	ReportingMetadata []*SharedStorageReportingMetadata `json:"reportingMetadata"` // Any associated reporting metadata.
}

// SharedStorageAccessParams bundles the parameters for shared storage access
// events whose presence/absence can vary according to SharedStorageAccessType.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Storage#type-SharedStorageAccessParams
type SharedStorageAccessParams struct {
	ScriptSourceURL  string                          `json:"scriptSourceUrl,omitempty"`  // Spec of the module script URL. Present only for SharedStorageAccessType.documentAddModule.
	OperationName    string                          `json:"operationName,omitempty"`    // Name of the registered operation to be run. Present only for SharedStorageAccessType.documentRun and SharedStorageAccessType.documentSelectURL.
	SerializedData   string                          `json:"serializedData,omitempty"`   // The operation's serialized data in bytes (converted to a string). Present only for SharedStorageAccessType.documentRun and SharedStorageAccessType.documentSelectURL.
	UrlsWithMetadata []*SharedStorageURLWithMetadata `json:"urlsWithMetadata,omitempty"` // Array of candidate URLs' specs, along with any associated metadata. Present only for SharedStorageAccessType.documentSelectURL.
	Key              string                          `json:"key,omitempty"`              // Key for a specific entry in an origin's shared storage. Present only for SharedStorageAccessType.documentSet, SharedStorageAccessType.documentAppend, SharedStorageAccessType.documentDelete, SharedStorageAccessType.workletSet, SharedStorageAccessType.workletAppend, SharedStorageAccessType.workletDelete, and SharedStorageAccessType.workletGet.
	Value            string                          `json:"value,omitempty"`            // Value for a specific entry in an origin's shared storage. Present only for SharedStorageAccessType.documentSet, SharedStorageAccessType.documentAppend, SharedStorageAccessType.workletSet, and SharedStorageAccessType.workletAppend.
	IgnoreIfPresent  bool                            `json:"ignoreIfPresent,omitempty"`  // Whether or not to set an entry for a key if that key is already present. Present only for SharedStorageAccessType.documentSet and SharedStorageAccessType.workletSet.
}