package Ġcom . example . what son news . repos Ċ Ċ import Ġcom . example . what son news . database . Article Database Ċ import Ġcom . example . what son news . news . Article Ċ import Ġcom . example . what son news . news . Ret rofit Instance Ċ Ċ class ĠNews Repository ( private Ġval Ġdb : ĠArticle Database ) Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġget Trend ing News ( pageNumber : ĠInt , Ġcountry Code : ĠString Ġ= Ġ" in ") ĊĠĠĠ Ġ= ĠRet rofit Instance . api . get Trend ing News ( pageNumber Ġ= Ġpage Number , Ġcountry Code Ġ= Ġcountry Code ) ĊĊĠĠĠ Ġsuspend Ġfun Ġget Search News ( query : ĠString , Ġpage Number : ĠInt ) ĊĠĠĠ Ġ= ĠRet rofit Instance . api . search For News ( search Query Ġ= Ġquery , Ġpage Number Ġ= Ġpage Number ) ĊĊĠĠĠ Ġsuspend Ġfun Ġget Section News ( section : ĠString , Ġpage Number : ĠInt ) ĊĠĠĠ Ġ= ĠRet rofit Instance . api . get Section News ( section , pageNumber ) ĊĊĊĊĠĠĠ Ġ// Ġnow Ġto Ġsave Ġour Ġlik ed Ġnews Ġin Ġour Ġlocal Ġdatabase ĊĊĠĠĠ Ġsuspend Ġfun Ġinsert Article ( article : ĠArticle ) Ġ= Ġdb . get Article DAO (). insert Article ( article ) ĊĊĠĠĠ Ġsuspend Ġfun ĠgetAll Saved Urls () Ġ= Ġdb . get Article DAO (). getAll Saved Urls () ĊĊĠĠĠ Ġfun ĠgetAll Saved Articles () Ġ= Ġdb . get Article DAO (). getAll Saved Articles () ĊĊĠĠĠ Ġsuspend Ġfun Ġdelete All The Articles From Database () Ġ= Ġdb . get Article DAO (). delete All The Articles From Database () ĊĊĠĠĠ Ġsuspend Ġfun Ġdelete Article ( article : ĠArticle ) Ġ= Ġdb . get Article DAO (). delete Article ( article . url !! ) ĊĊĠĠĠ Ġsuspend Ġfun Ġget Count Of Articles () Ġ= Ġdb . get Article DAO (). count () ĊĊĠĠĠ Ġsuspend Ġfun Ġarticle Is Already Present ( url : ĠString ) Ġ: ĠInt Ġ= Ġdb . get Article DAO (). article Is Already Present ( url ) Ċ Ċ }