Skip to content

editorGlobalsIAssetApi

Interface: IAssetApi

Hierarchy

  • IAssetApi

Implemented by

Index

Methods

Methods

Optional deleteAsset

deleteAsset(id: string): Promise‹boolean›

Defined in src/assets/IAssetApi.ts:73

Parameters:

Name Type Description
id string the id of the asset to delete

Returns: Promise‹boolean›

a promise that resolves to true, if the deletion succeeded, false otherwise.


fillInContainerDetails

fillInContainerDetails(fileContainer: FileContainer): Promise‹void›

Defined in src/assets/IAssetApi.ts:53

To optimize queries, asset resources might be loaded incompletely. This method should fill in missing details if necessary (except for the file contents).

Parameters:

Name Type Description
fileContainer FileContainer file container to be updated

Returns: Promise‹void›

promise that resolves once all loading has been done


getAllOfType

getAllOfType(assetType: string): PromiseAsset[]›

Defined in src/assets/IAssetApi.ts:23

List all assets that are of the specified type

Parameters:

Name Type Description
assetType string asset type identification, e.g. maker-format-plate

Returns: PromiseAsset[]›

promise that will resolve to an array of assets of given type


getAllThatContain

getAllThatContain(kindOfResource: string): PromiseAsset[]›

Defined in src/assets/IAssetApi.ts:30

(Proposed) list all assets that contain e.g. engraving(s)

Parameters:

Name Type Description
kindOfResource string desired kind of resource, e.g. 'engravings'

Returns: PromiseAsset[]›

promise that will resolve to array of assets of given type


getAsset

getAsset(id: string): PromiseAsset

Defined in src/assets/IAssetApi.ts:45

Retrieve an asset specified by its id

Parameters:

Name Type Description
id string id of the asset

Returns: PromiseAsset

promise that wil resolve to an asset or reject if the asset was not found ToDo: existingInstance - it might be cleaner to update an existing instance instead returning a new one - so there is only one asset instance with a defined state


getByMetadata

getByMetadata(metadataQuery: object): PromiseAsset[]›

Defined in src/assets/IAssetApi.ts:36

List assets whose metadata keys satisfy the provided Mongodb-styled query

Parameters:

Name Type
metadataQuery object

Returns: PromiseAsset[]›

promise that will resolve to array of assets


getName

getName(): string

Defined in src/assets/IAssetApi.ts:16

Returns: string

name that uniquely defines this instance across all APIs


getResourceUrl

getResourceUrl(resource: Resource, fileInResource: string): string

Defined in src/assets/IAssetApi.ts:67

Given an asset, returns the URL that can be used to fetch the resource contained in the asset

Parameters:

Name Type Description
resource Resource the resource in question
fileInResource string the file name of the resource to be fetched

Returns: string

the URL ToDo Rename to file container Url ToDo: Idea is: Tool or module fetches asset (meta definition), ToDo: and as soon as the model is needed, the actual resource ToDo: for/from this asset is fetched by querying the URL ToDo: and then using the ResourceLoader to get the data