Skip to content

Commit

Permalink
Add feedback link to KDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
e5l committed Dec 4, 2024
1 parent c927f5b commit 71c1a56
Show file tree
Hide file tree
Showing 712 changed files with 1,328 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import io.ktor.client.engine.*
* ```
*
* You can learn more about client engines from [Engines](https://ktor.io/docs/http-client-engines.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.android.Android)
*/
public object Android : HttpClientEngineFactory<AndroidEngineConfig> {
override fun create(block: AndroidEngineConfig.() -> Unit): HttpClientEngine =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private val METHODS_WITHOUT_BODY = listOf(HttpMethod.Get, HttpMethod.Head)

/**
* An Android client engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.android.AndroidClientEngine)
*/
@OptIn(InternalAPI::class)
public class AndroidClientEngine(override val config: AndroidEngineConfig) : HttpClientEngineBase("ktor-android") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import javax.net.ssl.*

/**
* A configuration for the [Android] client engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.android.AndroidEngineConfig)
*/
public class AndroidEngineConfig : HttpClientEngineConfig() {
/**
* Specifies a time period (in milliseconds) in which a client should establish a connection with a server.
*
* Set this value to `0` to use an infinite timeout.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.android.AndroidEngineConfig.connectTimeout)
*/
public var connectTimeout: Int = 100_000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.ktor.client.engine.*
* ```
*
* You can learn more about client engines from [Engines](https://ktor.io/docs/http-client-engines.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache.Apache)
*/
public object Apache : HttpClientEngineFactory<ApacheEngineConfig> {
override fun create(block: ApacheEngineConfig.() -> Unit): HttpClientEngine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import javax.net.ssl.*

/**
* A configuration for the [Apache] client engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache.ApacheEngineConfig)
*/
public class ApacheEngineConfig : HttpClientEngineConfig() {
/**
* Specifies whether to follow redirects automatically.
* Disabled by default.
*
* _Note: By default, the Apache client allows `50` redirects._
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache.ApacheEngineConfig.followRedirects)
*/
public var followRedirects: Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.ktor.client.engine.*
* ```
*
* You can learn more about client engines from [Engines](https://ktor.io/docs/http-client-engines.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache5.Apache5)
*/
public object Apache5 : HttpClientEngineFactory<Apache5EngineConfig> {
override fun create(block: Apache5EngineConfig.() -> Unit): HttpClientEngine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import javax.net.ssl.*

/**
* A configuration for the [Apache5] client engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache5.Apache5EngineConfig)
*/
public class Apache5EngineConfig : HttpClientEngineConfig() {
/**
* Specifies whether to follow redirects automatically.
* Disabled by default.
*
* _Note: By default, the Apache client allows `50` redirects._
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.apache5.Apache5EngineConfig.followRedirects)
*/
public var followRedirects: Boolean = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlinx.coroutines.*

/**
* Creates a raw [ClientWebSocketSession]: no ping-pong and other service messages are used.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.websocket.cio.webSocketRawSession)
*/
public suspend fun HttpClient.webSocketRawSession(
method: HttpMethod = HttpMethod.Get,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import io.ktor.client.engine.*
* ```
*
* You can learn more about client engines from [Engines](https://ktor.io/docs/http-client-engines.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.cio.CIO)
*/
public data object CIO : HttpClientEngineFactory<CIOEngineConfig> {
init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import io.ktor.network.tls.*

/**
* A configuration for the [CIO] client engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.cio.CIOEngineConfig)
*/
public class CIOEngineConfig : HttpClientEngineConfig() {
/**
* Provides access to [Endpoint] settings.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.cio.CIOEngineConfig.endpoint)
*/
public val endpoint: EndpointConfig = EndpointConfig()

Expand Down Expand Up @@ -44,6 +46,7 @@ public class CIOEngineConfig : HttpClientEngineConfig() {

/**
* Provides access to [Endpoint] settings.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.cio.endpoint)
*/
public fun CIOEngineConfig.endpoint(block: EndpointConfig.() -> Unit): EndpointConfig = endpoint.apply(block)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ import kotlin.coroutines.*
*
* By directly setting the engine (e.g., `Apache`, `OkHttp`), you can optimize startup performance
* by preventing the default service loader mechanism.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.HttpClient)
*/
@KtorDsl
public expect fun HttpClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import kotlin.collections.set
* A mutable [HttpClient] configuration.
* Learn more about the client's configuration from
* [Creating and configuring a client](https://ktor.io/docs/create-client.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.HttpClientConfig)
*/
@KtorDsl
public class HttpClientConfig<T : HttpClientEngineConfig> {
Expand All @@ -28,6 +29,7 @@ public class HttpClientConfig<T : HttpClientEngineConfig> {
* Allows you to configure engine parameters.
*
* You can learn more from [Engines](https://ktor.io/docs/http-client-engines.html).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.HttpClientConfig.engine)
*/
public fun engine(block: T.() -> Unit) {
val oldConfig = engineConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import kotlin.reflect.*
* A pair of a [request] and [response] for a specific [HttpClient].
*
* @property client the client that executed the call.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.call.HttpClientCall)
*/
public open class HttpClientCall(
public val client: HttpClient
Expand Down Expand Up @@ -130,6 +131,7 @@ public open class HttpClientCall(
*
* @throws NoTransformationFoundException If no transformation is found for the type [T].
* @throws DoubleReceiveException If already called [body].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.call.body)
*/
public suspend inline fun <reified T> HttpClientCall.body(): T = bodyNullable(typeInfo<T>()) as T

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ internal class SavedHttpResponse(

/**
* Fetch data for [HttpClientCall] and close the origin.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.call.save)
*/

@OptIn(InternalAPI::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ import kotlin.coroutines.*
* Callback that can be registered to listen for upload/download progress.
* @param bytesSentTotal number of transmitted bytes.
* @param contentLength body size. Can be null if the size is unknown.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.content.ProgressListener)
*/
public fun interface ProgressListener {
/**
* Invokes every time some data is flushed through the [ByteReadChannel].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.content.ProgressListener.onProgress)
*/
public suspend fun onProgress(bytesSentTotal: Long, contentLength: Long?)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ internal val CLIENT_CONFIG = AttributeKey<HttpClientConfig<*>>("client-config")

/**
* Serves as the base interface for an [HttpClient]'s engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngine)
*/
public interface HttpClientEngine : CoroutineScope, Closeable {
/**
* Specifies [CoroutineDispatcher] for I/O operations.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngine.dispatcher)
*/
public val dispatcher: CoroutineDispatcher

Expand Down Expand Up @@ -109,17 +111,20 @@ public interface HttpClientEngine : CoroutineScope, Closeable {

/**
* A factory of [HttpClientEngine] with a specific [T] of [HttpClientEngineConfig].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngineFactory)
*/
public interface HttpClientEngineFactory<out T : HttpClientEngineConfig> {
/**
* Creates a new [HttpClientEngine] optionally specifying a [block] configuring [T].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngineFactory.create)
*/
public fun create(block: T.() -> Unit = {}): HttpClientEngine
}

/**
* Creates a new [HttpClientEngineFactory] based on this one
* with further configurations from the [nested] block.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.config)
*/
public fun <T : HttpClientEngineConfig> HttpClientEngineFactory<T>.config(
nested: T.() -> Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import kotlin.coroutines.*
* Abstract implementation of [HttpClientEngine] responsible for lifecycle control of [dispatcher] and
* [coroutineContext] as well as proper call context management. Should be considered as the best parent class for
* custom [HttpClientEngine] implementations.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngineBase)
*/
public abstract class HttpClientEngineBase(private val engineName: String) : HttpClientEngine {
private val closed = atomic(false)
Expand All @@ -35,6 +36,7 @@ public abstract class HttpClientEngineBase(private val engineName: String) : Htt

/**
* An exception indicating that the client's engine is already closed.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.ClientEngineClosedException)
*/
public class ClientEngineClosedException(override val cause: Throwable? = null) :
IllegalStateException("Client already closed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal val ENGINE_CAPABILITIES_KEY =

/**
* Default capabilities expected to be supported by engine.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.DEFAULT_CAPABILITIES)
*/
public val DEFAULT_CAPABILITIES: Set<HttpClientEngineCapability<*>> = setOf(HttpTimeoutCapability)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import kotlinx.coroutines.*

/**
* Base configuration for [HttpClientEngine].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngineConfig)
*/
@KtorDsl
public open class HttpClientEngineConfig {
/**
* Specifies network threads count advice.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.HttpClientEngineConfig.threadsCount)
*/
@Deprecated(
"The [threadsCount] property is deprecated. Consider setting [dispatcher] instead.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import io.ktor.util.network.*

/**
* A [proxy](https://ktor.io/docs/proxy.html) configuration.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.ProxyConfig)
*/
public expect class ProxyConfig

/**
* A type of the configured proxy.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.type)
*/
public expect val ProxyConfig.type: ProxyType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import kotlin.coroutines.*

/**
* Default user agent to use in ktor client.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.engine.KTOR_DEFAULT_USER_AGENT)
*/
@InternalAPI
public val KTOR_DEFAULT_USER_AGENT: String = "ktor-client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import kotlinx.io.IOException

/**
* This exception is thrown in case connect timeout exceeded.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.network.sockets.ConnectTimeoutException)
*/
public expect class ConnectTimeoutException(message: String, cause: Throwable? = null) : IOException

public expect open class InterruptedIOException : IOException

/**
* This exception is thrown in case socket timeout (read or write) exceeded.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.network.sockets.SocketTimeoutException)
*/
public expect class SocketTimeoutException : InterruptedIOException

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private val DownloadProgressListenerAttributeKey =

/**
* Plugin that provides observable progress for uploads and downloads
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.BodyProgress)
*/
public val BodyProgress: ClientPlugin<Unit> = createClientPlugin("BodyProgress") {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.ktor.util.converters.DataConversion

/**
* Object for installing [io.ktor.util.converters.DataConversion] as plugin
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.DataConversion)
*/
public object DataConversion : HttpClientPlugin<DataConversion.Configuration, DataConversion> {
override val key: AttributeKey<DataConversion> = AttributeKey("DataConversion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private val LOGGER = KtorSimpleLogger("io.ktor.client.plugins.DefaultRequest")
* client.get("https://some.url") { HttpHeaders.ContentType = ContentType.Application.Xml }
* // <- requests "https://some.url/", ContentType = Application.Xml
* ```
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.DefaultRequest)
*/
public class DefaultRequest private constructor(private val block: DefaultRequestBuilder.() -> Unit) {

Expand Down Expand Up @@ -157,6 +158,7 @@ public class DefaultRequest private constructor(private val block: DefaultReques

/**
* Configuration object for [DefaultRequestBuilder] plugin
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.DefaultRequest.DefaultRequestBuilder)
*/
@KtorDsl
public class DefaultRequestBuilder internal constructor() : HttpMessageBuilder {
Expand Down Expand Up @@ -220,6 +222,7 @@ public class DefaultRequest private constructor(private val block: DefaultReques

/**
* Set default request parameters. See [DefaultRequest]
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.defaultRequest)
*/
public fun HttpClientConfig<*>.defaultRequest(block: DefaultRequest.DefaultRequestBuilder.() -> Unit) {
install(DefaultRequest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private val LOGGER = KtorSimpleLogger("io.ktor.client.plugins.DefaultResponseVal
/**
* Default response validation.
* Check the response status code in range (0..299).
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.addDefaultResponseValidation)
*/
public fun HttpClientConfig<*>.addDefaultResponseValidation() {
HttpResponseValidator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private val LOGGER = KtorSimpleLogger("io.ktor.client.plugins.defaultTransformer
* Install default transformers.
* Usually installed by default so there is no need to use it
* unless you have disabled it via [HttpClientConfig.useDefaultTransformers].
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.defaultTransformers)
*/
@OptIn(InternalAPI::class)
public fun HttpClient.defaultTransformers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ private val RESPONSE_BODY_SAVED = AttributeKey<Unit>("ResponseBodySaved")

/**
* Configuration for [SaveBodyPlugin]
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.SaveBodyPluginConfig)
*/
public class SaveBodyPluginConfig {
/**
Expand All @@ -29,6 +30,7 @@ public class SaveBodyPluginConfig {
* skipSavingBody()
* }
* ```
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.SaveBodyPluginConfig.disabled)
*/
public var disabled: Boolean = false
}
Expand All @@ -51,6 +53,7 @@ public class SaveBodyPluginConfig {
* }
* }
* ```
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.SaveBodyPlugin)
*/
@OptIn(InternalAPI::class)
public val SaveBodyPlugin: ClientPlugin<SaveBodyPluginConfig> = createClientPlugin(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ private val LOGGER = KtorSimpleLogger("io.ktor.client.plugins.HttpCallValidator"

/**
* [HttpCallValidator] configuration.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.HttpCallValidatorConfig)
*/
@KtorDsl
public class HttpCallValidatorConfig {
Expand All @@ -35,6 +36,7 @@ public class HttpCallValidatorConfig {
/**
* Add [CallRequestExceptionHandler].
* Last added handler executes first.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.HttpCallValidatorConfig.handleResponseException)
*/
public fun handleResponseException(block: CallRequestExceptionHandler) {
responseExceptionHandlers += RequestExceptionHandlerWrapper(block)
Expand All @@ -61,6 +63,7 @@ public class HttpCallValidatorConfig {
* Response validator method.
*
* You could throw an exception to fail the response.
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.plugins.ResponseValidator)
*/
public typealias ResponseValidator = suspend (response: HttpResponse) -> Unit

Expand Down
Loading

0 comments on commit 71c1a56

Please sign in to comment.