Deepgram.Manage (Deepgram v0.1.0)

View Source

Management API services for the Deepgram API.

This module provides project and key management capabilities including project operations, API key management, member management, and usage tracking.

Summary

Functions

Gets all balances for a project.

Gets a specific API key.

Gets all API keys for a project.

Gets all members of a project.

Gets a specific model by ID.

Gets all available models for a project.

Gets a specific project by ID.

Gets all projects accessible by the API key.

Gets usage requests for a project.

Gets usage summary for a project.

Removes a member from a project.

Functions

create_key(client, project_id, options)

Creates a new API key.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> options = %{comment: "My API key", scopes: ["usage:read"], tags: ["production"]}
iex> {:ok, key} = Deepgram.Manage.create_key(client, "project-id", options)
{:ok, %{api_key: %{key_id: "...", api_key: "...", ...}}}

delete_key(client, project_id, key_id)

@spec delete_key(Deepgram.Client.t(), String.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.message()} | {:error, any()}

Deletes an API key.

Parameters

  • client - A Deepgram.Client struct
  • project_id - The project ID
  • key_id - The API key ID

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, message} = Deepgram.Manage.delete_key(client, "project-id", "key-id")
{:ok, %{message: "API key deleted successfully"}}

delete_project(client, project_id)

@spec delete_project(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.message()} | {:error, any()}

Deletes a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, message} = Deepgram.Manage.delete_project(client, "project-id")
{:ok, %{message: "Project deleted successfully"}}

get_balances(client, project_id)

@spec get_balances(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.balances_response()} | {:error, any()}

Gets all balances for a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, balances} = Deepgram.Manage.get_balances(client, "project-id")
{:ok, %{balances: [%{balance_id: "...", amount: 100.0, ...}]}}

get_key(client, project_id, key_id)

@spec get_key(Deepgram.Client.t(), String.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.key_response()} | {:error, any()}

Gets a specific API key.

Parameters

  • client - A Deepgram.Client struct
  • project_id - The project ID
  • key_id - The API key ID

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, key} = Deepgram.Manage.get_key(client, "project-id", "key-id")
{:ok, %{api_key: %{key_id: "...", api_key: "...", ...}}}

get_keys(client, project_id)

@spec get_keys(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.keys_response()} | {:error, any()}

Gets all API keys for a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, keys} = Deepgram.Manage.get_keys(client, "project-id")
{:ok, %{api_keys: [%{key_id: "...", api_key: "...", ...}]}}

get_members(client, project_id)

@spec get_members(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.members_response()} | {:error, any()}

Gets all members of a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, members} = Deepgram.Manage.get_members(client, "project-id")
{:ok, %{members: [%{member_id: "...", email: "...", ...}]}}

get_model(client, project_id, model_id)

@spec get_model(Deepgram.Client.t(), String.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.model_response()} | {:error, any()}

Gets a specific model by ID.

Parameters

  • client - A Deepgram.Client struct
  • project_id - The project ID
  • model_id - The model ID

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, model} = Deepgram.Manage.get_model(client, "project-id", "model-id")
{:ok, %{name: "nova-2", canonical_name: "...", ...}}

get_models(client, project_id)

@spec get_models(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.models_response()} | {:error, any()}

Gets all available models for a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, models} = Deepgram.Manage.get_models(client, "project-id")
{:ok, %{stt: [...], tts: [...], read: [...]}}

get_project(client, project_id)

@spec get_project(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.project()} | {:error, any()}

Gets a specific project by ID.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, project} = Deepgram.Manage.get_project(client, "project-id")
{:ok, %{project_id: "...", name: "...", ...}}

get_projects(client)

@spec get_projects(Deepgram.Client.t()) ::
  {:ok, Deepgram.Types.Manage.projects_response()} | {:error, any()}

Gets all projects accessible by the API key.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, projects} = Deepgram.Manage.get_projects(client)
{:ok, %{projects: [%{project_id: "...", name: "...", ...}]}}

get_usage_requests(client, project_id)

@spec get_usage_requests(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.usage_requests_response()} | {:error, any()}

Gets usage requests for a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, usage} = Deepgram.Manage.get_usage_requests(client, "project-id")
{:ok, %{page: 1, limit: 50, requests: [%{request_id: "...", ...}]}}

get_usage_summary(client, project_id)

@spec get_usage_summary(Deepgram.Client.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.usage_response()} | {:error, any()}

Gets usage summary for a project.

Parameters

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, usage} = Deepgram.Manage.get_usage_summary(client, "project-id")
{:ok, %{start: "...", end: "...", usage: %{...}}}

remove_member(client, project_id, member_id)

@spec remove_member(Deepgram.Client.t(), String.t(), String.t()) ::
  {:ok, Deepgram.Types.Manage.message()} | {:error, any()}

Removes a member from a project.

Parameters

  • client - A Deepgram.Client struct
  • project_id - The project ID
  • member_id - The member ID

Examples

iex> client = Deepgram.new(api_key: "your-api-key")
iex> {:ok, message} = Deepgram.Manage.remove_member(client, "project-id", "member-id")
{:ok, %{message: "Member removed successfully"}}