import { type OptimizelyGraphConfigInternal, type OptimizelyGraphConfig } from "../config.js"; import { GraphQLClient, type RequestMiddleware } from "graphql-request"; import { AuthMode, type RequestMethod, type IOptiGraphClient, type OptiGraphSiteInfo, type IOptiGraphClientFlags, type OptiCmsSchema, type FrontendUser, SchemaVersion } from "./types.js"; import { type FetchAPI } from "../hmac-fetch.js"; export declare class ContentGraphClient extends GraphQLClient implements IOptiGraphClient { static readonly ForceHmacToken: string; static readonly ForceBasicAuth: string; protected readonly _config: Readonly; private _user; private _token; private _hmacFetch; private _flags; private _customMiddleware; get currentOptiCmsSchema(): OptiCmsSchema; get debug(): boolean; get frontendUser(): FrontendUser | undefined; protected get token(): string | undefined; protected set token(newValue: string | undefined); protected get hmacFetch(): FetchAPI; get siteInfo(): OptiGraphSiteInfo; get currentAuthMode(): AuthMode; get graphSchemaVersion(): SchemaVersion; constructor(config?: OptimizelyGraphConfig, token?: AuthMode | string | undefined, flags?: Partial); /** * Update the authentication data for this client. * - Set to AuthMode.HMAC or AuthMode.Basic to use that authentication scheme, this requires the AppKey and Secret to be part of the configuration * - Set to the actual token to be used to switch to AuthMode.Token * - Set to undefined or AuthMode.Public to switch to public, read-only mode. (i.e. using the SingleKey) * * @param tokenOrAuthmode The authentication mode/token to be used * @returns The client itself */ updateAuthentication(tokenOrAuthmode?: string | AuthMode | undefined): ContentGraphClient; toJSON(key?: string): OptimizelyGraphConfig; setRequestMiddleware(additionalMiddleware: RequestMiddleware): ContentGraphClient; query: RequestMethod; private _oldFlags; updateFlags(newFlags: Partial, temporary?: boolean): IOptiGraphClient; restoreFlags(): IOptiGraphClient; setFrontendUser(newUser: FrontendUser | null): boolean; protected updateRequestConfig(): void; /** * Build headers that are shared across authentication modes, taking * the current feature flags and authentication into consideration. * * @returns The default header set */ protected buildDefaultHeaders(): Record; protected buildUrlWithFlags(): string; /** * Check on the cache, to ensure it's only reported as enabled if the client * is in "public access" mode. * * @returns The cache status */ protected get cacheEnabled(): boolean; private _changeset; enablePreview(changeset?: string): IOptiGraphClient; disablePreview(): IOptiGraphClient; isPreviewEnabled(): boolean; getChangeset(): string | null; } export default ContentGraphClient;