import { Nullable, NullableResultPromise } from "./base-types"; import { AggregateLoadOption } from "./clients"; import { IExtendedContentHubClient } from "./clients/extended-client"; import { ViewMode } from "./contracts/base/view-mode"; import CultureInfo from "./culture-info"; import Link from "./link"; export interface ILinkHelper { /** * Extracts the name of a data source from the specified link. * @param link - The link to extract the name from * @returns The name as extracted from the link. If the link doesn't contain a name, null is returned. */ nameFromDataSourceAsync(link: Link): NullableResultPromise; /** * Creates a link to the data source with the specified name. * @param name - The name of the data source to link to * @returns A link to the data source with the specified name. */ dataSourceToLinkAsync(name: string): Promise; /** * Creates a link to the data sources endpoint. * @returns A link to the data sources endpoint. */ dataSourcesLinkAsync(): Promise>; /** * Extracts the name of an entity definition from the specified link. * @param link - The link to extract the name from * @returns The name as extracted from the link. If the link doesn't contain a name, null is returned. */ nameFromDefinitionAsync(link: Link): NullableResultPromise; /** * Extracts the names of the specified entity definition links. * @param links - The links to extract the names from * @returns The names as extracted from the links. If the link doesn't contain a name, null is returned. */ namesFromDefinitionsAsync(links: Array): Promise>>; /** * Creates a link to the entity definition with the specified name. * @param name - The name of the entity definition to link to * @param includeConditionalMembers - [Optional] Include conditional members * @param loadPermissions - [Optional] Load permissions for the definitions * @returns A link to the entity definition with the specified name. */ definitionToLinkAsync(name: string, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; /** * Creates a link to the entity definition with the specified id. * @param id - The id of the entity definition to link to * @param includeConditionalMembers - [Optional] Include conditional members * @param loadPermissions - [Optional] Load permissions for the definitions * @returns A link to the entity definition with the specified id. */ definitionToLinkAsync(id: number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; definitionToLinkAsync(param: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; /** * Creates a link to the entity definition with the specified name. * @param name - The name of the entity definition to link to * @param includeConditionalMembers - [Optional] Include conditional members * @param loadPermissions - [Optional] Load permissions for the definitions * @returns A link to the entity definition with the specified name. */ definitionToLinkV2Async(name: string, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; /** *Creates links to the specified entity definitions by name. * @param names - The names of the entity definitions to include in the result * @param skip - [Optional] Number of results to skip * @param take - [Optional] Number of results to fetch * @param includeConditionalMembers - [Optional] Include conditional members * @param viewMode - [Optional] Select appropriate ViewMode * @param loadPermissions - [Optional] Load permissions for the definitions * @param excludeTaxonomyDefinitions - [Optional] Exclude taxonomy definitions from the result * @param excludeSystemOwnedDefinitions - [Optional] Exclude system owned definitions from the result * @returns Link to the entity definitions with the specified names. */ definitionsToLinkAsync(names: Nullable>, skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise; /** * Creates links to the specified entity definitions by id. * @param ids - The ids of the entity definitions to include in the result * @param skip - [Optional] Number of results to skip * @param take - [Optional] Number of results to fetch * @param includeConditionalMembers - [Optional] Include conditional members * @param viewMode - [Optional] Select appropriate ViewMode * @param loadPermissions - [Optional] Load permissions for the definitions * @param excludeTaxonomyDefinitions - [Optional] Exclude taxonomy definitions from the result * @param excludeSystemOwnedDefinitions - [Optional] Exclude system owned definitions from the result * @returns Link to the entity definitions with the specified ids. */ definitionsToLinkAsync(ids: Nullable>, skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise; /** * Creates a link to the entity definitions endpoint. * @param skip - [Optional] Number of results to skip * @param take - [Optional] Number of results to fetch * @param includeConditionalMembers - [Optional] Include conditional members * @param viewMode - [Optional] Select appropriate ViewMode * @param loadPermissions - [Optional] Load permissions for the definitions * @param excludeTaxonomyDefinitions - [Optional] Exclude taxonomy definitions from the result * @param excludeSystemOwnedDefinitions - [Optional] Exclude system owned definitions from the result * @param filter - [Optional] Filter to apply to the result * @param definitionsToLoadByName - [Optional] Comma separated list of entity definition names to load * @param definitionsToLoadById - [Optional] Comma separated list of entity definition ids to load * @param excludeLightDefinitions - [Optional] Exclude light definitions from the result * @returns Link to the entity definitions included in this batch. */ definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string, excludeLightDefinitions?: boolean): Promise; relationToLinkAsync(id: number, name: string): Promise; /** * Extracts the id of an entity from the specified link. * @param link - The link to extract the name from * @returns The id as extracted from the link. If the link doesn't contain an id, null is returned. */ idFromEntityAsync(link: Link): NullableResultPromise; /** * Extracts the id of entities from the specified links. * @param links - The links to extract the names from * @returns The ids as extracted from the links. */ idsFromEntitiesAsync(links: Array): Promise>; /** * Creates a link to the entity with the specified id. * @param id - The id of the entity to link to * @param culture - [Optional] Culture for the entity * @returns A link to the entity with the specified id. */ entityToLinkAsync(id: number, culture?: Nullable): Promise; /** * Creates a link to the entity with the specified identifier. * @param identifier - The identifier of the entity to link to * @returns A link to the entity with the specified identifier. */ entityToLinkAsync(identifier: string): Promise; /** * Creates links to the entities with the specified ids. * @param ids - The ids of the entities to link to * @returns Link to the entities with the specified ids. */ entitiesToLinksAsync(ids: Array): Promise>; /** * Extracts the identifier of an entity from the specified * @param link - The link to extract the identifier from * @returns The identifier as extracted from the link. If the link doesn't contain an identifier, null is returned. */ identifierFromEntityAsync(link: Link): NullableResultPromise; /** * Creates a link to the entities endpoint. * @returns Link to entities endpoint. */ entitiesLinkAsync(): Promise>; /** * Creates a link to the permissions for entity endpoint. * @param id - The entity id * @returns Link to the permissions for entity. */ permissionsForEntityToLinkAsync(id: number): Promise; /** * Creates a link to the permissions for entity endpoint. * @param id - The entity id * @param userId - The user id * @returns Link to the permissions for entity. */ explainUserPermissionsForEntityToLinkAsync(id: number, userId: number): Promise; /** * Creates a link to the copy entities endpoint. * @param id - The entity id * @returns Link to the copy entities endpoint. */ copyEntityToLinkAsync(id: number): Promise; /** * Gets the link to set the password of the specified user. * * @param userId - The id of the user * @returns Link to set user password. */ setUserPasswordToLinkAsync(userId: number): Promise; /** * Gets the link to reset the password of the specified user. * * @param userId - The id of the user * @returns Link to reset user password. */ resetPasswordToLinkAsync(userId: number): Promise; policyToLinkAsync(id: number): Promise; idFromPolicyAsync(link: Link): NullableResultPromise; /** * Generates a link to a command. * * @param namespace - The name of the folder containing the command * @param command - The name of the command * @returns Link for the command. */ commandToLinkAsync(namespace: string, command: string): Promise; sendConfirmationMailToLinkAsync(userId: number): Promise; sendNotificationToLinkAsync(notificationType: string): Promise; /** * Generate a link to an aggregate resource. * @param aggregateName - The name of the aggregate * @param entityId - The entity id for which to get the aggregate * @param culture - Culture for the entity * @param options - Can optionally configure what needs to be loaded from the aggregates (everything will be loaded by default except for permissions) * @returns Link to the aggregate resource. */ aggregateToLinkAsync(aggregateName: string, entityId: number, culture?: CultureInfo, options?: AggregateLoadOption): Promise; /** * Generate a link to a page name. * @param pageName - The name or id of the page * @param culture - Culture of the page * @param entityId - The current entity id (Optional) */ pageResourceToLinkAsync(page: string | number, culture: CultureInfo, entityId?: number): Promise; searchLinkAsync(): Promise>; allFacetsAsync(): Promise>; createUploadToLinkAsync(): Promise>; finalizeUploadToLinkAsync(): Promise>; settingByNameLink(categoryName: string, settingName: string): Promise>; } export declare class LinkHelper implements ILinkHelper { private readonly _client; constructor(client: IExtendedContentHubClient); nameFromDataSourceAsync(link: Link): NullableResultPromise; dataSourceToLinkAsync(name: string): Promise; dataSourcesLinkAsync(): Promise>; nameFromDefinitionAsync(link: Link): NullableResultPromise; namesFromDefinitionsAsync(links: Array): Promise>>; definitionToLinkAsync(param: string | number, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; definitionToLinkV2Async(name: string, includeConditionalMembers?: boolean, loadPermissions?: boolean): Promise; definitionsToLinkAsync(values: Nullable> | Nullable>, skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean): Promise; definitionsLinkAsync(skip?: number, take?: number, includeConditionalMembers?: boolean, viewMode?: ViewMode, loadPermissions?: boolean, excludeTaxonomyDefinitions?: boolean, excludeSystemOwnedDefinitions?: boolean, filter?: string, definitionsToLoadByName?: string, definitionsToLoadById?: string, excludeLightDefinitions?: boolean): Promise; idFromEntityAsync(link: Link): Promise; idsFromEntitiesAsync(links: Array): Promise>; entityToLinkAsync(param: number | string, culture?: Nullable): Promise; relationToLinkAsync(id: number, name: string): Promise; entitiesToLinksAsync(ids: Array): Promise>; identifierFromEntityAsync(link: Link): NullableResultPromise; entitiesLinkAsync(): Promise>; permissionsForEntityToLinkAsync(id: number): Promise; explainUserPermissionsForEntityToLinkAsync(id: number, userId: number): Promise; copyEntityToLinkAsync(id: number): Promise; setUserPasswordToLinkAsync(userId: number): Promise; resetPasswordToLinkAsync(userId: number): Promise; policyToLinkAsync(id: number): Promise; idFromPolicyAsync(link: Link): NullableResultPromise; commandToLinkAsync(namespace: string, command: string): Promise; sendConfirmationMailToLinkAsync(userId: number): Promise; sendNotificationToLinkAsync(notificationType: string): Promise; aggregateToLinkAsync(aggregateName: string, entityId: number, culture?: CultureInfo, { loadPermissions, loadOptionLists, loadSettings, loadEntities, loadDefinitions, }?: AggregateLoadOption): Promise; pageResourceToLinkAsync(page: string | number, culture: CultureInfo, entityId?: number): Promise; searchLinkAsync(): Promise>; allFacetsAsync(): Promise>; settingByNameLink(categoryName: string, settingName: string): Promise>; createUploadToLinkAsync(): Promise>; finalizeUploadToLinkAsync(): Promise>; private getVariableValueAsync; private bindAsync; private static applyEntityDefinitionVariables; }