MoneyHub.Users (MoneyHub v1.0.0)

Copy Markdown View Source

Moneyhub user management, for the "ongoing access" integration pattern where you maintain a long-lived mapping between your own user records and a Moneyhub sub.

In the simplest flow, you never call this module directly: registering a user happens implicitly the first time they complete an AIS connection via MoneyHub.Auth.pushed_authorisation_request/2 with MoneyHub.Claims.put_sub/2 called with no fixed id, and Moneyhub assigns the sub you read back from the id_token. This module exists for direct user CRUD when you need it (e.g. pre-creating a user record before any connection exists).

Summary

Functions

Deletes a user and all of their associated data.

Removes one of a user's connections.

Fetches a user's record.

Fetches one of a user's connections by id.

Lists a specific user's connections. Equivalent to MoneyHub.Connections.list/2 called with a token scoped to that user via MoneyHub.Auth.token_for_user/3, but addressable directly by user id with a client-credentials-level token.

Lists sync status/metadata for all of a user's connections.

Types

user()

@type user() :: map()

Functions

delete(config, token, user_id)

@spec delete(MoneyHub.Config.t(), String.t(), String.t()) ::
  :ok | {:error, MoneyHub.Error.t()}

Deletes a user and all of their associated data.

delete_connection(config, token, user_id, connection_id)

@spec delete_connection(MoneyHub.Config.t(), String.t(), String.t(), String.t()) ::
  :ok | {:error, MoneyHub.Error.t()}

Removes one of a user's connections.

get(config, token, user_id)

@spec get(MoneyHub.Config.t(), String.t(), String.t()) ::
  {:ok, user()} | {:error, MoneyHub.Error.t()}

Fetches a user's record.

get_connection(config, token, user_id, connection_id)

@spec get_connection(MoneyHub.Config.t(), String.t(), String.t(), String.t()) ::
  {:ok, map()} | {:error, MoneyHub.Error.t()}

Fetches one of a user's connections by id.

list_connections(config, token, user_id)

@spec list_connections(MoneyHub.Config.t(), String.t(), String.t()) ::
  {:ok, [map()]} | {:error, MoneyHub.Error.t()}

Lists a specific user's connections. Equivalent to MoneyHub.Connections.list/2 called with a token scoped to that user via MoneyHub.Auth.token_for_user/3, but addressable directly by user id with a client-credentials-level token.

list_syncs(config, token, user_id)

@spec list_syncs(MoneyHub.Config.t(), String.t(), String.t()) ::
  {:ok, [map()]} | {:error, MoneyHub.Error.t()}

Lists sync status/metadata for all of a user's connections.