(create-connection-pool {:keys [max-idle-connections
keep-alive-duration-seconds]})
(create-dispatcher {:keys [executor-service idle-callback max-requests
max-requests-per-host]})
(request client request-data)
(request client {:keys [timeout-opts] :as request-data} callbacks)
Performs an HTTP request using OkHttpClient.
This function can be used in two different ways:
client
: OkHttpClient instance.request-data
: Map containing request details.client
: OkHttpClient instance.request-data
: Map containing request details and optional timeout settings.callbacks
: Map of callback functions for async handling.The function automatically applies timeout settings if provided in the request-data
.
request-data
:
timeout-opts
: Optional map of timeout settings.callbacks
:
on-success
: One arity fn with response map as an argument.on-failure
: One arity fn with IOException object as an argument.The function returns the response from the synchronous call, or nil for the asynchronous call.
Example: (request client {:url "https://api.example.com"} {:on-success success-fn :on-failure failure-fn})
Performs an HTTP request using OkHttpClient. This function can be used in two different ways: 1. Synchronous Request: (request client request-data) - `client`: OkHttpClient instance. - `request-data`: Map containing request details. 2. Asynchronous Request: (request client request-data callbacks) - `client`: OkHttpClient instance. - `request-data`: Map containing request details and optional timeout settings. - `callbacks`: Map of callback functions for async handling. The function automatically applies timeout settings if provided in the `request-data`. `request-data`: - `timeout-opts`: Optional map of timeout settings. `callbacks`: - `on-success`: One arity fn with response map as an argument. - `on-failure`: One arity fn with IOException object as an argument. The function returns the response from the synchronous call, or nil for the asynchronous call. Example: (request client {:url "https://api.example.com"} {:on-success success-fn :on-failure failure-fn})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close