Usage — current period summary, per-session metering, and report queries.
Example
client = Miosa.client(System.fetch_env!("MIOSA_API_KEY"))
{:ok, summary} = Miosa.Usage.current(client)
{:ok, sessions} = Miosa.Usage.sessions(client, %{limit: 100})
Summary
Functions
Get the current period usage summary.
Rollup usage grouped by external_user_id, external_project_id, or
workspace_id.
Get a usage report for a period.
List per-session metering events.
Functions
@spec current(Miosa.Client.t()) :: Miosa.Client.result(map())
Get the current period usage summary.
@spec get(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())
Rollup usage grouped by external_user_id, external_project_id, or
workspace_id.
GET /api/v1/usage?group_by=<group>&period=<period>
Options
:group_by—"external_user_id"(default),"external_project_id", or"workspace_id".:period—"7d","30d","month-to-date", or a map%{start: iso, end: iso}.:external_user_id— filter to a single user.
Returns {:ok, %{"period_start" => _, "period_end" => _, "results" => [...]}}.
@spec report(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())
Get a usage report for a period.
Options: :period_start and :period_end (ISO 8601 strings), plus any
additional filters accepted by the API.
@spec sessions(Miosa.Client.t(), keyword() | map()) :: Miosa.Client.result(map())
List per-session metering events.
Accepts optional filters as a keyword list or map (e.g. :limit, :cursor,
:computer_id).