Fen.Client 1.0.1

Standardized HttpClient conventions, from the opinions of the Fulfiller Enablement team.

There is a newer version of this package available.
See the version list below for details.
Install-Package Fen.Client -Version 1.0.1
dotnet add package Fen.Client --version 1.0.1
<PackageReference Include="Fen.Client" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fen.Client --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

FEN.Client is a NuGet package containing configurations and customizations that cause an HttpClient to meet the standards of the Fulfiller Enablement squad. This is an opinionated library, and reflects those practices that FEN considers best. If you have a business need to do something other than what this library provides, you may want to choose something else.

Why You Want It

FEN.Client contains opinionated configuration on many significant HttpClient aspects:

  • Authentication
    • Caching of Authentication
  • Logging
  • Serialization and Deserialization

Most importantly, it allows for declarative configuration of what it takes to communicate with Cimpress services on the Platform. There's a certain amount of overhead or boilerplate required to do that, and this library aims to minimize it.

How You Use It

Import the NuGet package “Fen.Client” in your preferred way.

If you are using this library in an ASP.NET Core service, an AddHttpClient extension method has been provided that can be called from the service's ConfigureServices method in the startup class. Configuration is provided by the following types via dependency injection:

  • IOptions&lt;Auth0Options&gt;, which is provided by the standard configuration infrastructure.
  • ILogger, which is provided by the standard logging infrastructure.
  • IDistributedCache, which can be configured to operate in a distributed or local way by the standard caching infrastructure.
  • MediaTypeFormatter, which is ideally configured from the JsonSerializationSettings in the service's MvcJsonOptions.

If the application is not an ASP.NET Core, these dependencies can be passed via the constructors of the classes Auth0AuthenticatingHandler and V1.Auth0AuthenticatingHandler. The HttpClient itself can be constructed in many ways from this point, but the recommended pattern is to pass the handlers to the HttpClientFactory.Create(params DelegatingHandler[]) method. (It saves a lot of tedious work hooking the handlers up to one another.) Because delegating handlers operate like client middleware, the order in which these handlers are applied matters. For the Platform, apply the V1 handler first.

HttpClientFactory.Create(v1Auth0Handler, auth0Handler);

FEN.Client is a NuGet package containing configurations and customizations that cause an HttpClient to meet the standards of the Fulfiller Enablement squad. This is an opinionated library, and reflects those practices that FEN considers best. If you have a business need to do something other than what this library provides, you may want to choose something else.

Why You Want It

FEN.Client contains opinionated configuration on many significant HttpClient aspects:

  • Authentication
    • Caching of Authentication
  • Logging
  • Serialization and Deserialization

Most importantly, it allows for declarative configuration of what it takes to communicate with Cimpress services on the Platform. There's a certain amount of overhead or boilerplate required to do that, and this library aims to minimize it.

How You Use It

Import the NuGet package “Fen.Client” in your preferred way.

If you are using this library in an ASP.NET Core service, an AddHttpClient extension method has been provided that can be called from the service's ConfigureServices method in the startup class. Configuration is provided by the following types via dependency injection:

  • IOptions&lt;Auth0Options&gt;, which is provided by the standard configuration infrastructure.
  • ILogger, which is provided by the standard logging infrastructure.
  • IDistributedCache, which can be configured to operate in a distributed or local way by the standard caching infrastructure.
  • MediaTypeFormatter, which is ideally configured from the JsonSerializationSettings in the service's MvcJsonOptions.

If the application is not an ASP.NET Core, these dependencies can be passed via the constructors of the classes Auth0AuthenticatingHandler and V1.Auth0AuthenticatingHandler. The HttpClient itself can be constructed in many ways from this point, but the recommended pattern is to pass the handlers to the HttpClientFactory.Create(params DelegatingHandler[]) method. (It saves a lot of tedious work hooking the handlers up to one another.) Because delegating handlers operate like client middleware, the order in which these handlers are applied matters. For the Platform, apply the V1 handler first.

HttpClientFactory.Create(v1Auth0Handler, auth0Handler);

Release Notes

⁃ Everything is new!

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
7.0.0 115 10/31/2019
6.4.2 2,214 5/28/2019
6.4.1 464 5/3/2019
6.4.0 2,251 2/18/2019
6.3.0 363 1/30/2019
6.2.1 376 12/11/2018
6.1.0 4,831 10/11/2018
6.1.0-pre1 147 10/8/2018
6.0.1 5,197 8/20/2018
6.0.0 567 8/17/2018
5.0.0 580 7/26/2018
4.0.2 9,712 7/12/2018
4.0.1 484 6/7/2018
4.0.0 293 6/6/2018
4.0.0-preview2 222 6/6/2018
4.0.0-preview1 235 6/6/2018
3.0.0 745 5/15/2018
2.0.0 5,204 1/26/2018
1.0.1 3,511 12/12/2017
Show less