import { ServiceKey, type ServiceScope } from '@microsoft/sp-core-library'; import { type IHttpClientOptions, type _IRequestCacheOptions, type _IHttpRequestCacheOptions, type _IClientCachableResponse } from '@microsoft/sp-http-base'; import DEPRECATED_DO_NOT_USE_GraphHttpClientResponse from './DEPRECATED_DO_NOT_USE_GraphHttpClientResponse'; import type { DEPRECATED_DO_NOT_USE_IGraphHttpClientConfigurations } from './DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration'; import type DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration from './DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration'; /** * GraphHttpClient is used to perform REST calls against Microsoft Graph. It adds default * headers and collects telemetry that helps the service to monitor the performance of an application. * https://developer.microsoft.com/en-us/graph/ * * @remarks * For communicating with SharePoint, use the {@link @microsoft/sp-http-base#SPHttpClient} class instead. * For communicating with other internet services, use the {@link @microsoft/sp-http-base#HttpClient} class instead. * * @internal * @deprecated The GraphHttpClient class has been superseded by the MSGraphClient class. * @sealed */ export default class DEPRECATED_DO_NOT_USE_GraphHttpClient { /** * The standard predefined GraphHttpClientConfiguration objects for use with * the GraphHttpClient class. */ static readonly configurations: DEPRECATED_DO_NOT_USE_IGraphHttpClientConfigurations; /** * The service key for GraphHttpClient. */ static readonly serviceKey: ServiceKey; private static readonly _className; private static _logSource; private _graphContext; private _parentSource; private _serviceScope; private _token; private _tokenProvider; private _fetchProvider; private _clientManifestData; private _cacheProvider; constructor(serviceScope: ServiceScope); /** * Perform a REST service call. * * @remarks * Generally, the parameters and semantics for HttpClient.fetch() are essentially * the same as the WHATWG API standard that is documented here: * https://fetch.spec.whatwg.org/ * * The GraphHttpClient subclass adds some additional behaviors that are convenient when * working with SharePoint ODATA API's (which can be avoided by using * HttpClient instead): * - Default "Accept" and "Content-Type" headers are added if not explicitly specified. * * @param url - The url string should be relative to the graph server. * Good: 'v1.0/me/events' * Bad: '/v1.0/me/events', 'https://graph.microsoft.com/v1.0/me/events' * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @returns a promise that will return the result */ fetch(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions): Promise; /** * Perform a REST service call. * * @remarks * Generally, the parameters and semantics for HttpClient.fetch() are essentially * the same as the WHATWG API standard that is documented here: * https://fetch.spec.whatwg.org/ * * The GraphHttpClient subclass adds some additional behaviors that are convenient when * working with SharePoint ODATA API's (which can be avoided by using * HttpClient instead): * - Default "Accept" and "Content-Type" headers are added if not explicitly specified. * * @param url - The url string should be relative to the graph server. * Good: 'v1.0/me/events' * Bad: '/v1.0/me/events', 'https://graph.microsoft.com/v1.0/me/events' * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @param cacheConfiguration - determines the configuration for cache management of this request * @returns A promise containing a IClientCachableResponse, which contains a * Promise to the cached data response and a Promise to the server response * * @internal */ fetch(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions, cacheConfiguration: _IRequestCacheOptions): Promise<_IClientCachableResponse>; /** * Perform a REST service call. * * @remarks * Generally, the parameters and semantics for HttpClient.fetch() are essentially * the same as the WHATWG API standard that is documented here: * https://fetch.spec.whatwg.org/ * * The GraphHttpClient subclass adds some additional behaviors that are convenient when * working with SharePoint ODATA API's (which can be avoided by using * HttpClient instead): * - Default "Accept" and "Content-Type" headers are added if not explicitly specified. * * @param url - The url string should be relative to the graph server. * Good: 'v1.0/me/events' * Bad: '/v1.0/me/events', 'https://graph.microsoft.com/v1.0/me/events' * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @param cacheConfiguration - determines the configuration for cache management of this request * @returns A Promise to the cached data response or a Promise to the server response * * @internal */ fetch(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions, cacheConfiguration: _IHttpRequestCacheOptions): Promise; /** * Calls fetch(), but sets the method to "GET". * @param url - the URL to fetch * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @returns a promise that will return the result */ get(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options?: IGraphHttpClientOptions): Promise; /** * Calls fetch(), but sets the method to "GET". * @param url - the URL to fetch * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @param cacheConfiguration - determines the configuration for cache management of this request * @returns A promise containing a IClientCachableResponse, which contains a * Promise to the cached data response and a Promise to the server response * * @internal */ get(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions | undefined, cacheConfiguration: _IRequestCacheOptions): Promise<_IClientCachableResponse>; /** * Calls fetch(), but sets the method to "GET". * @param url - the URL to fetch * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @param cacheConfiguration - determines the configuration for cache management of this request * @returns A Promise to the cached data response or a Promise to the server response * * @internal */ get(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions | undefined, cacheConfiguration: _IHttpRequestCacheOptions): Promise; /** * Calls fetch(), but sets the method to "POST". * @param url - the URL to fetch * @param configuration - determines the default behavior of GraphHttpClient; normally this should * be the latest version number from GraphHttpClientConfigurations * @param options - additional options that affect the request * @returns a promise that will return the result */ post(url: string, configuration: DEPRECATED_DO_NOT_USE_GraphHttpClientConfiguration, options: IGraphHttpClientOptions): Promise; private _fetch; private _fetchWithInstrumentation; private _getOAuthToken; /** * Gets the cache data provider */ private get _cacheDataProvider(); private get _logSourceId(); private _mergeUserHeaders; private _writeQosMonitorUpdate; /** * This function verifies that */ private _validateGraphRelativeUrl; } /** * Options for HttpClient * * @remarks * This interface defines the options for the GraphHttpClient operations such as * get(), post(), fetch(), etc. It is based on the WHATWG API standard * parameters that are documented here: * https://fetch.spec.whatwg.org/ * * @internal */ export interface IGraphHttpClientOptions extends IHttpClientOptions { } //# sourceMappingURL=DEPRECATED_DO_NOT_USE_GraphHttpClient.d.ts.map