Elvis

Elvis

new Elvis()

Source:

Methods

alive() → {Promise}

Send activity signal to keep the session open

Source:
Returns:
Type
Promise

browse(params) → {Promise}

Browse folders and collections

Parameters:
Name Type Description
params Object

Parameters object

Source:
Returns:
Type
Promise

copy(params) → {Promise}

Copy a folder or a single asset

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
source String

folderPath or assetPath to copy from

target String

folderPath or assetPath to copy to

folderReplacePolicy String <optional>

Policy used when destination folder already exists. One of: AUTO_RENAME | MERGE | THROW_EXCEPTION

fileReplacePolicy String <optional>

Policy used when destination asset already exists. One of: AUTO_RENAME | OVERWRITE | OVERWRITE_IF_NEWER | REMOVE_SOURCE | THROW_EXCEPTION | DO_NOTHING

filterQuery String <optional>

Only assets that match this query will be copied

flattenFolders Boolean <optional>

Flatten subfolder structures while copying

async Boolean <optional>

Return immediately and run process in the background

Source:
Returns:
Type
Promise

create(params) → {Promise}

Create new asset

Parameters:
Name Type Description
params Object

Parameters

Properties
Name Type Attributes Description
Filedata File <optional>

The file to be created in Elvis

metadata Object <optional>

Object containing Elvis fields

nextUrl String <optional>

301 redirect will happen to this URL if specified

Source:
Returns:
Type
Promise

createFolder(path) → {Promise}

Create new folder

Parameters:
Name Type Description
path Array | String

Path for folder. If this option is supplied as array, multiple folders will be created with given paths.

Source:
Returns:
Type
Promise

createRelation(target1Id, target2Id, relationType, metadataopt) → {Promise}

Create relation between two assets

Parameters:
Name Type Attributes Description
target1Id String

ID of first asset

target2Id String

ID of second asset

relationType String

Type of relation e.g: 'related'

metadata Object <optional>

Optional metadata fields to write to relation node

Source:
Returns:
Type
Promise

getProfile() → {Promise}

Get info of current user

Source:
Returns:
Type
Promise

login(params, isSticky) → {Promise}

Login

Parameters:
Name Type Description
params Object

An object contains login parameters

Properties
Name Type Attributes Description
username String <optional>

Either username and password or cred is required

password String <optional>

Either username and password or cred is required

cred String <optional>

A base64 string. Either username and password or cred is required

nextUrl String <optional>

Url for next page

failUrl String <optional>

Url for fail page

locale String <optional>

language_COUNTRY

timezoneOffset Number <optional>

Timezone offset in milliseconds

clientType string <optional>

Client type

returnProfile Boolean <optional>

Returns profile info if given true

isSticky Boolean

Sticky session flag; set it true to use one assigned cluster node, false or omit for load balancing

Source:
Returns:
Type
Promise

logout() → {Promise}

Invalidate current session

Source:
Returns:
Type
Promise

move(params) → {Promise}

Move or rename a folder or a single asset

Parameters:
Name Type Description
params Object

Parameters

Properties
Name Type Attributes Default Description
source String

folderPath or assetPath to be moved or renamed

target String

Target path

filterQuery String <optional>

Move/rename only source assets that match this query

flattenFolders Boolean <optional>

Flatten any subfolder structure

async Boolean <optional>

Will cause the process to run asynchronous in the background

folderReplacePolicy String <optional>
"AUTO_RENAME"

"AUTO_RENAME" | "MERGE" | "THROW_EXCEPTION"

fileReplacePolicy String <optional>
"AUTO_RENAME"

"AUTO_RENAME" | "OVERWRITE" | "OVERWRITE_IF_NEWER" | "REMOVE_SOURCE" | "THROW_EXCEPTION" | "DO_NOTHING"

Source:
Returns:
Type
Promise

preview(assetIdOrPath, extensionopt, optionsopt) → {Promise}

Get previews of assets. Should be used either with assetID or assetPath.

Parameters:
Name Type Attributes Description
assetIdOrPath String

Get preview of asset with assetID or assetPath

extension String <optional>

File extension. Required if options is provided.

options Object <optional>

Parameters object

Properties
Name Type Attributes Description
maxWidth Number <optional>

Sets the maximum width of the preview

maxHeight Number <optional>

Sets the maximum height of the preview

scale Number <optional>

Sets the width and height of the preview relative to the original size. The scale is in percentages from 1 to 100. If used in combination with maxWidth or maxHeight the image will be scaled with a maximum size.

ppi Number <optional>

Pixels per inch

dpi Number <optional>

Dots per inch

Source:
Returns:
Type
Promise

remove(options) → {Promise}

Remove asset

Parameters:
Name Type Description
options Object

An object contains one of these keys: id, ids, q, folderPath to find which assets/folders to remove

And optionally async: false if process is meant to be sync.

Source:
Returns:
Type
Promise

removeRelation(relationIds) → {Promise}

Removes relation nodes

Parameters:
Name Type Description
relationIds Array | String

List of relation ids

Source:
Returns:
Type
Promise

Search assets

Parameters:
Name Type Description
params Object

Search parameters

Properties
Name Type Attributes Description
q String

Query

start Number <optional>

Start after this number of results

num Number <optional>

Number of hits to return. Specify 0 to return no hits

sort String <optional>

Comma-delimited list of fields to sort on

metadataToReturn String <optional>

Comma-delimited list of metadata fields

facets String <optional>

Comma-delimited list of fields

facet..selection String <optional>

Comma-delimited list of values that should be selected for a given facet

appendRequestSecret Boolean <optional>

Return results with an encrypted code

Source:
Returns:
Type
Promise

update(id, options) → {Promise}

Update asset

Parameters:
Name Type Description
id String

ID of asset to update

options Object

Update parameters

Properties
Name Type Attributes Description
metadata Object <optional>

Either metadata or Filedata is required

Filedata File <optional>

Either metadata or Filedata is required

nextUrl String <optional>

301 redirect on success

Source:
Returns:
Type
Promise

updateBulk(params) → {Promise}

Update multiple assets at once

Parameters:
Name Type Description
params Object

Bulk update parameters

Properties
Name Type Attributes Description
q String

Query for selecting assets

metadata Object <optional>

Metadata object contains fields to update

Source:
Returns:
Type
Promise