Created
October 12, 2019 12:50
-
-
Save ininmm/82a1d3102a297ec01da4f72c9bccca7d to your computer and use it in GitHub Desktop.
Write a sample api
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
interface SearchService { | |
@GET("search/repositories") | |
suspend fun searchRepo( | |
@Query("q", encoded = true) repo: String = "coil+org:coil-kt" | |
): SearchRepo | |
} | |
@Module | |
class NetworkModule { | |
@Singleton | |
@Provides | |
fun provideGithubService(): SearchService { | |
return Retrofit.Builder() | |
.baseUrl("https://api.github.com") | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build() | |
.create(SearchService::class.java) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment