Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feedback link to KDocs #4531

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ 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)
e5l marked this conversation as resolved.
Show resolved Hide resolved
*/
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,8 @@ 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,16 @@ 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,8 @@ 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,17 @@ 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,8 @@ 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,17 @@ 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,8 @@ 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,8 @@ 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,14 @@ 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 +48,8 @@ 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,8 @@ 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,8 @@ 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 +30,8 @@ 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 @@ -21,6 +21,9 @@ import kotlin.reflect.*
/**
* A pair of a [request] and [response] for a specific [HttpClient].
*
*
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.call.HttpClientCall)
*
* @property client the client that executed the call.
*/
public open class HttpClientCall(
Expand Down Expand Up @@ -128,6 +131,9 @@ public open class HttpClientCall(
/**
* Tries to receive the payload of the [response] as a specific type [T].
*
*
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.call.body)
*
* @throws NoTransformationFoundException If no transformation is found for the type [T].
* @throws DoubleReceiveException If already called [body].
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ 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 @@ -15,12 +15,17 @@ import kotlin.coroutines.*

/**
* Callback that can be registered to listen for upload/download progress.
*
* [Report a problem](https://ktor.io/feedback?fqname=io.ktor.client.content.ProgressListener)
*
* @param bytesSentTotal number of transmitted bytes.
* @param contentLength body size. Can be null if the size is unknown.
*/
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,14 @@ 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 +113,23 @@ 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,8 @@ 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 +37,8 @@ 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,8 @@ 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,15 @@ 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,15 @@ 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,8 @@ 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,17 @@ 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,8 @@ 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,8 @@ 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,8 @@ 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 +159,8 @@ 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 +224,8 @@ 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,8 @@ 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,8 @@ 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
Loading
Loading