Skip to content

Get Accounts By Group

GetAccountsByGroup

Retrieves all accounts belonging to a specified group.

int GetAccountsByGroup(const std::string& group, std::vector<AccountRecord>* accounts);

Parameters

  • group — string representing the group name.
  • accounts — pointer to a std::vector of AccountRecord structures where the retrieved accounts will be stored.

Return Value

  • RET_OK — accounts found and successfully retrieved.
  • RET_NOT_FOUND — no accounts found for the specified group.
  • RET_* — other error codes.
  • Return Codes

Example

std::vector<AccountRecord> groupAccounts;
if (GetAccountsByGroup("demo", &groupAccounts) == RET_OK) {
    // Process groupAccounts
}

Warning

  • The accounts pointer must point to a valid std::vector<AccountRecord> object.
  • If no accounts are found, the function returns RET_NOT_FOUND and leaves accounts unchanged.
  • Always check the return code before accessing accounts.