ExTypesense.Key (ExTypesense v2.0.0)
View SourceTypesense allows you to create API Keys with fine-grained access control. You can restrict access on a per-collection, per-action, per-record or even per-field level or a mixture of these.
More here: https://typesense.org/docs/latest/api/api-keys.html
Summary
Functions
Typesense allows you to create API Keys with fine-grained access control. You can restrict access on a per-collection, per-action, per-record or even per-field level or a mixture of these.
Same as create_key/1
Delete an API key given its ID.
Same as delete_key/1
Retrieve (metadata about) all keys.
Same as get_key/1
Retrieve (metadata about) all keys.
Same as list_keys/0
Functions
@spec create_key(map()) :: {:ok, OpenApiTypesense.ApiKey.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Typesense allows you to create API Keys with fine-grained access control. You can restrict access on a per-collection, per-action, per-record or even per-field level or a mixture of these.
Examples
iex> body = %{
...> actions: ["documents:search"],
...> collections: ["companies"],
...> description: "Search-only companies key"
...> }
iex> ExTypesense.create_key(body)
@spec create_key( map(), keyword() ) :: {:ok, OpenApiTypesense.ApiKey.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Same as create_key/1
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.create_key(body, conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.create_key(body, conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.create_key(body, opts)
@spec delete_key(integer()) :: {:ok, OpenApiTypesense.ApiKeyDeleteResponse.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Delete an API key given its ID.
@spec delete_key( integer(), keyword() ) :: {:ok, OpenApiTypesense.ApiKeyDeleteResponse.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Same as delete_key/1
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.delete_key(6, conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.delete_key(7, conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.delete_key(8, opts)
@spec get_key(integer()) :: {:ok, OpenApiTypesense.ApiKey.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Retrieve (metadata about) all keys.
@spec get_key( integer(), keyword() ) :: {:ok, OpenApiTypesense.ApiKey.t()} | {:error, OpenApiTypesense.ApiResponse.t()}
Same as get_key/1
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.get_key(6, conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.get_key(7, conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.get_key(8, opts)
@spec list_keys() :: {:ok, OpenApiTypesense.ApiKeysResponse.t()} | :error
Retrieve (metadata about) all keys.
@spec list_keys(keyword()) :: {:ok, OpenApiTypesense.ApiKeysResponse.t()} | :error
Same as list_keys/0
Options
conn
: The custom connection map or struct you passed
Examples
iex> conn = %{api_key: xyz, host: ...}
iex> ExTypesense.list_keys(conn: conn)
iex> conn = OpenApiTypesense.Connection.new()
iex> ExTypesense.list_keys(conn: conn)
iex> opts = [conn: conn]
iex> ExTypesense.list_keys(opts)