Created
November 20, 2024 11:17
-
-
Save anitaa1990/35794a044341e92d315953e41dd41406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NewsRepository @Inject constructor( | |
| private val apiService: NewsApiService | |
| ) { | |
| suspend fun fetchNews( | |
| query: String, | |
| nextPage: Long | |
| ): NewsApiResponse { | |
| return try { | |
| apiService.fetchFeed( | |
| q = query, | |
| apiKey = BuildConfig.api_key, | |
| pageSize = PAGE_SIZE, | |
| page = nextPage | |
| ) | |
| } catch (e: Exception) { | |
| e.printStackTrace() | |
| throw Exception(e) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment