AdminPanel/NetinaShop.AdminPanel.PWA/Services/RestServices/RestWrapper.cs

23 lines
978 B
C#

namespace NetinaShop.AdminPanel.PWA.Services.RestServices;
public class RestWrapper : IRestWrapper
{
private static RefitSettings setting = new RefitSettings(new NewtonsoftJsonContentSerializer(new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
}));
public ICrudApiRest<T, TKey> CrudApiRest<T, TKey>(string address) where T : class
{
return RestService.For<ICrudApiRest<T, TKey>>(address, setting);
}
public ICrudDtoApiRest<T, TDto, TKey> CrudDtoApiRest<T, TDto, TKey>(string address) where T : class where TDto : class
{
return RestService.For<ICrudDtoApiRest<T, TDto, TKey>>(address, setting);
}
public IAuthRestApi AuthRestApi => RestService.For<IAuthRestApi>(Address.AuthController, setting);
public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
}