Viewer
    Preparing search index...

    Interface IFileParameterApi

    The api for a file parameter of a corresponding [session]ISessionApi.

    File parameters accept https://developer.mozilla.org/en-US/docs/Web/API/File|File or https://developer.mozilla.org/en-US/docs/Web/API/Blob|Blob objects. The data gets uploaded to the Geometry Backend prior to sending a customization request. This prior upload assigns a unique id to the data, which can be read from IFileParameter.value once the upload completed. The unique id can be used to run further customizations using the same data, avoiding a further upload.

    upload is used to trigger the prior upload, in case one is necessary. This is taken care of automatically by ISessionApi.customize and ISessionApi.customizeParallel, but can also be triggered separately beforehand.

    interface IFileParameterApi {
        hidden: boolean;
        id: string;
        name: string;
        sessionValue: string | Blob | File;
        type: PARAMETER_TYPE;
        value: string | Blob | File;
        getFilename(fileId?: string): Promise<string | undefined>;
        isValid(value: unknown, throwError?: boolean): boolean;
        resetToDefaultValue(): void;
        resetToSessionValue(): void;
        stringify(value?: unknown): string;
        upload(v?: string | Blob | File): Promise<string>;
        choices?: string[];
        decimalplaces?: number;
        defval?: string;
        displayname?: string;
        expression?: string;
        format?: string[];
        group?: CommonsGroup;
        hint?: string;
        interval?: number;
        max?: number;
        min?: number;
        order?: number;
        settings?: object;
        structure?: ResStructureType;
        tooltip?: string;
        umax?: number;
        umin?: number;
        visualization?: PARAMETER_VISUALIZATION;
        vmax?: number;
        vmin?: number;
    }

    Hierarchy (View Summary)

    Index

    Properties

    hidden: boolean
    id: string
    name: string
    sessionValue: string | Blob | File

    The value that corresponds to the latest successful call to ISessionApi.customize. This property will be updated immediately before ISessionApi.customize returns.

    value: string | Blob | File

    The current value.

    Validation happens immediately when setting this property. An error will be thrown in case validation fails. Use isValid to test whether a value passes validation.

    In case ISessionApi.automaticSceneUpdate is true, setting the value will immediately trigger a customization (see ISessionApi.customize).

    choices?: string[]
    decimalplaces?: number
    defval?: string
    displayname?: string
    expression?: string
    format?: string[]
    group?: CommonsGroup
    hint?: string
    interval?: number
    max?: number
    min?: number
    order?: number
    settings?: object
    structure?: ResStructureType
    tooltip?: string
    umax?: number
    umin?: number
    visualization?: PARAMETER_VISUALIZATION
    vmax?: number
    vmin?: number

    Methods

    • Get the filename of the file with the given id. If no id is given, the filename of the current value is returned (if available).

      Parameters

      • OptionalfileId: string

        The id of the file to get the filename for.

      Returns Promise<string | undefined>

      The filename of the file with the given id, or the filename of the current value if no id is given. If the filename is not available, undefined is returned.

      {@type ShapeDiverViewerError}

    • Evaluates if a given value is valid for this parameter.

      Parameters

      • value: unknown

        the value to evaluate

      • OptionalthrowError: boolean

        if true, an error is thrown if validation does not pass (default: false)

      Returns boolean

    • Returns the current value as a string, or attempts to stringify a given value if provided.

      Parameters

      • Optionalvalue: unknown

        the value to stringify

      Returns string

    • Upload the data (File, Blob) that is currently set to the value property. You can then use the returned id to either set it as the value of the parameter or use it in a subsequent customization. This call returns immediately in case no data is waiting to be uploaded.

      Parameters

      • Optionalv: string | Blob | File

        Optionally, the data (File, Blob, or string id) to upload. If not provided, the current value is used.

      Returns Promise<string>

      The id of the uploaded file, or the current value if no upload was necessary.

      {@type ShapeDiverViewerError}