@adobe/genstudio-extensibility-sdk
Version:
GenStudio Extensibility SDK
52 lines (51 loc) • 2.13 kB
TypeScript
import { Experience, FieldUpdate } from "../types/experience/Experience";
import { VirtualApi } from "@adobe/uix-core";
import { GenerationContext } from "../types/generationContext/GenerationContext";
export interface ValidationExtensionApi extends VirtualApi {
api: {
validationExtension: {
open: (extensionId: string) => void;
getExperiences: () => Promise<Experience[]>;
getGenerationContext: () => Promise<GenerationContext>;
updateField: (fieldUpdate: FieldUpdate) => void;
};
};
}
export declare class ValidationExtensionServiceError extends Error {
constructor(message: string);
}
/**
* Manages experience data conversion and retrieval
*/
export declare class ValidationExtensionService {
/**
* Opens the validation extension
* @param connection - The guest connection to the host
* @param extensionId - The ID of the extension to open
* @throws Error if connection is missing
*/
static open(connection: any, extensionId: string): void;
/**
* Fetches experiences from the connection
* @param connection - The guest connection to the host
* @returns Promise<Experience[]> Array of converted experiences
* @throws Error if connection is missing
*
* In non-HTML canvas, variants are flattened into Experience and returned. Use getExperiencesWithVariants instead.
*/
static getExperiences(connection: any): Promise<Experience[]>;
/**
* Gets the generation context from the connection
* @param connection - The guest connection to the host
* @returns The generation context
* @throws Error if connection is missing
*/
static getGenerationContext(connection: any): Promise<GenerationContext>;
/**
* Updates a field value on the canvas.
* @param connection - The guest connection to the host
* @param fieldUpdate - The field update payload describing which field to change and the new value
* @throws Error if connection is missing
*/
static updateField(connection: any, fieldUpdate: FieldUpdate): void;
}