public class OkClient extends Object implements io.apimatic.coreinterfaces.http.HttpClient
| Constructor and Description |
|---|
OkClient(io.apimatic.coreinterfaces.http.ClientConfiguration httpClientConfig,
io.apimatic.coreinterfaces.compatibility.CompatibilityFactory compatibilityFactory)
Constructor to initialize the OKClient.
|
| Modifier and Type | Method and Description |
|---|---|
static okhttp3.Authenticator |
buildProxyAuthenticator(String username,
String password)
Builds a proxy authenticator using the provided credentials.
|
static io.apimatic.coreinterfaces.http.response.Response |
convertResponse(io.apimatic.coreinterfaces.http.request.Request request,
okhttp3.Response response,
boolean hasBinaryResponse)
Converts a given OkHttp response into our internal http response model.
|
io.apimatic.coreinterfaces.http.response.Response |
execute(io.apimatic.coreinterfaces.http.request.Request httpRequest,
io.apimatic.coreinterfaces.http.request.configuration.CoreEndpointConfiguration endpointConfiguration)
Execute a given Request to get string/binary response back.
|
CompletableFuture<io.apimatic.coreinterfaces.http.response.Response> |
executeAsync(io.apimatic.coreinterfaces.http.request.Request httpRequest,
io.apimatic.coreinterfaces.http.request.configuration.CoreEndpointConfiguration endpointConfiguration)
Execute a given Request to get string/binary response back.
|
static void |
shutdown()
Shutdown the underlying OkHttpClient instance.
|
public OkClient(io.apimatic.coreinterfaces.http.ClientConfiguration httpClientConfig,
io.apimatic.coreinterfaces.compatibility.CompatibilityFactory compatibilityFactory)
httpClientConfig - The httpClientConfigurationcompatibilityFactory - The compatibilityFactory for backward compatibilitypublic static okhttp3.Authenticator buildProxyAuthenticator(String username, String password)
username - the proxy usernamepassword - the proxy passwordAuthenticator that adds Proxy-Authorization headers,
or null if credentials are incompletepublic static void shutdown()
public CompletableFuture<io.apimatic.coreinterfaces.http.response.Response> executeAsync(io.apimatic.coreinterfaces.http.request.Request httpRequest, io.apimatic.coreinterfaces.http.request.configuration.CoreEndpointConfiguration endpointConfiguration)
executeAsync in interface io.apimatic.coreinterfaces.http.HttpClienthttpRequest - The given Request to execute.endpointConfiguration - The endpoint configuration for request.public io.apimatic.coreinterfaces.http.response.Response execute(io.apimatic.coreinterfaces.http.request.Request httpRequest,
io.apimatic.coreinterfaces.http.request.configuration.CoreEndpointConfiguration endpointConfiguration)
throws IOException
execute in interface io.apimatic.coreinterfaces.http.HttpClienthttpRequest - The given Request to execute.endpointConfiguration - The endpointConfiguration for request.IOException - Exception to be thrown while converting response.public static io.apimatic.coreinterfaces.http.response.Response convertResponse(io.apimatic.coreinterfaces.http.request.Request request,
okhttp3.Response response,
boolean hasBinaryResponse)
throws IOException
request - The given http request in internal format.response - The given OkHttp response.hasBinaryResponse - Whether the response is binary or string.IOException - exception to be thrown while converting response.Copyright © 2025. All rights reserved.