Mercury.Customers (mercury_client v1.0.0)

Copy Markdown View Source

The Mercury Customers API — accounts-receivable customers.

Summary

Functions

Creates a new customer. POST /customers

Deletes a customer. This action is irreversible. DELETE /customers/{id}

Returns a single customer by ID. GET /customers/{id}

Returns one page of customers. GET /customers

A lazy, auto-paginating stream of every customer.

Updates a customer. PUT /customers/{id}

Functions

create(client, attrs)

@spec create(client :: Mercury.Client.t(), attrs :: map() | keyword()) ::
  {:ok, Mercury.Customer.t()} | {:error, Exception.t()}

Creates a new customer. POST /customers

create!(client, attrs)

@spec create!(client :: Mercury.Client.t(), attrs :: map() | keyword()) ::
  Mercury.Customer.t()

delete(client, customer_id)

@spec delete(client :: Mercury.Client.t(), customer_id :: String.t()) ::
  :ok | {:error, Exception.t()}

Deletes a customer. This action is irreversible. DELETE /customers/{id}

delete!(client, customer_id)

@spec delete!(client :: Mercury.Client.t(), customer_id :: String.t()) :: :ok

get(client, customer_id)

@spec get(client :: Mercury.Client.t(), customer_id :: String.t()) ::
  {:ok, Mercury.Customer.t()} | {:error, Exception.t()}

Returns a single customer by ID. GET /customers/{id}

get!(client, customer_id)

@spec get!(client :: Mercury.Client.t(), customer_id :: String.t()) ::
  Mercury.Customer.t()

list(client, opts \\ [])

@spec list(client :: Mercury.Client.t(), opts :: keyword()) ::
  {:ok, Mercury.Page.t(Mercury.Customer.t())} | {:error, Exception.t()}

Returns one page of customers. GET /customers

list!(client, opts \\ [])

@spec list!(client :: Mercury.Client.t(), opts :: keyword()) ::
  Mercury.Page.t(Mercury.Customer.t())

stream(client, opts \\ [])

@spec stream(client :: Mercury.Client.t(), opts :: keyword()) :: Enumerable.t()

A lazy, auto-paginating stream of every customer.

update(client, customer_id, attrs)

@spec update(
  client :: Mercury.Client.t(),
  customer_id :: String.t(),
  attrs :: map() | keyword()
) ::
  {:ok, Mercury.Customer.t()} | {:error, Exception.t()}

Updates a customer. PUT /customers/{id}

update!(client, customer_id, attrs)

@spec update!(
  client :: Mercury.Client.t(),
  customer_id :: String.t(),
  attrs :: map() | keyword()
) ::
  Mercury.Customer.t()