All the code

This commit is contained in:
2020-12-13 14:27:36 -06:00
parent 9c3d67a07e
commit 9e6a7bca2c
49 changed files with 1878 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using Gameboard.Shogi.Api.ServiceModels.Messages;
using Newtonsoft.Json;
using System;
using System.Threading.Tasks;
using Websockets.Repositories.Utility;
namespace Websockets.Repositories
{
[Obsolete("Use GameboardRepository. Functions from PlayerRepository will be moved.")]
public class PlayerRepository
{
private readonly IAuthenticatedHttpClient client;
public PlayerRepository(IAuthenticatedHttpClient client)
{
this.client = client;
}
public async Task<GetPlayerResponse> GetPlayer(string playerName)
{
var response = await client.GetAsync($"/Player/{playerName}");
var json = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<GetPlayerResponse>(json);
}
public async Task DeletePlayer(string playerName)
{
var response = await client.DeleteAsync($"/Player/{playerName}");
await response.Content.ReadAsStringAsync();
}
}
}