@sitecore/sc-contenthub-webclient-sdk
Version:
Sitecore Content Hub WebClient SDK.
47 lines (46 loc) • 1.84 kB
TypeScript
import { MapNumberTo, MapStringTo, Nullable, Object_Unknown } from "../../..";
import { IContentHubClient } from "../../../clients/content-hub-client";
import { IParentRelation, RelationBase } from "../relation";
import { RelationRole } from "../relation-role";
import { IToManyRelation } from "./to-many-relation";
/**
* A relation where the parent has many children.
*/
export interface IParentToManyChildrenRelation extends IParentRelation, IToManyRelation {
/**
* The list of children ids.
*/
readonly children: Array<number>;
/**
* When related items are partially loaded, this value will be set
* to indicate how many related items there are in total.
*/
childTotal?: number;
/**
* Gets the properties for a child.
*
* If no properties are found, an empty list is returned.
* @param id - The id of the child to get properties for
*/
getChildProperties(id: number): MapStringTo<Object_Unknown>;
}
export declare class ParentToManyChildrenRelation extends RelationBase implements IParentToManyChildrenRelation {
private _children;
readonly role: RelationRole;
readonly childTotal?: number;
readonly isMultiValue: boolean;
get isFullyLoaded(): boolean;
get isDirty(): boolean;
get children(): Array<number>;
constructor(name: string, properties?: Nullable<MapNumberTo<MapStringTo<Object_Unknown>>>, client?: IContentHubClient, childTotal?: number);
getIds(): Array<number>;
setIds(ids: Array<number>): void;
clear(): void;
add(id: number): void;
addRange(ids: Array<number>): void;
addAsync(identifier: string): Promise<void>;
addRangeAsync(identifiers: Array<string>): Promise<void>;
startTracking(): void;
markClean(): void;
getChildProperties(id: number): MapStringTo<Object_Unknown>;
}