Liking cljdoc? Tell your friends :D

k16.ok-http


?Callbacksclj

source

?CreateClientPropsclj

source

?OkHttpClientclj

source

?RequestDataclj

source

create-clientclj

(create-client)
(create-client {:keys [dispatcher] :as options})
source

create-connection-poolclj

(create-connection-pool {:keys [max-idle-connections
                                keep-alive-duration-seconds]})
source

create-dispatcherclj

(create-dispatcher {:keys [executor-service idle-callback max-requests
                           max-requests-per-host]})
source

requestclj

(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:

  • A map representation of the response.

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"})
sourceraw docstring

request-asyncclj

(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:

  • 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})

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})
sourceraw docstring

set-timeouts!clj

(set-timeouts! client override-options)
source

timeout-optsclj

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close