-
Notifications
You must be signed in to change notification settings - Fork 4
fix: you can now set "false" to the includeOriginalStrings of a file download #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
|
@@ -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 | ||
| } | ||
|
|
||
| // GetQuery returns URL values representation of download file query params. | ||
|
|
@@ -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
|
||
|
|
||
| return query | ||
|
|
||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😄