package Ġcom . ah med t iki wa . fx app . network Ċ Ċ import Ġcom . ah med t iki wa . fx app . network . models . Network Convert Response Ċ import Ġcom . ah med t iki wa . fx app . network . models . Network C urrencies Response Ċ import Ġcom . ah med t iki wa . fx app . network . models . Network H istorical Response Ċ import Ġcom . jak ew h art on . ret rofit 2 . adapter . kotlin . coroutines . Coroutine Call Adapter Factory Ċ import Ġkotlinx . coroutines . Deferred Ċ import Ġokhttp 3 . Connection Pool Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġokhttp 3 . logging . Http Logging Interceptor Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . gson . Gson Converter Factory Ċ import Ġretrofit 2 . http . GET Ċ import Ġretrofit 2 . http . Query Ċ import Ġjava . util . concurrent . TimeUnit Ċ Ċ interface ĠFX Market Service Ġ{ ĊĊĠĠĠ Ġ@ GET (" apic urrencies ") ĊĠĠĠ Ġfun ĠgetC urrencies Async (): ĠDeferred < Network C urrencies Response > ĊĊĠĠĠ Ġ@ GET (" ap icon vert ") ĊĠĠĠ Ġfun Ġget Conversion Async ( ĊĠĠĠĠĠĠĠ Ġ@ Query (" from ") Ġfrom : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ Query (" to ") Ġto : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ Query (" amount ") Ġamount : ĠInt Ġ= Ġ 1 , ĊĠĠĠ Ġ): ĠDeferred < Network Convert Response > ĊĊĠĠĠ Ġ@ GET (" api h istorical ") ĊĠĠĠ Ġfun Ġget H istorical Async ( ĊĠĠĠĠĠĠĠ Ġ@ Query (" date ") Ġdate : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ Query (" interval ") Ġinterval : ĠString Ġ= Ġ" daily " ĊĠĠĠ Ġ): ĠDeferred < Network H istorical Response > Ċ } Ċ Ċ object ĠFX Market Network Ġ{ ĊĠĠĠ Ġprivate Ġconst Ġval ĠBASE _ URL Ġ= Ġ" https :// fx market api . com /" ĊĊĠĠĠ Ġprivate Ġval Ġlogging Interceptor Ġ= ĠHttp Logging Interceptor (). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġlevel Ġ= ĠHttp Logging Interceptor . Level . BODY ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval Ġclient Ġ= ĠOk HttpClient (). newBuilder () ĊĠĠĠĠĠĠĠ Ġ. add Interceptor ( logging Interceptor ) ĊĠĠĠĠĠĠĠ Ġ. add Interceptor ( FX Market Connection Interceptor ()) ĊĠĠĠĠĠĠĠ Ġ. connect Timeout ( 3 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġ. retry On Connection Failure ( true ) ĊĠĠĠĠĠĠĠ Ġ. read Timeout ( 3 0 , ĠTimeUnit . SECONDS ) ĊĠĠĠĠĠĠĠ Ġ. connection Pool ( Connection Pool ( 0 , Ġ 1 , ĠTimeUnit . NAN O SECONDS )) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġprivate Ġval Ġretrofit Ġ= ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠ Ġ. client ( client ) ĊĠĠĠĠĠĠĠ Ġ. baseUrl ( BASE _ URL ) ĊĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ()) ĊĠĠĠĠĠĠĠ Ġ. add Call Adapter Factory ( Coroutine Call Adapter Factory ()) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĊĠĠĠ Ġval Ġfx Market Api : ĠFX Market Service Ġ= Ġretrofit . create ( FX Market Service :: class . java ) Ċ }