LANCommander/LANCommander.SDK/Services/PlaySessionClient.cs

32 lines
995 B
C#

using LANCommander.SDK.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using LANCommander.SDK.Factories;
namespace LANCommander.SDK.Services
{
public class PlaySessionClient(ApiRequestFactory apiRequestFactory)
{
public async Task<IEnumerable<EntityReference>> GetAsync()
{
return await apiRequestFactory
.Create()
.UseAuthenticationToken()
.UseVersioning()
.UseRoute("/api/PlaySessions")
.GetAsync<IEnumerable<EntityReference>>();
}
public async Task<IEnumerable<PlaySession>> GetAsync(Guid gameId)
{
return await apiRequestFactory
.Create()
.UseAuthenticationToken()
.UseVersioning()
.UseRoute($"/api/PlaySessions/{gameId}")
.GetAsync<IEnumerable<PlaySession>>();
}
}
}