import SPHttpClientCommonConfiguration, { type ISPHttpClientCommonConfiguration } from './SPHttpClientCommonConfiguration'; import ODataVersion from './ODataVersion'; /** * Flags interface for SPHttpClientConfiguration. * * @public */ export interface ISPHttpClientConfiguration extends ISPHttpClientCommonConfiguration { /** * Automatically configure the RequestInit.credentials. * * @remarks * When this switch is true: * * If RequestInit.credentials is not explicitly specified for the request, * then SPHttpClient will assign it to be "same-origin". Without this switch, * different web browsers may apply different defaults. * * For more information, see the spec: * https://fetch.spec.whatwg.org/#cors-protocol-and-credentials */ defaultSameOriginCredentials?: boolean; /** * Automatically configure the "OData-Version" header. * * @remarks * When this switch is specified (i.e. not undefined): * If the "OData-Version" header was not explicitly added for the request, * then SPHttpClient will add the header to specify the version indicated * by defaultODataVersion. * * NOTE: Without an 'OData-Version' header, the SharePoint server currently * defaults to Version 3.0 in most cases. The recommended version is 4.0. */ defaultODataVersion?: ODataVersion; /** * Automatically provide an "X-RequestDigest" header for authentication. * * @remarks * When this switch is true: * * If the "X-RequestDigest" header was not explicitly added for the request, * then SPHttpClient will add it if the request is a write operation (i.e. * an HTTP method other than "GET", "HEAD", or "OPTIONS"). The request digest * is managed by the DigestCache service. In the case of a cache miss, an * additional network request may be performed. */ requestDigest?: boolean; /** * Handle cookie refresh with a popup dialog * * @remarks * When this switch is true popup auth will be used for handling a cookie refresh. * This means the caller must handle the popup events. If it is undefined or false * full page redirect will be defaulted to. */ usePopupForCookieRefresh?: boolean; } /** * Configuration for {@link SPHttpClient}. * * @remarks * The SPHttpClientConfiguration object provides a set of switches for enabling/disabling * various features of the SPHttpClient class. Normally these switches are set * (e.g. when calling SPHttpClient.fetch()) by providing one of the predefined defaults * from SPHttpClientConfigurations, however switches can also be changed via the * SPHttpClientConfiguration.overrideWith() method. * * @public */ export default class SPHttpClientConfiguration extends SPHttpClientCommonConfiguration implements ISPHttpClientConfiguration { protected flags: ISPHttpClientConfiguration; /** * Constructs a new instance of SPHttpClientConfiguration with the specified flags. * The default values will be used for any flags that are missing or undefined. * If overrideFlags is specified, it takes precedence over flags. */ constructor(flags: ISPHttpClientConfiguration, overrideFlags?: ISPHttpClientConfiguration); /** * @override */ overrideWith(sourceFlags: ISPHttpClientConfiguration): SPHttpClientConfiguration; /** * {@inheritDoc ISPHttpClientConfiguration.defaultSameOriginCredentials} */ get defaultSameOriginCredentials(): boolean; /** * {@inheritDoc ISPHttpClientConfiguration.defaultODataVersion} */ get defaultODataVersion(): ODataVersion; /** * {@inheritDoc ISPHttpClientConfiguration.requestDigest} */ get requestDigest(): boolean; /** * {@inheritDoc ISPHttpClientConfiguration.usePopupForCookieRefresh} */ get usePopupForCookieRefresh(): boolean; /** * @override */ protected initializeFlags(): void; } /** * Standard configurations for SPHttpClient. * * @remarks * This interface provides standard predefined SPHttpClientConfiguration objects for use with * the SPHttpClient class. In general, clients should choose the latest available * version number, which enables all the switches that are recommended for typical * scenarios. (If new switches are introduced in the future, a new version number * will be introduced, which ensures that existing code will continue to function the * way it did at the time when it was tested.) * * @public */ export interface ISPHttpClientConfigurations { /** * Version 1 enables these switches: * * consoleLogging = true; * jsonRequest = true; * jsonResponse = true; * defaultSameOriginCredentials = true; * defaultODataVersion = ODataVersion.v4; * requestDigest = true */ readonly v1: SPHttpClientConfiguration; } export declare const predefinedConfigurations: ISPHttpClientConfigurations; //# sourceMappingURL=SPHttpClientConfiguration.d.ts.map