Client configuration shared by Medplum API requests.
Summary
Types
Bearer token used directly for authenticated requests.
Authentication strategy used to authorize requests.
Base Medplum URL without a trailing slash.
OAuth client id used for the client credentials grant.
OAuth client secret paired with the client id.
FHIR version segment used in request paths. Defaults to "R4".
Default headers merged into every FHIR request.
Extra Req options forwarded to outgoing requests.
Client state used to authenticate requests and build FHIR URLs.
Functions
Builds a Medplum client.
Builds a Medplum client and raises on invalid configuration.
Builds a Medplum client that uses an existing bearer token directly.
Types
@type access_token() :: String.t() | nil
Bearer token used directly for authenticated requests.
@type auth_mode() :: :client_credentials | :access_token
Authentication strategy used to authorize requests.
@type base_url() :: String.t()
Base Medplum URL without a trailing slash.
@type client_id() :: String.t()
OAuth client id used for the client credentials grant.
@type client_secret() :: String.t()
OAuth client secret paired with the client id.
@type fhir_version() :: String.t()
FHIR version segment used in request paths. Defaults to "R4".
Default headers merged into every FHIR request.
@type req_options() :: keyword()
Extra Req options forwarded to outgoing requests.
@type retry() :: false | :safe_transient | :transient
Retry strategy passed through to Req.
@type t() :: %Medplum.Client{ access_token: access_token(), auth_mode: auth_mode(), auth_req_options: req_options(), base_url: base_url(), cache_tokens: boolean(), client_id: client_id(), client_secret: client_secret(), default_headers: headers(), fhir_version: fhir_version(), max_retries: non_neg_integer(), req_options: req_options(), retry: retry(), token_refresh_skew: non_neg_integer() }
Client state used to authenticate requests and build FHIR URLs.
Functions
Builds a Medplum client.
The base_url value is normalized by trimming a trailing slash, and
fhir_version defaults to "R4" when it is not provided.
By default the client uses the OAuth client credentials grant. When
access_token is provided, the client switches to direct bearer-token mode
unless auth_mode is set explicitly.
Builds a Medplum client and raises on invalid configuration.
Builds a Medplum client that uses an existing bearer token directly.