UNPKG

@itwin/core-backend

Version:
59 lines 2.76 kB
/** @packageDocumentation * @module Codes */ import { Id64String } from "@itwin/core-bentley"; import { CodeScopeSpec, CodeSpec, CodeSpecProperties } from "@itwin/core-common"; import { IModelDb } from "./IModelDb"; /** Manages [CodeSpecs]($docs/BIS/guide/fundamentals/element-fundamentals.md#codespec) within an [[IModelDb]] * @public @preview */ export declare class CodeSpecs { private static tableName; private _imodel; private _loadedCodeSpecs; constructor(imodel: IModelDb); private findByName; /** Look up the Id of the CodeSpec with the specified name. */ queryId(name: string): Id64String; /** Look up a CodeSpec by Id. The CodeSpec will be loaded from the database if necessary. * @param codeSpecId The Id of the CodeSpec to load * @returns The CodeSpec with the specified Id * @throws [[IModelError]] if the Id is invalid or if no CodeSpec with that Id could be found. */ getById(codeSpecId: Id64String): CodeSpec; /** Returns true if the IModelDb has a CodeSpec of the specified Id. */ hasId(codeSpecId: Id64String): boolean; /** Look up a CodeSpec by name. The CodeSpec will be loaded from the database if necessary. * @param name The name of the CodeSpec to load * @returns The CodeSpec with the specified name * @throws [[IModelError]] if no CodeSpec with the specified name could be found. */ getByName(name: string): CodeSpec; /** Returns true if the IModelDb has a CodeSpec of the specified name. */ hasName(name: string): boolean; private insertCodeSpec; /** Add a new CodeSpec to the iModel. * @param codeSpec The CodeSpec to insert * @returns The Id of the persistent CodeSpec. * @note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec * @throws IModelError if the insertion fails */ insert(codeSpec: CodeSpec): Id64String; /** Add a new CodeSpec to the IModelDb. * @param name The name for the new CodeSpec. * @param properties The properties or the CodeSpec. For backwards compatibility this may also be a `CodeScopeSpec.Type`. * @returns The Id of the persistent CodeSpec. * @throws IModelError if the insertion fails */ insert(name: string, properties: CodeSpecProperties | CodeScopeSpec.Type): Id64String; /** Update the Json properties of an existing CodeSpec. * @param codeSpec The codeSpec holding Json properties values to update * @throws if unable to update the codeSpec. */ updateProperties(codeSpec: CodeSpec): void; /** Load a CodeSpec from the iModel * @param id The persistent Id of the CodeSpec to load */ load(id: Id64String): CodeSpec; } //# sourceMappingURL=CodeSpecs.d.ts.map