View Source ExTypesense.HttpClient (ExTypesense v0.3.5)

Http client for Typesense server.

Link to this section Summary

Link to this section Types

Link to this type

request_body()

View Source (since 0.1.0)
@type request_body() :: iodata() | nil
Link to this type

request_method()

View Source (since 0.1.0)
@type request_method() :: :get | :post | :delete | :patch | :put
Link to this type

request_path()

View Source (since 0.1.0)
@type request_path() :: String.t()

Link to this section Functions

Link to this function

get_host()

View Source (since 0.1.0)
Link to this function

get_port()

View Source (since 0.1.0)
Link to this function

get_scheme()

View Source (since 0.1.0)
Link to this function

httpc_run(uri, method, payload, content_type \\ 'application/json')

View Source (since 0.1.0)
@spec httpc_run(URI.__struct__(), atom(), String.t(), list()) ::
  {:ok, map()} | {:error, map()}
Link to this function

run(request_method, request_path, body \\ nil, query \\ %{})

View Source (since 0.1.0)
@spec run(request_method(), request_path(), request_body(), map()) ::
  {:ok, map()} | {:error, map()}

Req client.

examples

Examples

iex> HttpClient.run(:get, "/collections")
{:ok,
  [%{
    "created_at" => 123456789,
    "default_sorting_field" => "num_employees",
    "fields" => [...],
    "name" => "companies",
    "num_documents" => 0,
    "symbols_to_index" => [],
    "token_separators" => []
  }]
}