2024-12-12 17:05:47 +05:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Persistence.Client.Clients.Base;
|
|
|
|
|
using Persistence.Client.Clients.Interfaces;
|
|
|
|
|
using Persistence.Client.Clients.Interfaces.Refit;
|
|
|
|
|
using Persistence.Models;
|
|
|
|
|
|
|
|
|
|
namespace Persistence.Client.Clients;
|
|
|
|
|
public class DataSourceSystemClient : BaseClient, IDataSourceSystemClient
|
|
|
|
|
{
|
|
|
|
|
private readonly IRefitDataSourceSystemClient dataSourceSystemClient;
|
|
|
|
|
|
|
|
|
|
public DataSourceSystemClient(IRefitDataSourceSystemClient dataSourceSystemClient, ILogger<DataSourceSystemClient> logger) : base(logger)
|
|
|
|
|
{
|
|
|
|
|
this.dataSourceSystemClient = dataSourceSystemClient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Add(DataSourceSystemDto dataSourceSystemDto, CancellationToken token)
|
|
|
|
|
{
|
|
|
|
|
await ExecutePostResponse(
|
|
|
|
|
async () => await dataSourceSystemClient.Add(dataSourceSystemDto, token), token);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<IEnumerable<DataSourceSystemDto>> Get(CancellationToken token)
|
|
|
|
|
{
|
2024-12-13 15:30:11 +05:00
|
|
|
|
var result = await ExecuteGetResponse(
|
2024-12-12 17:05:47 +05:00
|
|
|
|
async () => await dataSourceSystemClient.Get(token), token);
|
|
|
|
|
|
2024-12-13 17:30:35 +05:00
|
|
|
|
return result!;
|
2024-12-12 17:05:47 +05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
dataSourceSystemClient.Dispose();
|
2024-12-13 15:30:11 +05:00
|
|
|
|
|
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
|
}
|
2024-12-12 17:05:47 +05:00
|
|
|
|
}
|