upload Attachment
Uploads a binary file or screenshot attachment to storage and returns a descriptor ready to be attached to a FeedbackDraft.
Image MIME types (e.g.,
image/png,image/jpeg) are routed toPOST /api/v1/uploads/images.All other files (e.g. logs, crashes, text) are routed to
POST /api/v1/uploads/r2object storage.Use preferredKind to explicitly override the destination storage backend.
Return
FeedbackAttachment containing the CDN URL and storage key.
Parameters
Raw binary bytes of the file.
Suggested original filename (e.g. "screenshot.png", "logcat.txt").
Standard MIME type string (e.g. "image/png", "text/plain").
Optional storage destination override (FeedbackAttachment.Kind).
Throws
if the upload succeeded on the server but the response could not be parsed.
if the file upload is rejected (e.g. exceeded maxAttachmentBytes).
if a network error occurs.
Example:
val screenshotBytes = captureViewAsPngBytes(window.decorView)
val attachment = client.uploadAttachment(
data = screenshotBytes,
filename = "device_screenshot.png",
mimeType = "image/png"
)
val draft = baseDraft.copy(attachments = listOf(attachment))
client.submit(draft, userToken)