Files
monorepo/LCU.API.Operations.IncentiveAPI/LCU.API.Internal.Operations.IncentiveApi/DataAccess/FileOperationsApiDao.cs
T
2026-03-17 09:53:09 -05:00

33 lines
1.4 KiB
C#

using LCU.API.Internal.Operations.IncentiveApi.Configuration;
using LCU.Library.Internal.FileOperationsModels.Models;
using LCU.Library.Internal.LcuHttpClient.HttpRequest;
namespace LCU.API.Internal.Operations.IncentiveApi.DataAccess;
public class FileOperationsApiDao : IFileOperationsApiDao
{
private readonly FileOperationsApiConfiguration _fileOperationApiConfiguration;
private readonly IGetRequest _getRequest;
private readonly IPostRequest _postRequest;
public FileOperationsApiDao(FileOperationsApiConfiguration fileOperationApiConfiguration, IGetRequest getRequest, IPostRequest postRequest)
{
_fileOperationApiConfiguration = fileOperationApiConfiguration;
_getRequest = getRequest;
_postRequest = postRequest;
}
public async Task<string[]> BuildDynamicFileList(DynamicFileListRequest dynamicFileRequest)
{
var url = _fileOperationApiConfiguration.BuildDynamicFileListUri;
return await _postRequest.AsyncWithNewton<DynamicFileListRequest, string[]>(url, dynamicFileRequest, _fileOperationApiConfiguration.RetryCount);
}
public async Task<string> GetFileContent(string filePath)
{
var finalFilePath = filePath.Replace("\\", "%5C");
var url = new Uri($"{_fileOperationApiConfiguration.GetFileContentUri}/{finalFilePath}");
return await _getRequest.StringResponseAsync(url, _fileOperationApiConfiguration.RetryCount);
}
}