@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
46 lines (45 loc) • 2.5 kB
TypeScript
import { Nullable, NullableResultPromise } from "../base-types";
import { IEntity } from "../contracts/base/entity";
import { IEntityLoadConfiguration } from "../contracts/querying/entity-load-configuration";
import SettingResource from "../models/setting-resource";
import { IExtendedContentHubClient } from "./extended-client";
/**
* Client for fetching setting and category entities.
*/
export interface ISettingsClient {
/**
* Gets the id of a category by name.
* @param name - cannot be an empty or whitespace string
* @returns Id of the category entity.
*/
getCategoryIdAsync(name: string): NullableResultPromise<number>;
/**
* Gets the setting with the specified name from the specified category.
* @param category - The category to get the setting from
* @param name - The name of the setting to get
* @param loadConfiguration - Load configuration
* @returns The setting with the specified name from the specified category or null if that setting doesn't exist.
*/
getSettingAsync(category: string, name: string, loadConfiguration?: Nullable<IEntityLoadConfiguration>): NullableResultPromise<IEntity>;
/**
* Gets the setting value and schema for the desired setting name in the specified category.
* @param category - The category to get the setting from
* @param name - The name of the setting to get
*/
getSettingValueAndSchemaAsync(category: string, name: string): NullableResultPromise<SettingResource>;
/**
* Gets the settings for the specified category.
* @param category - The category to get the setting for
* @param loadConfiguration - Load configuration
* @returns A list of all setting entities for the specified category.
*/
getSettingsForCategoryAsync(category: string, loadConfiguration?: Nullable<IEntityLoadConfiguration>): Promise<Array<IEntity>>;
}
export declare class SettingsClient implements ISettingsClient {
private readonly _client;
constructor(client: IExtendedContentHubClient);
getCategoryIdAsync(name: string): NullableResultPromise<number>;
getSettingAsync(category: string, name: string, loadConfiguration?: Nullable<IEntityLoadConfiguration>): NullableResultPromise<IEntity>;
getSettingValueAndSchemaAsync(category: string, name: string): NullableResultPromise<SettingResource>;
getSettingsForCategoryAsync(category: string, loadConfiguration?: Nullable<IEntityLoadConfiguration>): Promise<Array<IEntity>>;
}