Nombaone.Prices (Nomba One v0.1.0)

View Source

Prices — the amounts and cadences plans are sold at. Create and list them under a plan via Nombaone.Plans.Prices; this namespace reads and deactivates them directly.

Summary

Functions

Deactivate a price so no new subscriptions can be created against it. Existing subscriptions are unaffected — prices are immutable history.

List prices across all plans, newest first. Optional filters: :plan_ref (note the wire name — filter one plan's prices), :active, :limit, :cursor.

Retrieve a price by id. Common errors: 404 PRICE_NOT_FOUND.

Functions

deactivate(client, id, opts \\ [])

@spec deactivate(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.Price.t()} | {:error, Nombaone.Error.t()}

Deactivate a price so no new subscriptions can be created against it. Existing subscriptions are unaffected — prices are immutable history.

Common errors: 409 PRICE_ALREADY_INACTIVE.

deactivate!(client, id, opts \\ [])

@spec deactivate!(Nombaone.Client.t(), String.t(), keyword()) :: Nombaone.Price.t()

Raising variant of deactivate/3.

list(client, params \\ %{}, opts \\ [])

@spec list(Nombaone.Client.t(), map(), keyword()) ::
  {:ok, Nombaone.Page.t()} | {:error, Nombaone.Error.t()}

List prices across all plans, newest first. Optional filters: :plan_ref (note the wire name — filter one plan's prices), :active, :limit, :cursor.

Example

{:ok, page} = Nombaone.Prices.list(client, %{plan_ref: plan.id, active: true})

list!(client, params \\ %{}, opts \\ [])

@spec list!(Nombaone.Client.t(), map(), keyword()) :: Nombaone.Page.t()

Raising variant of list/3.

retrieve(client, id, opts \\ [])

@spec retrieve(Nombaone.Client.t(), String.t(), keyword()) ::
  {:ok, Nombaone.Price.t()} | {:error, Nombaone.Error.t()}

Retrieve a price by id. Common errors: 404 PRICE_NOT_FOUND.

retrieve!(client, id, opts \\ [])

@spec retrieve!(Nombaone.Client.t(), String.t(), keyword()) :: Nombaone.Price.t()

Raising variant of retrieve/3.