@mendix/extensions-api - v0.9.0
    Preparing search index...

    Interface IJsonStructureModelApi

    API for working with JSON structure documents.

    A JSON structure captures the shape of a JSON message and acts as the schema source for import and export mappings. Use this API to create JSON structure documents — optionally seeding them from a JSON snippet so that elements are automatically derived — and to inspect the resulting element tree. The elements returned by IJsonStructureModelApi.getElements can then be referenced when configuring a mapping via IImportMappingModelApi or IExportMappingModelApi.

    interface IJsonStructureModelApi {
        _apiId: "mendix.JsonStructureModelApi";
        addEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): DisposeListener;
        addJsonStructure(
            containerId: string,
            options?: AddJsonStructureOptions,
        ): Promise<JsonStructure>;
        applyChanges(operations: Operation[]): Promise<ApplyChangesResult>;
        createElement<TElement extends ElementBase>(
            type: TElement["$Type"],
            options?: TElement["$CreationOptions"],
        ): Promise<TElement>;
        createUnit(
            type: "JsonStructures$JsonStructure",
            containerId: string,
            options?: JsonStructureCreationOptions,
        ): Promise<JsonStructure>;
        deleteUnit(unitId: string): Promise<void>;
        getElementMetadata(): Promise<ElementMetadataMap>;
        getElements(jsonStructureId: string): Promise<GetElementsResult>;
        getUnitsInfo(): Promise<UnitInfo[]>;
        load<TElement extends ElementBase>(
            type: TElement["$Type"],
            elementId: string,
        ): Promise<null | TElement>;
        loadUnits(
            type: "JsonStructures$JsonStructure",
            unitIds: string[],
        ): Promise<JsonStructure[]>;
        removeEventListener<K extends never>(
            eventType: K,
            listener: EventHandler<{}, K>,
        ): void;
        resolve<TElement extends ElementBase>(
            type: TElement["$Type"],
            qualifiedName: string,
        ): Promise<null | TElement>;
    }

    Hierarchy

    Index

    Properties

    _apiId: "mendix.JsonStructureModelApi"

    Unique identifier that can be used to register or retrieve a specific API.

    Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

    Methods

    • Adds an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to listen for.

      • listener: EventHandler<{}, K>

        The event listener to add.

      Returns DisposeListener

      A function that can be called to remove the event listener.

    • Adds a new JSON structure to the specified container. If the structure contains a JSON snippet, its elements are automatically initialized.

      Parameters

      • containerId: string

        The ID of the container where the JSON structure will be added. It could be a module or folder.

      • Optionaloptions: AddJsonStructureOptions

        Options that specify how the JSON structure will be initialized. Includes an optional name and a jsonSnippet string from which the structure elements are automatically derived.

      Returns Promise<JsonStructure>

      A promise that resolves to the newly created JSON structure.

    • Parameters

      • operations: Operation[]

      Returns Promise<ApplyChangesResult>

    • Parameters

      • unitId: string

      Returns Promise<void>

    • Returns Promise<ElementMetadataMap>

    • Gets the structure elements of the specified JSON structure.

      Parameters

      • jsonStructureId: string

        The ID of the JSON structure to retrieve elements from.

      Returns Promise<GetElementsResult>

      A promise that resolves to the structure elements, or a failure result if the elements could not be retrieved.

    • Returns Promise<UnitInfo[]>

    • Parameters

      • type: "JsonStructures$JsonStructure"
      • unitIds: string[]

      Returns Promise<JsonStructure[]>

    • Removes an event listener for the specified event type.

      Type Parameters

      • K extends never

      Parameters

      • eventType: K

        The type of event to remove the listener from.

      • listener: EventHandler<{}, K>

        The event listener to remove.

      Returns void