Interface IEnumerationApi

API for working with enumerations

interface IEnumerationApi {
    _apiId: "mendix.EnumerationApi";
    addEnumeration(containerId: string, options?: EnumerationCreationOptions): Promise<string>;
    addEventListener<K>(eventType: K, listener: EventHandler<{}, K>): DisposeListener;
    applyChanges(operations: Operation[]): Promise<ApplyChangesResult>;
    createElement<TElement>(type: TElement["$Type"], options?: TElement["$CreationOptions"]): Promise<TElement>;
    createUnit(type: "Enumerations$Enumeration", containerId: string, options?: EnumerationCreationOptions): Promise<Enumeration>;
    deleteUnit(unitId: string): Promise<void>;
    getElementMetadata(): Promise<ElementMetadataMap>;
    loadUnits(type: "Enumerations$Enumeration", unitIds: string[]): Promise<Enumeration[]>;
    removeEventListener<K>(eventType: K, listener: EventHandler<{}, K>): void;
}

Hierarchy

Properties

_apiId

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

Example: mendix.EditorsAPI, mycompany.MyFunkyAPI

Methods

  • Adds an enumeration document to the specified container.

    Parameters

    • containerId: string

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

    • Optionaloptions: EnumerationCreationOptions

      Options for that will be used during the enumeration initilization.

    Returns Promise<string>

    A promise that resolves to the ID of the newly created enumeration.

  • 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.

  • Parameters

    • operations: Operation[]

    Returns Promise<ApplyChangesResult>

  • Type Parameters

    Parameters

    Returns Promise<TElement>

  • Parameters

    Returns Promise<Enumeration>

  • Parameters

    • unitId: string

    Returns Promise<void>

  • Returns Promise<ElementMetadataMap>

  • Parameters

    • type: "Enumerations$Enumeration"
    • unitIds: string[]

    Returns Promise<Enumeration[]>

  • 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