Created
September 17, 2017 12:44
-
-
Save brainail/a36b4040cc30531ab4d67d3db107b1ea to your computer and use it in GitHub Desktop.
Kitsu API for Retrofit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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