Package africa.sendbyte.http
Class OkHttpTransport
java.lang.Object
africa.sendbyte.http.OkHttpTransport
- All Implemented Interfaces:
HttpTransport
Default
HttpTransport backed by OkHttp.
Applies the base URL, bearer authentication, JSON content headers, and a
SDK User-Agent to every request. Sync uses OkHttp's blocking call; async uses
OkHttp's native Call.enqueue(Callback) dispatcher.
-
Constructor Details
-
OkHttpTransport
-
-
Method Details
-
baseUrl
Description copied from interface:HttpTransportThe base URL (including scheme and version prefix) requests are sent to.- Specified by:
baseUrlin interfaceHttpTransport
-
execute
public SendByteResponse execute(String method, String url, Map<String, String> headers, String jsonBody) throws IOExceptionDescription copied from interface:HttpTransportExecute a request synchronously.- Specified by:
executein interfaceHttpTransport- Throws:
IOException
-
executeAsync
public CompletableFuture<SendByteResponse> executeAsync(String method, String url, Map<String, String> headers, String jsonBody) Description copied from interface:HttpTransportExecute a request asynchronously.- Specified by:
executeAsyncin interfaceHttpTransport
-
close
public void close()Description copied from interface:HttpTransportRelease any underlying resources. Optional.- Specified by:
closein interfaceHttpTransport
-