FeedbackClient

Primary HTTP API client for interacting with the CupThread developer platform.

Provides asynchronous, coroutine-based access to:

Thread Safety and Concurrency

Every public method is a suspend function that automatically dispatches network operations on Dispatchers.IO. FeedbackClient maintains no mutable state and is safe to use concurrently from multiple coroutines. You should create a single instance during application startup and share it across your dependency injection graph.

Error Handling

All API and network failures are wrapped in subclasses of FeedbackException, allowing predictable and uniform exception handling:

Example Initialization

val config = FeedbackClientConfig(
baseUrl = "https://api.cupthread.com",
appKey = "app_live_yourConsoleAppKey",
defaultPlatform = FeedbackPlatform.ANDROID
)
val client = FeedbackClient(config)
val userToken = UserTokenStore.create(context).token

lifecycleScope.launch {
try {
val appConfig = client.fetchAppConfig()
println("Loaded app: ${appConfig.name}")
} catch (e: FeedbackException) {
Log.e("CupThread", "Failed to load config", e)
}
}

Parameters

config

Immutable client configuration (FeedbackClientConfig).

transport

Internal HTTP transport implementation; defaults to standard HttpURLConnection.

Constructors

Link copied to clipboard
constructor(config: FeedbackClientConfig)

Constructs a FeedbackClient with default HTTP URL connection transport.

Properties

Link copied to clipboard

Functions

Link copied to clipboard

Fetches public app configuration from GET /api/v1/public/config/{appKey}.

Link copied to clipboard

Fetches published changelog entries and release notes from GET /api/v1/public/apps/{appKey}/changelog.

Link copied to clipboard
suspend fun fetchColumns(): List<BoardColumn>

Fetches the roadmap kanban columns from GET /api/v1/public/columns/{appKey}.

Link copied to clipboard
suspend fun fetchComments(featureRequestId: String): List<FeatureRequestComment>

Fetches public comments on a feature request from GET /api/v1/feature-requests/{id}/comments.

Link copied to clipboard
suspend fun fetchFeatureRequests(userToken: String, limit: Int = 50, offset: Int = 0, versionId: String? = null, query: String? = null): ListFeatureRequestsResult

Fetches a paginated list of public feature requests from GET /api/v1/feature-requests.

Link copied to clipboard

Fetches a public user profile from GET /api/v1/users/{userId}/profile.

Link copied to clipboard
suspend fun fetchVersions(): List<AppVersion>

Fetches milestone release versions from GET /api/v1/public/versions/{appKey}.

Link copied to clipboard
fun hasSeenChangelog(context: Context, versionOrId: String): Boolean

Checks whether the user has already viewed the changelog for versionOrId on this device.

Link copied to clipboard
fun markChangelogSeen(context: Context, versionOrId: String)

Marks the changelog for versionOrId as seen on this device.

Link copied to clipboard
suspend fun postComment(featureRequestId: String, draft: CommentDraft, userToken: String): FeatureRequestComment

Posts a new comment or threaded @reply on a feature request via POST /api/v1/feature-requests/{id}/comments.

Link copied to clipboard
suspend fun prepareChangelogOverlay(context: Context? = null, onlyIfUnseen: Boolean = false): Pair<List<ChangelogEntry>, SdkAppearance>?

Prepares changelog entries and appearance styling for What's-New presentation overlays (dev.cupthread.feedback.ui.ChangelogOverlay and dev.cupthread.feedback.ui.presentLatestChangelog).

Link copied to clipboard
suspend fun FeedbackClient.presentLatestChangelog(activity: Activity, onlyIfUnseen: Boolean = false, autoMarkSeen: Boolean = true): Boolean

Convenience extension function that fetches console-configured What's-New copy and presents a modal bottom sheet dialog directly over an Android Activity.

Link copied to clipboard
suspend fun submit(draft: FeedbackDraft, userToken: String? = null): FeedbackSubmissionResult

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

Link copied to clipboard

Submits a new feature request proposal to POST /api/v1/feature-requests.

Link copied to clipboard

Subscribes an email address to product update emails via POST /api/v1/public/apps/{appKey}/changelog/subscribe.

Link copied to clipboard
suspend fun toggleVote(featureRequestId: String, userToken: String): VoteResult

Toggles an upvote on a feature request via POST /api/v1/feature-requests/{id}/vote.

Link copied to clipboard

Unsubscribes an email address from product update emails via POST /api/v1/public/apps/{appKey}/changelog/unsubscribe.

Link copied to clipboard
suspend fun updateUserAttributes(userToken: String, isPaying: Boolean? = null, plan: String? = null, mrr: Double? = null, currency: String? = null): UserAttributesUpdateResult

Reports self-declared user segmentation attributes and telemetry via PUT /api/v1/public/apps/{appKey}/user.

Link copied to clipboard
suspend fun uploadAttachment(data: ByteArray, filename: String, mimeType: String, preferredKind: FeedbackAttachment.Kind? = null): FeedbackAttachment

Uploads a binary file or screenshot attachment to storage and returns a descriptor ready to be attached to a FeedbackDraft.