@@ -9,8 +9,34 @@ export class KiotaClientFactory {
9
9
/**
10
10
* @public
11
11
* @static
12
- * Returns an instance of HttpClient with the provided middlewares and custom fetch implementation
12
+ * Returns an instance of HttpClient with the provided middlewares and custom fetch implementation both parameters are optional.
13
+ * if not provided, the default fetch implementation and middlewares will be used.
14
+ * @param {(request: string, init?: RequestInit) => Promise < Response > } customFetch - a Fetch API implementation
15
+ * @param {Middleware[] } middlewares - an aray of Middleware handlers
16
+ * If middlewares param is undefined, the httpClient instance will use the default array of middlewares.
17
+ * Set middlewares to `null` if you do not wish to use middlewares.
18
+ * If custom fetch is undefined, the httpClient instance uses the `DefaultFetchHandler`
13
19
* @returns a HttpClient instance
20
+ * @example
21
+ * ```Typescript
22
+ * // Example usage of KiotaClientFactory.create method with both customFetch and middlewares parameters provided
23
+ * KiotaClientFactory.create(customFetch, [middleware1, middleware2]);
24
+ * ```
25
+ * @example
26
+ * ```Typescript
27
+ * // Example usage of KiotaClientFactory.create method with only customFetch parameter provided
28
+ * KiotaClientFactory.create(customFetch);
29
+ * ```
30
+ * @example
31
+ * ```Typescript
32
+ * // Example usage of KiotaClientFactory.create method with only middlewares parameter provided
33
+ * KiotaClientFactory.create(undefined, [middleware1, middleware2]);
34
+ * ```
35
+ * @example
36
+ * ```Typescript
37
+ * // Example usage of KiotaClientFactory.create method with no parameters provided
38
+ * KiotaClientFactory.create();
39
+ * ```
14
40
*/
15
41
public static create ( customFetch : ( request : string , init : RequestInit ) => Promise < Response > = fetch as any , middlewares ?: Middleware [ ] ) : HttpClient {
16
42
const middleware = middlewares || MiddlewareFactory . getDefaultMiddlewares ( customFetch ) ;
0 commit comments