Medplum.Client (medplum_elixir v0.2.0)

Copy Markdown View Source

Client configuration shared by Medplum API requests.

Summary

Types

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.

Retry strategy passed through to Req.

t()

Client state used to authenticate requests and build FHIR URLs.

Functions

Builds a Medplum client.

Builds a Medplum client and raises on invalid configuration.

Types

base_url()

@type base_url() :: String.t()

Base Medplum URL without a trailing slash.

client_id()

@type client_id() :: String.t()

OAuth client id used for the client credentials grant.

client_secret()

@type client_secret() :: String.t()

OAuth client secret paired with the client id.

fhir_version()

@type fhir_version() :: String.t()

FHIR version segment used in request paths. Defaults to "R4".

headers()

@type headers() :: [{String.t(), String.t()}]

Default headers merged into every FHIR request.

req_options()

@type req_options() :: keyword()

Extra Req options forwarded to outgoing requests.

retry()

@type retry() :: false | :safe_transient | :transient

Retry strategy passed through to Req.

t()

@type t() :: %Medplum.Client{
  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

new(opts)

@spec new(keyword() | map()) :: t()

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.

new!(opts)

@spec new!(keyword() | map()) :: t()

Builds a Medplum client and raises on invalid configuration.