import { EditorAPI, EditorResponse, Id } from '../types/CommonTypes'; import { ConnectorConfigOptions, DeprecatedMediaConnectorDownloadType, DeprecatedMediaType, FilePointer, MediaType, MetaData, QueryOptions, QueryPage } from '../types/ConnectorTypes'; import { Media, MediaConnectorCapabilities, MediaDetail, MediaDownloadType } from '../types/MediaConnectorTypes'; /** * The MediaConnectorController is responsible for all communication regarding media connectors. * Methods inside this controller can be called by `window.SDK.mediaConnector.{method-name}` * * The way GraFx Studio handles different sources of media is called 'MediaConnector'. * A MediaConnector is an implementation of a set of capabilities we need * to interact with a certain Digital Asset Management system. * In essence, a connector is the combination of a JavaScript snippet and some metadata. * The JavaScript snippet is loaded in the studio engine using a sandboxed JavaScript execution engine (QuickJs). * This allows us to execute the media connector * both on web using webassembly and on the server side during e.g. animation output generation. * This controller is an interface to the running connector instance inside the studio engine. */ export declare class MediaConnectorController { #private; /** * @ignore */ constructor(editorAPI: EditorAPI); /** * Query a specific MediaConnector for data using both standardized queryOptions and the dynamic * context as parameters. This call returns an array of Media items. * @param id unique id of the media connector * @param queryOptions stringified instance of `QueryOptions` * @param context context that will be available in the connector script. * @returns array of Media items */ query: (id: Id, queryOptions: QueryOptions, context?: MetaData) => Promise>>; /** * Returns a single media using a specific MediaConnector. * * The connector needs to list `detail` as a supported capability. * @param id unique id of the Media connector * @param mediaId unique id of the Media * @param context context that will be available in the connector script. * @returns Media item */ detail: (id: Id, mediaId: string, context?: MetaData) => Promise>; /** * The combination of a `connectorId` and `mediaId` is typically enough for a media connector to * perform the download of this asset. The `download` endpoint is capable of relaying this information to the * media connector instance running in the editor engine. * @param id unique id of the media connector * @param mediaId unique id of the media to download * @param downloadType hint to the media connector about desired quality of the downloaded media * @param context context that will be available in the connector script. * @returns */ download: (id: Id, mediaId: Id, downloadType: MediaDownloadType, context?: MetaData) => Promise>; /** * All connectors have a certain set of mappings they allow to be passed into the connector methods their context. This * method allows you to discover which mappings are available for a given connector. If you want to use any of these * mappings, they will be available in the `context` parameter of any connector method. * @param id unique id of the media connector * @returns connector mappings */ getConfigurationOptions: (id: Id) => Promise>; /** * This method returns what capabilities the selected connector has. It gives an indication what methods can * be used successfully for a certain connector. * @param id unique id of the media connector * @returns MediaConnectorCapabilities */ getCapabilities: (id: Id) => Promise>; /** * This method will parse the deprecatedMediaType to the new media type. This method will be removed once the deprecatedMediaType is out of use * @param deprecatedType is 0 or 1 * @returns connector capabilities */ parseDeprecatedMediaType: (deprecatedType: DeprecatedMediaType) => MediaType | undefined; /** * This method will parse the deprecatedMediaDownloadType to the new media download type. * This method will be removed once the deprecatedMediaDownloadType is out of use * @param deprecatedMediaDownloadType legacy download type * @returns MediaDownloadType */ parseDeprecatedMediaDownloadType(deprecatedMediaDownloadType: DeprecatedMediaConnectorDownloadType): MediaDownloadType; /** * Invokes the upload on the connector, using the given staged pointer(s). * If you want help with staging files, use the `stageFiles` method from the UtilsController. * @param connectorId The MediaConnector instance to use (just like download API). * @param filePointers Array of FilePointer as staged by stageFile(s). * @param context Arbitrary metadata/context for the upload (auth, meta fields, etc). * @returns Promise */ upload: (connectorId: Id, filePointers: FilePointer[], context?: MetaData) => Promise>; }