forked from go-rod/rod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.go
89 lines (63 loc) · 2.25 KB
/
io.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
// This file is generated by "./lib/proto/generate"
package proto
/*
IO
Input/Output operations for streams produced by DevTools.
*/
// IOStreamHandle This is either obtained from another method or specified as `blob:<uuid>` where
// `<uuid>` is an UUID of a Blob.
type IOStreamHandle string
// IOClose Close the stream, discard any temporary backing storage.
type IOClose struct {
// Handle Handle of the stream to close.
Handle IOStreamHandle `json:"handle"`
}
// ProtoReq name
func (m IOClose) ProtoReq() string { return "IO.close" }
// Call sends the request
func (m IOClose) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// IORead Read a chunk of the stream
type IORead struct {
// Handle Handle of the stream to read.
Handle IOStreamHandle `json:"handle"`
// Offset (optional) Seek to the specified offset before reading (if not specificed, proceed with offset
// following the last read). Some types of streams may only support sequential reads.
Offset *int `json:"offset,omitempty"`
// Size (optional) Maximum number of bytes to read (left upon the agent discretion if not specified).
Size *int `json:"size,omitempty"`
}
// ProtoReq name
func (m IORead) ProtoReq() string { return "IO.read" }
// Call the request
func (m IORead) Call(c Client) (*IOReadResult, error) {
var res IOReadResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// IOReadResult ...
type IOReadResult struct {
// Base64Encoded (optional) Set if the data is base64-encoded
Base64Encoded bool `json:"base64Encoded,omitempty"`
// Data Data that were read.
Data string `json:"data"`
// EOF Set if the end-of-file condition occurred while reading.
EOF bool `json:"eof"`
}
// IOResolveBlob Return UUID of Blob object specified by a remote object id.
type IOResolveBlob struct {
// ObjectID Object id of a Blob object wrapper.
ObjectID RuntimeRemoteObjectID `json:"objectId"`
}
// ProtoReq name
func (m IOResolveBlob) ProtoReq() string { return "IO.resolveBlob" }
// Call the request
func (m IOResolveBlob) Call(c Client) (*IOResolveBlobResult, error) {
var res IOResolveBlobResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// IOResolveBlobResult ...
type IOResolveBlobResult struct {
// UUID UUID of the specified Blob.
UUID string `json:"uuid"`
}