@microsoft/kiota-http-fetchlibrary
Version:
Kiota request adapter implementation with fetch
48 lines • 2.52 kB
TypeScript
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
import { Middleware } from "./index.js";
import { HttpClient } from "./httpClient.js";
import { BaseBearerTokenAuthenticationProvider } from "@microsoft/kiota-abstractions";
/**
*
* Class containing function(s) related to the middleware pipelines.
*/
export declare class KiotaClientFactory {
/**
* Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional.
* if not provided, the default fetch implementation and middlewares will be used.
* @param customFetch - a Fetch API implementation
* @param middlewares - an aray of Middleware handlers
* If middlewares param is undefined, the httpClient instance will use the default array of middlewares.
* Set middlewares to `null` if you do not wish to use middlewares.
* If custom fetch is undefined, the httpClient instance uses the `DefaultFetchHandler`
* @param authenticationProvider - an optional instance of BaseBearerTokenAuthenticationProvider to be used for authentication
* @returns a HttpClient instance
* @example
* ```Typescript
* // Example usage of KiotaClientFactory.create method with both customFetch and middlewares parameters provided
* KiotaClientFactory.create(customFetch, [middleware1, middleware2]);
* ```
* @example
* ```Typescript
* // Example usage of KiotaClientFactory.create method with only customFetch parameter provided
* KiotaClientFactory.create(customFetch);
* ```
* @example
* ```Typescript
* // Example usage of KiotaClientFactory.create method with only middlewares parameter provided
* KiotaClientFactory.create(undefined, [middleware1, middleware2]);
* ```
* @example
* ```Typescript
* // Example usage of KiotaClientFactory.create method with no parameters provided
* KiotaClientFactory.create();
* ```
*/
static create(customFetch?: (request: string, init: RequestInit) => Promise<Response>, middlewares?: Middleware[], authenticationProvider?: BaseBearerTokenAuthenticationProvider): HttpClient;
}
//# sourceMappingURL=kiotaClientFactory.d.ts.map