forked from microsoftgraph/msgraph-sdk-typescript-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphHttpClient.ts
20 lines (19 loc) · 898 Bytes
/
graphHttpClient.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { HttpClient, type Middleware } from "@microsoft/kiota-http-fetchlibrary";
import { GraphTelemetryOption, getDefaultMiddlewareChain } from "./middleware";
/**
* Specialized version of the HTTP client for the Graph API that bootstraps telemetry, /me replacement, and other aspects
*/
export class GraphHttpClient extends HttpClient {
/**
* Creates a new instance of the GraphHttpClient class
* @param graphTelemetryOption The options for telemetry
* @param customFetch The custom fetch implementation to use
* @param middlewares The middlewares to use
*/
public constructor(graphTelemetryOption: GraphTelemetryOption, customFetch?: (request: string, init: RequestInit) => Promise<Response>, ...middlewares: Middleware[]) {
super(customFetch, ...((middlewares ?? []).length > 0 ? middlewares : getDefaultMiddlewareChain({
customFetch,
graphTelemetryOption
})));
}
}