StandardAssetConnector

How to get StandardAssetConnector

ES2015+:

import StandardAssetConnector from 'fontoxml-connectors-standard/StandardAssetConnector'

ES5:

define([
	'fontoxml-connectors-standard/StandardAssetConnector'
], function (
	StandardAssetConnector
) {
});

Type: Class

The asset connector handles communication with the /asset CMS endpoint.

Do not construct an instance of this connector yourself. Instead, obtain the preconfigured instance by importing fontoxml-configuration/get!asset-connector.

Constructor

# Name Type Description
1. cmsClient CmsClient

The preconfigured connector instance uses the CMS client appropriate for your CMS

Methods

Name Description
upload

Upload a file to the CMS.


  Arguments
# Name Type Description
1. context RemoteDocumentId | Object

The remote ID of the document in which this file is uploaded.

2. file File

Directly obtained from form field with type="file" (inputElement.files)

3. fileType String

The type of file that is being uploaded, possible values are determined by the CMS.

4. metadata Object

Arbitrary metadata that is stored with the uploaded file (and returned on download).

5. [folderId] FolderId

If left empty, root is assumed (use this if the backend has no folder hierarchy).

  Returns

Type: Promise

Resolves to a response object. Refer to the CMS endpoint documentation for details on the format used.