Skip to content
Merged
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
20 changes: 13 additions & 7 deletions download_file_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ package smartling

import (
"fmt"
"github.com/Smartling/api-sdk-go/helpers/sm_file"
"net/url"
"strconv"

"github.com/Smartling/api-sdk-go/helpers/sm_file"
)

// RetrievalType describes type of file download.
Expand Down Expand Up @@ -54,13 +56,17 @@ const (
RetrieveChromeInstrumented = "contextMatchingInstrumented"
)

// FileDownloadRequest represents optional parameters for file download
// operation.
// FileDownloadRequest represents optional parameters for a file download operation.
//
// See: https://api-reference.smartling.com/#tag/Files/operation/downloadTranslatedFile
type FileDownloadRequest struct {
smfile.FileURIRequest

Type RetrievalType
IncludeOriginal bool
Type RetrievalType

// IncludeOriginal controls the "includeOriginalStrings" query parameter.
// If nil, the parameter is omitted and the API defaults to including untranslated strings. .
IncludeOriginal *bool
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the type from bool to *bool is a breaking API change. Existing code that sets IncludeOriginal will fail to compile. Consider documenting this breaking change in a CHANGELOG or migration guide, or introducing this as a new field to maintain backward compatibility.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

searched for a changelog, but there is none. I'd be happy to do this if you could give me some pointers 😄

}

// GetQuery returns URL values representation of download file query params.
Expand All @@ -73,8 +79,8 @@ func (request FileDownloadRequest) GetQuery() url.Values {
query.Set("retrievalType", fmt.Sprint(request.Type))
}

if request.IncludeOriginal {
query.Set("includeOriginalStrings", "true")
if request.IncludeOriginal != nil {
query.Set("includeOriginalStrings", strconv.FormatBool(*request.IncludeOriginal))
}
Comment on lines +82 to 84
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GetQuery method for FileDownloadRequest lacks test coverage. Given that this change modifies how query parameters are constructed and this is a public API, add unit tests to verify the three states: nil (parameter not included), true (parameter set to "true"), and false (parameter set to "false").

Copilot uses AI. Check for mistakes.

return query
Expand Down