@Test public void testGetDefaultApi() { assertNotNull(Sixpack.getDefaultApi(Sixpack.DEFAULT_URL, "client_id", LogLevel.NONE, null)); }
static SixpackApi getDefaultApi(final HttpUrl sixpackUrl, final String clientId, final LogLevel logLevel, final OkHttpClient client) { HttpUrl sixpackEndpoint = getSixpackEndpoint(sixpackUrl); final OkHttpClient finalClient; if (client == null) { finalClient = getDefaultOkHttpClient(); } else { finalClient = client; } HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptorLoggerAdapter(PlatformLogger.INSTANCE.getLogger())) .setLevel(getRetrofitLogLevel(logLevel)); Interceptor clientIdInterceptor = getClientIdInterceptor(clientId); OkHttpClient interceptedClient = finalClient.newBuilder() .addInterceptor(clientIdInterceptor) .addInterceptor(loggingInterceptor) .build(); GsonConverterFactory gsonConverter = getDefaultGsonConverter(); Retrofit adapter = new Retrofit.Builder() .baseUrl(sixpackEndpoint) .client(interceptedClient) .addConverterFactory(gsonConverter) .build(); return adapter.create(SixpackApi.class); }
Sixpack { static SixpackApi getDefaultApi(final HttpUrl sixpackUrl, final String clientId, final LogLevel logLevel, final OkHttpClient client) { HttpUrl sixpackEndpoint = getSixpackEndpoint(sixpackUrl); final OkHttpClient finalClient; if (client == null) { finalClient = getDefaultOkHttpClient(); } else { finalClient = client; } HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptorLoggerAdapter(PlatformLogger.INSTANCE.getLogger())) .setLevel(getRetrofitLogLevel(logLevel)); Interceptor clientIdInterceptor = getClientIdInterceptor(clientId); OkHttpClient interceptedClient = finalClient.newBuilder() .addInterceptor(clientIdInterceptor) .addInterceptor(loggingInterceptor) .build(); GsonConverterFactory gsonConverter = getDefaultGsonConverter(); Retrofit adapter = new Retrofit.Builder() .baseUrl(sixpackEndpoint) .client(interceptedClient) .addConverterFactory(gsonConverter) .build(); return adapter.create(SixpackApi.class); } }
Sixpack { static SixpackApi getDefaultApi(final HttpUrl sixpackUrl, final String clientId, final LogLevel logLevel, final OkHttpClient client) { HttpUrl sixpackEndpoint = getSixpackEndpoint(sixpackUrl); final OkHttpClient finalClient; if (client == null) { finalClient = getDefaultOkHttpClient(); } else { finalClient = client; } HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptorLoggerAdapter(PlatformLogger.INSTANCE.getLogger())) .setLevel(getRetrofitLogLevel(logLevel)); Interceptor clientIdInterceptor = getClientIdInterceptor(clientId); OkHttpClient interceptedClient = finalClient.newBuilder() .addInterceptor(clientIdInterceptor) .addInterceptor(loggingInterceptor) .build(); GsonConverterFactory gsonConverter = getDefaultGsonConverter(); Retrofit adapter = new Retrofit.Builder() .baseUrl(sixpackEndpoint) .client(interceptedClient) .addConverterFactory(gsonConverter) .build(); return adapter.create(SixpackApi.class); } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); }
Sixpack { static SixpackApi getDefaultApi(final HttpUrl sixpackUrl, final String clientId, final LogLevel logLevel, final OkHttpClient client) { HttpUrl sixpackEndpoint = getSixpackEndpoint(sixpackUrl); final OkHttpClient finalClient; if (client == null) { finalClient = getDefaultOkHttpClient(); } else { finalClient = client; } HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptorLoggerAdapter(PlatformLogger.INSTANCE.getLogger())) .setLevel(getRetrofitLogLevel(logLevel)); Interceptor clientIdInterceptor = getClientIdInterceptor(clientId); OkHttpClient interceptedClient = finalClient.newBuilder() .addInterceptor(clientIdInterceptor) .addInterceptor(loggingInterceptor) .build(); GsonConverterFactory gsonConverter = getDefaultGsonConverter(); Retrofit adapter = new Retrofit.Builder() .baseUrl(sixpackEndpoint) .client(interceptedClient) .addConverterFactory(gsonConverter) .build(); return adapter.create(SixpackApi.class); } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); ExperimentBuilder experiment(); String getClientId(); void setLogLevel(LogLevel logLevel); LogLevel getLogLevel(); void setLogger(final Logger logger); static String generateRandomClientId(); }
Sixpack { static SixpackApi getDefaultApi(final HttpUrl sixpackUrl, final String clientId, final LogLevel logLevel, final OkHttpClient client) { HttpUrl sixpackEndpoint = getSixpackEndpoint(sixpackUrl); final OkHttpClient finalClient; if (client == null) { finalClient = getDefaultOkHttpClient(); } else { finalClient = client; } HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptorLoggerAdapter(PlatformLogger.INSTANCE.getLogger())) .setLevel(getRetrofitLogLevel(logLevel)); Interceptor clientIdInterceptor = getClientIdInterceptor(clientId); OkHttpClient interceptedClient = finalClient.newBuilder() .addInterceptor(clientIdInterceptor) .addInterceptor(loggingInterceptor) .build(); GsonConverterFactory gsonConverter = getDefaultGsonConverter(); Retrofit adapter = new Retrofit.Builder() .baseUrl(sixpackEndpoint) .client(interceptedClient) .addConverterFactory(gsonConverter) .build(); return adapter.create(SixpackApi.class); } Sixpack(final HttpUrl sixpackUrl, final String clientId, final OkHttpClient client);   Sixpack(final SixpackApi api);   Sixpack(final SixpackApi api, final String clientId); ExperimentBuilder experiment(); String getClientId(); void setLogLevel(LogLevel logLevel); LogLevel getLogLevel(); void setLogger(final Logger logger); static String generateRandomClientId(); static final HttpUrl DEFAULT_URL; static final String NAME_REGEX; static final Pattern NAME_PATTERN; static final LogLevel DEFAULT_LOG_LEVEL; static final String SIXPACK_LOG_TAG; }