Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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