create, read, playercount

This commit is contained in:
2022-11-09 16:08:04 -06:00
parent a1f996e508
commit da76917490
37 changed files with 999 additions and 814 deletions

View File

@@ -8,7 +8,7 @@ namespace Shogi.UI.Pages.Home.Api
{
Task<CreateGuestTokenResponse?> GetGuestToken();
Task<Session?> GetSession(string name);
Task<ReadAllSessionsResponse?> GetSessions();
Task<ReadSessionsPlayerCountResponse?> GetSessions();
Task<Guid?> GetToken();
Task GuestLogout();
Task PostMove(string sessionName, Move move);

View File

@@ -63,12 +63,12 @@ namespace Shogi.UI.Pages.Home.Api
return null;
}
public async Task<ReadAllSessionsResponse?> GetSessions()
public async Task<ReadSessionsPlayerCountResponse?> GetSessions()
{
var response = await HttpClient.GetAsync(new Uri("Session", UriKind.Relative));
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadFromJsonAsync<ReadAllSessionsResponse>(serializerOptions);
return await response.Content.ReadFromJsonAsync<ReadSessionsPlayerCountResponse>(serializerOptions);
}
return null;
}
@@ -90,7 +90,6 @@ namespace Shogi.UI.Pages.Home.Api
var response = await HttpClient.PostAsJsonAsync(new Uri("Session", UriKind.Relative), new CreateSessionCommand
{
Name = name,
IsPrivate = isPrivate
});
return response.StatusCode;
}