OpenApiTypesense.Connection (OpenApiTypesense v1.0.4)
View SourceFetches credentials either from application env or map.
Summary
Functions
Setting new connection or using the default config.
Types
Functions
@spec config() :: list()
@spec new() :: %OpenApiTypesense.Connection{ api_key: term(), client: term(), host: term(), options: term(), port: term(), scheme: term() }
Setting new connection or using the default config.
On using this function
Functions e.g. OpenApiTypesense.Health.health/0
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
...> Connection.new()
%OpenApiTypesense.Connection{
host: "localhost",
port: 8108,
scheme: "http",
api_key: "xyz"
}
iex> alias OpenApiTypesense.Connection
...> Connection.new(%{})
** (ArgumentError) Missing required fields: [:api_key, :host, :port, :scheme]