Skip to end of metadata
Go to start of metadata

Requirements

The examples in this page use the Prototype library, which is included by default inside a portal. However, the same concepts may be applied using other implementations.

Description

These set of actions can retrieve a list of available Sample projects, and import a specific sample into the workspace.
Samples are contributed to the Studio via extensions, or via the scripting mechanism (Rubles).

Invocation

This command is executed immediately in a synchronous way.

List the available Samples

To get the JSON list of samples, dispatch this call:

The returned JSON holds this information:

key

description

category

The sample's category

name

The name of the sample

id

A unique sample identifier which should also be used when importing a sample

description

A description of the sample

image

(currently empty for all samples) Will hold an image URL for the sample

Import a Sample

When importing a sample, the dispatch call should use a sample id that was retrieved via the getSamples action.
Here is a dispatch example:

Listening to Sample Changes

It is possible that some of the samples are loaded or removed after the portal is opened. In this case, the Studio fires events that indicate a Sample addition or removal.
Here is a sample of a way you can listen to such events (based on the studio3-sdk sample):

The update call receives an event object that holds the following information, and can be used to update the UI:

key

value

event

The event identifier (in this case, always 'samples')

eventType

'added' or 'deleted'

data

A JSON representation of the Sample-Info (as described above)