Skip to content

Instantly share code, notes, and snippets.

@efleming969
Created June 13, 2018 17:55
Show Gist options
  • Save efleming969/c9974d1cc5f9d46dcc48fe4bf4c3274f to your computer and use it in GitHub Desktop.
Save efleming969/c9974d1cc5f9d46dcc48fe4bf4c3274f to your computer and use it in GitHub Desktop.
using ACME.Api.Domain;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace ACME.Api.Infrastructure
{
public class HttpRemoteBowlingService : IRemoteBowlingService
{
public List<RemotePlayerData> Fetch(string code)
{
var url = $"https://grn4aewhhg.execute-api.us-east-1.amazonaws.com/prod/games/{code}";
var client = new HttpClient();
var responseText = client.GetStringAsync(url).Result;
var remote_players = JsonConvert.DeserializeObject<RemoteBowlingServiceResponse>(responseText);
return remote_players.players;
}
}
class RemoteBowlingServiceResponse
{
public string Date { get; set; }
public List<RemotePlayerData> players { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment