RequestFactory

abstract class RequestFactory : Closeable

Factory for requests, responses and event sources.

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Purpose of the request.

Functions

Link copied to clipboard
abstract override fun close()
abstract fun close(cancelOutstandingRequests: Boolean)
Link copied to clipboard
fun eventSource(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): EventSource
fun <B : Any> eventSource(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): EventSource

Creates an EventSource that uses the provided request parameters to supply the Request used for connecting to the Server-Sent Events stream.

Link copied to clipboard
fun <D : Any> eventStream(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null, decoder: (TextMediaTypeDecoder, String?, String?, String, Logger) -> D?): Flow<D>
fun <B : Any, D : Any> eventStream(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null, decoder: (TextMediaTypeDecoder, String?, String?, String, Logger) -> D?): Flow<D>

Creates an Flow of events that uses the provided request parameters to supply the Request used for connecting to the Server-Sent Events stream.

Link copied to clipboard
abstract fun registerProblem(typeId: String, problemType: KClass<out ThrowableProblem>)

Register a type of Problem to allow decoding and throwing specific exception instances of the provided type when returned in server responses.

Link copied to clipboard
inline suspend fun request(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): Request
abstract suspend fun <B : Any> request(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null, purpose: RequestFactory.RequestPurpose = RequestPurpose.Normal): Request

Create a Request.

Link copied to clipboard
abstract suspend fun response(request: Request): Response

Execute a request and return the server's response.

inline suspend fun response(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): Response
inline suspend fun <B : Any> response(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): Response

Create and execute a request created from the given request parameters and return the server's response.

Link copied to clipboard
inline suspend fun <R : Any> result(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): R
inline suspend fun <B : Any, R : Any> result(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): R
suspend fun <B : Any, R : Any> result(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null, resultType: KType): R

Create and execute a request created from the given request parameters and returns a result decoded from the server's response.

Link copied to clipboard
inline suspend fun <R : Any> resultResponse(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): ResultResponse<R>
inline suspend fun <B : Any, R : Any> resultResponse(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null): ResultResponse<R>
suspend fun <B : Any, R : Any> resultResponse(method: Method, pathTemplate: String, pathParameters: Parameters? = null, queryParameters: Parameters? = null, body: B? = null, contentTypes: List<MediaType>? = null, acceptTypes: List<MediaType>? = null, headers: Parameters? = null, resultType: KType): ResultResponse<R>

Create and execute a request created from the given request parameters and return the server's response along with a result decoded from the server's response.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val registeredProblemTypes: Map<String, KClass<out ThrowableProblem>>