package Ġcom . j bc 7 ag . ap od . network Ċ Ċ import Ġcom . jak ew h art on . ret rofit 2 . adapter . kotlin . coroutines . Coroutine Call Adapter Factory Ċ import Ġcom . squareup . mos hi . M oshi Ċ import Ġcom . squareup . mos hi . kotlin . reflect . Kotlin Json Adapter Factory Ċ import Ġkotlinx . coroutines . Deferred Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . mos hi . M oshi Converter Factory Ċ import Ġretrofit 2 . http . GET Ċ import Ġretrofit 2 . http . Query ĊĊ Ċ private Ġconst Ġval ĠBASE _ URL Ġ= Ġ" https :// api . nasa . gov / plan etary /" Ċ private Ġconst Ġval ĠAPI _ KEY Ġ= Ġ" DEMO _ KEY " Ċ Ċ private Ġval Ġm oshi Ġ= ĠM oshi . Builder () ĊĠĠĠ Ġ. add ( Kotlin Json Adapter Factory ()) ĊĠĠĠ Ġ. build () Ċ Ċ private Ġval Ġretrofit Ġ= ĠRet rofit . Builder () ĊĠĠĠ Ġ. add Converter Factory ( M oshi Converter Factory . create ( mos hi )) ĊĠĠĠ Ġ. add Call Adapter Factory ( Coroutine Call Adapter Factory ()) ĊĠĠĠ Ġ. baseUrl ( BASE _ URL ) ĊĠĠĠ Ġ. build () Ċ Ċ interface ĠAp od ApiService { ĊĊĠĠĠ Ġ@ GET (" ap od ") ĊĠĠĠ Ġfun Ġget Ap od (@ Query (" api _ key ") ĠapiKey : ĠString Ġ= ĠAPI _ KEY , Ġ@ Query (" date ") Ġdate : ĠString ): ĠDeferred < Ap od Property > ĊĊĠĠĠ Ġ@ GET (" ap od ") ĊĠĠĠ Ġfun Ġget Ap od List (@ Query (" api _ key ") ĠapiKey : ĠString Ġ= ĠAPI _ KEY , Ġ@ Query (" count ") Ġcount : ĠInt ): ĠDeferred < List < Ap od Property >> Ċ } Ċ Ċ object Ġ ĠAp od Api Ġ{ ĊĠĠĠ Ġ// create Ġonly Ġonce ĊĠĠĠ Ġval Ġretrofit Service Ġ: ĠAp od ApiService Ġby Ġlazy Ġ{ ĊĠĠĠĠĠĠĠ Ġretrofit . create ( Ap od ApiService :: class . java ) ĊĠĠĠ Ġ} Ċ } ĊĊ