private HttpService() { //手动创建一个OkHttpClient并设置超时时间 OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder(); httpClientBuilder.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS); HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); httpClientBuilder.addInterceptor(interceptor).build(); retrofit = new Retrofit.Builder() .client(httpClientBuilder.build()) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .baseUrl(BASE_URL) .build(); }
/** * 获取通用配置的Retrofit实例,同时提供数据转换工厂定制,与拦截器定制 * @param context Application对应的context:getApplicationContext * @param baseUrl 服务器接口url通用部分 * @param converterFactory 定制的数据转换工厂 * @param interceptor 定制的拦截器 * @return */ protected static Retrofit getRetrofit( Context context, String baseUrl, Converter.Factory converterFactory, Interceptor interceptor) { if (null == mRetrofit) { if (null == mOkHttpClient) { mOkHttpClient = OkHttpUtils.getOkHttpClient(context, interceptor); } Retrofit.Builder builder = new Retrofit.Builder(); // 设置服务器路径Url通用部分 builder.baseUrl(baseUrl); // 添加数据转换工厂,支持自定义数据转换工厂,默认使用Gson if (converterFactory != null) { builder.addConverterFactory(converterFactory); } else { builder.addConverterFactory(GsonConverterFactory.create()); } // 添加回调工厂,采用RxJava builder.addCallAdapterFactory(RxJavaCallAdapterFactory.create()); // 设置使用OkHttp网络请求库 builder.client(mOkHttpClient); mRetrofit = builder.build(); } return mRetrofit; }
public static <T> T createRetrofitService(final Class<T> clazz, final String endPoint) { // Logs HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); final Retrofit restAdapter = new Retrofit.Builder() .baseUrl(endPoint) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .client(new OkHttpClient.Builder() .addInterceptor(interceptor) .build()) .build(); return restAdapter.create(clazz); }
public HttpRequestFactory() { HttpLoggingInterceptor logging = new HttpLoggingInterceptor(); logging.setLevel(HttpLoggingInterceptor.Level.HEADERS); OkHttpClient okHttpClient = new OkHttpClient.Builder().connectTimeout(TIMEOUT, TimeUnit.SECONDS) .readTimeout(TIMEOUT, TimeUnit.SECONDS) .writeTimeout(TIMEOUT, TimeUnit.SECONDS) .cache(getCache()) .addInterceptor(logging) .addNetworkInterceptor(mTokenInterceptor) //应用拦截器,用于离线缓存 .addInterceptor(mCacheInterceptor) //网络拦截器,用于在线缓存 .addNetworkInterceptor(mCacheInterceptor) .addNetworkInterceptor(new StethoInterceptor()) .build(); Retrofit retrofit = new Retrofit.Builder().baseUrl(Constants.FanFou.FANFOU_API_URL) .addConverterFactory(ResponseConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(okHttpClient) .build(); mServiceFactory = retrofit.create(ApiFactory.class); }
public static Retrofit retrofit() { if (mRetrofit == null) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); if (BuildConfig.DEBUG) { // Log信息拦截器 HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); //设置 Debug Log 模式 builder.addInterceptor(loggingInterceptor); } OkHttpClient okHttpClient = builder.build(); mRetrofit = new Retrofit.Builder() .baseUrl(ApiStores2.URL_BASE) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(okHttpClient) .build(); } return mRetrofit; }
@Provides Retrofit retrofit() { OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(new Interceptor() { @Override public Response intercept(Chain chain) throws IOException { return chain.proceed( chain.request() .newBuilder() .addHeader("Authorization", "Client-ID " + ImgurService.CLIENT_ID) .build()); } }) .build(); return new Retrofit.Builder() .client(client) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .baseUrl("https://api.imgur.com/3/") .build(); }
private ApiManager() { /** * 设置请求超时时间为5秒 */ mOkHttpClient = new OkHttpClient.Builder() .connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(5000, TimeUnit.MILLISECONDS) .writeTimeout(5000, TimeUnit.MILLISECONDS).build(); //.addConverterFactory(fastJsonConverterFactory) mRetrofit = new Retrofit.Builder() .client(mOkHttpClient) .baseUrl("https://i.play.163.com/") .addConverterFactory(GsonConverterFactory.create()) //.addConverterFactory(fastJsonConverterFactory) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); }
@NonNull private static <S> S createService(@NonNull Class<S> s, @NonNull String token, @NonNull String secret) { final GsonConverterFactory serializer = GsonConverterFactory.create( new GsonBuilder().registerTypeAdapterFactory(JSONModelTypeAdapterFactory.create()) .create()); final OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); OkHttpOAuthConsumer consumer = new OkHttpOAuthConsumer( Config.CONSUMER_KEY, Config.CONSUMER_SECRET); consumer.setTokenWithSecret(token, secret); httpClient.addInterceptor(new SigningInterceptor(consumer)); final HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(Config.HTTP_LOG_LEVEL); httpClient.addInterceptor(loggingInterceptor); final Retrofit client = new Retrofit.Builder().baseUrl(Config.HOST) .addConverterFactory(serializer) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(httpClient.build()) .build(); return client.create(s); }
@Provides @Singleton Retrofit provideCall() { OkHttpOAuthConsumer consumer = new OkHttpOAuthConsumer(App.getTwitterKey(), App.getTwitterSecret()); consumer.setTokenWithSecret( App.getApplicationInstance().getTwitterSession().getAuthToken().token, App.getApplicationInstance().getTwitterSession().getAuthToken().secret); Retrofit.Builder builder = new Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create()) .addConverterFactory(ScalarsConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()); OkHttpClient client = new OkHttpClient.Builder() .addInterceptor(new SigningInterceptor(consumer)) .addNetworkInterceptor(new StethoInterceptor()) .build(); return builder.client(client).build(); }
default ProtoCore getProtocore() { Gson gson = NetworkUtilities.getGson(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(getSatispayContext().getBaseUrl()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client( getProtocoreHttpClientProvider().getProtocoreClient( getSatispayContext(), getSecurePersistenceManager(), getSessionManager(), getSdkDeviceInfo() ) ) .build(); return retrofit.create(ProtoCore.class); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_example); mTv= (TextView) findViewById(R.id.tv); Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://api.github.com/") .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(new OkHttpClient()) .build(); GitHubService service=retrofit.create(GitHubService.class); service.contributors1("square", "retrofit") .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(s-> mTv.setText(s.toString())); }
public JiraService(final Site jiraSite) { this.jiraSite = jiraSite; final ConnectionPool CONNECTION_POOL = new ConnectionPool(5, 60, TimeUnit.SECONDS); OkHttpClient httpClient = new OkHttpClient.Builder() .connectTimeout(jiraSite.getTimeout(), TimeUnit.MILLISECONDS) .readTimeout(10000, TimeUnit.MILLISECONDS).connectionPool(CONNECTION_POOL) .retryOnConnectionFailure(true).addInterceptor(new SigningInterceptor(jiraSite)).build(); final ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new JodaModule()); this.jiraEndPoints = new Retrofit.Builder().baseUrl(this.jiraSite.getUrl().toString()) .addConverterFactory(JacksonConverterFactory.create(mapper)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()).client(httpClient).build() .create(JiraEndPoints.class); }
public void start(final DownInfo info) { // 如果消息实体为空,或正在下载,则返回 if (info == null || mDownInfoMap.get(info.getUrl()) != null) return; DownLoadSubscriber<DownInfo> downLoadSubscriber = new DownLoadSubscriber<>(info); mDownInfoMap.put(info.getUrl(), downLoadSubscriber); // HttpService service; // 增加一个拦截器,用于获取数据的进度回调 DownLoadInterceptor interceptor = new DownLoadInterceptor(downLoadSubscriber); OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.connectTimeout(info.getConnectedTime(), TimeUnit.SECONDS).addInterceptor(interceptor); Retrofit retrofit = new Retrofit.Builder(). addConverterFactory(ScalarsConverterFactory.create()).addCallAdapterFactory(RxJavaCallAdapterFactory.create()). baseUrl(CommonUtils.getBaseUrl(info.getUrl())).client(builder.build()).build(); HttpService service = retrofit.create(HttpService.class); info.setHttpService(service); service.download("bytes=" + info.getReadLength() + "-", info.getUrl()).subscribeOn(Schedulers.io()) .unsubscribeOn(Schedulers.io()).retryWhen(new RetryWhenNetWorkException()).map(new Func1<ResponseBody, DownInfo>() { @Override public DownInfo call(ResponseBody responseBody) { FileUtil.writeToCache(responseBody, info.getSavedFilePath(), info.getReadLength(), info.getTotalLength()); // 这里进行转化 return info; } }).observeOn(AndroidSchedulers.mainThread()).subscribe(downLoadSubscriber); }
@NonNull public static GoogleSpeechService newService() { return new GoogleSpeechServiceImpl( new Retrofit.Builder() .baseUrl(HOST_SPEECH_API) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(new GoogleSpeechServiceConverterFactory()) .build() .create(SpeechApi.class), new Retrofit.Builder() .baseUrl(HOST_SUPPORTED_LANGUAGE_API) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(new GoogleSpeechServiceConverterFactory()) .build() .create(SupportedLanguageApi.class), new AuthenticationSpeechApiBridgeCache() ); }
private ApiRetrofit() { super(); //创建一个Gson对象 Gson gson = new GsonBuilder() .setLenient() .create(); //在构造方法中完成对Retrofit接口的初始化 创建 Retrofit对象 mApi = new Retrofit.Builder() .baseUrl(MyApi.BASE_URL) .client(getClient()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build() .create(MyApi.class); }
@Before public void before() throws IOException { metrics = new MetricRegistry(); server = new MockWebServer(); server.start(); MockResponse response = new MockResponse(); response.setBody(RESPONSE_BODY); server.enqueue(response); retrofit = new Retrofit.Builder() .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(new TimedCallAdapterFactory(metrics)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .baseUrl(server.url("/").toString()) .build(); }
public static Retrofit retrofit() { if (mRetrofit == null) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); if (BuildConfig.DEBUG) { // Log信息拦截器 HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); //设置 Debug Log 模式 builder.addInterceptor(loggingInterceptor); } OkHttpClient okHttpClient = builder.build(); mRetrofit = new Retrofit.Builder() .baseUrl(ApiStores.URL_BASE) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(okHttpClient) .build(); } return mRetrofit; }
public static Retrofit createDefaultRetrofitBuilder(String baseUrl, boolean useSsl, Gson gson, Interceptor... interceptors) { OkHttpClient.Builder okHttpClientBuilder = createDefaultClient(useSsl); if (interceptors != null && interceptors.length > 0) { for (Interceptor interceptor : interceptors) { okHttpClientBuilder.interceptors().add(interceptor); } } return new Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(okHttpClientBuilder.build()) .build(); }
public static SocialSystemAPI getSocialSystemAPI() { if (socialSystemAPI == null) { Executor executor = Executors.newCachedThreadPool(); final Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new GsonDateTypeAdapter()).create(); Retrofit retrofit = new Retrofit.Builder() .baseUrl(BASE_URL) .callbackExecutor(executor) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(OkHttpProvider.getInstance()) .build(); socialSystemAPI = retrofit.create(SocialSystemAPI.class); } return socialSystemAPI; }
@Before public void setUp() { OkHttpClient.Builder builder = new OkHttpClient.Builder() .addInterceptor(youtubeInterceptor) .addInterceptor(provideHttpLoggingInterceptor()) .connectTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .readTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .writeTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .cache(cache); OkHttpClient httpClient = builder.build(); retrofit = new Retrofit.Builder() .baseUrl(APIYouTube.URL) .client(httpClient) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); mApi = retrofit.create(APIYouTube.class); }
@Before public void setUp() { OkHttpClient.Builder builder = new OkHttpClient.Builder() .addInterceptor(new LastFMKeyInterceptor()) .addInterceptor(provideHttpLoggingInterceptor()) .addNetworkInterceptor(new CacheInterceptor()) .connectTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .readTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .writeTimeout(CONNECTION_TIMEOUT, TimeUnit.SECONDS) .cache(cache); OkHttpClient httpClient = builder.build(); retrofit = new Retrofit.Builder() .baseUrl(APILastFM.URL) .client(httpClient) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) //.addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io())) .build(); mApi = retrofit.create(APILastFM.class); }
public static RetrofitInterface getRetrofit(String email, String password) { String credentials = email + ":" + password; String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP); OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); httpClient.addInterceptor(chain -> { Request original = chain.request(); Request.Builder builder = original.newBuilder() .addHeader("Authorization", basic) .method(original.method(),original.body()); return chain.proceed(builder.build()); }); RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()); return new Retrofit.Builder() .baseUrl(Constants.BASE_URL) .client(httpClient.build()) .addCallAdapterFactory(rxAdapter) .addConverterFactory(GsonConverterFactory.create()) .build().create(RetrofitInterface.class); }
public static RetrofitInterface getRetrofit(String token) { OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); httpClient.addInterceptor(chain -> { Request original = chain.request(); Request.Builder builder = original.newBuilder() .addHeader("x-access-token", token) .method(original.method(),original.body()); return chain.proceed(builder.build()); }); RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()); return new Retrofit.Builder() .baseUrl(Constants.BASE_URL) .client(httpClient.build()) .addCallAdapterFactory(rxAdapter) .addConverterFactory(GsonConverterFactory.create()) .build().create(RetrofitInterface.class); }
public static <T> T create(final Class<T> cls, CacheType cacheType, String baseUrl) { Converter.Factory factory = getFactory(); Retrofit.Builder builder = new Retrofit.Builder() .baseUrl(baseUrl) .client(defaultClient(cacheType)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()); if (factory != null) { builder.addConverterFactory(factory); } // builder.addConverterFactory(ScalarsConverterFactory.create()); try { saveToSDCard(cls.getSimpleName()); } catch (Exception e) { e.printStackTrace(); } Retrofit retrofit = builder.build(); return retrofit.create(cls); }
public static RetrofitInterface getRetrofit(String email, String password) { String credentials = email + ":" + password; String basic = "Basic " + Base64.encodeToString(credentials.getBytes(),Base64.NO_WRAP); OkHttpClient.Builder httpClient = new OkHttpClient.Builder(); httpClient.addInterceptor(chain -> { Request original = chain.request(); Request.Builder builder = original.newBuilder() .addHeader("Authorization", basic) .method(original.method(),original.body()); return chain.proceed(builder.build()); }); RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()); return new Retrofit.Builder() .baseUrl(Constants.BASE_URL) .client(httpClient.build()) .addCallAdapterFactory(rxAdapter) .addConverterFactory(GsonConverterFactory.create()) .build().create(RetrofitInterface.class); }
private void buildHereMapsService() { Gson gson = new GsonBuilder().create(); Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://route.api.here.com/routing/7.2/") .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); hereMapsService = retrofit.create(HereMapsService.class); hereMapsErrorConverter = retrofit.responseBodyConverter(HereMapsResponse.class, new Annotation[0]); }
private Retrofit.Builder getBuilder(String apiUrl) { Retrofit.Builder builder = new Retrofit.Builder(); builder.client(getOkClient()); builder.baseUrl(apiUrl);//设置远程地址 builder.addConverterFactory(new NullOnEmptyConverterFactory()); builder.addConverterFactory(GsonConverterFactory.create(getGson())); builder.addCallAdapterFactory(RxJavaCallAdapterFactory.create()); return builder; }
public static <T> T createRetrofitService(final Class<T> clazz){ HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY : HttpLoggingInterceptor.Level.NONE); OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build(); Retrofit retrofit = new Retrofit.Builder() .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .client(client) .baseUrl(BuildConfig.REST_URL) .build(); return retrofit.create(clazz); }
@Provides @Singleton Retrofit provideRetrofit(OkHttpClient client, @Named("LOGIN_URL") String url) { return new Retrofit.Builder().baseUrl(url) .client(client) .addConverterFactory(GsonConverterFactory.create( new GsonBuilder().registerTypeAdapterFactory(ImpalaGsonTypeAdapter.create()) .create())) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); }
public BookApi(OkHttpClient okHttpClient) { Retrofit retrofit = new Retrofit.Builder() .baseUrl(Constant.API_BASE_URL) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) // 添加Rx适配器 .addConverterFactory(GsonConverterFactory.create()) // 添加Gson转换器 .client(okHttpClient) .build(); service = retrofit.create(BookApiService.class); }
public static Retrofit retrofit(){ if (mRetrofit == null){ initClient(); mRetrofit = new Retrofit.Builder() .baseUrl(ApiStores.API_SERVER_URL) .client(mOkHttpClient) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); } return mRetrofit; }
private RetrofitManager() { retrofit = new Retrofit.Builder() .baseUrl("http://liyuyu.cn") .client(getNewClient()) .addConverterFactory(GsonConverterFactory.create(GsonUtil.getGson())) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(); }
@Provides @Singleton public Retrofit provideRetrofit() { return new Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .client(provideOkHttpClient()) .build(); }
private ApiRetrofit() { super(); Gson gson = new GsonBuilder() .setLenient() .create(); //在构造方法中完成对Retrofit接口的初始化 mApi = new Retrofit.Builder() .baseUrl(MyApi.BASE_URL) .client(getClient()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build() .create(MyApi.class); }
/** * */ public void initRetrofit() { if (retrofit == null) { retrofit = new Retrofit.Builder() .client(client) .baseUrl(ApiService.BASE_URL) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create(getGson())) .build(); } }
@Provides @Singleton public ServerAPI provideServerApi(Gson gson,OkHttpClient okHttpClient){ return new Retrofit.Builder() .addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl(BASE_URL) .client(okHttpClient) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build().create(ServerAPI.class); }
@Provides @Singleton public NewsAPI provideNewsApi(Gson gson,OkHttpClient okHttpClient){ return new Retrofit.Builder() .addConverterFactory(GsonConverterFactory.create(gson)) .baseUrl(NEWS_URL) .client(okHttpClient) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build().create(NewsAPI.class); }
private void initRetrofit() { sRetrofit = new Retrofit.Builder() .baseUrl(Constants.BASE_URL) .client(sOkHttp) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .addConverterFactory(ScalarsConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .build(); }