package Ġcom . example . android . polit ical prepared ness . data . datasource . remote Ċ Ċ import Ġcom . ch u cker team . ch u cker . api . Ch u cker Interceptor Ċ import Ġcom . example . android . polit ical prepared ness . data . models . E lection Response Ċ import Ġcom . example . android . polit ical prepared ness . data . models . Represent ative Response Ċ import Ġcom . example . android . polit ical prepared ness . data . models . V oter Info Response Ċ import Ġcom . squareup . mos hi . M oshi Ċ import Ġcom . squareup . mos hi . adapters . R fc 3 3 3 9 Date Json Adapter Ċ import Ġcom . squareup . mos hi . kotlin . reflect . Kotlin Json Adapter Factory Ċ import Ġretrofit 2 . Ret rofit Ċ import Ġretrofit 2 . converter . mos hi . M oshi Converter Factory Ċ import Ġretrofit 2 . http . GET Ċ import Ġretrofit 2 . http . Path Ċ import Ġretrofit 2 . http . Query Ċ import Ġjava . util .* Ċ Ċ private Ġconst Ġval ĠBASE _ URL Ġ= Ġ" https :// www . googleapis . com / c ivic info / v 2 /" Ċ Ċ private Ġval Ġm oshi Ġ= ĠM oshi . Builder () ĊĠĠĠ Ġ. add Last ( Kotlin Json Adapter Factory ()) ĊĠĠĠ Ġ. add ( Date :: class . java , ĠR fc 3 3 3 9 Date Json Adapter (). null Safe ()) Ċ // ĠĠĠ Ġ. add ( Date Adapter ()) Ġ// Ġalternative Ġcustom Ġdate Ġadapter ĊĠĠĠ Ġ. add ( E lection Adapter ()) ĊĠĠĠ Ġ. build () Ċ Ċ /** Ċ Ġ* Ġ ĠDocumentation Ġfor Ġthe ĠGoogle ĠC iv ics ĠAPI ĠService Ġcan Ġbe Ġfound Ġat Ġhttps :// developers . google . com / c ivic - information / docs / v 2 Ċ Ġ*/ Ċ Ċ interface ĠC iv ics ApiService Ġ{ ĊĠĠĠ Ġ@ GET (" election s ") ĊĠĠĠ Ġsuspend Ġfun Ġget E lection s (): ĠE lection Response ĊĊĠĠĠ Ġ@ GET (" v oter info ") ĊĠĠĠ Ġsuspend Ġfun Ġget V oter Info ( ĊĠĠĠĠĠĠĠ Ġ@ Query (" address ") Ġaddress : ĠString ,// ĠFrom ĠE lection Response Ġ-> ĠE lection DTO Ġ-> ĠDiv ision Ġ-> Ġ Ġstate Ġ+ Ġcountry ĊĠĠĠĠĠĠĠ Ġ@ Query (" election Id ") Ġelection Id : ĠLong ? Ġ= Ġnull , Ġ// ĠFrom ĠE lection Response Ġ-> ĠE lection DTO Ġ-> ĠDiv ision Ġ-> Ġid ĊĠĠĠĠĠĠĠ Ġ@ Query (" official Only ") Ġofficial Only : ĠBoolean ? Ġ= Ġnull ĊĠĠĠ Ġ): ĠV oter Info Response ĊĊĠĠĠ Ġ@ GET (" represent atives ") ĊĠĠĠ Ġsuspend Ġfun Ġget Represent atives By Address ( ĊĠĠĠĠĠĠĠ Ġ@ Query (" address ") Ġaddress : ĠString ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġ@ Query (" include Off ices ") Ġinclude Off ices : ĠBoolean ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġ@ Query (" levels ") Ġlevels : ĠString ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġ@ Query (" roles ") Ġroles : ĠString ? Ġ= Ġnull ĊĠĠĠ Ġ): ĠRepresent ative Response ĊĊĠĠĠ Ġ@ GET (" represent atives /{ oc d Id }") ĊĠĠĠ Ġsuspend Ġfun Ġget Represent ative Info By Division ( ĊĠĠĠĠĠĠĠ Ġ@ Path (" oc d Id ") Ġo cd Id : ĠString , ĊĠĠĠĠĠĠĠ Ġ@ Query (" levels ") Ġlevels : ĠString ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġ@ Query (" recursive ") Ġrecursive : ĠBoolean ? Ġ= Ġnull , ĊĠĠĠĠĠĠĠ Ġ@ Query (" roles ") Ġroles : ĠString ? Ġ= Ġnull ĊĠĠĠ Ġ): ĠRepresent ative Response Ċ } Ċ Ċ object ĠC iv ics Api Ġ{ ĊĠĠĠ Ġfun Ġcreate ( ch u cker Interceptor : ĠCh u cker Interceptor ): ĠC iv ics ApiService Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġretrofit Ġ= ĠRet rofit . Builder () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. add Converter Factory ( M oshi Converter Factory . create ( mos hi )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. client ( C iv ics HttpClient . getClient ( ch u cker Interceptor )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. baseUrl ( BASE _ URL ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠ Ġreturn Ġretrofit . create ( C iv ics ApiService :: class . java ) ĊĠĠĠ Ġ} Ċ }