Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IFileParameterApi

The api for a file parameter of a corresponding session.

File parameters accept File or 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 {@link 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.

Hierarchy

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?: ResParameterGroup
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

  • getFilename(fileId?: string): Promise<undefined | string>
  • 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).

    throws

    {@type ShapeDiverViewerError}

    Parameters

    • Optional fileId: string

      The id of the file to get the filename for.

    Returns Promise<undefined | string>

    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.

  • isValid(value: unknown, throwError?: boolean): boolean
  • Evaluates if a given value is valid for this parameter.

    Parameters

    • value: unknown

      the value to evaluate

    • Optional throwError: boolean

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

    Returns boolean

  • resetToDefaultValue(): void
  • resetToSessionValue(): void
  • stringify(value?: unknown): string
  • Returns the current value as a string, or attempts to stringify a given value if provided.

    Parameters

    • Optional value: unknown

      the value to stringify

    Returns string

  • upload(): Promise<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.

    throws

    {@type ShapeDiverViewerError}

    Returns Promise<string>