campyre icon indicating copy to clipboard operation
campyre copied to clipboard

Consider using Retrofit

Open pforhan opened this issue 12 years ago • 4 comments

Retrofit is a handy framework for going from a java interface to a remote service. Handles threading and it can parse json responses directly into java objects pretty seamlessly.

Disclaimer: I work on Retrofit for my day job.

pforhan avatar Dec 12 '12 17:12 pforhan

If you think it'd clean up the code, go for it. Is this in use in Square's own Android app?

konklone avatar Dec 12 '12 19:12 konklone

Yep, both Wallet and Register make use of the library. There is a small trick we use Guice (actually, Dagger, though in the same way) to make it easier, but this shouldn't be necessary.

pforhan avatar Dec 13 '12 00:12 pforhan

Very rough work-in-progress at https://github.com/pforhan/campyre/compare/master...retrofit-fun

Not hooked up at all, or tested, but that's about all that's required to have multithreading and automatic gson deserialization. Two big missing pieces:

  • The part that constructs the proxy service implementations (See RestAdapter.create())
  • Verifying upload/download formats.

If I get a chance tomorrow, I'll move farther on this.

pforhan avatar Dec 14 '12 04:12 pforhan

Nice syntax, I like where it's going.

On Thu, Dec 13, 2012 at 11:05 PM, Patrick Forhan [email protected]:

Very rough work-in-progress at https://github.com/pforhan/campyre/compare/master...retrofit-fun

Not hooked up at all, or tested, but that's about all that's required to have multithreading and automatic gson deserialization. Two big missing pieces:

  • The part that constructs the proxy service implementations (See RestAdapter.create())
  • Verifying upload/download formats.

If I get a chance tomorrow, I'll move farther on this.

— Reply to this email directly or view it on GitHubhttps://github.com/konklone/campyre/issues/147#issuecomment-11364580.

konklone avatar Dec 14 '12 15:12 konklone