Skip to content

Instantly share code, notes, and snippets.

Created July 17, 2018 10:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hwjeremy/6fc71fbda13f9710ea6b974de2e33356 to your computer and use it in GitHub Desktop.
Retrieve a Transaction in Amatino Swift - A double-entry accounting library for iOS & MacOS
// Amatino Swift:
// Double entry accounting API
try Transaction.retrieve(
session: session,
entity: starkIndustries,
transactionId: borrowedCashTxId,
callback: { (error: Error?, transaction: Transaction?) in
guard error == nil else {
// Handle error. E.g. 404 for an unknown Transaction, or 403
// for a Transaction you are not authorised to retrieve.
guard let borrowedCash: Transaction = transaction {
// Should never happen, but we guard against nil because we
// are good little Swift programmers
// Do cool stuff with the newly retrieved Transaction
print("Retrieved Transaction: \(borrowedCash.description)")
Copy link

hwjeremy commented Jul 17, 2018

#The parameters supplied to Transaction.retrieve() come from the following examples:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment