ShapeDiver Viewer - Export API
The export api is part of the global API.
It allows to
- get the definition of currently registered exports,
- request exports, and
- add and remove listeners for related events.
Methods
-
addEventListener(type, callback)
-
Add a callback to be invoked when a certain event occurs
Parameters:
Name Type Description typeExportEventType Type of event to subscribe to
callbackEventListenerCallback Function to be called when the event fires
Returns:
-
Type Description APIResponse APIResponse with an EventListenerToken object. The event listener token can be used to remove the event listener by calling removeEventListener.
-
-
get()
-
Get all export definitions
Returns:
-
Type Description APIResponse APIResponse with an array of export definitions
-
-
removeEventListener(token)
-
Remove an event listener
Parameters:
Name Type Description tokenEventListenerToken event listener token for event listener to be removed
Returns:
-
Type Description APIResponse APIResponse with a Boolean data, indicating whether the event listener could be removed.
-
-
requestAsync(requestObject [, payload])
-
Requests an export for current parameter values.
Parameters:
Name Type Argument Description requestObjectExportRequestObject Object defining the export request.
payload* <optional>
Payload which will be passed through to the response and events related to a call of this function.
Returns:
-
Type Description Promise.<APIResponse> APIResponse with a export result object.
-
-
updateProperties( [definitions])
-
Update properties of registered exports.
The following properties can be updated: name, order, hidden This function will fail in case no unique export can be found for each export definition given.
Parameters:
Name Type Argument Description definitionsArray.<ExportDefinition> <optional>
updated export definitions
Returns:
-
Type Description APIResponse APIResponse with its data set to a boolean according to success or error
-
Members
-
<readonly> EVENTTYPE :ExportEventType
-
Enum for supported export event types.
Type:
Properties:
Name Type Default Description AVAILABLEExportEventType available the result of an export has become available
REGISTEREDExportEventType registered a new export has been registered
REGISTERED_BATCHExportEventType registered.batch a batch of exports has been registered
UPDATEExportEventType update the definition of an export has been updated, typically one of the properties name or order or hidden
STATUSExportEventType status status event for an ongoing export
-
<readonly> RESULT :ExportRequestResult
-
Enum for export request result.
Type:
Properties:
Name Type Default Description EXPORT_NOT_FOUNDExportRequestResult export_not_found the export was not found
PLUGIN_NOT_FOUNDExportRequestResult plugin_not_found the plugin responsible to handle the export request was not found
ERRORExportRequestResult error the export request failed
CACHEExportRequestResult cache the export request can be answered from the local cache
LOADExportRequestResult load the export request needs to be loaded from somewhere
Type Definitions
-
ExportDefinition
-
Definition of an export
Type:
- Object
Properties:
Name Type Argument Description idString unique id of export
pluginString plugin runtime id of export
nameString name of export
_nameString <optional>
original name of the export, will be set in case the export name got changed from its original value
typeString type of export, currently we support 'email', 'download', and 'shapeways'
hiddenBoolean <optional>
must exist and be true if the export should be hidden from the ui
orderNumber <optional>
optional number used for ordering exports in the ui
-
ExportEventType
-
Export event type, see EVENTTYPE for values
Type:
- String
-
ExportRequestObject
-
Data required for requesting an export
Type:
- Object
Properties:
Name Type Argument Default Description idString <optional>
id of export, takes precedence over idOrName and name
idOrNameString <optional>
id or name of export, takes precedence over name
nameString <optional>
name of export, last priority after id and idOrName
pluginString <optional>
runtime id of plugin the export belongs to
parametersObject <optional>
optional key value pairs of parameter ids and corresponding values to use instead of the currently set values
silentBoolean <optional>
false if true, do not display any information about the export to the user
-
ExportRequestResult
-
Export request result, see RESULT for values
Type:
- String
-
ExportResult
-
Definition of the object resulting from a finished export, or from a status of an ongoing export
Type:
- Object
Properties:
Name Type Argument Description idString unique id of the export
pluginString plugin runtime id of export
nameString name of the export
typeString type of export, currently we support 'email', 'download', and 'shapeways'
msgString <optional>
optional status message for the export, e.g. describing server side progress or status
versionString <optional>
version id of the export
filenameString <optional>
optional filename to be used for files which are part of content (FILENAME.FILETYPE)
contentArray.<ExportResultContentItem> <optional>
will be set once the export has been finished for type 'download'. Typically this array has only one entry.
resultObject <optional>
optional object describing the result of the export for types 'email' and 'shapeways'
Properties
Name Type Argument Description msgString <optional>
optional message to display to the user
errString <optional>
optional error message to display to the user
hrefString <optional>
optional link to direct the user to
modelIdString <optional>
optional ShapeWays model id
resultcodeExportRequestResult <optional>
result code
-
ExportResultContentItem
-
Export content item of a ExportResult
Type:
- Object
Properties:
Name Type Description formatString format of the exported file, e.g. stl|3dm|dxf|dwg|…
hrefString download link to the exported file, time limited to the duration of the session
sizeNumber size in bytes of the exported file