Meili.Key (Meili v0.1.0)

Copy Markdown View Source

Manages Meilisearch API keys.

Summary

Functions

Creates a new API key, raising on error.

Deletes an API key, raising on error.

Retrieves a single API key by its value or UUID.

Retrieves a single API key, raising on error.

Lists all API keys, raising on error.

Updates an existing API key. Only the name and description can be updated.

Functions

create(client_or_params, params_or_nil \\ nil)

Creates a new API key.

Keys are automatically camelized from snake_case to camelCase.

Options

  • name: Human-readable name.
  • description: Purpose of the key.
  • actions: List of permitted actions (e.g. ["search"]).
  • indexes: List of accessible indexes.
  • expires_at / expiresAt: Expiration date (RFC 3339 string).

Examples

params = %{
  name: "Search Key",
  actions: ["search"],
  indexes: ["*"],
  expires_at: nil
}
Meili.Key.create(params)
Meili.Key.create(client, params)

create!(client_or_params, params_or_nil \\ nil)

Creates a new API key, raising on error.

delete(client_or_key, key_or_nil \\ nil)

Deletes an API key.

Examples

Meili.Key.delete("key_value")
Meili.Key.delete(client, "key_value")

delete!(client_or_key, key_or_nil \\ nil)

Deletes an API key, raising on error.

get(client_or_key, key_or_nil \\ nil)

Retrieves a single API key by its value or UUID.

Examples

Meili.Key.get("some-key-value-or-uuid")
Meili.Key.get(client, "some-key-value-or-uuid")

get!(client_or_key, key_or_nil \\ nil)

Retrieves a single API key, raising on error.

list(client_or_opts \\ nil, opts \\ [])

Lists all API keys.

Options

  • limit: The maximum number of keys to return.
  • offset: The number of keys to skip.

Examples

Meili.Key.list()
Meili.Key.list(limit: 5)
Meili.Key.list(client, limit: 5)

list!(client_or_opts \\ nil, opts \\ [])

Lists all API keys, raising on error.

update(client_or_key, key_or_params \\ nil, params_or_nil \\ nil)

Updates an existing API key. Only the name and description can be updated.

Examples

Meili.Key.update("key_value", name: "New Name", description: "New Description")
Meili.Key.update(client, "key_value", %{name: "New Name"})

update!(client_or_key, key_or_params \\ nil, params_or_nil \\ nil)

Updates an API key, raising on error.