Package-level declarations

Types

Link copied to clipboard
interface HttpEndpoint<in Request, Dto, out Response>

Represents a set of transforming functions that is specific for an HTTP endpoint.

Link copied to clipboard
typealias HttpErrorMapper = (error: Throwable) -> Throwable
Link copied to clipboard
typealias HttpRequestCreator<Request> = HttpRequestBuilder.(request: Request) -> Unit
Link copied to clipboard
typealias HttpResponseMapper<Request, Dto, Response> = (request: Request, dto: Dto) -> Response
Link copied to clipboard
typealias HttpResponseReader<Response> = suspend HttpResponse.() -> Response

Functions

Link copied to clipboard

Creates a DataSourceResolver integrated with HttpClient. It is based on association between DataSourceKeys and HttpEndpoints described with config block.

Link copied to clipboard
inline fun <Request, Response> HttpEndpoint(noinline requestCreator: HttpRequestCreator<Request>, noinline errorMapper: HttpErrorMapper? = null): HttpEndpoint<Request, Response, Response>

Creates a HttpEndpoint with given transformation functions, that reads a Response form HttpResponse with HttpResponse.body and returns it without mapping.

inline fun <Request, Dto, Response> HttpEndpoint(noinline requestCreator: HttpRequestCreator<Request>, noinline responseMapper: HttpResponseMapper<Request, Dto, Response>, noinline errorMapper: HttpErrorMapper? = null): HttpEndpoint<Request, Dto, Response>

Creates a HttpEndpoint with given transformation functions that reads a Dto form HttpResponse with HttpResponse.body.

fun <Request, Dto, Response> HttpEndpoint(requestCreator: HttpRequestCreator<Request>, responseReader: HttpResponseReader<Dto>, responseMapper: HttpResponseMapper<Request, Dto, Response>, errorMapper: HttpErrorMapper? = null): HttpEndpoint<Request, Dto, Response>

Creates a HttpEndpoint with given transformation functions.