Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created April 22, 2020 21:01
Show Gist options
  • Select an option

  • Save cdmunoz/5b6d0bcec7c9e2e59e1e1c9ec2578b27 to your computer and use it in GitHub Desktop.

Select an option

Save cdmunoz/5b6d0bcec7c9e2e59e1e1c9ec2578b27 to your computer and use it in GitHub Desktop.
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