library/src/main/java/com/github/lykmapipo/retrofit/HttpService.java
@NonNull
    public static <S> S create(
            final Class<S> service, final String baseUrl,
            final AuthProvider authProvider, final Map<String, String> headers,
            final Long connectTimeout, final Long readTimeout, final Long writeTimeout
    ) {
        //TODO use Provider(auth, headers, baseUrl)

        // build http client with defaults
        OkHttpClient.Builder httpClientBuilder = httpClient.newBuilder();

        // apply timeouts
        httpClientBuilder.connectTimeout(connectTimeout != null ? connectTimeout : 10, TimeUnit.SECONDS);
        httpClientBuilder.readTimeout(readTimeout != null ? readTimeout : 10, TimeUnit.SECONDS);
        httpClientBuilder.writeTimeout(writeTimeout != null ? writeTimeout : 10, TimeUnit.SECONDS);

        // add common interceptors
        httpClientBuilder.addInterceptor(new HeadersInterceptor(headers));
        httpClientBuilder.addInterceptor(new AuthInterceptor(authProvider));

        // build client
        OkHttpClient client = httpClientBuilder.build();

        // create retrofit client with defaults
        Retrofit retrofit =
                retrofitBuilder
                        .client(client)
                        .baseUrl(baseUrl)
                        .build();

        // create provided service and return
        return retrofit.create(service);
    }
/**
     * Create an implementation of the API endpoints defined by the {@code service} interface.
     *
     * @param service        valid retrofit service definition
     * @param baseUrl        valid service base url
     * @param authProvider   valid authentication provider
     * @param headers        valid http headers to apply on every request
     * @param connectTimeout valid connect timeout (in seconds). The default is 10 seconds.
     * @param readTimeout    valid read timeout (in seconds). The default is 10 seconds.
     * @param writeTimeout   valid write timeout (in seconds). The default is 10 seconds.
     * @return an object of type S from the {@code service} creation
     */
Create an implementation of the API endpoints defined by the  service interface.
Create an implementation of the API endpoints defined by the service interface .
@NonNull
    public static <S> S create(
            final Class<S> service, final String baseUrl,
            final AuthProvider authProvider, final Map<String, String> headers,
            final Long connectTimeout, final Long readTimeout, final Long writeTimeout
    ) {
        OkHttpClient.Builder httpClientBuilder = httpClient.newBuilder();
        httpClientBuilder.connectTimeout(connectTimeout != null ? connectTimeout : 10, TimeUnit.SECONDS);
        httpClientBuilder.readTimeout(readTimeout != null ? readTimeout : 10, TimeUnit.SECONDS);
        httpClientBuilder.writeTimeout(writeTimeout != null ? writeTimeout : 10, TimeUnit.SECONDS);
        httpClientBuilder.addInterceptor(new HeadersInterceptor(headers));
        httpClientBuilder.addInterceptor(new AuthInterceptor(authProvider));
        OkHttpClient client = httpClientBuilder.build();
        Retrofit retrofit =
                retrofitBuilder
                        .client(client)
                        .baseUrl(baseUrl)
                        .build();
        return retrofit.create(service);
    }
@ NonNull public static < S > S create ( final Class < S > service , final String baseUrl , final AuthProvider authProvider , final Map < String , String > headers , final Long connectTimeout , final Long readTimeout , final Long writeTimeout ) { OkHttpClient . Builder httpClientBuilder = httpClient . newBuilder ( ) ; httpClientBuilder . connectTimeout ( connectTimeout != null ? connectTimeout : 10 , TimeUnit . SECONDS ) ; httpClientBuilder . readTimeout ( readTimeout != null ? readTimeout : 10 , TimeUnit . SECONDS ) ; httpClientBuilder . writeTimeout ( writeTimeout != null ? writeTimeout : 10 , TimeUnit . SECONDS ) ; httpClientBuilder . addInterceptor ( new HeadersInterceptor ( headers ) ) ; httpClientBuilder . addInterceptor ( new AuthInterceptor ( authProvider ) ) ; OkHttpClient client = httpClientBuilder . build ( ) ; Retrofit retrofit = retrofitBuilder . client ( client ) . baseUrl ( baseUrl ) . build ( ) ; return retrofit . create ( service ) ; }
Create an implementation of the API endpoints defined by the {@code service} interface.
Create an implementation of the API endpoints defined by the { @code service } interface .
//TODO use Provider(auth, headers, baseUrl) // build http client with defaults // apply timeouts // add common interceptors // build client // create retrofit client with defaults // create provided service and return