TransactionService
public struct TransactionService
Provides access to transaction operations
-
transaction(planId:AsynchronoustransactionId: ) Returns a single transaction.
Declaration
Swift
public func transaction( planId: String, transactionId: String ) async throws -> (TransactionDetail, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan).
transactionIdId 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
planIdThe id of the plan (last_used can also be used to specify the last used plan)
sinceDateIf specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
typeIf specified, only transactions of the specified type will be included.
lastKnowledgeOfServerThe starting server knowledge. If provided, only entities that have changed since
lastKnowledgeOfServerwill 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
planIdThe id of the plan (last_used can also be used to specify the last used plan)
accountIdThe id of the account.
sinceDateIf specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
typeIf specified, only transactions of the specified type will be included.
lastKnowledgeOfServerThe starting server knowledge. If provided, only entities that have changed since
lastKnowledgeOfServerwill 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
planIdThe id of the plan (last_used can also be used to specify the last used plan)
categoryIdThe id of the category.
sinceDateIf specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
typeIf specified, only transactions of the specified type will be included.
lastKnowledgeOfServerThe starting server knowledge. If provided, only entities that have changed since
lastKnowledgeOfServerwill 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
planIdThe id of the plan (last_used can also be used to specify the last used plan)
payeeIdThe id of the payee.
sinceDateIf specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
typeIf specified, only transactions of the specified type will be included.
lastKnowledgeOfServerThe starting server knowledge. If provided, only entities that have changed since
lastKnowledgeOfServerwill 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
planIdThe id of the plan (last_used can also be used to specify the last used plan)
monthThe month to filter transactions by.
sinceDateIf specified, only transactions on or after this date will be included. The date should be ISO formatted (e.g. 2016-12-30).
typeIf specified, only transactions of the specified type will be included.
lastKnowledgeOfServerThe starting server knowledge. If provided, only entities that have changed since
lastKnowledgeOfServerwill be included.Return Value
A tuple containing a list of transactions and server knowledge
-
createTransaction(planId:Asynchronoustransaction: ) Creates a single transaction.
Declaration
Swift
public func createTransaction( planId: String, transaction: NewTransaction ) async throws -> (TransactionDetail?, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
transactionThe transaction data to create
Return Value
A tuple containing the created transaction, server knowledge, and duplicate import IDs
-
createTransactions(planId:Asynchronoustransactions: ) Creates multiple transactions.
Declaration
Swift
public func createTransactions( planId: String, transactions: [NewTransaction] ) async throws -> ([TransactionDetail]?, ServerKnowledge, [String]?)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
transactionsAn array of transaction data to create
Return Value
A tuple containing the created transactions, server knowledge, and duplicate import IDs
-
updateTransactions(planId:Asynchronoustransactions: ) Updates multiple transactions.
Declaration
Swift
public func updateTransactions( planId: String, transactions: [SaveTransactionWithIdOrImportId] ) async throws -> ([TransactionDetail]?, ServerKnowledge, [String]?)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
transactionsAn array of transaction data to update
Return Value
A tuple containing the updated transactions, server knowledge, and duplicate import IDs
-
updateTransaction(planId:AsynchronoustransactionId: transaction: ) Updates a single transaction.
Declaration
Swift
public func updateTransaction( planId: String, transactionId: String, transaction: ExistingTransaction ) async throws -> (TransactionDetail, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
transactionThe transaction data to update
Return Value
A tuple containing the updated transaction and server knowledge
-
importTransactions(planId:Asynchronous) Imports transactions that have been uploaded via file-based import.
Declaration
Swift
public func importTransactions( planId: String ) async throws -> [String]Parameters
planIdThe 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
-
deleteTransaction(planId:AsynchronoustransactionId: ) Deletes a transaction.
Declaration
Swift
public func deleteTransaction( planId: String, transactionId: String ) async throws -> (TransactionDetail, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
transactionIdThe id of the transaction to delete
Return Value
A tuple containing the deleted transaction and server knowledge
View on GitHub