AccountService

public class AccountService

Provides access to account operations

  • Retrieves a single account.

    Declaration

    Swift

    public func getAccount(budgetId: String, accountId: String) async throws -> Account

    Parameters

    budgetId

    Id of the budget the account belongs to

    accountId

    Id of the account to be retrieved

    Return Value

    A single account

  • Retrieves all accounts for a single budget.

    Declaration

    Swift

    public func getAccounts(
        budgetId: String,
        lastKnowledgeOfServer: Int? = nil
    ) async throws -> [Account]

    Parameters

    budgetId

    Id of the budget the accounts belongs to

    lastKnowledgeOfServer

    If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of accounts

  • Creates a new unlinked account in a budget.

    Declaration

    Swift

    public func newBudgetAccount(
        budgetId: String,
        name: String,
        type: String,
        balance: Int
    ) async throws -> Account

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    name

    The name of the new account

    type

    The type of the new account

    Return Value

    A single account