using Microsoft.Extensions.Logging; using DD.Persistence.Client.Clients.Base; using DD.Persistence.Client.Clients.Interfaces; using DD.Persistence.Models; using DD.Persistence.Models.Requests; namespace DD.Persistence.Client.Clients; public class ChangeLogClient : BaseClient, IChangeLogClient { private readonly Interfaces.Refit.IRefitChangeLogClient refitChangeLogClient; public ChangeLogClient(Interfaces.Refit.IRefitChangeLogClient refitChangeLogClient, ILogger logger) : base(logger) { this.refitChangeLogClient = refitChangeLogClient; } public async Task ClearAndAddRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitChangeLogClient.ClearAndAddRange(idDiscriminator, dtos, token), token); return result; } public async Task> GetByDate(Guid idDiscriminator, DateTimeOffset moment, SectionPartRequest filterRequest, PaginationRequest paginationRequest, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitChangeLogClient.GetByDate(idDiscriminator, moment, filterRequest, paginationRequest, token), token); return result; } public async Task> GetChangeLogForInterval(Guid idDiscriminator, DateTimeOffset dateBegin, DateTimeOffset dateEnd, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitChangeLogClient.GetChangeLogForInterval(idDiscriminator, dateBegin, dateEnd, token), token); return result!; } public async Task Add(Guid idDiscriminator, DataWithWellDepthAndSectionDto dto, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.Add(idDiscriminator, dto, token), token); return result; } public async Task AddRange(Guid idDiscriminator, IEnumerable dtos, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.AddRange(idDiscriminator, dtos, token), token); return result; } public async Task Update(DataWithWellDepthAndSectionDto dto, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.Update(dto, token), token); return result; } public async Task UpdateRange(IEnumerable dtos, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.UpdateRange(dtos, token), token); return result; } public async Task Delete(Guid id, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.Delete(id, token), token); return result; } public async Task DeleteRange(IEnumerable ids, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitChangeLogClient.DeleteRange(ids, token), token); return result; } public async Task GetDatesRange(Guid idDiscriminator, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitChangeLogClient.GetDatesRange(idDiscriminator, token), token); return result; } public void Dispose() { refitChangeLogClient.Dispose(); GC.SuppressFinalize(this); } }