UNPKG

@mindconnect/mindconnect-nodejs

Version:

MindConnect Library for NodeJS (community based)

671 lines (666 loc) 30.1 kB
/// <reference types="node" /> import { SdkClient } from "../common/sdk-client"; import { AssetManagementModels } from "./asset-models"; /** * Service for configuring, reading and managing assets, asset ~ and aspect types. * * @export * @class AssetManagementClient * @extends {SdkClient} */ export declare class AssetManagementClient extends SdkClient { private _baseUrl; /** * * AspectTypes * * Managing static and dynamic aspect types. * * List all aspect types * * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * * @example await assetManagement.GetAspectTypes(); * @example await assetManagement.GetAspectTypes({filter: "id eq mdsp.wing"}); * @returns {Promise<AssetManagementModels.AspectTypeListResource>} * * @memberOf AssetManagementClient */ GetAspectTypes(params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: number; }): Promise<AssetManagementModels.AspectTypeListResource>; /** * * AspectTypes * * Create or Update an aspect type. * Only adding variables supported. * User can increase the length of a static STRING variable. * The length cannot be decreased. * The length of a dynamic STRING variable cannot be changed. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {AssetManagementModels.AspectType} aspectType aspect type * @param {{ ifMatch?: string; ifNoneMatch?: string }} [params] * @param {{number}} [params.ifMatch] Last known version to facilitate optimistic locking. Required for modification. * @param {{number}} [params.ifNoneMatch] Set ifNoneMatch header to “*” for ensuring create request * @returns {Promise<AssetManagementModels.AspectTypeResource>} * * @example await am.PutAspectType ("mdsp.EnvironmentAspects", myAspectType, {ifNoneMatch:"*"}) * @memberOf AssetManagementClient */ PutAspectType(id: string, aspectType: AssetManagementModels.AspectType, params?: { ifMatch?: string; ifNoneMatch?: string; }): Promise<AssetManagementModels.AspectTypeResource>; /** * * AspectTypes * * Patch an aspect type. Only adding variables supported. * Patching requires the inclusion of already existing variables. * Other fields may be omitted. Conforms to RFC 7396 - JSON merge Patch. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {AssetManagementModels.AspectType} aspectType aspect type * @param {{ ifMatch: string}} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking. Required for modification. * @returns {Promise<AssetManagementModels.AspectTypeResource>} * * @example await am.PatchAspectType ("mdsp.EnvironmentAspect", myAspectType, {ifMatch:"0"}) * @memberOf AssetManagementClient */ PatchAspectType(id: string, aspectType: AssetManagementModels.AspectType, params: { ifMatch: string; }): Promise<AssetManagementModels.AspectTypeResource>; /** * * AspectTypes * * Delete an aspect type. Aspect type can only be deleted if there is no asset type using it. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {{ ifMatch: string }} params * @param {{ ifMatch: string }} params.ifMatch Last known version to facilitate optimistic locking, required for deleting * @returns {Promise<Object>} - return empty object * * @example await am.DeleteAspectType("mdsp.EnvironmentAspect", {ifMatch:0}) * @memberOf AssetManagementClient * */ DeleteAspectType(id: string, params: { ifMatch: string; }): Promise<void>; /** * * AspectTypes * * Read an aspect type. * * @param {string} id he type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {{ ifNoneMatch?: number }} [params] ETag hash of previous request to allow caching * @returns {Promise<AssetManagementModels.AspectTypeResource>} * * @example await am.GetAspectType("mdsp.EnvironmentAspect") * @memberOf AssetManagementClient */ GetAspectType(id: string, params?: { ifNoneMatch?: number; }): Promise<AssetManagementModels.AspectTypeResource>; /** * * AssetTypes * ! important: the default setting for inherited properties is false * ! important: @see [params.exploded] * * List all asset types * * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * exploded?: boolean; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * @param [params.exploded] Specifies if the asset type should include all of it’s inherited variables and aspects. Default is false. * * @example await assetManagement.GetAssetTypes(); * @example await assetManagement.GetAssetTypes({filter: "id eq mdsp.spaceship"}); * @returns {Promise<AssetManagementModels.AssetTypeListResource>} * * @memberOf AssetManagementClient * */ GetAssetTypes(params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: string; exploded?: boolean; }): Promise<AssetManagementModels.AssetTypeListResource>; /** * * AssetTypes * * Create or Update an asset type * User can increase the length of a STRING variable. * The length cannot be decreased. * * @param {string} id * @param {AssetManagementModels.AssetType} assetType * @param {{ ifMatch?: string; ifNoneMatch?: string; exploded?: boolean }} [params] * @param {{number}} [params.ifMatch] Last known version to facilitate optimistic locking. Required for modification. * @param {{string}} [params.ifNoneMatch] Set ifNoneMatch header to “*” for ensuring create request * @param {{boolean}} [params.exploded] Specifies if the asset type should include all of it’s inherited variables and aspects. Default is false. * @returns {Promise<AssetManagementModels.AssetTypeResource>} * * @example await am.PutAssetType("mdsp.SimulationEngine", myAssetType) * @memberOf AssetManagementClient */ PutAssetType(id: string, assetType: AssetManagementModels.AssetType, params?: { ifMatch?: string; ifNoneMatch?: string; exploded?: boolean; }): Promise<AssetManagementModels.AssetTypeResource>; /** * * AssetTypes * * Patch an asset type. * Patching requires the inclusion of all existing variables and aspects. * Missing file assignments will be deleted. * Other fields may be omitted. Conforms to RFC 7396 - JSON merge Patch. * * @param {string} id * @param {AssetManagementModels.AssetType} assetType * @param {{ ifMatch: string; exploded?: boolean }} params * @param {{number}} [params.ifMatch] Last known version to facilitate optimistic locking. Required for modification. * @param {{boolean}} [params.exploded] Specifies if the asset type should include all of it’s inherited variables and aspects. Default is false. * @returns {Promise<AssetManagementModels.AssetTypeResource>} * * @example await am.PatchAssetType("mdsp.SimulationEngine", myAssetType) * @memberOf AssetManagementClient */ PatchAssetType(id: string, assetType: AssetManagementModels.AssetType, params: { ifMatch: string; exploded?: boolean; }): Promise<AssetManagementModels.AssetTypeResource>; /** * * AssetTypes * * Deletes an asset type. * Deletion only possible when the type has no child-type and there is no asset that instantiate it. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking, required for deleting * * @example await am.DeleteAssetType("mdsp.SimulationEnigine", {ifMatch:0}) * @memberOf AssetManagementClient * */ DeleteAssetType(id: string, params: { ifMatch: string; }): Promise<void>; /** * * AssetTypes * * Read an asset type * ! important: the default setting for inherited properties is false * ! important: @see [params.exploded] * * @param {string} id * @param {{ ifNoneMatch?: string; exploded?: boolean }} [params] * @returns {Promise<AssetManagementModels.AssetTypeResource>} * * @example await am.GetAssetType("mdsp.SimulationEngine") * @memberOf AssetManagementClient */ GetAssetType(id: string, params?: { ifNoneMatch?: string; exploded?: boolean; }): Promise<AssetManagementModels.AssetTypeResource>; /** * * AssetTypes * * Add a new file assignment to a given asset type. All asset which extends these types will have its file by default. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {string} key Keyword for the file to be assigned to an asset or asset type. * @param {AssetManagementModels.KeyedFileAssignment} assignment Data for file assignment * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * @returns {Promise<AssetManagementModels.AssetTypeResource>} * * @memberOf AssetManagementClient */ PutAssetTypeFileAssignment(id: string, key: string, assignment: AssetManagementModels.KeyedFileAssignment, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetTypeResource>; /** * *AssetTypes * * Deletes a file assignment from an asset type. * If the type’s parent has defined a file with the same key, the key will be displayed with the inherited value. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {string} key Keyword for the file to be assigned to an asset or asset type. * @param {AssetManagementModels.KeyedFileAssignment} assignment Data for file assignment * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * * @memberOf AssetManagementClient */ DeleteAssetTypeFileAssignment(id: string, key: string, params: { ifMatch: string; }): Promise<void>; /** * * Asset * * List all assets available for the authenticated user. * * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: string; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * @returns {Promise<AssetManagementModels.AssetListResource>} * * @example await assetManagement.GetAssets(); * @example await assetManagement.GetAssetTypes({filter: "typeid eq mdsp.spaceship"}); * * @memberOf AssetManagementClient */ GetAssets(params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: string; }): Promise<AssetManagementModels.AssetListResource>; /** * * Asset * * Creates a new asset with the provided content. Only instantiable types could be used. * * @param {AssetManagementModels.Asset} asset * @returns {Promise<AssetManagementModels.AssetResourceWithHierarchyPath>} * * @example await assetManagement.PostAsset(myasset); * @memberOf AssetManagementClient */ PostAsset(asset: AssetManagementModels.Asset): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset * * Read a single asset. All static properties of asset are returned. * * @param {string} assetId Unique identifier * @param {{ ifNoneMatch?: string }} [params] * @param {{string}} [params.ifNoneMatch] * @returns {Promise<AssetManagementModels.AssetResourceWithHierarchyPath>} * * @memberOf AssetManagementClient */ GetAsset(assetId: string, params?: { ifNoneMatch?: string; }): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset * * Updates an asset with the provided content. * Only values can be modified, asset’s structure have to be modified in asset’s type * * @param {string} assetId * @param {AssetManagementModels.AssetUpdate} asset * @param {{ ifMatch: string }} params * @param {{number}} [params.ifMatch] Last known version to facilitate optimistic locking. Required for modification. * @returns {Promise<AssetManagementModels.AssetResourceWithHierarchyPath>} * * @example await assetManagement.PutAsset (myAsset, {ifMatch: `${myAsset.etag}`}) * * @memberOf AssetManagementClient */ PutAsset(assetId: string, asset: AssetManagementModels.AssetUpdate, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset * * Patch an asset with the provided content. * Only values can be modified, asset’s structure have to be modified in asset’s type. * Conforms to RFC 7396 - JSON merge Patch. * * @param {string} assetId * @param {AssetManagementModels.AssetUpdate} asset * @param {{ ifMatch: string }} params * @param {{number}} [params.ifMatch] Last known version to facilitate optimistic locking. Required for modification. * @returns {Promise<AssetManagementModels.AssetResourceWithHierarchyPath>} * * @example await assetManagement.Patch (myAsset, {ifMatch: `${myAsset.etag}`}) * * @memberOf AssetManagementClient */ PatchAsset(assetId: string, asset: AssetManagementModels.AssetUpdate, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset * * Deletes the given asset. * After deletion only users with admin role can read it, * but modification is not possible anymore. * It’s not possible to delete an asset if it has children. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking, required for deleting * * @example await assetManagement.DeleteAsset(id, {ifMatch:0}) * * @memberOf AssetManagementClient */ DeleteAsset(id: string, params: { ifMatch: string; }): Promise<void>; /** * * Asset * * Save a file assignment to a given asset * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {string} key Keyword for the file to be assigned to an asset or asset type. * @param {AssetManagementModels.KeyedFileAssignment} assignment Data for file assignment * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * @returns {Promise<AssetManagementModels.AssetTypeResource>} * * @memberOf AssetManagementClient */ PutAssetFileAssignment(id: string, key: string, assignment: AssetManagementModels.KeyedFileAssignment, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetTypeResource>; /** * * Asset * * Deletes a file assignment from an asset. * If the asset’s parent type has defined a file with the same key, the key will be displayed with the inherited value. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {string} key Keyword for the file to be assigned to an asset or asset type. * @param {AssetManagementModels.KeyedFileAssignment} assignment Data for file assignment * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * * @memberOf AssetManagementClient */ DeleteAssetFileAssignment(id: string, key: string, params: { ifMatch: string; }): Promise<void>; /** * * Asset * Returns the root asset of the user. * Read the root asset of the user, from which the whole asset hierarchy can be rebuilt. * * @returns {Promise<AssetManagementModels.RootAssetResource>} * * @memberOf AssetManagementClient */ GetRootAsset(): Promise<AssetManagementModels.RootAssetResource>; /** * * Asset Structure * Get all static and dynamic aspects of a given asset * * @param {string} assetId * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * * @returns {Promise<AssetManagementModels.AspectListResource>} * * @memberOf AssetManagementClient */ GetAspects(assetId: string, params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: number; }): Promise<AssetManagementModels.AspectListResource>; /** * * Asset Structure * Get all variables of a given asset including inherited ones * * @param {string} assetId * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * * @returns {Promise<AssetManagementModels.AspectListResource>} * * @memberOf AssetManagementClient */ GetVariables(assetId: string, params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: number; }): Promise<AssetManagementModels.VariableListResource>; /** * * Asset Location * * Create or Update location assigned to given asset * * * If the given asset has own location, this endpoint will update that location. * * If the given asset has no location, this endpoint will create a new location and update the given asset. * * If the given asset has inherited location, this endpoint will create a new location and update the given asset. * * If you wanted to update the inherited location you have to use the ‘location’ url in AssetResource object (with PUT method). * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {AssetManagementModels.Location} location Data for location * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * @returns {Promise<AssetManagementModels.Location>} * * ! fix: 3.11. : the swagger documentation says that the method is returning Location but it returns AssetResourceWithHierarchyPath * * @memberOf AssetManagementClient */ PutAssetLocation(id: string, location: AssetManagementModels.Location, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset Location * * Delete location assigned to given asset. * * * Only those locations can be deleted here which assigned to the given asset. * * If the location inherited from an ancestor asset, you have to delete the location with the assigned assetId (using ‘location’ url in AssetResource object with DELETE method). * * The response contains the updated AssetResource with the inherited Location details. * * @param {string} id The type’s id is a unique identifier. The id’s length must be between 1 and 128 characters and matches the following symbols "A-Z", "a-z", "0-9", “_” and “.” beginning with the tenant prefix what has a maximum of 8 characters. (e.g . ten_pref.type_id) * @param {AssetManagementModels.Location} location Data for location * @param {{ ifMatch: string }} params * @param {{number}} params.ifMatch Last known version to facilitate optimistic locking * @returns {Promise<AssetManagementModels.AssetResourceWithHierarchyPath>} * * @memberOf AssetManagementClient */ DeleteAssetLocation(id: string, params: { ifMatch: string; }): Promise<AssetManagementModels.AssetResourceWithHierarchyPath>; /** * * Asset Files * * Upload files to be used in Asset Management. * * @param {Buffer} file * @param {string} name * @param {{ * scope?: AssetManagementModels.FileMetadataResource.ScopeEnum; * description?: string; * mimeType?: string; * }} [params] * @returns {Promise<AssetManagementModels.FileMetadataResource>} * * @memberOf AssetManagementClient */ PostFile(file: Buffer, name: string, params?: { scope?: AssetManagementModels.FileMetadataResource.ScopeEnum; description?: string; mimeType?: string; }): Promise<AssetManagementModels.FileMetadataResource>; /** * * Asset files * * Get metadata of uploaded files. * Returns all visible file metadata for the tenant. Will NOT return the files. * * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * }} [params] * * @param {{ * page?: number; * size?: number; * sort?: string; * filter?: string; * ifNoneMatch?: number; * }} [params] * @param [params.page] Specifies the requested page index * @param [params.size] Specifies the number of elements in a page * @param [params.sort] Specifies the ordering of returned elements * @param [params.filter] Specifies the additional filtering criteria * @param [params.ifnonematch] ETag hash of previous request to allow caching * @returns {Promise<AssetManagementModels.FileMetadataListResource>} * * @memberOf AssetManagementClient */ GetFiles(params?: { page?: number; size?: number; sort?: string; filter?: string; ifNoneMatch?: number; }): Promise<AssetManagementModels.FileMetadataListResource>; /** * * Asset Files * * Get metadata of uploaded files. * * @param {string} fileId * @param {{ * ifNoneMatch?: number; * }} [params] * @returns {Promise<AssetManagementModels.FileMetadataResource>} * * @memberOf AssetManagementClient */ GetFile(fileId: string, params?: { ifNoneMatch?: number; }): Promise<AssetManagementModels.FileMetadataResource>; /** * Returns a file by its id * * @param {string} fileId * @param {{ * ifNoneMatch?: number; * }} [params] * @returns {Promise<Response>} Response Context Type is base64 * * @memberOf AssetManagementClient */ DownloadFile(fileId: string, params?: { ifNoneMatch?: number; }): Promise<Response>; /** * * Asset Files * * Update a previously uploaded file. * Max file size is 5 MB. * * @param {string} fileid * @param {Buffer} file * @param {string} name * @param {{ * scope: AssetManagementModels.FileMetadataResource.ScopeEnum; * description?: string; * mimeType?: string; * ifMatch: string; * }} params * @returns {Promise<AssetManagementModels.FileMetadataResource>} * * @memberOf AssetManagementClient */ PutFile(fileid: string, file: Buffer, name: string, params: { scope: AssetManagementModels.FileMetadataResource.ScopeEnum; description?: string; mimeType?: string; ifMatch: string; }): Promise<AssetManagementModels.FileMetadataResource>; /** * * Asset Files * * Delete a file * Deletion is blocked if there are any file assignment with the given fileId. * * @param {string} fileId * @param {{ ifMatch: string }} params * * @memberOf AssetManagementClient */ DeleteFile(fileId: string, params: { ifMatch: string; }): Promise<void>; /** * List all links for available resources * * @returns {Promise<AssetManagementModels.BillboardResource>} * * @memberOf AssetManagementClient */ GetBillboard(): Promise<AssetManagementModels.BillboardResource>; }