Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions internal/api/client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions internal/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import (
"context"
"crypto/tls"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"

notteErrors "github.com/nottelabs/notte-cli/internal/errors"
Expand Down Expand Up @@ -224,28 +221,6 @@ func (c *NotteClient) APIKey() string {
return c.apiKey
}

// DownloadUploadedFile requests a temporary download link for a user-uploaded file.
// This endpoint is kept here until it is available in the generated OpenAPI client.
func (c *NotteClient) DownloadUploadedFile(ctx context.Context, filename string) (*http.Response, []byte, error) {
endpoint := strings.TrimRight(c.baseURL, "/") + "/storage/uploads/" + url.PathEscape(filename)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, endpoint, nil)
if err != nil {
return nil, nil, fmt.Errorf("failed to create uploaded file download request: %w", err)
}

resp, err := c.httpClient.Do(req)
if err != nil {
return nil, nil, err
}
defer func() { _ = resp.Body.Close() }()

body, err := io.ReadAll(resp.Body)
if err != nil {
return resp, nil, fmt.Errorf("failed to read uploaded file download response: %w", err)
}
return resp, body, nil
}

// Context helper for commands
func DefaultContext() context.Context {
return context.Background()
Expand Down
Loading
Loading