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)
(request client {:keys [timeout-opts] :as request-data} callbacks)

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.
  1. 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})

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