UNPKG

@mindconnect/mindconnect-nodejs

Version:

NodeJS Library for Siemens Insights Hub Connectivity - TypeScript SDK for Insights Hub and Industrial IoT - Command Line Interface - Insights Hub Development Proxy (Siemens Insights Hub was formerly known as MindSphere)

222 lines (221 loc) 11 kB
import { SdkClient } from "../common/sdk-client"; import { ModelManagementModels } from "./model-models"; /** * Service for configuring, reading and managing assets, asset ~ and aspect types. * * @export * @class AssetManagementClient * @extends {SdkClient} */ export declare class ModelManagementClient extends SdkClient { private _baseUrl; /** * * Models * * List all all models and algorithms available for the authenticated user. * * @param {{ * pageNumber?: number; * pageSize?: number; * filter?: string; * sort?: string; * }} [params] * @param [params.pageNumber] Specifies the requested page index * @param [params.pageSize] Specifies the number of elements in a page * @param [params.filter] Specifies the additional filtering criteria. * Complex filter that can filter by model name, type, description, author or fields set as optional parameters. All fields are optional. Filters can be set as plain string or as a regular expression. * The expected format follows: * @example {"name":"model\*","type":"type","description":"modelDescription","optionalParameters":{"entityId":"64","entityName": "*"}} * * @param [params.sort] Specifies the ordering of returned elements e.g. 'asc' or 'desc' * * @returns {Promise<ModelManagementModels.ModelArray>} * * @example await modelManagement.GetModels(); * @example await modelManagement.GetModels({sort: "asc"}); * * @memberOf ModelManagementClient */ GetModels(params?: { pageNumber?: number; pageSize?: number; filter?: string; sort?: "asc" | "desc"; }): Promise<ModelManagementModels.ModelArray>; /** * * Models * * Gets the model for the given model id. * * @param {string} id * @returns {Promise<ModelManagementModels.Model>} * * @example await modelManagement.GetModel("mdsp.SimulationEngine") * @memberOf ModelManagementClient */ GetModel(id: string): Promise<ModelManagementModels.Model>; /** * * Models * * Updates the model's metadata. * * @param {string} id ID of the model which is to be updated * @param {ModelManagementModels.ModelDefinition} model * @returns {Promise<ModelManagementModels.Model>} * @throws {ModelManagementModels.RequiredError} * * @example await modelManagement.PatchModel("mdsp.SimulationEngine", myModelDefinition) * @memberOf ModelManagementClient */ PatchModel(id: string, model: ModelManagementModels.ModelDefinition): Promise<ModelManagementModels.Model>; /** * * Models * * Deletes a model, all the versions and the corresponding metadata. * Also, use this endpoint if needed to delete a model that has a single version available. * * @param {string} id ID of the model which is to be updated * * @example await modelManagement.DeleteModel(id) * * @memberOf ModelManagementClient */ DeleteModel(id: string): Promise<void>; /** * * Models * * Uploads a model payload and the corresponding metadata. * * @param {any} file The model/algorithm file * @param {ModelManagementModels.ModelDefinition} metadata The details regarding what the model represents, as name, author, type, description, in JSON format (see definitions/Model and definitions/VersionDefinition)&lt;br /&gt; &lt;pre&gt; { name: \&quot;NN - Quasi Newton\&quot;, description: \&quot;Newton using variable matrix methods\&quot;, type: \&quot;Zeppelin notebook\&quot;, author: \&quot;user@siemens.com\&quot;, version: { number: 3.1, expirationDate: \&quot;2017-10-01T12:00:00.001Z\&quot;, author: \&quot;user@siemens.com\&quot;, creationDate: \&quot;2017-10-01T12:00:00.001Z\&quot;, dependencies: [ { name: \&quot;sklearn-theano\&quot;, type: \&quot;Python\&quot;, version: \&quot;1.7, 5.2.6\&quot; } ], io: { consumes: \&quot;CSV/XML/Parquet\&quot;, input: [ { name: \&quot;t1\&quot;, type: \&quot;integer\&quot;, description: \&quot;temperature sensor value\&quot;, value: 5 } ], output: [ { name: \&quot;t1\&quot;, type: \&quot;integer\&quot;, description: \&quot;temperature sensor value\&quot;, value: 5 } ], optionalParameters: { freeFormParams: \&quot;for the author to use\&quot; } }, producedBy: [ {\&quot;951b3240-7857-11e8-adc0-fa7ae01bbebc\&quot;} ], kpi: [ { name: \&quot;error rate\&quot;, value: 0.9 } ] } }&lt;/pre&gt; * @returns {Promise<ModelManagementModels.Model>} * * @memberOf ModelManagementClient */ PostModel(metadata: ModelManagementModels.ModelDefinition, payload: ModelManagementModels.ModelPayload): Promise<ModelManagementModels.Model>; /** * * Versions * * Retrieves all the versions of a model or an algorithm based on the model identifier. * Whenever a new model file or a metadata JSON are uploaded as an update of an existing entry a new version of the entry is created. * * @param {{ * modelId?: string; * pageNumber?: number; * pageSize?: number; * }} [params] * @param [params.modelId] Model ID to get the information for it * @param [params.pageNumber] Specifies the requested page index * @param [params.pageSize] Specifies the number of elements in a page * * @returns {Promise<ModelManagementModels.VersionArray>} * * @memberOf ModelManagementClient */ GetModelVersions(params?: { modelId?: string; pageNumber?: number; pageSize?: number; }): Promise<ModelManagementModels.VersionArray>; /** * * Model Version * * Retrieves the metadata of the model with specified version. * * @param {string} modelId Model ID to get the information for it * @param {string} versionId Version ID to get the information for it * * @example await modelManagement.GetModelVersion("mdsp.SimulationEngine", "v0.0.1") * @memberOf ModelManagementClient */ GetModelVersion(modelId: string, versionId: string): Promise<ModelManagementModels.Version>; /** * * Model Version * * Retrieves the payload of the model with specified version. * * @param {string} modelId Model ID to get the information for it * @param {string} versionId Version ID to get the information for it * * @memberOf ModelManagementClient */ DownloadModelVersion(modelId: string, versionId: string): Promise<Response>; /** * * Model Version * * Downloads the last version payload or description of a model. * * @param {string} modelId Id of the model * @returns {Promise<ModelManagementModels.Version>} * * @example await modelManagement.GetModelLastVersion("mdsp.SimulationEngine") * @memberOf ModelManagementClient */ GetModelLastVersion(modelId: string): Promise<ModelManagementModels.Version>; /** * * Model Version * * Retrieves the last version of model payload. * * @param {string} modelId Id of the model * @returns {Promise<ModelManagementModels.Version>} * * @memberOf ModelManagementClient */ DownloadModelLastVersion(modelId: string): Promise<Response>; /** * * Model Version * * Deletes a version of a model and the corresponding metadata, * only if the version is not the single available version for the model. * * @summary Deletes the specified version of a model and the corresponding metadata * @param {string} modelId Id of the model * @param {string} versionId The version id * * @example await modelManagement.DeleteModelVersion(myModelId, myVersionId) * * @memberOf ModelManagementClient */ DeleteModelVersion(modelId: string, versionId: string): Promise<void>; /** * * Model Version * * Deletes the last version of a model and its associated payload. * If the version is the only version of the model all the information regarding the model will be deleted. * * @param {string} modelId Id of the model * * @example await modelManagement.DeleteModelLastVersion(myModelId) * * @memberOf ModelManagementClient */ DeleteModelLastVersion(modelId: string): Promise<void>; /** * * Model Version * * Updates the last version metadata information of a model, without allowing updates to the model payload itself * * @param {string} modelId The model id * @param {ModelManagementModels.VersionDefinition} version * @returns {Promise<ModelManagementModels.VersionDefinition>} * @throws {ModelManagementModels.RequiredError} * * @example await modelManagement.PatchLastModelVersion("mdsp.SimulationEngine", myModelVersionDefinition) * @memberOf ModelManagementClient */ PatchLastModelVersion(modelId: string, version: ModelManagementModels.VersionDefinition): Promise<ModelManagementModels.VersionDefinition>; /** * * Model Versions * * Create a new model version. * * @param {string} modelId Model ID to create a new verion for * @param {any} file The model/algorithm file * @param {ModelManagementModels.VersionDefinition} metadata Version data in JSON format (See definitions/VersionDefinition) &lt;pre&gt; { number: 3.1, expirationDate: \&quot;2017-10-01T12:00:00.001Z\&quot;, author: \&quot;user@siemens.com\&quot;, creationDate: \&quot;2017-10-01T12:00:00.001Z\&quot;, dependencies: [ { name: \&quot;sklearn-theano\&quot;, type: \&quot;Python\&quot;, version: \&quot;1.7, 5.2.6\&quot; } ], io: { consumes: \&quot;CSV/XML/Parquet\&quot;, input: [ { name: \&quot;t1\&quot;, type: \&quot;integer\&quot;, description: \&quot;temperature sensor value\&quot;, value: 5 } ], output: [ { name: \&quot;t1\&quot;, type: \&quot;integer\&quot;, description: \&quot;temperature sensor value\&quot;, value: 5 } ], optionalParameters: { freeFormParams: \&quot;for the author to use\&quot; } }, producedBy: [ {\&quot;951b3240-7857-11e8-adc0-fa7ae01bbebc\&quot;} ], kpi: [ { name: \&quot;error rate\&quot;, value: 0.9 } ] } &lt;/pre&gt; * @returns {Promise<ModelManagementModels.Version>} * * @memberOf ModelManagementClient */ PostModelVersion(modelId: string, metadata: ModelManagementModels.VersionDefinition, payload: ModelManagementModels.ModelPayload): Promise<ModelManagementModels.Version>; }