Last active
December 11, 2018 10:05
-
-
Save florent37/a51ab9dc3c0011cc681b7691bcfae6dc to your computer and use it in GitHub Desktop.
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 OMDBApi { | |
@GET("/") | |
fun searchMovies(@Query("s") name: String, @Query("apiKey") apikey: String) : Deferred<SearchResponse> | |
companion object { | |
val apiKey = "YOUR_KEY" | |
val baseUrl = "http://www.omdbapi.com/" | |
} | |
} | |
class OmdbRepository(val omdbApi: OMDBApi) { | |
suspend fun searchMovies(byName: String): List<Movie> { | |
val response = omdbApi.searchMovies(byName, OMDBApi.apiKey).await() | |
return response.movies | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment