submit

suspend fun submit(draft: FeedbackDraft, userToken: String? = null): FeedbackSubmissionResult(source)

Submits a completed feedback draft to POST /api/v1/feedback.

Text fields are automatically trimmed, and blank optional values are omitted from the payload. The SDK injects default diagnostic metadata (sdk, platform, submittedAt) alongside any custom properties in FeedbackDraft.metadata.

All attachments included in FeedbackDraft.attachments must be uploaded beforehand via uploadAttachment.

Return

FeedbackSubmissionResult containing the server-assigned submission ID and optional GitHub discussion URL.

Parameters

draft

The feedback content, reporter details, and uploaded attachments (FeedbackDraft).

userToken

Optional stable anonymous user token from UserTokenStore. Sent as the X-User-Token header to attribute submissions.

Throws

if anonymous feedback is disabled and token is missing (HTTP 401).

if the server rejects the submission with an unexpected status code.

if a network transport failure occurs or response parsing fails.

Example:

val draft = FeedbackDraft.autofilled(
versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE.toString()
).copy(
title = "Audio drops out on Bluetooth disconnect",
description = "When disconnecting headphones during playback, sound does not route to speaker.",
reporterEmail = "listener@example.com"
)

val result = client.submit(draft, userToken = userToken)
Log.d("Feedback", "Submitted: ${result.submissionId}")