Package-level declarations

Types

Link copied to clipboard
class DefaultHttpClient(userAgent: String? = null, connectTimeout: Duration? = null, readTimeout: Duration? = null, var callback: DefaultHttpClient.Callback = object : Callback {}) : HttpClient

An implementation of HttpClient using the native HttpURLConnection.

Link copied to clipboard
interface HttpClient

An HTTP client performs HTTP requests.

Link copied to clipboard
class HttpContainer(baseUrl: Url? = null, val entries: Set<Url>, client: HttpClient) : Container<Resource>

Fetches remote resources through HTTP.

Link copied to clipboard
sealed class HttpDownloadError : Error

Represents an error occurring during an HTTP download activity.

Link copied to clipboard
sealed class HttpError : AccessError

Represents an error occurring during an HTTP activity.

Link copied to clipboard
class HttpFetchResponse(val response: HttpResponse, val body: ByteArray)

HTTP response with the whole body as a ByteArray.

Link copied to clipboard
data class HttpHeaders(val headers: Map<String, List<String>>)

Helper to parse HTTP request/response headers.

Link copied to clipboard
data class HttpRange(val start: Long, val end: Long?)

HTTP content range.

Link copied to clipboard
class HttpRequest(val url: AbsoluteUrl, val method: HttpRequest.Method = Method.GET, val headers: Map<String, List<String>> = mapOf(), val body: HttpRequest.Body? = null, val extras: Bundle = Bundle(), val connectTimeout: Duration? = null, val readTimeout: Duration? = null, val allowUserInteraction: Boolean = false) : Serializable

Holds the information about an HTTP request performed by an HttpClient.

Link copied to clipboard
class HttpResource(val sourceUrl: AbsoluteUrl, client: HttpClient, maxSkipBytes: Long = MAX_SKIP_BYTES) : Resource

Provides access to an external URL through HTTP.

Link copied to clipboard

Creates HttpResource instances granting access to http:// URLs using an HttpClient.

Link copied to clipboard
data class HttpResponse(val request: HttpRequest, val url: AbsoluteUrl, val statusCode: HttpStatus, val headers: Map<String, List<String>>, val mediaType: MediaType?)

Represents a successful HTTP response received from a server.

Link copied to clipboard
value class HttpStatus(val code: Int) : Comparable<HttpStatus>

Status code of an HTTP response.

Link copied to clipboard
class HttpStreamResponse(val response: HttpResponse, val body: InputStream)

HTTP response with streamable content.

Link copied to clipboard
Link copied to clipboard
data class ProblemDetails(val title: String, val type: String? = null, val status: Int? = null, val detail: String? = null, val instance: String? = null) : Parcelable

Problem Details for HTTP APIs.

Functions

Link copied to clipboard
suspend fun HttpClient.download(request: HttpRequest, destination: File, onProgress: (Double) -> Unit = {}): Try<HttpResponse, HttpDownloadError>

Downloads the resource from the given request to the destination file.

Link copied to clipboard

Fetches the resource from the given request.

Link copied to clipboard

Fetches the resource from the given request as a JSONObject.

Link copied to clipboard
suspend fun HttpClient.fetchString(request: HttpRequest, charset: Charset = Charsets.UTF_8): HttpTry<String>

Fetches the resource from the given request as a String.

Link copied to clipboard
suspend fun <T> HttpClient.fetchWithDecoder(request: HttpRequest, decoder: (HttpFetchResponse) -> T): HttpTry<T>

Fetches the resource from the given request before decoding it with the provided decoder.

Link copied to clipboard

Performs a HEAD request to retrieve only the response headers.