Skip to content

Instantly share code, notes, and snippets.

@muchbeer
Last active January 5, 2022 15:45
Show Gist options
  • Select an option

  • Save muchbeer/49fc57cc4fe1fa609e23a5697b9c300b to your computer and use it in GitHub Desktop.

Select an option

Save muchbeer/49fc57cc4fe1fa609e23a5697b9c300b to your computer and use it in GitHub Desktop.
Utility contained different useful component i.e Constant, declare apiKey and ignore using gitignore
***********************gitignore file*******************
// add the below line
/gradle.properties
************gradle.properties**********************
API_KEY=""
**************gradle.build*********************
defaultConfig {
buildConfigField("String", "API_KEY", API_KEY)
}
*****************Retrofit Interface*****************
@Headers("Authorization: Client-ID ${BuildConfig.API_KEY}")
@GET("/photos")
suspend fun getAllUsers (
@Query("page") page : Int,
@Query("per_page") per_page : Int
) : List<Users>
object Constants {
const val UNSPLASH_IMAGE_TABLE = "unsplash_image_table
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment