44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using DeepDrftModels.DTOs;
|
|
using DeepDrftPublic.Client.Clients;
|
|
using Models.Common;
|
|
using NetBlocks.Models;
|
|
|
|
namespace DeepDrftPublic.Client.Services;
|
|
|
|
/// <summary>
|
|
/// WASM-side <see cref="ITrackDataService"/> that delegates to <see cref="TrackClient"/>
|
|
/// (HTTP to the <c>DeepDrft.API</c> backend). Used on the WASM interactive render pass;
|
|
/// the server prerender pass swaps in a direct, in-process implementation.
|
|
/// </summary>
|
|
public class TrackClientDataService : ITrackDataService
|
|
{
|
|
private readonly TrackClient _trackClient;
|
|
|
|
public TrackClientDataService(TrackClient trackClient)
|
|
{
|
|
_trackClient = trackClient;
|
|
}
|
|
|
|
public Task<ApiResult<PagedResult<TrackDto>>> GetPage(
|
|
int pageNumber,
|
|
int pageSize,
|
|
string? sortColumn = null,
|
|
bool sortDescending = false,
|
|
string? searchText = null,
|
|
string? album = null,
|
|
string? genre = null)
|
|
=> _trackClient.GetPage(pageNumber, pageSize, sortColumn, sortDescending, searchText, album, genre);
|
|
|
|
public Task<ApiResult<List<ReleaseDto>>> GetAlbums()
|
|
=> _trackClient.GetAlbums();
|
|
|
|
public Task<ApiResult<List<GenreSummaryDto>>> GetGenres()
|
|
=> _trackClient.GetGenres();
|
|
|
|
public Task<ApiResult<TrackDto>> GetTrack(string trackId)
|
|
=> _trackClient.GetTrack(trackId);
|
|
|
|
public Task<ApiResult<TrackDto?>> GetRandomTrack()
|
|
=> _trackClient.GetRandom();
|
|
}
|