2023-09-20 11:54:12 +03:30
|
|
|
|
namespace Brizco.Infrastructure.RestServices;
|
|
|
|
|
|
|
|
|
|
|
|
public interface IRestApiWrapper : IScopedDependency
|
|
|
|
|
|
{
|
|
|
|
|
|
IKaveNegarRestApi KaveNegarRestApi { get; }
|
2025-05-12 16:18:01 +03:30
|
|
|
|
IMetisRestApi MetisRestApi { get; }
|
2023-09-20 11:54:12 +03:30
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class RestApiWrapper : IRestApiWrapper
|
|
|
|
|
|
{
|
2025-05-12 16:18:01 +03:30
|
|
|
|
private static readonly RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings
|
|
|
|
|
|
{
|
|
|
|
|
|
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
2023-09-20 11:54:12 +03:30
|
|
|
|
public IKaveNegarRestApi KaveNegarRestApi => RestService.For<IKaveNegarRestApi>(RestAddress.BaseKaveNegar);
|
2025-05-12 16:18:01 +03:30
|
|
|
|
public IMetisRestApi MetisRestApi => RestService.For<IMetisRestApi>("https://api.metisai.ir/api/v1", setting);
|
2023-09-20 11:54:12 +03:30
|
|
|
|
}
|