XeroAPI / xerogolang

Golang SDK for the Xero API
MIT License
24 stars 28 forks source link

Transactional operation within session #26

Closed febytanzil closed 5 years ago

febytanzil commented 5 years ago

Hi,

In the case of error happened during creating multiple items in Xero, would it be possible to rollback everything that I had created in Xero before? Could be there a way to create transactional session with Xero like regular database operation? e.g.

session, tx, err := provider.BeginTxAuth("")
...
defer tx.Rollback()

tx.CreateContact(session, ...)
tx.CreateInvoice(session, ...) // error here, then rollback create contact
tx.CreatePayment(session, ...)
...
tx.Commit() // commit all creations

Thanks

TheRegan commented 5 years ago

Hey there,

This is outside the scope of what this SDK intends to provide. I'd be interested to hear how you would implement this for yourself but it isn't something that we want to support in the SDK itself.

Cheers,

Regan.