Loading repository data…
Loading repository data…
emedinaa / repository
Librería Http basada en Volley . "Es como usar Volley pero con sabor a retrofit" https://developer.android.com/training/volley/index.html
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Librería Http basada en Volley . "Es como usar Volley pero con sabor a retrofit"
public class ApiClient
{
private static MyApiInterface myApiInterface;
private static final String PATH="https://api.parse.com";
public static MyApiInterface getApiInterface(Context context)
{
if(myApiInterface==null)
{
Monkey monkey = new Monkey.Builder()
.setContext(context)
.setEndpoint(PATH)
.build();
myApiInterface= monkey.create(MyApiInterface.class);
}
return myApiInterface;
}
public interface MyApiInterface
{
@MGET("/1/classes/Type")
void loadTypesPokemon(Callback<String> MCallback);
@MPOST("/1/classes/Pokemon")
void addPokemon(@MBody Object json,Callback<String> MCallback);
@MPUT("/1/classes/Pokemon/{objectId}")
void updatePokemon(@MPath("objectId") String objectId,@MBody Object json,Callback<String> MCallback);
@MDELETE("/1/classes/Pokemon/{objectId}")
void deletePokemon(@MPath("objectId") String objectId,Callback<String> MCallback);
}
}
Usar el tag @MHeaders
@MHeaders({"X-Parse-Application-Id: TMEEmQ9ORjV2qnVmY5Z4WFSmfRSuzGLBmugDDDFfs","X-Parse-REST-API-Key: MZIKBgBRSVtt7EDhsXGtb6T6DEWFWFWDWDD"})
@MGET("/1/classes/Type")
void loadTypesPokemon(Callback<String> MCallback);
@MPOST("/1/classes/Pokemon")
void addPokemon(@MBody Object json,Callback<String> MCallback);
@MPUT("/1/classes/Pokemon/{objectId}")
void updatePokemon(@MPath("objectId") String objectId,@MBody Object json,Callback<String> MCallback);
@MDELETE("/1/classes/Pokemon/{objectId}")
void deletePokemon(@MPath("objectId") String objectId,Callback<String> MCallback);
repositories {
maven { url "https://jitpack.io" }
}
compile 'com.github.emedinaa:monkey:v0.04b'