(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)Performs a synchronous HTTP request using OkHttpClient.
Parameters:
client: OkHttpClient instance.request-data: Map containing request details, including optional timeout settings.request-data:
timeout-opts: Optional map of timeout settings.Returns:
Example: (request client {:url "https://api.example.com"})
Performs a synchronous HTTP request using OkHttpClient.
Parameters:
- `client`: OkHttpClient instance.
- `request-data`: Map containing request details, including optional timeout settings.
`request-data`:
- `timeout-opts`: Optional map of timeout settings.
Returns:
- A map representation of the response.
Example:
(request client {:url "https://api.example.com"})(request-async client {:keys [timeout-opts] :as request-data} callbacks)Performs an asynchronous cancellable HTTP request using OkHttpClient.
Parameters:
client: OkHttpClient instance.request-data: Map containing request details, including optional timeout settings.callbacks: Map of callback functions for async handling.request-data:
timeout-opts: Optional map of timeout settings.callbacks:
on-response: Function to be called on successful response. Receives the response as a map.on-failure: Function to be called on request failure. Receives the exception as a parameter.Returns:
Example: (request-async client {:url "https://api.example.com"} {:on-response success-fn :on-failure failure-fn})
Performs an asynchronous cancellable HTTP request using OkHttpClient.
Parameters:
- `client`: OkHttpClient instance.
- `request-data`: Map containing request details, including optional timeout settings.
- `callbacks`: Map of callback functions for async handling.
`request-data`:
- `timeout-opts`: Optional map of timeout settings.
`callbacks`:
- `on-response`: Function to be called on successful response. Receives the response as a map.
- `on-failure`: Function to be called on request failure. Receives the exception as a parameter.
Returns:
- A function that cancels the request when called.
Example:
(request-async client {:url "https://api.example.com"} {:on-response success-fn :on-failure failure-fn})cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |