The OpenFeed sharing API — one function per endpoint.
Every function takes an OpenFeed.Config and an access token. Collections
return every page as a list; single resources return the unwrapped data.
For a collection that could be large, OpenFeed.Client.stream/4 pages
lazily instead:
OpenFeed.Client.stream(config, token, "/v1/banking/accounts/#{id}/transactions")
|> Stream.each(&store!/1)
|> Stream.run()Scopes
| Functions | Scope |
|---|---|
banking_* | openfeed-au:data:banking:read |
energy_* | openfeed-au:data:energy:read |
grant/3 | openfeed-au:grant:self:query |
revoke_grant/3 | openfeed-au:grant:self:revoke |
app/2 | openfeed-au:app:all:read (client credentials) |
app_grants/2 | openfeed-au:grant:all:list (client credentials) |
The app_* functions need a client-credentials token from
OpenFeed.Auth.client_credentials_token/2, not a consumer's grant-bound one.
Costs
Balances are not mirrored: OpenFeed fetches them from the data holder on
demand and caches for around 15 minutes. They are the slowest calls here, and
can fail with :balance_unavailable when the data holder is down while every
other endpoint works fine. Do not fetch balances in a tight loop.
Summary
Types
An access token. Prefer the OpenFeed.Tokens struct — it carries the
token_type OpenFeed issued, which the transport needs to pick the right
authorization scheme. See OpenFeed.Client.token_type/2.
Functions
Get your app's registration. Needs a client-credentials token.
List every grant belonging to your app.
Get one banking account.
List the consumer's banking accounts.
Get a banking account's current balance.
List transactions for a banking account.
Get one energy account.
List the consumer's energy accounts.
Get an energy account's current balance. See banking_balance/4 on cost.
List billing transactions for an energy account.
Get a meter's distributed energy resource (DER) configuration.
List invoices for an energy account.
List meters for an energy account.
List usage readings for a meter.
Query a grant.
Revoke a grant.
Types
@type result(t) :: {:ok, t} | {:error, OpenFeed.Error.t()}
@type token() :: OpenFeed.Client.token()
An access token. Prefer the OpenFeed.Tokens struct — it carries the
token_type OpenFeed issued, which the transport needs to pick the right
authorization scheme. See OpenFeed.Client.token_type/2.
Functions
@spec app(OpenFeed.Config.t(), token(), keyword()) :: result(map())
Get your app's registration. Needs a client-credentials token.
@spec app_grants(OpenFeed.Config.t(), token(), keyword()) :: result([map()])
List every grant belonging to your app.
A lightweight index — id, revision, last_updated — intended for
reconciliation: poll it to notice grants revoked upstream without waiting for
a data call to fail with :grant_revoked. Needs a client-credentials token.
Get one banking account.
@spec banking_accounts(OpenFeed.Config.t(), token(), keyword()) :: result([map()])
List the consumer's banking accounts.
Get a banking account's current balance.
Fetched from the data holder on demand. Can fail with
%OpenFeed.Error{kind: :balance_unavailable} — retryable — while the rest of
the API is healthy.
List transactions for a banking account.
Options
:oldest_date/:newest_date—Dateor ISO 8601 string. Both filters are preserved across pagination.
Get one energy account.
@spec energy_accounts(OpenFeed.Config.t(), token(), keyword()) :: result([map()])
List the consumer's energy accounts.
Get an energy account's current balance. See banking_balance/4 on cost.
List billing transactions for an energy account.
Get a meter's distributed energy resource (DER) configuration.
List invoices for an energy account.
@spec energy_meter(OpenFeed.Config.t(), token(), String.t(), String.t(), keyword()) :: result(map())
Get one meter.
List meters for an energy account.
@spec energy_usage(OpenFeed.Config.t(), token(), String.t(), String.t(), keyword()) :: result([map()])
List usage readings for a meter.
Options
:oldest_date/:newest_date—Dateor ISO 8601 string.
Query a grant.
Returns its status, revision, metering state and the account ids in scope.
Needs the openfeed-au:grant:self:query scope, which must be requested at
authorization time.
@spec revoke_grant(OpenFeed.Config.t(), token(), String.t(), keyword()) :: :ok | {:error, OpenFeed.Error.t()}
Revoke a grant.
Needs the openfeed-au:grant:self:revoke scope. Returns :ok on success.
A grant that does not exist, or belongs to another app, returns
:not_found rather than :forbidden — OpenFeed does that deliberately, so
the endpoint cannot be used to probe for valid grant ids.