Package-level declarations

Types

Link copied to clipboard

Ktor traffic buckets shown by Settings network usage.

Link copied to clipboard

Process-wide bridge from low-level network clients to the data layer.

Properties

Link copied to clipboard
private const val DEFAULT_TIMEOUT_MILLIS: Long

Exposes the DEFAULT_TIMEOUT_MILLIS value used by the SDAI network layer.

Link copied to clipboard

Exposes the defaultNetworkJson value used by the SDAI network layer.

Link copied to clipboard

Request attribute used to mark a Ktor call for usage accounting.

Functions

Link copied to clipboard
fun createConfiguredHttpClient(json: Json = defaultNetworkJson, installContentNegotiation: Boolean = true, configure: HttpClientConfig<HttpClientEngineConfig>.() -> Unit = {}): HttpClient

Creates the SDAI value produced by createConfiguredHttpClient.

Link copied to clipboard
actual fun platformHttpClientEngine(): HttpClientEngineFactory<HttpClientEngineConfig>

Executes the platformHttpClientEngine step in the SDAI network layer.

expect fun platformHttpClientEngine(): HttpClientEngineFactory<HttpClientEngineConfig>

Executes the platformHttpClientEngine step in the SDAI network layer.

actual fun platformHttpClientEngine(): HttpClientEngineFactory<HttpClientEngineConfig>

Executes the platformHttpClientEngine step in the SDAI network layer.

Link copied to clipboard

Records an externally measured byte delta for an existing Ktor traffic bucket.

Link copied to clipboard
inline fun <T> HttpRequestBuilder.setTrackedJsonBody(category: NetworkUsageCategory, body: T, json: Json = defaultNetworkJson)

Serializes and records a JSON request body before sending it through Ktor.

Link copied to clipboard
fun HttpRequestBuilder.setTrackedTextBody(category: NetworkUsageCategory, body: String, contentType: ContentType = ContentType.Application.Json)

Records a text request body and installs it as Ktor content with the supplied content type.

Link copied to clipboard
suspend fun HttpResponse.trackedBodyAsText(category: NetworkUsageCategory): String

Reads a response as text and records its UTF-8 byte size.

Link copied to clipboard
suspend fun HttpResponse.trackedByteArrayBody(category: NetworkUsageCategory): ByteArray

Reads a binary response and records the number of bytes returned by Ktor.

Link copied to clipboard
inline suspend fun <T> HttpResponse.trackedJsonBody(category: NetworkUsageCategory, json: Json = defaultNetworkJson): T

Reads a response as JSON while counting the exact text bytes received from the server.

Link copied to clipboard
fun HttpRequestBuilder.trackUsage(category: NetworkUsageCategory)

Marks a request so shared Ktor plumbing can identify its traffic bucket.