package Ġseg ura . countries . app . di Ċ Ċ import Ġokhttp 3 . Ok HttpClient Ċ import Ġorg . k oin . android . view model . dsl . viewModel Ċ import Ġorg . k oin . core . qual ifier . named Ċ import Ġorg . k oin . dsl . module Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . gson . Gson Converter Factory Ċ import Ġseg ura . countries . app . model . network Handler . Response Handler Ċ import Ġseg ura . countries . app . network . Interceptor Ċ import Ġseg ura . countries . app . network . Rest Cont ries Service Ċ import Ġseg ura . countries . app . repository . Country Repository Ċ import Ġseg ura . countries . app . ui . Countries ViewModel Ċ Ċ val ĠviewModel Module Ġ= Ġmodule Ġ{ ĊĠĠĠ ĠviewModel Ġ{ ĠCount ries ViewModel ( get ()) Ġ} Ċ } Ċ Ċ val Ġrest Countries Module Ġ= Ġmodule Ġ{ ĊĠĠĠ Ġsingle ( named (" country ")) Ġ{ Ġprovide Ret rofit ( get (), Ġ" https :// rest countries . eu /") Ġ} ĊĠĠĠ Ġsingle Ġ{ Ġget < Ret rofit >( named (" country ")). create ( Rest Cont ries Service :: class . java ) Ġ} ĊĠĠĠ Ġsingle Ġ{ Ġprovide Ok HttpClient ( get ()) Ġ} ĊĠĠĠ Ġsingle Ġ{ ĠResponse Handler () Ġ} ĊĠĠĠ Ġsingle Ġ{ ĠCountry Repository ( get (), Ġget ()) Ġ} ĊĠĠĠ Ġsingle Ġ{ ĠInter ceptor () Ġ} Ċ } Ċ Ċ fun Ġprovide Ret rofit ( ok HttpClient : ĠOk HttpClient , ĠbaseUrl : ĠString ): ĠRet rofit Ġ{ ĊĠĠĠ Ġreturn ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠ Ġ. baseUrl ( baseUrl ) ĊĠĠĠĠĠĠĠ Ġ. client ( ok HttpClient ) ĊĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ()) ĊĠĠĠĠĠĠĠ Ġ. build () Ċ } Ċ Ċ fun Ġprovide Ok HttpClient ( ĊĠĠĠ Ġinterceptor : ĠInter ceptor Ċ Ċ ): ĠOk HttpClient Ġ{ ĊĠĠĠ Ġval Ġok HttpClient Builder : ĠOk HttpClient . Builder Ġ= ĠOk HttpClient . Builder () ĊĠĠĠ Ġok HttpClient Builder . add Interceptor ( interceptor ) ĊĠĠĠ Ġreturn Ġok HttpClient Builder . build () Ċ }