TransactionService
public struct TransactionService
Provides access to transaction operations
-
transaction(budgetId:
AsynchronoustransactionId: ) Returns a single transaction.
Declaration
Swift
public func transaction( budgetId: String, transactionId: String ) async throws -> TransactionDetail
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget).
transactionId
Id of the transaction.
Return Value
A single transaction
-
Returns all transactions for a budget.
Declaration
Swift
public func transactions( budgetId: String, sinceDate: Date? = nil, type: TransactionType? = nil, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([TransactionDetail], ServerKnowledge)
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
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.
Declaration
Swift
public func transactions( budgetId: String, accountId: String, sinceDate: Date? = nil, type: TransactionType? = nil, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([TransactionDetail], ServerKnowledge)
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
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.
Declaration
Swift
public func transactions( budgetId: String, categoryId: String, sinceDate: Date? = nil, type: TransactionType? = nil, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([HybridTransaction], ServerKnowledge)
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
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 server knowledge
-
Returns all transactions for a payee.
Declaration
Swift
public func transactions( budgetId: String, payeeId: String, sinceDate: Date? = nil, type: TransactionType? = nil, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([HybridTransaction], ServerKnowledge)
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
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 server knowledge
-
Returns all transactions for a specific month.
Declaration
Swift
public func transactions( budgetId: String, month: Date, sinceDate: Date? = nil, type: TransactionType? = nil, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([HybridTransaction], ServerKnowledge)
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
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 hybrid transactions and server knowledge
-
createTransaction(budgetId:
Asynchronoustransaction: ) Creates a single transaction.
Declaration
Swift
public func createTransaction( budgetId: String, transaction: SaveTransactionWithIdOrImportId ) async throws -> (TransactionDetail, ServerKnowledge, [String])
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
transaction
The transaction data to create
Return Value
A tuple containing the created transaction, server knowledge, and duplicate import IDs
-
createTransactions(budgetId:
Asynchronoustransactions: ) Creates multiple transactions.
Declaration
Swift
public func createTransactions( budgetId: String, transactions: [SaveTransactionWithIdOrImportId] ) async throws -> ([TransactionDetail], ServerKnowledge, [String])
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
transactions
An array of transaction data to create
Return Value
A tuple containing the created transactions, server knowledge, and duplicate import IDs
-
updateTransactions(budgetId:
Asynchronoustransactions: ) Updates multiple transactions.
Declaration
Swift
public func updateTransactions( budgetId: String, transactions: [SaveTransactionWithIdOrImportId] ) async throws -> ([TransactionDetail], ServerKnowledge, [String])
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
transactions
An array of transaction data to update
Return Value
A tuple containing the updated transactions, server knowledge, and duplicate import IDs
-
updateTransaction(budgetId:
Asynchronoustransaction: ) Updates a single transaction.
Declaration
Swift
public func updateTransaction( budgetId: String, transaction: SaveTransactionWithIdOrImportId ) async throws -> TransactionDetail
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
transaction
The transaction data to update
Return Value
The updated transaction
-
importTransactions(budgetId:
Asynchronous) Imports transactions that have been uploaded via file-based import.
Declaration
Swift
public func importTransactions( budgetId: String ) async throws -> [String]
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
Return Value
An array of transaction IDs for the imported transactions
-
deleteTransaction(budgetId:
AsynchronoustransactionId: ) Deletes a transaction.
Declaration
Swift
public func deleteTransaction( budgetId: String, transactionId: String ) async throws -> TransactionDetail
Parameters
budgetId
The id of the budget (last_used can also be used to specify the last used budget)
transactionId
The id of the transaction to delete
Return Value
The deleted transaction