Api/NetinaShop.Infrastructure/RestServices/IRestApiWrapper.cs

24 lines
836 B
C#

using NetinaShop.Infrastructure.Models;
namespace NetinaShop.Infrastructure.RestServices;
public interface IRestApiWrapper : IScopedDependency
{
IKaveNegarRestApi KaveNegarRestApi { get; }
IZarinpalRestApi ZarinpalRestApi { get; }
IDigikalaRestApi DigikalaRestApi { get; }
IFileRestApi FileRestApi(string address);
}
public class RestApiWrapper : IRestApiWrapper
{
public IKaveNegarRestApi KaveNegarRestApi => RestService.For<IKaveNegarRestApi>(RestAddress.BaseKaveNegar);
public IZarinpalRestApi ZarinpalRestApi => RestService.For<IZarinpalRestApi>(RestAddress.BaseZarinpal);
public IDigikalaRestApi DigikalaRestApi => RestService.For<IDigikalaRestApi>(RestAddress.DigikalaApi);
public IFileRestApi FileRestApi(string address)
{
return RestService.For<IFileRestApi>(address);
}
}