27 lines
732 B
C#
27 lines
732 B
C#
using System.Net.Http.Json;
|
|
using Demo.Domain.Models;
|
|
using Microsoft.Extensions.Logging;
|
|
using presence_client.ApiClients.Interfaces;
|
|
|
|
namespace presence_client.ApiClients;
|
|
|
|
public class GroupApiClient : BaseApiClient, IGroupApiClient
|
|
{
|
|
private const string BasePath = "Group";
|
|
|
|
public GroupApiClient(IHttpClientFactory httpClientFactory, ILogger<GroupApiClient> logger)
|
|
: base(httpClientFactory, logger)
|
|
{
|
|
}
|
|
|
|
public async Task<List<Group>> GetGroupsAsync()
|
|
{
|
|
return await GetAsync<List<Group>>(BasePath) ?? new List<Group>();
|
|
}
|
|
|
|
public async Task<List<GroupU>> GetGroupsWithUsersAsync()
|
|
{
|
|
return await GetAsync<List<GroupU>>("Admin") ?? new List<GroupU>();
|
|
}
|
|
}
|