StopDesktopRecording stops a desktop recording session on the agent and returns the recording as a StopDesktopRecordingResponse. The response body is a multipart/mixed stream containing the video (and optionally a JPEG thumbnail). The caller is responsible for closing the returned Body. Idempotent —
(ctx context.Context, req StopDesktopRecordingRequest)
| 758 | // responsible for closing the returned Body. Idempotent — safe |
| 759 | // to call on an already-stopped recording. |
| 760 | func (c *agentConn) StopDesktopRecording(ctx context.Context, req StopDesktopRecordingRequest) (StopDesktopRecordingResponse, error) { |
| 761 | ctx, span := tracing.StartSpan(ctx) |
| 762 | defer span.End() |
| 763 | res, err := c.apiRequest(ctx, http.MethodPost, "/api/v0/desktop/recording/stop", req) |
| 764 | if err != nil { |
| 765 | return StopDesktopRecordingResponse{}, xerrors.Errorf("stop recording request: %w", err) |
| 766 | } |
| 767 | if res.StatusCode != http.StatusOK { |
| 768 | defer res.Body.Close() |
| 769 | return StopDesktopRecordingResponse{}, codersdk.ReadBodyAsError(res) |
| 770 | } |
| 771 | // Caller is responsible for closing res.Body. |
| 772 | return StopDesktopRecordingResponse{ |
| 773 | Body: res.Body, |
| 774 | ContentType: res.Header.Get("Content-Type"), |
| 775 | }, nil |
| 776 | } |
| 777 | |
| 778 | // DeleteDevcontainer deletes the provided devcontainer. |
| 779 | // This is a blocking call and will wait for the container to be deleted. |
nothing calls this directly
no test coverage detected