Skip to content

Commit

Permalink
Corrected indenting in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerohegartyDfE committed Jul 30, 2024
1 parent 583ddb2 commit 3195f21
Showing 1 changed file with 38 additions and 37 deletions.
75 changes: 38 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,44 @@ Alternatively, the registrations can be configured in the consuming application

```
services.TryAddSingleton<ISearchByKeywordClientProvider, SearchByKeywordClientProvider>();
services.TryAddSingleton<ISearchIndexNamesProvider, SearchIndexNamesProvider>();
services.TryAddSingleton<ISearchByKeywordService, DefaultSearchByKeywordService>();
services.TryAddScoped<IGeoLocationClientProvider, GeoLocationClientProvider>();
services.TryAddScoped<IGeoLocationService, DefaultGeoLocationService>();
services.AddOptions<SearchByKeywordClientOptions>()
.Configure<IConfiguration>(
(settings, configuration) =>
configuration
.GetSection(nameof(SearchByKeywordClientOptions))
.Bind(settings));
services.AddOptions<GeoLocationOptions>()
.Configure<IConfiguration>(
(settings, configuration) =>
configuration
.GetSection(nameof(GeoLocationOptions))
.Bind(settings));
services.AddHttpClient("GeoLocationHttpClient", config =>
{
var geoLocationOptions =
configuration
.GetSection(nameof(GeoLocationOptions)).Get<GeoLocationOptions>();
ArgumentNullException.ThrowIfNull(geoLocationOptions);
ArgumentNullException.ThrowIfNullOrWhiteSpace(geoLocationOptions.MapsServiceUri);
config.BaseAddress = new Uri(geoLocationOptions.MapsServiceUri);
config.Timeout =
new TimeSpan(
geoLocationOptions.RequestTimeOutHours,
geoLocationOptions.RequestTimeOutMinutes,
geoLocationOptions.RequestTimeOutSeconds);
config.DefaultRequestHeaders.Clear();
});```
services.TryAddSingleton<ISearchIndexNamesProvider, SearchIndexNamesProvider>();
services.TryAddSingleton<ISearchByKeywordService, DefaultSearchByKeywordService>();
services.TryAddScoped<IGeoLocationClientProvider, GeoLocationClientProvider>();
services.TryAddScoped<IGeoLocationService, DefaultGeoLocationService>();
services.AddOptions<SearchByKeywordClientOptions>()
.Configure<IConfiguration>(
(settings, configuration) =>
configuration
.GetSection(nameof(SearchByKeywordClientOptions))
.Bind(settings));
services.AddOptions<GeoLocationOptions>()
.Configure<IConfiguration>(
(settings, configuration) =>
configuration
.GetSection(nameof(GeoLocationOptions))
.Bind(settings));
services.AddHttpClient("GeoLocationHttpClient", config =>
{
var geoLocationOptions =
configuration
.GetSection(nameof(GeoLocationOptions)).Get<GeoLocationOptions>();
ArgumentNullException.ThrowIfNull(geoLocationOptions);
ArgumentNullException.ThrowIfNullOrWhiteSpace(geoLocationOptions.MapsServiceUri);
config.BaseAddress = new Uri(geoLocationOptions.MapsServiceUri);
config.Timeout =
new TimeSpan(
geoLocationOptions.RequestTimeOutHours,
geoLocationOptions.RequestTimeOutMinutes,
geoLocationOptions.RequestTimeOutSeconds);
config.DefaultRequestHeaders.Clear();
});```
### Code Usage/Examples
Typical dependency injection and search request would look something like the following,
Expand Down

0 comments on commit 3195f21

Please sign in to comment.