View Source OpenApiTypesense.Connection (OpenApiTypesense v0.2.0)

Fetches credentials either from application env or map.

Summary

Functions

Setting new connection or using the default config.

Types

t()

(since 0.2.0)
@type t() :: %{
  host: binary() | nil,
  api_key: binary() | nil,
  port: non_neg_integer() | nil,
  scheme: binary() | nil
}

Functions

new(connection \\ defaults())

(since 0.2.0)
@spec new(connection :: t() | map()) :: %OpenApiTypesense.Connection{
  api_key: term(),
  host: term(),
  port: term(),
  scheme: term()
}

Setting new connection or using the default config.

On using this function

Functions e.g. OpenApiTypesense.Health.health don't need to explicitly pass this unless you want to use another connection. Also, api_key is hidden when invoking this function.

Examples

iex> alias OpenApiTypesense.Connection

iex> conn = Connection.new()
%OpenApiTypesense.Connection{
  host: "localhost",
  port: 8108,
  scheme: "http",
  ...
}