Created
October 19, 2016 05:23
-
-
Save juanxodj/a9816924a730dad72703294f45fad7b2 to your computer and use it in GitHub Desktop.
This file contains 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.lctics.retrofit2.dataPokemon.remote; | |
import com.lctics.retrofit2.dataPokemon.model.PokemonFeed; | |
import retrofit2.Call; | |
import retrofit2.Retrofit; | |
import retrofit2.converter.gson.GsonConverterFactory; | |
import retrofit2.http.GET; | |
public interface PokemonAPI { | |
String BASE_URL = "http://pokeapi.co/api/v1/"; | |
@GET("pokemon/" + pokemonID + "/") | |
Call<PokemonFeed> getPokemon(); | |
class Factory{ | |
private static PokemonAPI service; | |
public static PokemonAPI getInstance(){ | |
if(service == null){ | |
Retrofit retrofit = new Retrofit.Builder().addConverterFactory(GsonConverterFactory.create()).baseUrl(BASE_URL).build(); | |
service = retrofit.create(PokemonAPI.class); | |
return service; | |
} else{ | |
return service; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment