Skip to content

Commit

Permalink
1.4.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinCanton authored Apr 8, 2023
2 parents 15470b1 + 3e0183f commit 5461f0b
Show file tree
Hide file tree
Showing 51 changed files with 1,192 additions and 129 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.

## [1.4.0](https://github.com/JustinCanton/Geo.NET/compare/1.3.0...1.4.0) (2023-04-08)
### Features
- **core:** removing the asp framework dependency and creating a repository specific QueryString class ([#61](https://github.com/JustinCanton/Geo.NET/issues/61)) ([c6e4688](https://github.com/JustinCanton/Geo.NET/commit/c6e46888e8b6ec4fec96bf6b0a8c0fe77f91d140))
- changing the DI methods to allow for configuration of the http client ([#66](https://github.com/JustinCanton/Geo.NET/issues/66)) ([5369e85](https://github.com/JustinCanton/Geo.NET/commit/5369e85ae2c95aff66ba23bfd444655fdb8a40d8))

## [1.3.0](https://github.com/JustinCanton/Geo.NET/compare/1.2.1...1.3.0) (2023-04-04)
### Features
- **core:** replacing the IStringLocalizer with a Geo.NET specific interface ([#50](https://github.com/JustinCanton/Geo.NET/issues/50)) ([cc43384](https://github.com/JustinCanton/Geo.NET/commit/cc43384815df870cbfb59c64ad0e9fe1e89aabf5))
Expand Down
7 changes: 3 additions & 4 deletions Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
<PackageReference Include="StyleCop.CSharp.Async.Rules" Version="6.1.41">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Text.Analyzers" Version="2.6.4">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Analyzers" Version="2.2.0">
<PackageReference Include="Text.Analyzers" Version="3.3.4">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

<PropertyGroup>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<IncludeOpenAPIAnalyzers>true</IncludeOpenAPIAnalyzers>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions Geo.NET.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<Rules AnalyzerId="System.Diagnostics.CodeAnalysis" RuleNamespace="System.Diagnostics.CodeAnalysis">
<Rule Id="CA1014" Action="None"/>
<Rule Id="CA1704" Action="None"/>
<Rule Id="CA1805" Action="None"/>
<Rule Id="CA2208" Action="None"/>
</Rules>
Expand Down
20 changes: 15 additions & 5 deletions src/Geo.ArcGIS/DependencyInjection/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Geo.ArcGIS.DependencyInjection
{
using System;
using System.Net.Http;
using Geo.ArcGIS.Abstractions;
using Geo.ArcGIS.Models;
using Geo.ArcGIS.Services;
Expand All @@ -26,10 +27,15 @@ public static class ServiceCollectionExtensions
/// </list>
/// </para>
/// </summary>
/// <param name="services">A <see cref="IServiceCollection"/> to add the ArcGIS services to.</param>
/// <param name="services">An <see cref="IServiceCollection"/> to add the ArcGIS services to.</param>
/// <param name="optionsBuilder">A <see cref="Action{ArcGISOptionsBuilder}"/> with the options to add to the ArcGIS configuration.</param>
/// <returns>A <see cref="IServiceCollection"/> with the added services.</returns>
public static IServiceCollection AddArcGISServices(this IServiceCollection services, Action<ArcGISOptionsBuilder> optionsBuilder)
/// <param name="configureClient">Optional. A delegate that is used to configure the <see cref="HttpClient"/>.</param>
/// <returns>An <see cref="IHttpClientBuilder"/> to configure the http client.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="services"/> is null.</exception>
public static IHttpClientBuilder AddArcGISServices(
this IServiceCollection services,
Action<ArcGISOptionsBuilder> optionsBuilder,
Action<HttpClient> configureClient = null)
{
services.AddCoreServices();

Expand All @@ -47,9 +53,13 @@ public static IServiceCollection AddArcGISServices(this IServiceCollection servi

services.AddHttpClient<IArcGISTokenRetrevial, ArcGISTokenRetrevial>();
services.AddSingleton<IArcGISTokenContainer, ArcGISTokenContainer>();
services.AddHttpClient<IArcGISGeocoding, ArcGISGeocoding>();

return services;
return services.AddHttpClient<IArcGISGeocoding, ArcGISGeocoding>(configureClient ?? DefaultHttpClientConfiguration);
}

private static void DefaultHttpClientConfiguration(HttpClient client)
{
// No-op
}
}
}
3 changes: 1 addition & 2 deletions src/Geo.ArcGIS/Services/ArcGISGeocoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace Geo.ArcGIS.Services
using Geo.ArcGIS.Models.Responses;
using Geo.Core;
using Geo.Core.Extensions;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Newtonsoft.Json;
Expand All @@ -44,7 +43,7 @@ public class ArcGISGeocoding : ClientExecutor, IArcGISGeocoding
/// Initializes a new instance of the <see cref="ArcGISGeocoding"/> class.
/// </summary>
/// <param name="client">A <see cref="HttpClient"/> used for making calls to the ArcGIS system.</param>
/// <param name="tokenContainer">A <see cref="IArcGISTokenContainer"/> used for retreiving the ArcGIS token.</param>
/// <param name="tokenContainer">An <see cref="IArcGISTokenContainer"/> used for retreiving the ArcGIS token.</param>
/// <param name="exceptionProvider">An <see cref="IGeoNETExceptionProvider"/> used to provide exceptions based on an exception type.</param>
/// <param name="resourceStringProviderFactory">An <see cref="IGeoNETResourceStringProviderFactory"/> used to create a resource string provider for log or exception messages.</param>
/// <param name="loggerFactory">An <see cref="ILoggerFactory"/> used to create a logger used for logging information.</param>
Expand Down
2 changes: 1 addition & 1 deletion src/Geo.ArcGIS/Services/ArcGISTokenContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ArcGISTokenContainer : IArcGISTokenContainer
/// <summary>
/// Initializes a new instance of the <see cref="ArcGISTokenContainer"/> class.
/// </summary>
/// <param name="tokenRetrevial">A <see cref="IArcGISTokenRetrevial"/> used to retrieve the token if expired of none existant.</param>
/// <param name="tokenRetrevial">An <see cref="IArcGISTokenRetrevial"/> used to retrieve the token if expired of none existant.</param>
public ArcGISTokenContainer(IArcGISTokenRetrevial tokenRetrevial)
{
_tokenRetrevial = tokenRetrevial ?? throw new ArgumentNullException(nameof(tokenRetrevial));
Expand Down
2 changes: 1 addition & 1 deletion src/Geo.ArcGIS/Services/ArcGISTokenRetrevial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class ArcGISTokenRetrevial : IArcGISTokenRetrevial
/// Initializes a new instance of the <see cref="ArcGISTokenRetrevial"/> class.
/// </summary>
/// <param name="client">A <see cref="HttpClient"/> used for placing calls to the ArcGIS token generation API.</param>
/// <param name="credentialsContainer">A <see cref="IArcGISCredentialsContainer"/> used for fetching the ArcGIS credentials.</param>
/// <param name="credentialsContainer">An <see cref="IArcGISCredentialsContainer"/> used for fetching the ArcGIS credentials.</param>
public ArcGISTokenRetrevial(
HttpClient client,
IArcGISCredentialsContainer credentialsContainer)
Expand Down
19 changes: 14 additions & 5 deletions src/Geo.Bing/DependencyInjection/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
namespace Geo.Bing.DependencyInjection
{
using System;
using System.Net.Http;
using Geo.Bing.Abstractions;
using Geo.Bing.Models;
using Geo.Bing.Services;
Expand All @@ -26,10 +27,15 @@ public static class ServiceCollectionExtensions
/// </list>
/// </para>
/// </summary>
/// <param name="services">A <see cref="IServiceCollection"/> to add the Bing services to.</param>
/// <param name="services">An <see cref="IServiceCollection"/> to add the Bing services to.</param>
/// <param name="optionsBuilder">A <see cref="Action{BingOptionsBuilder}"/> with the options to add to the Bing configuration.</param>
/// <returns>A <see cref="IServiceCollection"/> with the added services.</returns>
public static IServiceCollection AddBingServices(this IServiceCollection services, Action<BingOptionsBuilder> optionsBuilder)
/// <param name="configureClient">Optional. A delegate that is used to configure the <see cref="HttpClient"/>.</param>
/// <returns>An <see cref="IHttpClientBuilder"/> to configure the http client.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="services"/> is null.</exception>
public static IHttpClientBuilder AddBingServices(
this IServiceCollection services,
Action<BingOptionsBuilder> optionsBuilder,
Action<HttpClient> configureClient = null)
{
services.AddCoreServices();

Expand All @@ -45,9 +51,12 @@ public static IServiceCollection AddBingServices(this IServiceCollection service
services.AddSingleton<IBingKeyContainer>(new BingKeyContainer(string.Empty));
}

services.AddHttpClient<IBingGeocoding, BingGeocoding>();
return services.AddHttpClient<IBingGeocoding, BingGeocoding>(configureClient ?? DefaultHttpClientConfiguration);
}

return services;
private static void DefaultHttpClientConfiguration(HttpClient client)
{
// No-op
}
}
}
3 changes: 1 addition & 2 deletions src/Geo.Bing/Services/BingGeocoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ namespace Geo.Bing.Services
using Geo.Bing.Models.Parameters;
using Geo.Bing.Models.Responses;
using Geo.Core;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;

Expand All @@ -36,7 +35,7 @@ public class BingGeocoding : ClientExecutor, IBingGeocoding
/// Initializes a new instance of the <see cref="BingGeocoding"/> class.
/// </summary>
/// <param name="client">A <see cref="HttpClient"/> used for placing calls to the Bing Geocoding API.</param>
/// <param name="keyContainer">A <see cref="IBingKeyContainer"/> used for fetching the Bing key.</param>
/// <param name="keyContainer">An <see cref="IBingKeyContainer"/> used for fetching the Bing key.</param>
/// <param name="exceptionProvider">An <see cref="IGeoNETExceptionProvider"/> used to provide exceptions based on an exception type.</param>
/// <param name="resourceStringProviderFactory">An <see cref="IGeoNETResourceStringProviderFactory"/> used to create a resource string provider for log or exception messages.</param>
/// <param name="loggerFactory">An <see cref="ILoggerFactory"/> used to create a logger used for logging information.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ namespace Geo.Core
public interface IGeoNETResourceStringProviderFactory
{
/// <summary>
/// Creates a <see cref="IGeoNETResourceStringProvider"/> based on a type.
/// Creates an <see cref="IGeoNETResourceStringProvider"/> based on a type.
/// </summary>
/// <typeparam name="TResource">The type of the resource to create an <see cref="IGeoNETResourceStringProvider"/> for.</typeparam>
/// <returns>An <see cref="IGeoNETResourceStringProvider"/>.</returns>
IGeoNETResourceStringProvider CreateResourceStringProvider<TResource>();

/// <summary>
/// Creates a <see cref="IGeoNETResourceStringProvider"/> based on a type.
/// Creates an <see cref="IGeoNETResourceStringProvider"/> based on a type.
/// </summary>
/// <param name="resourceType">The type of the resource to create an <see cref="IGeoNETResourceStringProvider"/> for.</param>
/// <returns>An <see cref="IGeoNETResourceStringProvider"/>.</returns>
IGeoNETResourceStringProvider CreateResourceStringProvider(Type resourceType);

/// <summary>
/// Creates a <see cref="IGeoNETResourceStringProvider"/> based on the resouce file name and assembly.
/// Creates an <see cref="IGeoNETResourceStringProvider"/> based on the resouce file name and assembly.
/// </summary>
/// <param name="resourceFileName">The name of the resource file.</param>
/// <param name="assembly">Optional. The assembly the resource file is located in. If not passed in, the current assembly will be used.</param>
Expand Down
24 changes: 19 additions & 5 deletions src/Geo.Core/DependencyInjection/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

namespace Geo.Core.DependencyInjection
{
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

/// <summary>
/// Extension methods for the <see cref="IServiceCollection"/> class.
Expand All @@ -14,14 +16,26 @@ public static class ServiceCollectionExtensions
{
/// <summary>
/// Adds the Core services to the service collection.
/// <para>
/// Adds the services:
/// <list type="bullet">
/// <item><see cref="IGeoNETResourceStringProviderFactory"/></item>
/// <item><see cref="IGeoNETExceptionProvider"/></item>
/// </list>
/// </para>
/// </summary>
/// <param name="services">A <see cref="IServiceCollection"/> to add the Core services to.</param>
/// <returns>A <see cref="IServiceCollection"/> with the added services.</returns>
/// <param name="services">An <see cref="IServiceCollection"/> to add the Core services to.</param>
/// <returns>The <see cref="IServiceCollection"/> for chaining.</returns>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="services"/> is null.</exception>
public static IServiceCollection AddCoreServices(this IServiceCollection services)
{
services
.AddTransient<IGeoNETResourceStringProviderFactory, GeoNETResourceStringProviderFactory>()
.AddTransient<IGeoNETExceptionProvider, GeoNETExceptionProvider>();
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}

services.TryAddTransient<IGeoNETResourceStringProviderFactory, GeoNETResourceStringProviderFactory>();
services.TryAddTransient<IGeoNETExceptionProvider, GeoNETExceptionProvider>();

return services;
}
Expand Down
9 changes: 8 additions & 1 deletion src/Geo.Core/Geo.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.Extensions.Localization" Version="6.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.1" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.1" />
<PackageReference Include="System.Text.Encodings.Web" Version="5.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 5461f0b

Please sign in to comment.