Liking cljdoc? Tell your friends :D

ehr-adapter.core


initializeclj

(initialize adapter-config)
(initialize ctx adapter-config)

Builds and validates an adapter instance ready for use from a configuration map.

This process:

  1. Validates the input configuration against the AdapterConfiguration schema.
  2. Wraps the request-handler with middlewares and network retry logic.
  3. Compiles all defined operations for fast execution.
  4. If authentication is configured, initializes the token state in a thread-safe atom.

Args:

  • ctx: (Optional) Initial context map to resolve references during setup.
  • adapter-config: Configuration map conforming to the adapter schema.

Returns: A map validated as AdapterInstance, ready to be used with invoke.

Builds and validates an adapter instance ready for use from a configuration map.

This process:
1. Validates the input configuration against the `AdapterConfiguration` schema.
2. Wraps the `request-handler` with middlewares and network retry logic.
3. Compiles all defined operations for fast execution.
4. If authentication is configured, initializes the token state in a thread-safe atom.

Args:
- ctx: (Optional) Initial context map to resolve references during setup.
- adapter-config: Configuration map conforming to the adapter schema.

Returns:
A map validated as `AdapterInstance`, ready to be used with `invoke`.
raw docstring

invokeclj

(invoke adapter-instance operation-key)
(invoke adapter-instance operation-key ctx)

Executes a precompiled operation within an adapter instance.

Before executing the operation, this function:

  1. Automatically ensures the authentication token is valid (proactive refresh if needed).
  2. Safely injects authorization headers into the request, preserving any custom headers provided by the user in the context.

Args:

  • adapter-instance: The adapter instance created previously with initialize.
  • operation-key: The keyword identifying the operation to execute.
  • ctx: (Optional) Map with dynamic bindings and request overrides for this specific execution.

Returns: The resulting HTTP response map from the operation execution.

Throws:

  • :unsupported/invoked-operation if the operation key does not exist in the instance.
Executes a precompiled operation within an adapter instance.

Before executing the operation, this function:
1. Automatically ensures the authentication token is valid (proactive refresh if needed).
2. Safely injects authorization headers into the request, preserving any custom headers provided by the user in the context.

Args:
- adapter-instance: The adapter instance created previously with `initialize`.
- operation-key: The keyword identifying the operation to execute.
- ctx: (Optional) Map with dynamic bindings and request overrides for this specific execution.

Returns:
The resulting HTTP response map from the operation execution.

Throws:
- `:unsupported/invoked-operation` if the operation key does not exist in the instance.
raw docstring

wrap-handlerclj

(wrap-handler request-handler middlewares)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close