Skip to content

Instantly share code, notes, and snippets.

@Arneball
Last active March 31, 2016 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arneball/235893cb973407e6f28ce3e388c3e83a to your computer and use it in GitHub Desktop.
Save Arneball/235893cb973407e6f28ce3e388c3e83a to your computer and use it in GitHub Desktop.
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);
}
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