-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathapi_computer_use.go
More file actions
3634 lines (2984 loc) · 119 KB
/
api_computer_use.go
File metadata and controls
3634 lines (2984 loc) · 119 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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Daytona Toolbox API
Daytona Toolbox API
API version: v0.0.0-dev
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package toolbox
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"strings"
"os"
)
type ComputerUseAPI interface {
/*
Click Click mouse button
Click the mouse button at the specified coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIClickRequest
*/
Click(ctx context.Context) ComputerUseAPIClickRequest
// ClickExecute executes the request
// @return MouseClickResponse
ClickExecute(r ComputerUseAPIClickRequest) (*MouseClickResponse, *http.Response, error)
/*
DeleteRecording Delete a recording
Delete a recording file by ID
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id Recording ID
@return ComputerUseAPIDeleteRecordingRequest
*/
DeleteRecording(ctx context.Context, id string) ComputerUseAPIDeleteRecordingRequest
// DeleteRecordingExecute executes the request
DeleteRecordingExecute(r ComputerUseAPIDeleteRecordingRequest) (*http.Response, error)
/*
DownloadRecording Download a recording
Download a recording by providing its ID
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id Recording ID
@return ComputerUseAPIDownloadRecordingRequest
*/
DownloadRecording(ctx context.Context, id string) ComputerUseAPIDownloadRecordingRequest
// DownloadRecordingExecute executes the request
// @return *os.File
DownloadRecordingExecute(r ComputerUseAPIDownloadRecordingRequest) (*os.File, *http.Response, error)
/*
Drag Drag mouse
Drag the mouse from start to end coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIDragRequest
*/
Drag(ctx context.Context) ComputerUseAPIDragRequest
// DragExecute executes the request
// @return MouseDragResponse
DragExecute(r ComputerUseAPIDragRequest) (*MouseDragResponse, *http.Response, error)
/*
GetComputerUseStatus Get computer use process status
Get the status of all computer use processes
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetComputerUseStatusRequest
*/
GetComputerUseStatus(ctx context.Context) ComputerUseAPIGetComputerUseStatusRequest
// GetComputerUseStatusExecute executes the request
// @return ComputerUseStatusResponse
GetComputerUseStatusExecute(r ComputerUseAPIGetComputerUseStatusRequest) (*ComputerUseStatusResponse, *http.Response, error)
/*
GetComputerUseSystemStatus Get computer use status
Get the current status of the computer use system
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetComputerUseSystemStatusRequest
*/
GetComputerUseSystemStatus(ctx context.Context) ComputerUseAPIGetComputerUseSystemStatusRequest
// GetComputerUseSystemStatusExecute executes the request
// @return ComputerUseStatusResponse
GetComputerUseSystemStatusExecute(r ComputerUseAPIGetComputerUseSystemStatusRequest) (*ComputerUseStatusResponse, *http.Response, error)
/*
GetDisplayInfo Get display information
Get information about all available displays
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetDisplayInfoRequest
*/
GetDisplayInfo(ctx context.Context) ComputerUseAPIGetDisplayInfoRequest
// GetDisplayInfoExecute executes the request
// @return DisplayInfoResponse
GetDisplayInfoExecute(r ComputerUseAPIGetDisplayInfoRequest) (*DisplayInfoResponse, *http.Response, error)
/*
GetMousePosition Get mouse position
Get the current mouse cursor position
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetMousePositionRequest
*/
GetMousePosition(ctx context.Context) ComputerUseAPIGetMousePositionRequest
// GetMousePositionExecute executes the request
// @return MousePositionResponse
GetMousePositionExecute(r ComputerUseAPIGetMousePositionRequest) (*MousePositionResponse, *http.Response, error)
/*
GetProcessErrors Get process errors
Get errors for a specific computer use process
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param processName Process name to get errors for
@return ComputerUseAPIGetProcessErrorsRequest
*/
GetProcessErrors(ctx context.Context, processName string) ComputerUseAPIGetProcessErrorsRequest
// GetProcessErrorsExecute executes the request
// @return ProcessErrorsResponse
GetProcessErrorsExecute(r ComputerUseAPIGetProcessErrorsRequest) (*ProcessErrorsResponse, *http.Response, error)
/*
GetProcessLogs Get process logs
Get logs for a specific computer use process
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param processName Process name to get logs for
@return ComputerUseAPIGetProcessLogsRequest
*/
GetProcessLogs(ctx context.Context, processName string) ComputerUseAPIGetProcessLogsRequest
// GetProcessLogsExecute executes the request
// @return ProcessLogsResponse
GetProcessLogsExecute(r ComputerUseAPIGetProcessLogsRequest) (*ProcessLogsResponse, *http.Response, error)
/*
GetProcessStatus Get specific process status
Check if a specific computer use process is running
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param processName Process name to check
@return ComputerUseAPIGetProcessStatusRequest
*/
GetProcessStatus(ctx context.Context, processName string) ComputerUseAPIGetProcessStatusRequest
// GetProcessStatusExecute executes the request
// @return ProcessStatusResponse
GetProcessStatusExecute(r ComputerUseAPIGetProcessStatusRequest) (*ProcessStatusResponse, *http.Response, error)
/*
GetRecording Get recording details
Get details of a specific recording by ID
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id Recording ID
@return ComputerUseAPIGetRecordingRequest
*/
GetRecording(ctx context.Context, id string) ComputerUseAPIGetRecordingRequest
// GetRecordingExecute executes the request
// @return Recording
GetRecordingExecute(r ComputerUseAPIGetRecordingRequest) (*Recording, *http.Response, error)
/*
GetWindows Get windows information
Get information about all open windows
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetWindowsRequest
*/
GetWindows(ctx context.Context) ComputerUseAPIGetWindowsRequest
// GetWindowsExecute executes the request
// @return WindowsResponse
GetWindowsExecute(r ComputerUseAPIGetWindowsRequest) (*WindowsResponse, *http.Response, error)
/*
ListRecordings List all recordings
Get a list of all recordings (active and completed)
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIListRecordingsRequest
*/
ListRecordings(ctx context.Context) ComputerUseAPIListRecordingsRequest
// ListRecordingsExecute executes the request
// @return ListRecordingsResponse
ListRecordingsExecute(r ComputerUseAPIListRecordingsRequest) (*ListRecordingsResponse, *http.Response, error)
/*
MoveMouse Move mouse cursor
Move the mouse cursor to the specified coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIMoveMouseRequest
*/
MoveMouse(ctx context.Context) ComputerUseAPIMoveMouseRequest
// MoveMouseExecute executes the request
// @return MousePositionResponse
MoveMouseExecute(r ComputerUseAPIMoveMouseRequest) (*MousePositionResponse, *http.Response, error)
/*
PressHotkey Press hotkey
Press a hotkey combination (e.g., ctrl+c, cmd+v)
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIPressHotkeyRequest
*/
PressHotkey(ctx context.Context) ComputerUseAPIPressHotkeyRequest
// PressHotkeyExecute executes the request
// @return map[string]interface{}
PressHotkeyExecute(r ComputerUseAPIPressHotkeyRequest) (map[string]interface{}, *http.Response, error)
/*
PressKey Press key
Press a key with optional modifiers
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIPressKeyRequest
*/
PressKey(ctx context.Context) ComputerUseAPIPressKeyRequest
// PressKeyExecute executes the request
// @return map[string]interface{}
PressKeyExecute(r ComputerUseAPIPressKeyRequest) (map[string]interface{}, *http.Response, error)
/*
RestartProcess Restart specific process
Restart a specific computer use process
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param processName Process name to restart
@return ComputerUseAPIRestartProcessRequest
*/
RestartProcess(ctx context.Context, processName string) ComputerUseAPIRestartProcessRequest
// RestartProcessExecute executes the request
// @return ProcessRestartResponse
RestartProcessExecute(r ComputerUseAPIRestartProcessRequest) (*ProcessRestartResponse, *http.Response, error)
/*
Scroll Scroll mouse wheel
Scroll the mouse wheel at the specified coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIScrollRequest
*/
Scroll(ctx context.Context) ComputerUseAPIScrollRequest
// ScrollExecute executes the request
// @return ScrollResponse
ScrollExecute(r ComputerUseAPIScrollRequest) (*ScrollResponse, *http.Response, error)
/*
StartComputerUse Start computer use processes
Start all computer use processes and return their status
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIStartComputerUseRequest
*/
StartComputerUse(ctx context.Context) ComputerUseAPIStartComputerUseRequest
// StartComputerUseExecute executes the request
// @return ComputerUseStartResponse
StartComputerUseExecute(r ComputerUseAPIStartComputerUseRequest) (*ComputerUseStartResponse, *http.Response, error)
/*
StartRecording Start a new recording
Start a new screen recording session
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIStartRecordingRequest
*/
StartRecording(ctx context.Context) ComputerUseAPIStartRecordingRequest
// StartRecordingExecute executes the request
// @return Recording
StartRecordingExecute(r ComputerUseAPIStartRecordingRequest) (*Recording, *http.Response, error)
/*
StopComputerUse Stop computer use processes
Stop all computer use processes and return their status
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIStopComputerUseRequest
*/
StopComputerUse(ctx context.Context) ComputerUseAPIStopComputerUseRequest
// StopComputerUseExecute executes the request
// @return ComputerUseStopResponse
StopComputerUseExecute(r ComputerUseAPIStopComputerUseRequest) (*ComputerUseStopResponse, *http.Response, error)
/*
StopRecording Stop a recording
Stop an active screen recording session
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIStopRecordingRequest
*/
StopRecording(ctx context.Context) ComputerUseAPIStopRecordingRequest
// StopRecordingExecute executes the request
// @return Recording
StopRecordingExecute(r ComputerUseAPIStopRecordingRequest) (*Recording, *http.Response, error)
/*
TakeCompressedRegionScreenshot Take a compressed region screenshot
Take a compressed screenshot of a specific region of the screen
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPITakeCompressedRegionScreenshotRequest
*/
TakeCompressedRegionScreenshot(ctx context.Context) ComputerUseAPITakeCompressedRegionScreenshotRequest
// TakeCompressedRegionScreenshotExecute executes the request
// @return ScreenshotResponse
TakeCompressedRegionScreenshotExecute(r ComputerUseAPITakeCompressedRegionScreenshotRequest) (*ScreenshotResponse, *http.Response, error)
/*
TakeCompressedScreenshot Take a compressed screenshot
Take a compressed screenshot of the entire screen
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPITakeCompressedScreenshotRequest
*/
TakeCompressedScreenshot(ctx context.Context) ComputerUseAPITakeCompressedScreenshotRequest
// TakeCompressedScreenshotExecute executes the request
// @return ScreenshotResponse
TakeCompressedScreenshotExecute(r ComputerUseAPITakeCompressedScreenshotRequest) (*ScreenshotResponse, *http.Response, error)
/*
TakeRegionScreenshot Take a region screenshot
Take a screenshot of a specific region of the screen
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPITakeRegionScreenshotRequest
*/
TakeRegionScreenshot(ctx context.Context) ComputerUseAPITakeRegionScreenshotRequest
// TakeRegionScreenshotExecute executes the request
// @return ScreenshotResponse
TakeRegionScreenshotExecute(r ComputerUseAPITakeRegionScreenshotRequest) (*ScreenshotResponse, *http.Response, error)
/*
TakeScreenshot Take a screenshot
Take a screenshot of the entire screen
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPITakeScreenshotRequest
*/
TakeScreenshot(ctx context.Context) ComputerUseAPITakeScreenshotRequest
// TakeScreenshotExecute executes the request
// @return ScreenshotResponse
TakeScreenshotExecute(r ComputerUseAPITakeScreenshotRequest) (*ScreenshotResponse, *http.Response, error)
/*
TypeText Type text
Type text with optional delay between keystrokes
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPITypeTextRequest
*/
TypeText(ctx context.Context) ComputerUseAPITypeTextRequest
// TypeTextExecute executes the request
// @return map[string]interface{}
TypeTextExecute(r ComputerUseAPITypeTextRequest) (map[string]interface{}, *http.Response, error)
}
// ComputerUseAPIService ComputerUseAPI service
type ComputerUseAPIService service
type ComputerUseAPIClickRequest struct {
ctx context.Context
ApiService ComputerUseAPI
request *MouseClickRequest
}
// Mouse click request
func (r ComputerUseAPIClickRequest) Request(request MouseClickRequest) ComputerUseAPIClickRequest {
r.request = &request
return r
}
func (r ComputerUseAPIClickRequest) Execute() (*MouseClickResponse, *http.Response, error) {
return r.ApiService.ClickExecute(r)
}
/*
Click Click mouse button
Click the mouse button at the specified coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIClickRequest
*/
func (a *ComputerUseAPIService) Click(ctx context.Context) ComputerUseAPIClickRequest {
return ComputerUseAPIClickRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return MouseClickResponse
func (a *ComputerUseAPIService) ClickExecute(r ComputerUseAPIClickRequest) (*MouseClickResponse, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *MouseClickResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ComputerUseAPIService.Click")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/computeruse/mouse/click"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.request == nil {
return localVarReturnValue, nil, reportError("request is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.request
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ComputerUseAPIDeleteRecordingRequest struct {
ctx context.Context
ApiService ComputerUseAPI
id string
}
func (r ComputerUseAPIDeleteRecordingRequest) Execute() (*http.Response, error) {
return r.ApiService.DeleteRecordingExecute(r)
}
/*
DeleteRecording Delete a recording
Delete a recording file by ID
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id Recording ID
@return ComputerUseAPIDeleteRecordingRequest
*/
func (a *ComputerUseAPIService) DeleteRecording(ctx context.Context, id string) ComputerUseAPIDeleteRecordingRequest {
return ComputerUseAPIDeleteRecordingRequest{
ApiService: a,
ctx: ctx,
id: id,
}
}
// Execute executes the request
func (a *ComputerUseAPIService) DeleteRecordingExecute(r ComputerUseAPIDeleteRecordingRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodDelete
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ComputerUseAPIService.DeleteRecording")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/computeruse/recordings/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"*/*"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 404 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 500 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ComputerUseAPIDownloadRecordingRequest struct {
ctx context.Context
ApiService ComputerUseAPI
id string
}
func (r ComputerUseAPIDownloadRecordingRequest) Execute() (*os.File, *http.Response, error) {
return r.ApiService.DownloadRecordingExecute(r)
}
/*
DownloadRecording Download a recording
Download a recording by providing its ID
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param id Recording ID
@return ComputerUseAPIDownloadRecordingRequest
*/
func (a *ComputerUseAPIService) DownloadRecording(ctx context.Context, id string) ComputerUseAPIDownloadRecordingRequest {
return ComputerUseAPIDownloadRecordingRequest{
ApiService: a,
ctx: ctx,
id: id,
}
}
// Execute executes the request
// @return *os.File
func (a *ComputerUseAPIService) DownloadRecordingExecute(r ComputerUseAPIDownloadRecordingRequest) (*os.File, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *os.File
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ComputerUseAPIService.DownloadRecording")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/computeruse/recordings/{id}/download"
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", url.PathEscape(parameterValueToString(r.id, "id")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/octet-stream"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 404 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 500 {
var v map[string]string
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ComputerUseAPIDragRequest struct {
ctx context.Context
ApiService ComputerUseAPI
request *MouseDragRequest
}
// Mouse drag request
func (r ComputerUseAPIDragRequest) Request(request MouseDragRequest) ComputerUseAPIDragRequest {
r.request = &request
return r
}
func (r ComputerUseAPIDragRequest) Execute() (*MouseDragResponse, *http.Response, error) {
return r.ApiService.DragExecute(r)
}
/*
Drag Drag mouse
Drag the mouse from start to end coordinates
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIDragRequest
*/
func (a *ComputerUseAPIService) Drag(ctx context.Context) ComputerUseAPIDragRequest {
return ComputerUseAPIDragRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return MouseDragResponse
func (a *ComputerUseAPIService) DragExecute(r ComputerUseAPIDragRequest) (*MouseDragResponse, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodPost
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *MouseDragResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ComputerUseAPIService.Drag")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/computeruse/mouse/drag"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.request == nil {
return localVarReturnValue, nil, reportError("request is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
// body params
localVarPostBody = r.request
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ComputerUseAPIGetComputerUseStatusRequest struct {
ctx context.Context
ApiService ComputerUseAPI
}
func (r ComputerUseAPIGetComputerUseStatusRequest) Execute() (*ComputerUseStatusResponse, *http.Response, error) {
return r.ApiService.GetComputerUseStatusExecute(r)
}
/*
GetComputerUseStatus Get computer use process status
Get the status of all computer use processes
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ComputerUseAPIGetComputerUseStatusRequest
*/
func (a *ComputerUseAPIService) GetComputerUseStatus(ctx context.Context) ComputerUseAPIGetComputerUseStatusRequest {
return ComputerUseAPIGetComputerUseStatusRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
// @return ComputerUseStatusResponse
func (a *ComputerUseAPIService) GetComputerUseStatusExecute(r ComputerUseAPIGetComputerUseStatusRequest) (*ComputerUseStatusResponse, *http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
localVarReturnValue *ComputerUseStatusResponse
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ComputerUseAPIService.GetComputerUseStatus")
if err != nil {
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/computeruse/process-status"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ComputerUseAPIGetComputerUseSystemStatusRequest struct {
ctx context.Context
ApiService ComputerUseAPI
}