Skip to content

Instantly share code, notes, and snippets.

@hwjeremy
Last active July 17, 2018 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwjeremy/459829a2949d00e8212ed9dfc7d43aba to your computer and use it in GitHub Desktop.
Save hwjeremy/459829a2949d00e8212ed9dfc7d43aba to your computer and use it in GitHub Desktop.
Retrieve an Entity in Amatino Swift - A double-entry accounting library for iOS & MacOS
// Amatino Swift: https://github.com/amatino-code/amatino-swift
// Double entry accounting API
try Entity.retrieve(
session: session,
entityId: starkIndustriesId,
callback: { (error: Error?, retrievedEntity: Entity?) in
guard error == nil else {
// Handle errors, e.g. a 404 for a non-existant entity id
}
guard let starkIndustries: Entity = retrievedEntity else {
// Should never happen
}
print("Retrieved entity with name: \(starkIndustries.name)")
// Ready to do cool stuff with the starkIndustries Entity!
})
@hwjeremy
Copy link
Author

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

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