Last active
March 31, 2016 07:14
-
-
Save Arneball/235893cb973407e6f28ce3e388c3e83a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android2111.app; | |
import java.util.List; | |
import retrofit2.Call; | |
import retrofit2.Retrofit; | |
import retrofit2.http.GET; | |
import retrofit2.http.Path; | |
import retrofit2.converter.gson.GsonConverterFactory | |
/** | |
* Created by arneball on 2016-03-30. | |
*/ | |
public class Backend { | |
public interface FittUfc { | |
@GET("/fighters") Call<List<User>> getFighters(); | |
@GET("/fighters/{id}") Call<User> getFighter(@Path("id") int id); | |
} | |
public static class User { | |
public String name, surname; | |
} | |
public static final FittUfc UFC = new Retrofit.Builder() | |
.baseUrl("http://ufc-data-api.ufc.com/api/v1/us") | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() | |
.create(FittUfc.class); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile 'com.squareup.retrofit2:retrofit:2.0.0' | |
compile 'com.squareup.retrofit2:converter-gson:2.0.0' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment