initial push

Signed-off-by: M M Arif <mmarif@swatian.com>
This commit is contained in:
M M Arif
2019-06-04 02:25:05 +05:00
parent a9b26e33e7
commit c3563dc861
379 changed files with 30478 additions and 620 deletions

View File

@@ -0,0 +1,33 @@
package org.mian.gitnex.clients;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Author M M Arif
*/
public class IssuesService {
public static <S> S createService(Class<S> serviceClass, String instanceURL) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(logging);
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(instanceURL)
.addConverterFactory(GsonConverterFactory.create())
//.client(httpClient.build())
.build();
return retrofit.create(serviceClass);
}
}

View File

@@ -0,0 +1,44 @@
package org.mian.gitnex.clients;
import org.mian.gitnex.interfaces.ApiInterface;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
/**
* Author M M Arif
*/
public class RetrofitClient {
private Retrofit retrofit;
private RetrofitClient(String instanceUrl) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(logging);
retrofit = new Retrofit.Builder()
.baseUrl(instanceUrl)
.addConverterFactory(ScalarsConverterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
//.client(httpClient.build())
.build();
}
public static synchronized RetrofitClient getInstance(String instanceUrl) {
return new RetrofitClient(instanceUrl);
}
public ApiInterface getApiInterface() {
return retrofit.create(ApiInterface.class);
}
}