All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.aallam.openai.client.internal.http.HttpRequester.kt Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta01
Show newest version
package com.aallam.openai.client.internal.http

import io.ktor.client.HttpClient
import io.ktor.client.statement.HttpResponse
import io.ktor.util.reflect.TypeInfo
import io.ktor.util.reflect.typeInfo

/**
 * Http request performer.
 */
internal interface HttpRequester {

    /**
     * Perform an HTTP request and get a result.
     */
    suspend fun  perform(info: TypeInfo, block: suspend (HttpClient) -> HttpResponse): T
}

/**
 * Perform an HTTP request and get a result
 */
internal suspend inline fun  HttpRequester.perform(noinline block: suspend (HttpClient) -> HttpResponse): T {
    return perform(typeInfo(), block)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy