Meili.Client (Meili v0.1.2)

Copy Markdown View Source

Configuration client struct for interacting with Meilisearch.

Summary

Functions

Performs an HTTP request using the client's Req.Request instance.

Types

t()

@type t() :: %Meili.Client{
  key: String.t() | nil,
  req: Req.Request.t(),
  url: String.t()
}

Functions

new(opts \\ [])

@spec new(Keyword.t() | map()) :: t()

Builds a new Meili.Client.

Options

  • :url or :endpoint - The Meilisearch base URL (default: http://localhost:7700).
  • :key or :api_key - The API key or master key for authentication.
  • :req_options - Custom configuration options passed directly to Req.new/1.

request(client, method, path, opts \\ [])

@spec request(t(), atom() | String.t(), String.t(), Keyword.t()) ::
  {:ok, term()} | {:error, Meili.Error.t()}

Performs an HTTP request using the client's Req.Request instance.

request!(client, method, path, opts \\ [])

@spec request!(t(), atom() | String.t(), String.t(), Keyword.t()) ::
  term() | no_return()

Same as request/4 but raises a Meili.Error on failure.