using MoonCore.Attributes; using MoonCore.Helpers; using MoonCore.Models; using MoonlightServers.Shared.Http.Requests.Client.Servers.Shares; using MoonlightServers.Shared.Http.Responses.Client.Servers.Shares; namespace MoonlightServers.Frontend.Services; [Scoped] public class ServerShareService { private readonly HttpApiClient ApiClient; public ServerShareService(HttpApiClient apiClient) { ApiClient = apiClient; } public async Task> GetAsync(int id, int startIndex, int count) => await ApiClient.GetJson>( $"api/client/servers/{id}/shares?startIndex={startIndex}&count={count}"); public async Task GetAsync(int id, int shareId) => await ApiClient.GetJson($"api/client/servers/{id}/shares/{shareId}"); public async Task CreateAsync(int id, CreateShareRequest request) => await ApiClient.PostJson($"api/client/servers/{id}/shares", request); public async Task UpdateAsync(int id, int shareId, UpdateShareRequest request) => await ApiClient.PatchJson($"api/client/servers/{id}/shares/{shareId}", request); public async Task DeleteAsync(int id, int shareId) => await ApiClient.Delete($"api/client/servers/{id}/shares/{shareId}"); }