Coach/app/src/main/java/com/example/coach/api/CoachApi.java

30 lines
818 B
Java

package com.example.coach.api;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class CoachApi {
private static final String API_URL = "http://10.0.2.2/rest_coach/";
private static Retrofit retrofit = null;
private static Gson gson = new GsonBuilder()
.setDateFormat("yyyy-MM-dd HH:mm:ss")
.create();
public static Retrofit getRetrofit()
{
if(retrofit == null){
retrofit = new Retrofit.Builder()
.baseUrl(API_URL)
.addConverterFactory(GsonConverterFactory.create(gson))
.build();
}
return retrofit;
}
public static Gson getGson() {
return gson;
}
}