-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdisplay.go
More file actions
403 lines (348 loc) · 12.2 KB
/
display.go
File metadata and controls
403 lines (348 loc) · 12.2 KB
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
// Code generated by Fern. DO NOT EDIT.
package api
import (
json "encoding/json"
fmt "fmt"
internal "github.com/agent-infra/sandbox-sdk-go/internal"
big "math/big"
)
var (
displayRecordRequestFieldAction = big.NewInt(1 << 0)
displayRecordRequestFieldSavePath = big.NewInt(1 << 1)
displayRecordRequestFieldFps = big.NewInt(1 << 2)
displayRecordRequestFieldCrf = big.NewInt(1 << 3)
displayRecordRequestFieldMaxDuration = big.NewInt(1 << 4)
displayRecordRequestFieldWidth = big.NewInt(1 << 5)
displayRecordRequestFieldHeight = big.NewInt(1 << 6)
)
type DisplayRecordRequest struct {
// Recording action: start, stop, or status
Action DisplayRecordRequestAction `json:"action" url:"-"`
// Output file path (default: /tmp/recordings/recording_{timestamp}.mp4)
SavePath *string `json:"save_path,omitempty" url:"-"`
// Frames per second
Fps *int `json:"fps,omitempty" url:"-"`
// H.264 CRF quality (0=lossless, 51=worst)
Crf *int `json:"crf,omitempty" url:"-"`
// Max recording duration in seconds
MaxDuration *float64 `json:"max_duration,omitempty" url:"-"`
// Video width in pixels (auto-detected from X11 if omitted)
Width *int `json:"width,omitempty" url:"-"`
// Video height in pixels (auto-detected from X11 if omitted)
Height *int `json:"height,omitempty" url:"-"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
}
func (d *DisplayRecordRequest) require(field *big.Int) {
if d.explicitFields == nil {
d.explicitFields = big.NewInt(0)
}
d.explicitFields.Or(d.explicitFields, field)
}
// SetAction sets the Action field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetAction(action DisplayRecordRequestAction) {
d.Action = action
d.require(displayRecordRequestFieldAction)
}
// SetSavePath sets the SavePath field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetSavePath(savePath *string) {
d.SavePath = savePath
d.require(displayRecordRequestFieldSavePath)
}
// SetFps sets the Fps field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetFps(fps *int) {
d.Fps = fps
d.require(displayRecordRequestFieldFps)
}
// SetCrf sets the Crf field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetCrf(crf *int) {
d.Crf = crf
d.require(displayRecordRequestFieldCrf)
}
// SetMaxDuration sets the MaxDuration field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetMaxDuration(maxDuration *float64) {
d.MaxDuration = maxDuration
d.require(displayRecordRequestFieldMaxDuration)
}
// SetWidth sets the Width field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetWidth(width *int) {
d.Width = width
d.require(displayRecordRequestFieldWidth)
}
// SetHeight sets the Height field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordRequest) SetHeight(height *int) {
d.Height = height
d.require(displayRecordRequestFieldHeight)
}
var (
displayRecordResultFieldStatus = big.NewInt(1 << 0)
displayRecordResultFieldSavePath = big.NewInt(1 << 1)
displayRecordResultFieldDuration = big.NewInt(1 << 2)
displayRecordResultFieldFileSizeBytes = big.NewInt(1 << 3)
)
type DisplayRecordResult struct {
Status Status `json:"status" url:"status"`
SavePath *string `json:"save_path,omitempty" url:"save_path,omitempty"`
Duration *float64 `json:"duration,omitempty" url:"duration,omitempty"`
FileSizeBytes *int `json:"file_size_bytes,omitempty" url:"file_size_bytes,omitempty"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (d *DisplayRecordResult) GetStatus() Status {
if d == nil {
return ""
}
return d.Status
}
func (d *DisplayRecordResult) GetSavePath() *string {
if d == nil {
return nil
}
return d.SavePath
}
func (d *DisplayRecordResult) GetDuration() *float64 {
if d == nil {
return nil
}
return d.Duration
}
func (d *DisplayRecordResult) GetFileSizeBytes() *int {
if d == nil {
return nil
}
return d.FileSizeBytes
}
func (d *DisplayRecordResult) GetExtraProperties() map[string]interface{} {
return d.extraProperties
}
func (d *DisplayRecordResult) require(field *big.Int) {
if d.explicitFields == nil {
d.explicitFields = big.NewInt(0)
}
d.explicitFields.Or(d.explicitFields, field)
}
// SetStatus sets the Status field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordResult) SetStatus(status Status) {
d.Status = status
d.require(displayRecordResultFieldStatus)
}
// SetSavePath sets the SavePath field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordResult) SetSavePath(savePath *string) {
d.SavePath = savePath
d.require(displayRecordResultFieldSavePath)
}
// SetDuration sets the Duration field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordResult) SetDuration(duration *float64) {
d.Duration = duration
d.require(displayRecordResultFieldDuration)
}
// SetFileSizeBytes sets the FileSizeBytes field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DisplayRecordResult) SetFileSizeBytes(fileSizeBytes *int) {
d.FileSizeBytes = fileSizeBytes
d.require(displayRecordResultFieldFileSizeBytes)
}
func (d *DisplayRecordResult) UnmarshalJSON(data []byte) error {
type unmarshaler DisplayRecordResult
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*d = DisplayRecordResult(value)
extraProperties, err := internal.ExtractExtraProperties(data, *d)
if err != nil {
return err
}
d.extraProperties = extraProperties
d.rawJSON = json.RawMessage(data)
return nil
}
func (d *DisplayRecordResult) MarshalJSON() ([]byte, error) {
type embed DisplayRecordResult
var marshaler = struct {
embed
}{
embed: embed(*d),
}
explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields)
return json.Marshal(explicitMarshaler)
}
func (d *DisplayRecordResult) String() string {
if len(d.rawJSON) > 0 {
if value, err := internal.StringifyJSON(d.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(d); err == nil {
return value
}
return fmt.Sprintf("%#v", d)
}
var (
responseDisplayRecordResultFieldSuccess = big.NewInt(1 << 0)
responseDisplayRecordResultFieldMessage = big.NewInt(1 << 1)
responseDisplayRecordResultFieldData = big.NewInt(1 << 2)
responseDisplayRecordResultFieldHint = big.NewInt(1 << 3)
)
type ResponseDisplayRecordResult struct {
// Whether the operation was successful
Success *bool `json:"success,omitempty" url:"success,omitempty"`
// Operation result message
Message *string `json:"message,omitempty" url:"message,omitempty"`
// Data returned from the operation
Data *DisplayRecordResult `json:"data,omitempty" url:"data,omitempty"`
// Context hint for AI agents (e.g. tab changes)
Hint *string `json:"hint,omitempty" url:"hint,omitempty"`
// Private bitmask of fields set to an explicit value and therefore not to be omitted
explicitFields *big.Int `json:"-" url:"-"`
extraProperties map[string]interface{}
rawJSON json.RawMessage
}
func (r *ResponseDisplayRecordResult) GetSuccess() *bool {
if r == nil {
return nil
}
return r.Success
}
func (r *ResponseDisplayRecordResult) GetMessage() *string {
if r == nil {
return nil
}
return r.Message
}
func (r *ResponseDisplayRecordResult) GetData() *DisplayRecordResult {
if r == nil {
return nil
}
return r.Data
}
func (r *ResponseDisplayRecordResult) GetHint() *string {
if r == nil {
return nil
}
return r.Hint
}
func (r *ResponseDisplayRecordResult) GetExtraProperties() map[string]interface{} {
return r.extraProperties
}
func (r *ResponseDisplayRecordResult) require(field *big.Int) {
if r.explicitFields == nil {
r.explicitFields = big.NewInt(0)
}
r.explicitFields.Or(r.explicitFields, field)
}
// SetSuccess sets the Success field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (r *ResponseDisplayRecordResult) SetSuccess(success *bool) {
r.Success = success
r.require(responseDisplayRecordResultFieldSuccess)
}
// SetMessage sets the Message field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (r *ResponseDisplayRecordResult) SetMessage(message *string) {
r.Message = message
r.require(responseDisplayRecordResultFieldMessage)
}
// SetData sets the Data field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (r *ResponseDisplayRecordResult) SetData(data *DisplayRecordResult) {
r.Data = data
r.require(responseDisplayRecordResultFieldData)
}
// SetHint sets the Hint field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (r *ResponseDisplayRecordResult) SetHint(hint *string) {
r.Hint = hint
r.require(responseDisplayRecordResultFieldHint)
}
func (r *ResponseDisplayRecordResult) UnmarshalJSON(data []byte) error {
type unmarshaler ResponseDisplayRecordResult
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*r = ResponseDisplayRecordResult(value)
extraProperties, err := internal.ExtractExtraProperties(data, *r)
if err != nil {
return err
}
r.extraProperties = extraProperties
r.rawJSON = json.RawMessage(data)
return nil
}
func (r *ResponseDisplayRecordResult) MarshalJSON() ([]byte, error) {
type embed ResponseDisplayRecordResult
var marshaler = struct {
embed
}{
embed: embed(*r),
}
explicitMarshaler := internal.HandleExplicitFields(marshaler, r.explicitFields)
return json.Marshal(explicitMarshaler)
}
func (r *ResponseDisplayRecordResult) String() string {
if len(r.rawJSON) > 0 {
if value, err := internal.StringifyJSON(r.rawJSON); err == nil {
return value
}
}
if value, err := internal.StringifyJSON(r); err == nil {
return value
}
return fmt.Sprintf("%#v", r)
}
type Status string
const (
StatusIdle Status = "idle"
StatusRecording Status = "recording"
StatusStopped Status = "stopped"
)
func NewStatusFromString(s string) (Status, error) {
switch s {
case "idle":
return StatusIdle, nil
case "recording":
return StatusRecording, nil
case "stopped":
return StatusStopped, nil
}
var t Status
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (s Status) Ptr() *Status {
return &s
}
// Recording action: start, stop, or status
type DisplayRecordRequestAction string
const (
DisplayRecordRequestActionStart DisplayRecordRequestAction = "start"
DisplayRecordRequestActionStop DisplayRecordRequestAction = "stop"
DisplayRecordRequestActionStatus DisplayRecordRequestAction = "status"
)
func NewDisplayRecordRequestActionFromString(s string) (DisplayRecordRequestAction, error) {
switch s {
case "start":
return DisplayRecordRequestActionStart, nil
case "stop":
return DisplayRecordRequestActionStop, nil
case "status":
return DisplayRecordRequestActionStatus, nil
}
var t DisplayRecordRequestAction
return "", fmt.Errorf("%s is not a valid %T", s, t)
}
func (d DisplayRecordRequestAction) Ptr() *DisplayRecordRequestAction {
return &d
}