Migrate file upload and message translation to generated models - #6632
Draft
gpunto wants to merge 2 commits into
Draft
Migrate file upload and message translation to generated models#6632gpunto wants to merge 2 commits into
gpunto wants to merge 2 commits into
Conversation
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
Contributor
SDK Size Comparison 📏
|
gpunto
force-pushed
the
migrate/upload-translate
branch
2 times, most recently
from
August 11, 2026 15:17
9a512e9 to
d6f911f
Compare
gpunto
force-pushed
the
migrate/upload-translate
branch
from
August 11, 2026 15:21
d6f911f to
f703b0d
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Goal
Migrate the file upload response and the message translation request body to the generated network models.
Part of AND-1291
Implementation
FileUploadResponse; remove the hand-writtenUploadFileResponseand rename its mapper andtest to match. It covers all four upload endpoints (
/channels/{type}/{id}/file,/channels/{type}/{id}/image,/uploads/file,/uploads/image).fileis nullable, matching the wire: Go tags itomitempty, so an empty asset URL isomitted and the old non-null
file: Stringwould have failed to parse. A response without a URL hasnothing to attach, so
toUploadedFile()now returns aResultand reports it as a failure;StreamFileUploaderusesflatMapto carry that through.TranslateMessageRequest; remove the hand-written one.ChatClient.translatestill takesa
String, converted withLanguage.fromString, which falls back toUnknownand sends the valuethrough unchanged, so an unsupported language is still rejected by the server rather than locally.
network/**path from theLongMethoddetekt rule: the models map each wire enumin one exhaustive
when(57 entries forLanguage), which a formatter cannot split and which would beregenerated anyway.
Testing
UploadFileResponseMappingTestcovers the mapping, a missing thumbnail, and the missing-URL failure.TranslateMessageRequestAdapterTestasserts the serialized body for a known language, for one the modelsdo not know, and for every one of the 57 languages the endpoint accepts. Removing the
Languageadapterregistration makes them fail.
returned no
thumb_url, so the nullable thumbnail path is the normal shape rather than an edge case.translatesent{"language":"fr"}, unchanged from the hand-written body, and an invalid language wasrejected by the server with its list of accepted values. That list matches the generated enum exactly,
all 57 values.