Created
January 16, 2022 22:04
-
-
Save hiteshchopra11/391ccdba025959f80dde55c0f8c03844 to your computer and use it in GitHub Desktop.
This file contains 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 ImageServiceImpl( | |
private val client: HttpClient | |
) : ImageService { | |
override suspend fun getImages(): ImageResponse { | |
return client.get { | |
headers { | |
append(HttpHeaders.Authorization, "Client-ID ${BuildConfig.CLIENT_ID}") | |
} | |
url(HttpRoutes.FETCH_IMAGES_URL) | |
} | |
} | |
} | |
object HttpRoutes { | |
private const val BASE_URL = "https://api.unsplash.com" | |
const val FETCH_IMAGES_URL = "${BASE_URL}/photos?page=1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment