TransactionService

public struct TransactionService

Provides access to transaction operations

  • Returns a single transaction.

    Declaration

    Swift

    public func transaction(
        planId: String,
        transactionId: String
    ) async throws -> (TransactionDetail, ServerKnowledge)

    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 tuple containing a single transaction and server knowledge

  • Returns all transactions for a plan.

    Declaration

    Swift

    public func transactions(
        planId: String,
        sinceDate: Date? = nil,
        type: TransactionType? = nil,
        lastKnowledgeOfServer: ServerKnowledge? = nil
    ) async throws -> ([TransactionDetail], ServerKnowledge)

    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 tuple containing a list of transactions and server knowledge

  • Returns all transactions for an account in a plan.

    Declaration

    Swift

    public func transactions(
        planId: String,
        accountId: String,
        sinceDate: Date? = nil,
        type: TransactionType? = nil,
        lastKnowledgeOfServer: ServerKnowledge? = nil
    ) async throws -> ([TransactionDetail], ServerKnowledge)

    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 tuple containing a list of transactions and server knowledge

  • Returns all transactions for a category in a plan.

    Declaration

    Swift

    public func transactions(
        planId: String,
        categoryId: String,
        sinceDate: Date? = nil,
        type: TransactionType? = nil,
        lastKnowledgeOfServer: ServerKnowledge? = nil
    ) async throws -> ([HybridTransaction], ServerKnowledge?)

    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 tuple containing a list of hybrid transactions and optional server knowledge

  • Returns all transactions for a payee in a plan.

    Declaration

    Swift

    public func transactions(
        planId: String,
        payeeId: String,
        sinceDate: Date? = nil,
        type: TransactionType? = nil,
        lastKnowledgeOfServer: ServerKnowledge? = nil
    ) async throws -> ([HybridTransaction], ServerKnowledge?)

    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 tuple containing a list of hybrid transactions and optional server knowledge

  • Returns all transactions for a specific month.

    Declaration

    Swift

    public func transactions(
        planId: String,
        month: Date,
        sinceDate: Date? = nil,
        type: TransactionType? = nil,
        lastKnowledgeOfServer: ServerKnowledge? = nil
    ) async throws -> ([TransactionDetail], ServerKnowledge)

    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 tuple containing a list of transactions and server knowledge

  • Creates a single transaction.

    Declaration

    Swift

    public func createTransaction(
        planId: String,
        transaction: NewTransaction
    ) async throws -> (TransactionDetail?, ServerKnowledge)

    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

    A tuple containing the created transaction, server knowledge, and duplicate import IDs

  • Creates multiple transactions.

    Declaration

    Swift

    public func createTransactions(
        planId: String,
        transactions: [NewTransaction]
    ) async throws -> ([TransactionDetail]?, ServerKnowledge, [String]?)

    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

    A tuple containing the created transactions, server knowledge, and duplicate import IDs

  • Updates multiple transactions.

    Declaration

    Swift

    public func updateTransactions(
        planId: String,
        transactions: [SaveTransactionWithIdOrImportId]
    ) async throws -> ([TransactionDetail]?, ServerKnowledge, [String]?)

    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

    A tuple containing the updated transactions, server knowledge, and duplicate import IDs

  • Updates a single transaction.

    Declaration

    Swift

    public func updateTransaction(
        planId: String,
        transactionId: String,
        transaction: ExistingTransaction
    ) async throws -> (TransactionDetail, ServerKnowledge)

    Parameters

    planId

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

    transaction

    The transaction data to update

    Return Value

    A tuple containing the updated transaction and server knowledge

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

    Declaration

    Swift

    public 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

    public func deleteTransaction(
        planId: String,
        transactionId: String
    ) async throws -> (TransactionDetail, ServerKnowledge)

    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

    A tuple containing the deleted transaction and server knowledge