using Microsoft.Extensions.Logging; using DD.Persistence.Client.Clients.Base; using DD.Persistence.Client.Clients.Interfaces; using DD.Persistence.Client.Clients.Interfaces.Refit; using DD.Persistence.Models; namespace DD.Persistence.Client.Clients; public class TimestampedSetClient : BaseClient, ITimestampedSetClient { private readonly IRefitTimestampedSetClient refitTimestampedSetClient; public TimestampedSetClient(IRefitClientFactory refitTimestampedSetClientFactory, ILogger logger) : base(logger) { this.refitTimestampedSetClient = refitTimestampedSetClientFactory.Create(); } public async Task AddRange(Guid idDiscriminator, IEnumerable sets, CancellationToken token) { var result = await ExecutePostResponse( async () => await refitTimestampedSetClient.AddRange(idDiscriminator, sets, token), token); return result; } public async Task> Get(Guid idDiscriminator, DateTimeOffset? geTimestamp, IEnumerable? columnNames, int skip, int take, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitTimestampedSetClient.Get(idDiscriminator, geTimestamp, columnNames, skip, take, token), token); return result!; } public async Task> GetLast(Guid idDiscriminator, IEnumerable? columnNames, int take, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitTimestampedSetClient.GetLast(idDiscriminator, columnNames, take, token), token); return result!; } public async Task Count(Guid idDiscriminator, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitTimestampedSetClient.Count(idDiscriminator, token), token); return result; } public async Task GetDatesRange(Guid idDiscriminator, CancellationToken token) { var result = await ExecuteGetResponse( async () => await refitTimestampedSetClient.GetDatesRange(idDiscriminator, token), token); return result; } public void Dispose() { refitTimestampedSetClient.Dispose(); GC.SuppressFinalize(this); } }