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
public class MoviesApiProvider | |
{ | |
public async Task<IList<Movie>> GetMovies() | |
{ | |
var moviesApiUrl = System.Environment.GetEnvironmentVariable("MOVIES_API_HOSTNAME", EnvironmentVariableTarget.Process); | |
Console.WriteLine(moviesApiUrl); | |
using (var client = new HttpClient()) | |
{ | |
client.BaseAddress = new Uri(moviesApiUrl); | |
var response = await client.GetAsync("movie"); | |
var responseContent = await response.Content.ReadAsStringAsync(); | |
var list = JsonConvert.DeserializeObject<IList<Movie>>(responseContent); | |
return list; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment