Api-PWA/DocuMed.PWA/Services/RestServices/RestWrapper.cs

29 lines
1.4 KiB
C#

using Newtonsoft.Json;
namespace DocuMed.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 ISectionRestApi SectionRestApi => RestService.For<ISectionRestApi>(Address.SectionController, setting);
public ICityRestApi CityRestApi => RestService.For<ICityRestApi>(Address.CityController, setting);
public IUserRestApi UserRestApi => RestService.For<IUserRestApi>(Address.UserController, setting);
public IMedicalHistoryRestApi MedicalHistoryRestApi => RestService.For<IMedicalHistoryRestApi>(Address.MedicalHistoryController);
public IPatientRestApi PatientRestApi => RestService.For<IPatientRestApi>(Address.PatientController,setting);
}