Skip to content

Instantly share code, notes, and snippets.

@Arneball Arneball/Backend.java
Last active Mar 31, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.