Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. public interface Link {
  2. @GET("3/movie/315635?api_key=66d87776b3672f4b97c6e57ffe238776&language=en-US")
  3. Call<List<Model>> moviesList();
  4. }
  5.  
  6. public class ApiClient {
  7.  
  8. public static final String BASE_URL = "https://api.themoviedb.org/";
  9. public static Retrofit retrofit = null;
  10.  
  11. public static Retrofit getApiClient() {
  12. if (retrofit == null) {
  13. retrofit = new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();
  14. }
  15. return retrofit;
  16. }
  17. }
  18.  
  19. {
  20. "adult": false,
  21. "backdrop_path": "/fudEG1VUWuOqleXv6NwCExK0VLy.jpg",
  22. "belongs_to_collection": null,
  23. "budget": 150000000,
  24. "genres": [
  25. {
  26. "id": 28,
  27. "name": "Action"
  28. },
  29. {
  30. "id": 18,
  31. "name": "Drama"
  32. },
  33. {
  34. "id": 36,
  35. "name": "History"
  36. },
  37. {
  38. "id": 53,
  39. "name": "Thriller"
  40. },
  41. {
  42. "id": 10752,
  43. "name": "War"
  44. }
  45. ],
  46. "homepage": "http://www.dunkirkmovie.com/",
  47. "id": 374720,
  48. "imdb_id": "tt5013056",
  49. "original_language": "en",
  50. "original_title": "Dunkirk",
  51. "overview": "Miraculous evacuation of Allied soldiers from Belgium, Britain, Canada, and France, who were cut off and surrounded by the German army from the beaches and harbor of Dunkirk, France, between May 26 and June 04, 1940, during Battle of France in World War II.",
  52. "popularity": 73.777516,
  53. "poster_path": "/cUqEgoP6kj8ykfNjJx3Tl5zHCcN.jpg",
  54. "production_companies": [
  55. {
  56. "name": "Canal+",
  57. "id": 5358
  58. },
  59. {
  60. "name": "Studio Canal",
  61. "id": 5870
  62. },
  63. {
  64. "name": "Warner Bros.",
  65. "id": 6194
  66. },
  67. {
  68. "name": "Syncopy",
  69. "id": 9996
  70. },
  71. {
  72. "name": "RatPac-Dune Entertainment",
  73. "id": 41624
  74. },
  75. {
  76. "name": "Kaap Holland Film",
  77. "id": 67254
  78. }
  79. ],
  80. "production_countries": [
  81. {
  82. "iso_3166_1": "NL",
  83. "name": "Netherlands"
  84. },
  85. {
  86. "iso_3166_1": "FR",
  87. "name": "France"
  88. },
  89. {
  90. "iso_3166_1": "GB",
  91. "name": "United Kingdom"
  92. },
  93. {
  94. "iso_3166_1": "US",
  95. "name": "United States of America"
  96. }
  97. ],
  98. "release_date": "2017-07-19",
  99. "revenue": 107413488,
  100. "runtime": 107,
  101. "spoken_languages": [
  102. {
  103. "iso_639_1": "en",
  104. "name": "English"
  105. },
  106. {
  107. "iso_639_1": "fr",
  108. "name": "Français"
  109. }
  110. ],
  111. "status": "Released",
  112. "tagline": "The event that shaped our world",
  113. "title": "Dunkirk",
  114. "video": false,
  115. "vote_average": 7.5,
  116. "vote_count": 423
  117. }
  118.  
  119. Link apiInterface = ApiClient.getApiClient().create(Link.class);
  120. Call<List<Model>> call = apiInterface.moviesList();
  121.  
  122. call.enqueue(new Callback<List<Model>>() {
  123. @Override
  124. public void onResponse(Call<List<Model>> call, Response<List<Model>> response) {
  125.  
  126.  
  127. }
  128.  
  129. @Override
  130. public void onFailure(Call<List<Model>> call, Throwable t) {
  131. t.printStackTrace();
  132. }
  133. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement