A C# .NET library for interacting with the government food hygiene rating API.
First, you'll need to configure the following in your Startup.cs
file:
services.AddFoodHygieneRatingDotNet();
Once, you've included the 'add' method, you can simply inject the required service and call one of its associated methods, like so:
[ApiController, Route("api/[controller]")]
public class AuthorityController : Controller
{
private readonly IAuthorityService _authorityService;
public AuthorityController(IAuthorityService authorityService)
{
_authorityService = authorityService;
}
[HttpGet, Route("paged")]
public async Task<FhrResponse<Authorities>> GetPagedAsync(int page, int size)
{
return await _authorityService.GetPagedAsync(page, size);
}
}
Each of the respective Food Hygiene Rating API calls have been wrapped into associated methods and can be invoked asynchronously.
A full breakdown of each API's associated class and method(s), can be found below:
RegionService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetPagedAsync(int , int ) |
Yes | View Documentation | FhrResponse<Regions> |
GetPagedBasicAsync(int , int ) |
Yes | View Documentation | FhrResponse<Regions> |
GetBasicAsync | Yes | View Documentation | FhrResponse<Regions> |
GetAsync | Yes | View Documentation | FhrResponse<Regions> |
GetAsync(int ) |
Yes | View Documentation | FhrResponse<Region> |
AuthorityService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetPagedAsync(int , int ) |
Yes | View Documentation | FhrResponse<Authorities> |
GetPagedBasicAsync(int , int ) |
Yes | View Documentation | FhrResponse<Authorities> |
GetBasicAsync | Yes | View Documentation | FhrResponse<Authorities> |
GetAsync | Yes | View Documentation | FhrResponse<Authorities> |
GetAsync(int ) |
Yes | View Documentation | FhrResponse<Authority> |
BusinessTypeService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetPagedAsync(int , int ) |
Yes | View Documentation | FhrResponse<BusinessTypes> |
GetPagedBasicAsync(int , int ) |
Yes | View Documentation | FhrResponse<BusinessTypes> |
GetBasicAsync | Yes | View Documentation | FhrResponse<BusinessTypes> |
GetAsync | Yes | View Documentation | FhrResponse<BusinessTypes> |
GetAsync(int ) |
Yes | View Documentation | FhrResponse<BusinessType> |
CountryService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetPagedAsync(int , int ) |
Yes | View Documentation | FhrResponse<Countries> |
GetPagedBasicAsync(int , int ) |
Yes | View Documentation | FhrResponse<Countries> |
GetBasicAsync | Yes | View Documentation | FhrResponse<Countries> |
GetAsync | Yes | View Documentation | FhrResponse<Countries> |
GetAsync(int ) |
Yes | View Documentation | FhrResponse<Country> |
EstablishmentService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetPagedBasicAsync(int , int ) |
Yes | View Documentation | FhrResponse<Establishments> |
GetBasicAsync | Yes | View Documentation | FhrResponse<Establishments> |
GetAsync(EstablishmentSearchCriteria ) |
Yes | View Documentation | FhrResponse<Establishments> |
GetAsync(int ) |
Yes | View Documentation | FhrResponse<Establishment> |
SchemeTypeService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetAsync() | Yes | View Documentation | FhrResponse<SchemeTypes> |
SortOptionService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetAsync() | Yes | View Documentation | FhrResponse<SortOptions> |
ScoreDescriptorService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetAsync(int ) |
Yes | View Documentation | FhrResponse<ScoreDescriptors> |
RatingService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetAsync() | Yes | View Documentation | FhrResponse<Ratings> |
RatingOperatorService.cs.
Method Name | Async | FHRS API Reference | Return Type |
---|---|---|---|
GetAsync() | Yes | View Documentation | FhrResponse<RatingOperators> |