UNPKG

@bolttech/templating-sdk

Version:

JavaScript SDK for Bolttech Templating Service - Create, manage and render templates with ease

72 lines 1.9 kB
import { TemplateEngine } from './TemplateEngine'; import { RenderOptions, TemplateDto, TemplatePlaceholders, TemplateUpdateData } from './types'; /** * Represents a template with rendering capabilities */ export declare class Template { #private; private _template; private _engine; private _isModified; private _originalTemplate; constructor(template: TemplateDto, engine: TemplateEngine, sdkInstance?: any, isModified?: boolean, originalTemplate?: TemplateDto); /** * Get template ID */ get id(): string; /** * Get template slug */ get slug(): string; /** * Get template title */ get title(): string; /** * Get template format */ get format(): string; /** * Get template content */ get content(): string; /** * Get template tenant */ get tenant(): string; /** * Get creation date */ get createdAt(): Date; /** * Get last update date */ get updatedAt(): Date; /** * Check if template has been modified locally but not yet saved to the API */ get isModified(): boolean; /** * Render the template with given placeholders using the template engine */ render(placeholders?: TemplatePlaceholders, options?: RenderOptions): string; /** * Create a new Template instance with updated properties * This method is immutable - returns a new instance with changes */ update(updates: TemplateUpdateData): Template; /** * Save the current template to the service * Requires SDK instance to be set */ save(): Promise<Template>; /** * Validate update data */ private _validate; /** * Check if the new template data has changes from the original template */ private _hasChangesFromOriginal; } //# sourceMappingURL=Template.d.ts.map