package Ġcom . cm devs . kotlin project . network Ċ Ċ 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 ĊĊ Ċ fun Ġ< T > Ġcreate Ret rofit ( cls : ĠClass < T >, ĠbaseUrl : ĠString ?): ĠT Ġ{ ĊĠĠĠ Ġreturn ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠ Ġ. baseUrl ( baseUrl ) ĊĠĠĠĠĠĠĠ Ġ. add Converter Factory ( Gson Converter Factory . create ()) ĊĠĠĠĠĠĠĠ Ġ. client ( create Ok HttpClient ()) ĊĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġ. create ( cls ) Ċ } Ċ Ċ private Ġfun Ġcreate Ok HttpClient (): ĠOk HttpClient Ġ{ ĊĊĠĠĠ Ġval Ġbuilder : ĠOk HttpClient . Builder Ġ= ĠOk HttpClient . Builder () ĊĠĠĠ Ġval Ġinterceptor Ġ= ĠHttp Logging Interceptor (). setLevel ( Http Logging Interceptor . Level . BODY ) ĊĠĠĠ Ġbuilder . add Interceptor ( interceptor ) ĊĊĠĠĠ Ġreturn Ġbuilder . build () Ċ } Ċ