Skip to content

Instantly share code, notes, and snippets.

@hiteshchopra11
Created January 16, 2022 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiteshchopra11/391ccdba025959f80dde55c0f8c03844 to your computer and use it in GitHub Desktop.
Save hiteshchopra11/391ccdba025959f80dde55c0f8c03844 to your computer and use it in GitHub Desktop.
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