Table of Contents

Class HttpClientFactory

Namespace
Autodesk.Common.HttpClientLibrary
Assembly
Autodesk.Common.HttpClientLibrary.dll
public static class HttpClientFactory
Inheritance
HttpClientFactory
Inherited Members

Methods

Create()

Create a resilient Http Client

public static HttpClient Create()

Returns

HttpClient

Http client including default middleware WITHOUT rate limit

Create(HttpMessageHandler?, IRequestOption[]?)

Initializes the HttpClient with the default configuration and middlewares including a authentication middleware using the Microsoft.Kiota.Abstractions.Authentication.IAuthenticationProvider if provided.

public static HttpClient Create(HttpMessageHandler? finalHandler = null, IRequestOption[]? optionsForHandlers = null)

Parameters

finalHandler HttpMessageHandler

The final HttpMessageHandler in the http pipeline. Can be configured for proxies, auto-decompression and auto-redirects

optionsForHandlers IRequestOption[]

A array of Microsoft.Kiota.Abstractions.IRequestOption objects passed to the default handlers.

Returns

HttpClient

The HttpClient with the default middlewares.

Create((int maxConcurrentRequests, TimeSpan timeWindow)?)

Create a resilient Http Client

public static HttpClient Create((int maxConcurrentRequests, TimeSpan timeWindow)? rateLimit)

Parameters

rateLimit (int maxConcurrentRequests, TimeSpan timeWindow)?

Maximum calls per endpoint in a specific timeframe

Returns

HttpClient

Http client including default middleware WITH rate limit

CreateAdapter(Func<Task<string>>, HttpClient?)

Creates a new HttpClientRequestAdapter with an AccessTokenProvider. The adapter will use the default error and decompression handlers.

public static HttpClientRequestAdapter CreateAdapter(Func<Task<string>> getAccessToken, HttpClient? httpClient)

Parameters

getAccessToken Func<Task<string>>
httpClient HttpClient

Returns

HttpClientRequestAdapter

Request adapter for SDK client instances

GetDefaultHandlerActivatableTypes()

Gets the default handler types.

public static IList<KiotaClientFactory.ActivatableType> GetDefaultHandlerActivatableTypes()

Returns

IList<KiotaClientFactory.ActivatableType>

A list of all the default handlers

Remarks

Order matters