Created
April 22, 2020 21:01
-
-
Save cdmunoz/5b6d0bcec7c9e2e59e1e1c9ec2578b27 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 PhotosRepository(val apiService: ApiService) { | |
| private val TAG = PhotosRepository::class.java.name | |
| var apiKey: String = BuildConfig.API_KEY | |
| suspend fun getPhotosFromApi(sol: Int, page: Int): Response<PhotosResponse>? { | |
| try { | |
| val response = apiService.getPhotos(sol, apiKey, page) | |
| response?.let { | |
| return it | |
| } | |
| } catch (error: Exception) { | |
| Log.e(TAG, "Error: ${error.message}") | |
| return null | |
| } | |
| return null | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment