Trade Me API - How to do the bidding part?

So a few of you have asked how to implement the bid functionality using the Trade Me API and I honestly didn't know because I never tried that myself.

But Mr. Nikhil Ramrakhiani did it and was very kind to provide a code sample, which I'm making available here.

Many thanks to Nikhil and hope it helps everybody else!