Polarex.Meters (Polarex v0.3.2)

Copy Markdown View Source

Provides API endpoints related to meters

Summary

Functions

meters_create(body, opts \\ [])

@spec meters_create(body :: Polarex.MeterCreate.t(), opts :: keyword()) ::
  {:ok, Polarex.Meter.t()} | {:error, Polarex.HTTPValidationError.t()}

Create Meter

Create a meter.

Scopes: meters:write

Request Body

Content Types: application/json

meters_get(id, opts \\ [])

@spec meters_get(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.Meter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Meter

Get a meter by ID.

Scopes: meters:read meters:write

meters_list(opts \\ [])

@spec meters_list(opts :: keyword()) ::
  {:ok, Polarex.ListResourceMeter.t()}
  | {:error, Polarex.HTTPValidationError.t()}

List Meters

List meters.

Scopes: meters:read meters:write

Options

  • organization_id: Filter by organization ID.
  • query: Filter by name.
  • is_archived: Filter on archived meters.
  • page: Page number, defaults to 1.
  • limit: Size of a page, defaults to 10. Maximum is 100.
  • sorting: Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.
  • metadata: Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.

meters_quantities(id, opts \\ [])

@spec meters_quantities(id :: String.t(), opts :: keyword()) ::
  {:ok, Polarex.MeterQuantities.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Get Meter Quantities

Get quantities of a meter over a time period.

Scopes: meters:read meters:write

Options

  • start_timestamp: Start timestamp.
  • end_timestamp: End timestamp.
  • interval: Interval between two timestamps.
  • timezone: Timezone to use for the timestamps. Default is UTC.
  • customer_id: Filter by customer ID.
  • external_customer_id: Filter by external customer ID.
  • customer_aggregation_function: If set, will first compute the quantities per customer before aggregating them using the given function. If not set, the quantities will be aggregated across all events.
  • metadata: Filter by metadata key-value pairs. It uses the deepObject style, e.g. ?metadata[key]=value.

meters_update(id, body, opts \\ [])

@spec meters_update(
  id :: String.t(),
  body :: Polarex.MeterUpdate.t(),
  opts :: keyword()
) ::
  {:ok, Polarex.Meter.t()}
  | {:error, Polarex.HTTPValidationError.t() | Polarex.ResourceNotFound.t()}

Update Meter

Update a meter.

Scopes: meters:write

Request Body

Content Types: application/json