Skip to content

Instantly share code, notes, and snippets.

@brainail
Created September 17, 2017 12:44
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 brainail/a36b4040cc30531ab4d67d3db107b1ea to your computer and use it in GitHub Desktop.
Save brainail/a36b4040cc30531ab4d67d3db107b1ea to your computer and use it in GitHub Desktop.
Kitsu API for Retrofit
object KitsuRestApi {
private val kitsuApi: KitsuSpecApi
init {
val retrofit = Retrofit.Builder()
.baseUrl("https://kitsu.io/api/edge/")
.addConverterFactory(MoshiConverterFactory.create())
.build()
kitsuApi = retrofit.create(KitsuSpecApi::class.java)
}
fun getKitsu(filter: String, offset: Int, limit: Int): Call<KitsuResponse> {
return kitsuApi.filterKitsu(filter, limit, offset)
}
}
interface KitsuSpecApi {
@GET("anime")
fun filterKitsu(
@Query("filter[text]") filter: String,
@Query("page[limit]") limit: Int,
@Query("page[offset]") offset: Int): Call<KitsuResponse>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment