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 BuildDynamicFileList(DynamicFileListRequest dynamicFileRequest) { var url = _fileOperationApiConfiguration.BuildDynamicFileListUri; return await _postRequest.AsyncWithNewton(url, dynamicFileRequest, _fileOperationApiConfiguration.RetryCount); } public async Task GetFileContent(string filePath) { var finalFilePath = filePath.Replace("\\", "%5C"); var url = new Uri($"{_fileOperationApiConfiguration.GetFileContentUri}/{finalFilePath}"); return await _getRequest.StringResponseAsync(url, _fileOperationApiConfiguration.RetryCount); } }