UNPKG

@sitecore/sc-contenthub-webclient-sdk

Version:

Sitecore Content Hub WebClient SDK.

113 lines (112 loc) 4.05 kB
import { Nullable } from "../.."; import { IEntityCopyOptions } from "./entity-copy-options"; import { PropertyCopyMethod } from "./property-copy-method"; import { IPropertyCopyOption } from "./property-copy-option"; import { RelationCopyMethod } from "./relation-copy-method"; import { IRelationCopyOption } from "./relation-copy-option"; /** * A builder for instances of <see cref="IEntityCopyOptions"/>. */ export interface IEntityCopyOptionsBuilder { /** * Indicates that the entity should be copied with the specified property. * * @param property - The name of the property. * @param method - The copy method. * @param newValue - The new value for the property. * * @returns The copy options builder. */ withProperty(property: string, method: PropertyCopyMethod, newValue: Nullable<string>): IEntityCopyOptionsBuilder; /** * Indicates that the entity should be copied with the specified properties. * * @param properties - The properties collection. * * @returns The copy options builder. */ withProperties(properties: Array<IPropertyCopyOption>): IEntityCopyOptionsBuilder; /** Indicates that the entity should be copied with the specified relation. * * @param relation - The name of the relation. * @param method - The copy method. * @param relatedOptions - The related options. * * @returns The copy options builder. */ withRelation(relation: string, method: RelationCopyMethod, relatedOptions: Nullable<IEntityCopyOptions>): IEntityCopyOptionsBuilder; /** * Indicates that the entity should be copied with the specified relations. * * @param relations - The relations collection. * * @returns The copy options builder. */ withRelations(relations: Array<IRelationCopyOption>): IEntityCopyOptionsBuilder; /** * Indicates that the entity should be copied to the entity with the specified id. * * @param id - The destination entity identifier. * * @returns The copy options builder. */ withDestinationEntityId(id: number): IEntityCopyOptionsBuilder; /** * Indicates that the entity should be copied using the copy profile with the specified id. * * @param id - The id of the copy profile. * * @returns The copy options builder. */ withCopyProfileId(id: number): IEntityCopyOptionsBuilder; /** * Indicates that the entity should be copied using the copy profile with the specified identifier. * * @param identifier - The identifier of the copy profile. * * @returns The copy options builder. */ withCopyProfileIdentifier(identifier: string): IEntityCopyOptionsBuilder; /** * Gets the resulting instance of IEntityCopyOptions. * * @returns The copy options. */ build(): IEntityCopyOptions; } export declare class EntityCopyOptionsBuilder implements IEntityCopyOptionsBuilder { private readonly _copyOptions; constructor(copyOptions?: IEntityCopyOptions); /** * {@inheritDoc} */ withProperty(property: string, method: PropertyCopyMethod, newValue?: Nullable<string>): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withProperties(properties: Array<IPropertyCopyOption>): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withRelation(relation: string, method: RelationCopyMethod, relatedOptions?: Nullable<IEntityCopyOptions>): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withRelations(relations: Array<IRelationCopyOption>): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withDestinationEntityId(id: number): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withCopyProfileId(id: number): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ withCopyProfileIdentifier(identifier: string): IEntityCopyOptionsBuilder; /** * {@inheritDoc} */ build(): IEntityCopyOptions; }