public async Task <Player> Create(Player player) { var response = new HttpClientResponse(); await response.Convert(HttpClientRequestService.Create("users", new { username = player.UserName, invite_key = player.InviteKey.Value, })); Player newPlayer = new PlayerJsonService().ToObject(response.ResponseContent, player.InviteKey).ToPlayer(); newPlayer.ErrorMessages = response.ErrorMessages; return(newPlayer); }
public async Task <Player> GetUser(int userId, int gameId) { HttpClientResponse response = new HttpClientResponse(); await response.Convert(HttpClientRequestService.Get($"users/{userId}")); if (response.Status == System.Net.HttpStatusCode.NotFound) { return(null); } var user = new PlayerJsonService().ToObject(response.ResponseContent); user.InviteKey.GameId = gameId; return(user.ToPlayer()); }