Typesensory.Api.Keys (Typesensory v0.1.0)

API calls for all endpoints tagged Keys.

Link to this section Summary

Functions

Create an API Key Create an API Key with fine-grain access control. You can restrict access on both a per-collection and per-action level. The generated key is returned only during creation. You want to store this key carefully in a secure place.

Delete an API key given its ID.

Retrieve (metadata about) a key Retrieve (metadata about) a key. Only the key prefix is returned when you retrieve a key. Due to security reasons, only the create endpoint returns the full API key.

Retrieve (metadata about) all keys.

Link to this section Functions

Link to this function

create_key(connection, opts \\ [])

@spec create_key(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, Typesensory.Model.ApiKey.t()}
  | {:ok, Typesensory.Model.ApiResponse.t()}
  | {:error, Tesla.Env.t()}

Create an API Key Create an API Key with fine-grain access control. You can restrict access on both a per-collection and per-action level. The generated key is returned only during creation. You want to store this key carefully in a secure place.

parameters

Parameters

  • connection (Typesensory.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :body (ApiKeySchema): The object that describes API key scope

returns

Returns

  • {:ok, Typesensory.Model.ApiKey.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

delete_key(connection, key_id, opts \\ [])

@spec delete_key(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, Typesensory.Model.ApiKey.t()}
  | {:ok, Typesensory.Model.ApiResponse.t()}
  | {:error, Tesla.Env.t()}

Delete an API key given its ID.

parameters

Parameters

  • connection (Typesensory.Connection): Connection to server
  • key_id (integer()): The ID of the key to delete
  • opts (keyword): Optional parameters

returns

Returns

  • {:ok, Typesensory.Model.ApiKey.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

get_key(connection, key_id, opts \\ [])

@spec get_key(Tesla.Env.client(), integer(), keyword()) ::
  {:ok, Typesensory.Model.ApiKey.t()}
  | {:ok, Typesensory.Model.ApiResponse.t()}
  | {:error, Tesla.Env.t()}

Retrieve (metadata about) a key Retrieve (metadata about) a key. Only the key prefix is returned when you retrieve a key. Due to security reasons, only the create endpoint returns the full API key.

parameters

Parameters

  • connection (Typesensory.Connection): Connection to server
  • key_id (integer()): The ID of the key to retrieve
  • opts (keyword): Optional parameters

returns

Returns

  • {:ok, Typesensory.Model.ApiKey.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

get_keys(connection, opts \\ [])

@spec get_keys(
  Tesla.Env.client(),
  keyword()
) :: {:ok, Typesensory.Model.ApiKeysResponse.t()} | {:error, Tesla.Env.t()}

Retrieve (metadata about) all keys.

parameters

Parameters

  • connection (Typesensory.Connection): Connection to server
  • opts (keyword): Optional parameters

returns

Returns

  • {:ok, Typesensory.Model.ApiKeysResponse.t} on success
  • {:error, Tesla.Env.t} on failure