package Ġcom . k ost as dr ak on ak is . notes . di Ċ Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . google . gson . Gson Builder Ċ import Ġcom . k ost as dr ak on ak is . notes . Build Config Ċ import Ġcom . k ost as dr ak on ak is . notes . network . api . Notes Api Ċ import Ġokhttp 3 . Interceptor Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġokhttp 3 . logging . Http Logging Interceptor Ċ import Ġorg . k oin . dsl . module Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . adapter . rx java 2 . Rx Java 2 Call Adapter Factory Ċ import Ġretrofit 2 . converter . gson . Gson Converter Factory Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ val Ġnetwork Module Ġ= Ġmodule Ġ{ ĊĠĠĠ Ġsingle < Gson > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġgson Builder Ġ= ĠGson Builder () ĊĠĠĠĠĠĠĠ Ġreturn @ single Ġgson Builder . create () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsingle Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġlogging Interceptor Ġ= Ġget < Interceptor ?> () ĊĠĠĠĠĠĠĠ Ġval ĠhttpClient Builder Ġ= ĠOk HttpClient (). newBuilder () ĊĠĠĠĠĠĠĠ ĠhttpClient Builder . connect Timeout ( 5 0 0 0 L , ĠTimeUnit . MILLISECONDS ) ĊĠĠĠĠĠĠĠ ĠhttpClient Builder . read Timeout ( 3 0 0 0 L , ĠTimeUnit . MILLISECONDS ) ĊĠĠĠĠĠĠĠ Ġif Ġ( logging Interceptor Ġ!= Ġnull ) ĠhttpClient Builder . add Interceptor ( logging Interceptor ) ĊĠĠĠĠĠĠĠ Ġreturn @ single ĠhttpClient Builder . build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsingle < Interceptor ?> Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ(! Build Config . DEBUG ) Ġreturn @ single Ġnull ĊĠĠĠĠĠĠĠ Ġval Ġhttp Logging Interceptor Ġ= ĠHttp Logging Interceptor () ĊĠĠĠĠĠĠĠ Ġhttp Logging Interceptor . level Ġ= ĠHttp Logging Interceptor . Level . BODY ĊĠĠĠĠĠĠĠ Ġreturn @ single Ġhttp Logging Interceptor ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsingle < Ret rofit > Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn @ single ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. baseUrl ( Build Config . BASE _ URL ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ( get ())) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Call Adapter Factory ( Rx Java 2 Call Adapter Factory . create ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. client ( get < Ok HttpClient >()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsingle < Notes Api > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġretrofit Ġ= Ġget < Ret rofit >() ĊĠĠĠĠĠĠĠ Ġreturn @ single Ġretrofit . create ( Notes Api :: class . java ) ĊĠĠĠ Ġ} Ċ }