using AipGateway.AIP; using AipGateway.API.Application; using AipGateway.API.Application.Interfaces.Services; using AipGateway.API.Domain.Models.Response; using AipGateway.API.Services.Interfaces; namespace AipGateway.API.Services { public class ApiAipService : BaseService, IApiAipService { private readonly ILogger _log; private readonly IAipFileService _aipFileService; public ApiAipService(ILogger log, IAipFileService aipFileService) : base(aipFileService) { _log = log; _aipFileService = aipFileService; } public async Task DownloadAipInfo() { try { var task = Task.Run(() => { int result = _aipFileService.DownloadAipFileInformations(); return result; }); int result = await task; return new GeneralResponse { errorCode = 0, errorMessage = GlobalConstants.API_RESULT_SUCCESS, effectCount = result, }; } catch (Exception e) { _log.LogError($"{e}"); throw; } } public async Task> GetLabels() { try { var task = Task.Run(() => { return _aipFileService.aipFileManager.SensitivityLabels(); }); List result = await task; return result; } catch (Exception) { throw; } } public async Task> GetPolicies() { try { var task = Task.Run(() => { return _aipFileService.aipFileManager.ListSensitivityLabels(); }); List result = await task; return result; } catch (Exception) { throw; } } public async Task> GetProtections() { try { var task = Task.Run(() => { return _aipFileService.aipFileManager.GetTemplates(); }); List result = await task; return result; } catch (Exception) { throw; } } } }