Documente Academic
Documente Profesional
Documente Cultură
felipeapedroso
felipepedroso
Cenrio Rest APIs
API
HttpURLConnection urlConnection = null;
URL url = null;
try {
HTTP Request url = new
URL("http://api.themoviedb.org/3/movie/upcoming?api_key=<KEY>");
@GET("movie/{movieId}/similar")
Call<MovieResults> listSimilarMovies(@Path("movieId") Integer movieId);
}
MoviesService moviesService =
retrofit.create(MoviesService.class);
Resposta POJO*
{
"poster_path":"\/lFSSLTlFozwpaGlO31OoUeirBgQ.jpg", public class MovieInfo {
"adult":false,
"overview":"Jason Bourne, now remembering who he tru
private Integer id;
ly is, tries to uncover hidden truths about his past.", private String poster_path;
"release_date":"2016-07-28",
"genre_ids":[ private String title;
],
28 public Double vote_average;
"id":324668, public String release_date;
"original_title":"Jason Bourne",
"original_language":"en", public String overview;
"title":"Jason Bourne",
"backdrop_path":"\/AoT2YrJUJlg5vKE3iMOLvHlTd3m.jp
g",
"popularity":6.463538,
....
"vote_count":52, }
"video":false,
"vote_average":3.97
}
@Override
public void onFailure(Call<MovieResults> call, Throwable t) {
// Handle failure
}
});
Outras caractersticas
Cdigo mais simples
Tratamento de erros mais fcil
Cliente HTTP plugvel (Ex.: OkHttp, ApacheHttp, etc)
Converters (Serializao) plugveis (Ex.: Gson, XML, etc)
Compatvel com RxJava (programao reativa)
Exemplo
JavaFX
github.com/felipepedroso/Upco
mingMoviesFX
Console
github.com/felipepedroso/Upco
mingMoviesConsole
Disponvel em:
github.com/felipepedroso/Retro
fitMoviesExample
Referncias
Retrofit Site Oficial
Retrofit Github
Realm 2 Jake Wharton
Android Libs Retrofit Daniel Gimenes
cones: https://www.iconfinder.com/AlfredoCreates
Dvidas?
Obrigado!
felipeapedroso
felipepedroso