TypedRest for .NET 1.3.6
build type-safe fluent-style REST API clients
TypedRest.ServiceCollectionExtensions Class Reference

Provides extension methods for IServiceCollection. More...

Static Public Member Functions

static IHttpClientBuilder AddTypedRest (this IServiceCollection services, Uri uri)
 Registers EntryEndpoint for dependency injection. More...
 
static IHttpClientBuilder AddTypedRest< TEndpoint > (this IServiceCollection services, Uri uri)
 Registers a type derived from EntryEndpoint for dependency injection. More...
 
static IHttpClientBuilder AddTypedRest< TInterface, TEndpoint > (this IServiceCollection services, Uri uri)
 Registers a type derived from EntryEndpoint for dependency injection. More...
 
static IHttpClientBuilder AddBasicAuth (this IHttpClientBuilder builder, Action< NetworkCredential > configureCredentials)
 Adds HTTP Basic authentication. More...
 
static IHttpClientBuilder AddBasicAuth (this IHttpClientBuilder builder, ICredentials credentials)
 Adds HTTP Basic authentication. More...
 

Detailed Description

Provides extension methods for IServiceCollection.

Member Function Documentation

◆ AddBasicAuth() [1/2]

static IHttpClientBuilder TypedRest.ServiceCollectionExtensions.AddBasicAuth ( this IHttpClientBuilder  builder,
Action< NetworkCredential >  configureCredentials 
)
static

Adds HTTP Basic authentication.

Parameters
builderThe builder to apply the configuration to.
configureCredentialsA delegate that is used to configure NetworkCredential.

◆ AddBasicAuth() [2/2]

static IHttpClientBuilder TypedRest.ServiceCollectionExtensions.AddBasicAuth ( this IHttpClientBuilder  builder,
ICredentials  credentials 
)
static

Adds HTTP Basic authentication.

Parameters
builderThe builder to apply the configuration to.
credentialsA credential provider. Will be queried using HttpClient.BaseAddress as the uri and "Basic" as the authType.

◆ AddTypedRest()

static IHttpClientBuilder TypedRest.ServiceCollectionExtensions.AddTypedRest ( this IServiceCollection  services,
Uri  uri 
)
static

Registers EntryEndpoint for dependency injection.

Parameters
servicesThe IServiceCollection.
uriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Returns
An IHttpClientBuilder that can be used to configure the underlying HttpClient.

◆ AddTypedRest< TEndpoint >()

static IHttpClientBuilder TypedRest.ServiceCollectionExtensions.AddTypedRest< TEndpoint > ( this IServiceCollection  services,
Uri  uri 
)
static

Registers a type derived from EntryEndpoint for dependency injection.

Parameters
servicesThe IServiceCollection.
uriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Template Parameters
TEndpointThe type of the EntryEndpoint. Must provide a constructor that accepts an HttpClient.
Returns
An IHttpClientBuilder that can be used to configure the underlying HttpClient.
Type Constraints
TEndpoint :EntryEndpoint 
TEndpoint :services.AddHttpClient<TEndpoint> 
TEndpoint :client 
TEndpoint :client.BaseAddress 
TEndpoint :uri 

◆ AddTypedRest< TInterface, TEndpoint >()

static IHttpClientBuilder TypedRest.ServiceCollectionExtensions.AddTypedRest< TInterface, TEndpoint > ( this IServiceCollection  services,
Uri  uri 
)
static

Registers a type derived from EntryEndpoint for dependency injection.

Parameters
servicesThe IServiceCollection.
uriThe base URI of the REST API. Missing trailing slash will be appended automatically.
Template Parameters
TInterfaceThe interface to register.
TEndpointThe type of the EntryEndpoint. Must provide a constructor that accepts an HttpClient.
Returns
An IHttpClientBuilder that can be used to configure the underlying HttpClient.
Type Constraints
TInterface :class 
TEndpoint :EntryEndpoint 
TEndpoint :TInterface 
TEndpoint :services.AddHttpClient 
TEndpoint :TInterface 
TEndpoint :TEndpoint 
TEndpoint :client 
TEndpoint :client.BaseAddress 
TEndpoint :uri 

The documentation for this class was generated from the following file: