package Ġcom . app . sl iding up . repository . events Ċ Ċ import Ġandroidx . lifecycle . Mediator LiveData Ċ import Ġcom . app . sl iding up . api . Network State Ċ import Ġcom . app . sl iding up . extensions . NonNull Mediator LiveData Ċ import Ġcom . app . sl iding up . model . events . Events ApiResponse Ċ import Ġretrofit 2 . HttpException Ċ Ċ class ĠEvents UseCase ( private Ġval Ġevents Repository Ġ: ĠEvents Repository ) Ċ { ĊĠĠĠ Ġsuspend Ġfun Ġexecute Query ( events Ġ: ĠNon Null Mediator LiveData < Network State < Events ApiResponse >>) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ: ĠMed iator LiveData < Network State < Events ApiResponse >> Ġ{ ĊĊĠĠĠĠĠĠĠ Ġevents . post Value ( Network State . Loading ()) ĊĠĠĠĠĠĠĠ Ġtry ĊĠĠĠĠĠĠĠ Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= Ġevents Repository . get Events () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevents . post Value ( Network State . Success ( response )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġcatch Ġ( exception Ġ: ĠHttp Exception ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġevents . post Value ( Network State . Error ( exception . code (), null )) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġreturn Ġevents ĊĠĠĠ Ġ} Ċ }