Qronomnom.Customers (Qronomnom v0.1.1)

Functions for interacting with Customers resource.

Link to this section Summary

Functions

Creates a customer.

Lists customers.

Shows a single customer.

Link to this section Types

Link to this type

customer_type()

Specs

customer_type() :: %{
  :account => String.t(),
  :email => String.t(),
  optional(:full_name) => String.t(),
  optional(:nickname) => String.t(),
  optional(:phone) => String.t(),
  optional(:metadata) => %{atom: String.t()}
}

Link to this section Functions

Link to this function

create(client, customer_data)

Specs

create(Tesla.Client.t(), customer_type()) ::
  {:error, any()} | {:ok, customer_type()}

Creates a customer.

Note that account must be a valid account ID hash.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Customers.create(%{
      account: "asklf",
      email: "string",
      full_name: "string",
      nickname: "string",
      phone: "string",
      metadata: %{
        additionalProp: "foo"
      }
})
{:ok, %{customer_id: "cus_EvLnqYo", ...}}

Specs

index(Tesla.Client.t()) :: {:error, any()} | {:ok, customer_type()}

Lists customers.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Customers.index()
{:ok, [%{customer_id: "cus_EvLnqYo"}, %{customer_id: "cus_SFOo"}]}
Link to this function

show(client, customer_id)

Specs

show(Tesla.Client.t(), String.t()) :: {:error, any()} | {:ok, customer_type()}

Shows a single customer.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Customers.show("cus_EvLnqYo")
{:ok, %{customer_id: "cus_EvLnqYo"}}
Link to this function

update(client, customer_id, customer_data)

Specs

update(Tesla.Client.t(), String.t(), customer_type()) ::
  {:error, any()} | {:ok, customer_type()}

Updates a customer.

Examples

iex> Qronomnom.client(%{api_key: "MY_KEY"}) |> Qronomnom.Customers.update("cus_EvLnqYo", %{
      email: "string",
      full_name: "string",
      nickname: "string",
      phone: "string",
      metadata: %{
        additionalProp: "foo"
      }
})
{:ok, %{customer_id: "cus_EvLnqYo", ...}}