Skip to content

joshthompsonsmithdev/food-hygiene-rating-dotnet

Repository files navigation

Food Hygiene Rating DotNet

Nuget

A C# .NET library for interacting with the government food hygiene rating API.

Getting Started

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);
    }
}

The API's

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:

Regions

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>

Authorities

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>

Business Types

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>

Countries

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>

Establishments

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>

Scheme Types

SchemeTypeService.cs.

Method Name Async FHRS API Reference Return Type
GetAsync() Yes View Documentation FhrResponse<SchemeTypes>

Sort Options

SortOptionService.cs.

Method Name Async FHRS API Reference Return Type
GetAsync() Yes View Documentation FhrResponse<SortOptions>

Score Descriptors

ScoreDescriptorService.cs.

Method Name Async FHRS API Reference Return Type
GetAsync(int) Yes View Documentation FhrResponse<ScoreDescriptors>

Ratings

RatingService.cs.

Method Name Async FHRS API Reference Return Type
GetAsync() Yes View Documentation FhrResponse<Ratings>

Rating Operators

RatingOperatorService.cs.

Method Name Async FHRS API Reference Return Type
GetAsync() Yes View Documentation FhrResponse<RatingOperators>

About

.NET Core library for interacting with the government food hygiene rating API.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages