Skip to content

Instantly share code, notes, and snippets.

@sharmadhiraj
Last active November 20, 2018 09:23
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 sharmadhiraj/b923572acc12e062d28609a75b5f4f6b to your computer and use it in GitHub Desktop.
Save sharmadhiraj/b923572acc12e062d28609a75b5f4f6b to your computer and use it in GitHub Desktop.
Android Paging Library
interface NetworkService {
@GET("/everything?q=sports&apiKey=aa67d8d98c8e4ad1b4f16dbd5f3be348")
fun getNews(@Query("page") page: Int, @Query("pageSize") pageSize: Int): Single<Response>
companion object {
fun getService(): NetworkService {
val retrofit = Retrofit.Builder()
.baseUrl("https://newsapi.org/v2/")
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build()
return retrofit.create(NetworkService::class.java)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment