GALANTHUS / ABI FUNCTION REFERENCE
gln_retrieve_accounts
Declared in <galanthus/c_api/gln_capi.h>.
GLN_API gln_status_t GLN_CALL gln_retrieve_accounts(
gln_backend_t* in_backend,
gln_backend_result_t** out_result);
Purpose
gln_retrieve_accounts asks a backend for the accounts available to the authenticated profile and returns a gln_backend_result_t envelope.
Success rows expose account identity and display fields such as IBAN, BIC, account number, bank code, owner, currency, and product name.
Backend support is operation-specific. Use gln_check_backend_operation_support to check whether a backend supports this operation before calling it. Unsupported operations return an envelope whose status is GLN_ERR_NOT_SUPPORTED.
When To Use
Use this operation before account-scoped reads such as balances, transactions, holdings, or standing orders.
Use gln_check_backend_operation_support when the caller may hold an arbitrary backend kind; support is not uniform across providers.
Call Contract
GLN_OK from the function means an envelope was produced in *out_result; it does not mean the backend operation succeeded. Inspect the envelope with gln_get_backend_result_outcome, gln_get_backend_result_status, and gln_get_backend_result_kind.
out_result == NULL is the no-envelope invalid-argument case. In that case the function returns GLN_ERR_INVALID_ARG directly.
The parameter table is binding for required handles and output slots.
Return
Returns GLN_OK when the call produced a gln_backend_result_t envelope in out_result. Operation success, caller action, provider rejection, and operation errors are reported inside that envelope.
| Type | Nullability | Ownership |
|---|---|---|
gln_status_t | value | value |
Parameters
| Name | Direction | Type | Nullability | Ownership |
|---|---|---|---|---|
in_backend | input | gln_backend_t* | nonnull | borrowed |
out_result | output | gln_backend_result_t** | nonnull | transferred_out |
Success Result
Successful operation envelopes have outcome GLN_BACKEND_OUTCOME_SUCCESS, status GLN_OK, and kind GLN_BACKEND_RESULT_KIND_ACCOUNTS.
Borrow the typed success view with gln_get_backend_result_accounts.
Use gln_get_backend_result_accounts only when the envelope outcome is GLN_BACKEND_OUTCOME_SUCCESS and the kind is GLN_BACKEND_RESULT_KIND_ACCOUNTS.
Action-required envelopes carry interrupt details and a continuation instead of this typed success view. Resume the operation and read the accessor only after a success envelope is produced.
Use the account identity accessors to feed later requests: gln_get_account_iban for balance, transaction, and standing-order reads; gln_get_account_number, optional gln_get_account_subaccount_number, and gln_get_account_bank_code are relevant to holdings requests.
Outcomes
GLN_BACKEND_OUTCOME_SUCCESS: read theGLN_BACKEND_RESULT_KIND_ACCOUNTStyped view.GLN_BACKEND_OUTCOME_ACTION_REQUIRED: FinTS read flows can require caller action, usually a TAN or decoupled step. Inspectgln_get_backend_result_interrupt_info, take the continuation withgln_take_backend_result_continuation, and resume withgln_resume_continuation.GLN_BACKEND_OUTCOME_REJECTED: inspectgln_get_backend_result_statusandgln_get_backend_result_errorfor provider rejection details.GLN_BACKEND_OUTCOME_ERROR: inspectgln_get_backend_result_statusandgln_get_backend_result_error. Other backends use this outcome with statusGLN_ERR_NOT_SUPPORTED.
Ownership And Lifetime
The envelope returned through out_result is caller-owned and must be released with gln_destroy_backend_result.
Typed views, result rows or fields, borrowed strings, and the JSON string are borrowed from the envelope. They become invalid when the envelope is destroyed. Copy strings or row data before destroying the envelope when the caller needs to keep them.
For action-required envelopes, gln_get_backend_result_interrupt_info returns borrowed interrupt details. gln_take_backend_result_continuation transfers continuation ownership to the caller; destroy that continuation with gln_destroy_continuation after it has been saved or resumed.
Example
gln_backend_result_t* result = NULL;
gln_status_t rc = gln_retrieve_accounts(backend, &result);
if (rc != GLN_OK) {
return rc;
}
if (gln_get_backend_result_outcome(result) == GLN_BACKEND_OUTCOME_SUCCESS &&
gln_get_backend_result_kind(result) == GLN_BACKEND_RESULT_KIND_ACCOUNTS) {
const gln_accounts_t* accounts = gln_get_backend_result_accounts(result);
for (size_t i = 0; i < gln_get_accounts_count(accounts); ++i) {
const gln_account_t* account = gln_get_account_at(accounts, i);
remember_account(
gln_get_account_iban(account),
gln_get_account_bic(account),
gln_get_account_owner(account),
gln_get_account_currency(account));
}
}
else if (gln_get_backend_result_outcome(result) == GLN_BACKEND_OUTCOME_ACTION_REQUIRED) {
gln_continuation_t* continuation = gln_take_backend_result_continuation(result);
handle_read_interrupt(gln_get_backend_result_interrupt_info(result), continuation);
gln_destroy_continuation(continuation);
}
else {
handle_read_failure(
gln_get_backend_result_status(result),
gln_get_backend_result_error(result));
}
gln_destroy_backend_result(result);
See Also
gln_get_backend_result_outcomegln_get_backend_result_statusgln_get_backend_result_kindgln_get_backend_result_accountsgln_get_backend_result_opaque_jsongln_get_backend_result_interrupt_infogln_take_backend_result_continuationgln_resume_continuationgln_get_backend_result_errorgln_destroy_backend_resultgln_get_accounts_countgln_get_account_atgln_get_account_ibangln_get_account_numbergln_get_account_bank_codegln_check_backend_operation_support- ABI function index