Api-PWA/DocuMed.Infrastructure/RestServices/RestApiWrapper.cs

21 lines
709 B
C#

using Newtonsoft.Json;
namespace DocuMed.Infrastructure.RestServices;
public interface IRestApiWrapper : IScopedDependency
{
IKaveNegarRestApi KaveNegarRestApi { get; }
IMetisRestApi MetisRestApi { get; }
}
public class RestApiWrapper : IRestApiWrapper
{
private static readonly RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
}));
public IKaveNegarRestApi KaveNegarRestApi => RestService.For<IKaveNegarRestApi>(RestAddress.BaseKaveNegar);
public IMetisRestApi MetisRestApi => RestService.For<IMetisRestApi>("https://api.metisai.ir/api/v1", setting);
}