Skip to content

Instantly share code, notes, and snippets.

@hwjeremy
Last active July 17, 2018 09:12
Show Gist options
  • Save hwjeremy/e07b9e46863bc3417ad958660197f568 to your computer and use it in GitHub Desktop.
Save hwjeremy/e07b9e46863bc3417ad958660197f568 to your computer and use it in GitHub Desktop.
Create a Session in Amatino Swift. This is analogous to "logging in" to the Amatino API
// Amatino Swift: https://github.com/amatino-code/amatino-swift
// Double entry accounting API
try Session.create(
email: "clever@cookie.com",
secret: "high entropy passphrase",
callback: { (error, session) in
guard error == nil else {
// Handle errors. In particular, look out for 401, which
// would indicate invalid credentials such as a mistyped
// passphrase.
}
// Store the session somewhere for use with later requests.
print("Created new Session with ID: \(session.id)")
return
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment