Class ServiceCollectionExtensions
- Namespace
 - TypedRest
 
- Assembly
 - TypedRest.dll
 
Provides extension methods for IServiceCollection.
public static class ServiceCollectionExtensions
  - Inheritance
 - 
      
      ServiceCollectionExtensions
 
- Inherited Members
 
Methods
AddBasicAuth(IHttpClientBuilder, Action<NetworkCredential>)
Adds HTTP Basic authentication.
public static IHttpClientBuilder AddBasicAuth(this IHttpClientBuilder builder, Action<NetworkCredential> configureCredentials)
  Parameters
builderIHttpClientBuilderThe builder to apply the configuration to.
configureCredentialsAction<NetworkCredential>A delegate that is used to configure NetworkCredential.
Returns
AddBasicAuth(IHttpClientBuilder, ICredentials)
Adds HTTP Basic authentication.
public static IHttpClientBuilder AddBasicAuth(this IHttpClientBuilder builder, ICredentials credentials)
  Parameters
builderIHttpClientBuilderThe builder to apply the configuration to.
credentialsICredentialsA credential provider. Will be queried using BaseAddress as the uri and "Basic" as the authType.
Returns
AddTypedRest(IServiceCollection, Uri)
Registers EntryEndpoint for dependency injection.
public static IHttpClientBuilder AddTypedRest(this IServiceCollection services, Uri uri)
  Parameters
servicesIServiceCollectionThe IServiceCollection.
uriUriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Returns
- IHttpClientBuilder
 An IHttpClientBuilder that can be used to configure the underlying HttpClient.
AddTypedRest<TEndpoint>(IServiceCollection, Uri)
Registers a type derived from EntryEndpoint for dependency injection.
public static IHttpClientBuilder AddTypedRest<TEndpoint>(this IServiceCollection services, Uri uri) where TEndpoint : EntryEndpoint
  Parameters
servicesIServiceCollectionThe IServiceCollection.
uriUriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Returns
- IHttpClientBuilder
 An IHttpClientBuilder that can be used to configure the underlying HttpClient.
Type Parameters
TEndpointThe type of the EntryEndpoint. Must provide a constructor that accepts an HttpClient.
AddTypedRest<TInterface, TEndpoint>(IServiceCollection, Uri)
Registers a type derived from EntryEndpoint for dependency injection.
public static IHttpClientBuilder AddTypedRest<TInterface, TEndpoint>(this IServiceCollection services, Uri uri) where TInterface : class where TEndpoint : EntryEndpoint, TInterface
  Parameters
servicesIServiceCollectionThe IServiceCollection.
uriUriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Returns
- IHttpClientBuilder
 An IHttpClientBuilder that can be used to configure the underlying HttpClient.
Type Parameters
TInterfaceThe interface to register.
TEndpointThe type of the EntryEndpoint. Must provide a constructor that accepts an HttpClient.