@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
56 lines (55 loc) • 1.81 kB
TypeScript
import { IApiInfo } from "../api/api-info";
import { ApiRoutesDictionary } from "../api/api-routes-dictionary";
import { MapStringTo } from "../base-types";
import Link from "../link";
import { IExtendedContentHubClient } from "./extended-client";
/**
* Contains functionality to get REST API information.
* It will also check for compatibility with the server REST API.
*/
export interface IApiClient {
/**
* Gets or sets whether compatibility checks should be disabled.
*
* @remarks
* The value is shared across all {@link IExtendedContentHubClient} instances.
*/
disableCompatibilityChecks: boolean;
/**
* Gets the REST API information. The result will be cached.
*
* @returns The API information.
*/
getApiInfoAsync(): Promise<IApiInfo>;
/**
* Gets the REST API routes. The result will be cached.
*
* @returns The REST API routes.
*/
getApiRoutesAsync(): Promise<ApiRoutesDictionary>;
/**
* Forces a refresh of the cached REST API information.
*/
refreshAsync(): Promise<void>;
}
export declare class ApiClient implements IApiClient {
private readonly _client;
private _api;
private static _disableCompatibilityChecks;
get disableCompatibilityChecks(): boolean;
set disableCompatibilityChecks(value: boolean);
constructor(client: IExtendedContentHubClient);
getApiInfoAsync(): Promise<IApiInfo>;
getApiRoutesAsync(): Promise<MapStringTo<Link>>;
refreshAsync(): Promise<void>;
/**
* Load the REST API information if absent.
*/
private loadAsync;
/**
* Fetches the API information and checks if the server is running a compatible Content Hub version.
*
* @returns The API information.
*/
private fetchApiInfoAsync;
}