TransactionServiceType

public protocol TransactionServiceType : Sendable

Provides access to transaction operations

  • Returns a single transaction.

    Declaration

    Swift

    func transaction(
        planId: String,
        transactionId: String
    ) async throws -> TransactionResponse

    Parameters

    planId

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

    transactionId

    Id of the transaction.

    Return Value

    A single transaction and the knowledge of the server

  • transactions(planId:sinceDate:type:lastKnowledgeOfServer:) Default implementation, asynchronous

    Returns all transactions for a plan.

    Default Implementation

    Returns all transactions for a plan, with optional parameters defaulted.

    Declaration

    Swift

    func transactions(
        planId: String,
        sinceDate: Date?,
        type: TransactionType?,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> TransactionsResponse

    Parameters

    planId

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

    sinceDate

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

    type

    If specified, only transactions of the specified type will be included.

    lastKnowledgeOfServer

    The starting server knowledge. If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of transactions and the knowledge of the server

  • Returns all transactions for an account in a plan.

    Default Implementation

    Returns all transactions for an account in a plan, with optional parameters defaulted.

    Declaration

    Swift

    func transactions(
        planId: String,
        accountId: String,
        sinceDate: Date?,
        type: TransactionType?,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> TransactionsResponse

    Parameters

    planId

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

    accountId

    The id of the account.

    sinceDate

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

    type

    If specified, only transactions of the specified type will be included.

    lastKnowledgeOfServer

    The starting server knowledge. If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of transactions and the knowledge of the server

  • Returns all transactions for a category in a plan.

    Default Implementation

    Returns all transactions for a category in a plan, with optional parameters defaulted.

    Declaration

    Swift

    func transactions(
        planId: String,
        categoryId: String,
        sinceDate: Date?,
        type: TransactionType?,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> HybridTransactionsResponse

    Parameters

    planId

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

    categoryId

    The id of the category.

    sinceDate

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

    type

    If specified, only transactions of the specified type will be included.

    lastKnowledgeOfServer

    The starting server knowledge. If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of hybrid transactions and the optional knowledge of the server

  • Returns all transactions for a payee in a plan.

    Default Implementation

    Returns all transactions for a payee in a plan, with optional parameters defaulted.

    Declaration

    Swift

    func transactions(
        planId: String,
        payeeId: String,
        sinceDate: Date?,
        type: TransactionType?,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> HybridTransactionsResponse

    Parameters

    planId

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

    payeeId

    The id of the payee.

    sinceDate

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

    type

    If specified, only transactions of the specified type will be included.

    lastKnowledgeOfServer

    The starting server knowledge. If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of hybrid transactions and the optional knowledge of the server

  • Returns all transactions for a specific month.

    Default Implementation

    Returns all transactions for a specific month, with optional parameters defaulted.

    Declaration

    Swift

    func transactions(
        planId: String,
        month: Date,
        sinceDate: Date?,
        type: TransactionType?,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> TransactionsResponse

    Parameters

    planId

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

    month

    The month to filter transactions by.

    sinceDate

    If specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).

    type

    If specified, only transactions of the specified type will be included.

    lastKnowledgeOfServer

    The starting server knowledge. If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of transactions and the knowledge of the server

  • Creates a single transaction.

    Declaration

    Swift

    func createTransaction(
        planId: String,
        transaction: NewTransaction
    ) async throws -> SaveTransactionResponse

    Parameters

    planId

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

    transaction

    The transaction data to create

    Return Value

    The created transaction and the knowledge of the server

  • Creates multiple transactions.

    Declaration

    Swift

    func createTransactions(
        planId: String,
        transactions: [NewTransaction]
    ) async throws -> SaveTransactionsResponse

    Parameters

    planId

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

    transactions

    An array of transaction data to create

    Return Value

    The created transactions, the knowledge of the server, and duplicate import ids

  • Updates multiple transactions.

    Declaration

    Swift

    func updateTransactions(
        planId: String,
        transactions: [SaveTransactionWithIdOrImportId]
    ) async throws -> SaveTransactionsResponse

    Parameters

    planId

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

    transactions

    An array of transaction data to update

    Return Value

    The updated transactions, the knowledge of the server, and duplicate import ids

  • Updates a single transaction.

    Declaration

    Swift

    func updateTransaction(
        planId: String,
        transactionId: String,
        transaction: ExistingTransaction
    ) async throws -> TransactionResponse

    Parameters

    planId

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

    transactionId

    The id of the transaction to update

    transaction

    The transaction data to update

    Return Value

    The updated transaction and the knowledge of the server

  • Imports transactions that have been uploaded via file-based import.

    Declaration

    Swift

    func importTransactions(planId: String) async throws -> [String]

    Parameters

    planId

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

    Return Value

    An array of transaction ids for the imported transactions

  • Deletes a transaction.

    Declaration

    Swift

    func deleteTransaction(
        planId: String,
        transactionId: String
    ) async throws -> TransactionResponse

    Parameters

    planId

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

    transactionId

    The id of the transaction to delete

    Return Value

    The deleted transaction and the knowledge of the server