ibm-watson
Version:
Client library to use the IBM Watson Services
3,495 lines • 179 kB
JavaScript
"use strict";
/**
* (C) Copyright IBM Corp. 2018, 2024.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/**
* IBM OpenAPI SDK Code Generator Version: 3.96.1-5136e54a-20241108-203028
*/
var extend = require("extend");
var ibm_cloud_sdk_core_1 = require("ibm-cloud-sdk-core");
var common_1 = require("../lib/common");
/**
* The IBM Watson™ Assistant service combines machine learning, natural language understanding, and an integrated
* dialog editor to create conversation flows between your apps and your users.
*
* The Assistant v1 API provides authoring methods your application can use to create or update a workspace.
*
* API Version: 1.0
* See: https://cloud.ibm.com/docs/assistant
*/
var AssistantV1 = /** @class */ (function (_super) {
__extends(AssistantV1, _super);
/**
* Construct a AssistantV1 object.
*
* @param {Object} options - Options for the service.
* @param {string} options.version - Release date of the API version you want to use. Specify dates in YYYY-MM-DD
* format. The current version is `2021-11-27`.
* @param {string} [options.serviceUrl] - The base URL for the service
* @param {OutgoingHttpHeaders} [options.headers] - Default headers that shall be included with every request to the service.
* @param {string} [options.serviceName] - The name of the service to configure
* @param {Authenticator} [options.authenticator] - The Authenticator object used to authenticate requests to the service. Defaults to environment if not set
* @constructor
* @returns {AssistantV1}
*/
function AssistantV1(options) {
var _this = this;
options = options || {};
var _requiredParams = ['version'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(options, _requiredParams, null);
if (_validationErrors) {
throw _validationErrors;
}
if (!options.serviceName) {
options.serviceName = AssistantV1.DEFAULT_SERVICE_NAME;
}
// If the caller didn't supply an authenticator, construct one from external configuration.
if (!options.authenticator) {
options.authenticator = (0, ibm_cloud_sdk_core_1.getAuthenticatorFromEnvironment)(options.serviceName);
}
_this = _super.call(this, options) || this;
_this.configureService(options.serviceName);
if (options.serviceUrl) {
_this.setServiceUrl(options.serviceUrl);
}
_this.version = options.version;
return _this;
}
/*************************
* message
************************/
/**
* Get response to user input.
*
* Send user input to a workspace and receive a response.
*
* **Important:** This method has been superseded by the new v2 runtime API. The v2 API offers significant advantages,
* including ease of deployment, automatic state management, versioning, and search capabilities. For more
* information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-api-overview).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {MessageInput} [params.input] - An input object that includes the input text.
* @param {RuntimeIntent[]} [params.intents] - Intents to use when evaluating the user input. Include intents from the
* previous response to continue using those intents rather than trying to recognize intents in the new input.
* @param {RuntimeEntity[]} [params.entities] - Entities to use when evaluating the message. Include entities from the
* previous response to continue using those entities rather than detecting entities in the new input.
* @param {boolean} [params.alternateIntents] - Whether to return more than one intent. A value of `true` indicates
* that all matching intents are returned.
* @param {Context} [params.context] - State information for the conversation. To maintain state, include the context
* from the previous response.
* @param {OutputData} [params.output] - An output object that includes the response to the user, the dialog nodes
* that were triggered, and messages from the log.
* @param {string} [params.userId] - A string value that identifies the user who is interacting with the workspace.
* The client must provide a unique identifier for each individual end user who accesses the application. For
* user-based plans, this user ID is used to identify unique users for billing purposes. This string cannot contain
* carriage return, newline, or tab characters. If no value is specified in the input, **user_id** is automatically
* set to the value of **context.conversation_id**.
*
* **Note:** This property is the same as the **user_id** property in the context metadata. If **user_id** is
* specified in both locations in a message request, the value specified at the root is used.
* @param {boolean} [params.nodesVisitedDetails] - Whether to include additional diagnostic information about the
* dialog nodes that were visited during processing of the message.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.MessageResponse>>}
*/
AssistantV1.prototype.message = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'input', 'intents', 'entities', 'alternateIntents', 'context', 'output', 'userId', 'nodesVisitedDetails', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'input': _params.input,
'intents': _params.intents,
'entities': _params.entities,
'alternate_intents': _params.alternateIntents,
'context': _params.context,
'output': _params.output,
'user_id': _params.userId,
};
var query = {
'version': this.version,
'nodes_visited_details': _params.nodesVisitedDetails,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'message');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/message',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* bulkClassify
************************/
/**
* Identify intents and entities in multiple user utterances.
*
* Send multiple user inputs to a workspace in a single request and receive information about the intents and entities
* recognized in each input. This method is useful for testing and comparing the performance of different workspaces.
*
* This method is available only with Enterprise with Data Isolation plans.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {BulkClassifyUtterance[]} [params.input] - An array of input utterances to classify.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.BulkClassifyResponse>>}
*/
AssistantV1.prototype.bulkClassify = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'input', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'input': _params.input,
};
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'bulkClassify');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/bulk_classify',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* workspaces
************************/
/**
* List workspaces.
*
* List the workspaces associated with a Watson Assistant service instance.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned workspaces will be sorted. To reverse the sort
* order, prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.WorkspaceCollection>>}
*/
AssistantV1.prototype.listWorkspaces = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = ['pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listWorkspaces');
var parameters = {
options: {
url: '/v1/workspaces',
method: 'GET',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create workspace.
*
* Create a workspace based on component objects. You must provide workspace components defining the content of the
* new workspace.
*
* **Note:** The new workspace data cannot be larger than 1.5 MB. For larger requests, use the **Create workspace
* asynchronously** method.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.name] - The name of the workspace. This string cannot contain carriage return, newline, or
* tab characters.
* @param {string} [params.description] - The description of the workspace. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.language] - The language of the workspace.
* @param {DialogNode[]} [params.dialogNodes] - An array of objects describing the dialog nodes in the workspace.
* @param {Counterexample[]} [params.counterexamples] - An array of objects defining input examples that have been
* marked as irrelevant input.
* @param {JsonObject} [params.metadata] - Any metadata related to the workspace.
* @param {boolean} [params.learningOptOut] - Whether training data from the workspace (including artifacts such as
* intents and entities) can be used by IBM for general service improvements. `true` indicates that workspace training
* data is not to be used.
* @param {WorkspaceSystemSettings} [params.systemSettings] - Global settings for the workspace.
* @param {Webhook[]} [params.webhooks] -
* @param {CreateIntent[]} [params.intents] - An array of objects defining the intents for the workspace.
* @param {CreateEntity[]} [params.entities] - An array of objects describing the entities for the workspace.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.createWorkspace = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = ['name', 'description', 'language', 'dialogNodes', 'counterexamples', 'metadata', 'learningOptOut', 'systemSettings', 'webhooks', 'intents', 'entities', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'description': _params.description,
'language': _params.language,
'dialog_nodes': _params.dialogNodes,
'counterexamples': _params.counterexamples,
'metadata': _params.metadata,
'learning_opt_out': _params.learningOptOut,
'system_settings': _params.systemSettings,
'webhooks': _params.webhooks,
'intents': _params.intents,
'entities': _params.entities,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createWorkspace');
var parameters = {
options: {
url: '/v1/workspaces',
method: 'POST',
body: body,
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get information about a workspace.
*
* Get information about a workspace, optionally including all workspace content.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {string} [params.sort] - Indicates how the returned workspace data will be sorted. This parameter is valid
* only if **export**=`true`. Specify `sort=stable` to sort all workspace objects by unique identifier, in ascending
* alphabetical order.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.getWorkspace = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', '_export', 'includeAudit', 'sort', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'include_audit': _params.includeAudit,
'sort': _params.sort,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getWorkspace');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update workspace.
*
* Update an existing workspace with new or modified data. You must provide component objects defining the content of
* the updated workspace.
*
* **Note:** The new workspace data cannot be larger than 1.5 MB. For larger requests, use the **Update workspace
* asynchronously** method.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} [params.name] - The name of the workspace. This string cannot contain carriage return, newline, or
* tab characters.
* @param {string} [params.description] - The description of the workspace. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.language] - The language of the workspace.
* @param {DialogNode[]} [params.dialogNodes] - An array of objects describing the dialog nodes in the workspace.
* @param {Counterexample[]} [params.counterexamples] - An array of objects defining input examples that have been
* marked as irrelevant input.
* @param {JsonObject} [params.metadata] - Any metadata related to the workspace.
* @param {boolean} [params.learningOptOut] - Whether training data from the workspace (including artifacts such as
* intents and entities) can be used by IBM for general service improvements. `true` indicates that workspace training
* data is not to be used.
* @param {WorkspaceSystemSettings} [params.systemSettings] - Global settings for the workspace.
* @param {Webhook[]} [params.webhooks] -
* @param {CreateIntent[]} [params.intents] - An array of objects defining the intents for the workspace.
* @param {CreateEntity[]} [params.entities] - An array of objects describing the entities for the workspace.
* @param {boolean} [params.append] - Whether the new data is to be appended to the existing data in the object. If
* **append**=`false`, elements included in the new data completely replace the corresponding existing elements,
* including all subelements. For example, if the new data for a workspace includes **entities** and
* **append**=`false`, all existing entities in the workspace are discarded and replaced with the new entities.
*
* If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in the new
* data collide with existing elements, the update request fails.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.updateWorkspace = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'name', 'description', 'language', 'dialogNodes', 'counterexamples', 'metadata', 'learningOptOut', 'systemSettings', 'webhooks', 'intents', 'entities', 'append', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'description': _params.description,
'language': _params.language,
'dialog_nodes': _params.dialogNodes,
'counterexamples': _params.counterexamples,
'metadata': _params.metadata,
'learning_opt_out': _params.learningOptOut,
'system_settings': _params.systemSettings,
'webhooks': _params.webhooks,
'intents': _params.intents,
'entities': _params.entities,
};
var query = {
'version': this.version,
'append': _params.append,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateWorkspace');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete workspace.
*
* Delete a workspace from the service instance.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteWorkspace = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteWorkspace');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create workspace asynchronously.
*
* Create a workspace asynchronously based on component objects. You must provide workspace components defining the
* content of the new workspace.
*
* A successful call to this method only initiates asynchronous creation of the workspace. The new workspace is not
* available until processing completes. To check the status of the asynchronous operation, use the **Get information
* about a workspace** method.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.name] - The name of the workspace. This string cannot contain carriage return, newline, or
* tab characters.
* @param {string} [params.description] - The description of the workspace. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.language] - The language of the workspace.
* @param {DialogNode[]} [params.dialogNodes] - An array of objects describing the dialog nodes in the workspace.
* @param {Counterexample[]} [params.counterexamples] - An array of objects defining input examples that have been
* marked as irrelevant input.
* @param {JsonObject} [params.metadata] - Any metadata related to the workspace.
* @param {boolean} [params.learningOptOut] - Whether training data from the workspace (including artifacts such as
* intents and entities) can be used by IBM for general service improvements. `true` indicates that workspace training
* data is not to be used.
* @param {WorkspaceSystemSettings} [params.systemSettings] - Global settings for the workspace.
* @param {Webhook[]} [params.webhooks] -
* @param {CreateIntent[]} [params.intents] - An array of objects defining the intents for the workspace.
* @param {CreateEntity[]} [params.entities] - An array of objects describing the entities for the workspace.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.createWorkspaceAsync = function (params) {
var _params = __assign({}, params);
var _requiredParams = [];
var _validParams = ['name', 'description', 'language', 'dialogNodes', 'counterexamples', 'metadata', 'learningOptOut', 'systemSettings', 'webhooks', 'intents', 'entities', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'description': _params.description,
'language': _params.language,
'dialog_nodes': _params.dialogNodes,
'counterexamples': _params.counterexamples,
'metadata': _params.metadata,
'learning_opt_out': _params.learningOptOut,
'system_settings': _params.systemSettings,
'webhooks': _params.webhooks,
'intents': _params.intents,
'entities': _params.entities,
};
var query = {
'version': this.version,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createWorkspaceAsync');
var parameters = {
options: {
url: '/v1/workspaces_async',
method: 'POST',
body: body,
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update workspace asynchronously.
*
* Update an existing workspace asynchronously with new or modified data. You must provide component objects defining
* the content of the updated workspace.
*
* A successful call to this method only initiates an asynchronous update of the workspace. The updated workspace is
* not available until processing completes. To check the status of the asynchronous operation, use the **Get
* information about a workspace** method.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} [params.name] - The name of the workspace. This string cannot contain carriage return, newline, or
* tab characters.
* @param {string} [params.description] - The description of the workspace. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.language] - The language of the workspace.
* @param {DialogNode[]} [params.dialogNodes] - An array of objects describing the dialog nodes in the workspace.
* @param {Counterexample[]} [params.counterexamples] - An array of objects defining input examples that have been
* marked as irrelevant input.
* @param {JsonObject} [params.metadata] - Any metadata related to the workspace.
* @param {boolean} [params.learningOptOut] - Whether training data from the workspace (including artifacts such as
* intents and entities) can be used by IBM for general service improvements. `true` indicates that workspace training
* data is not to be used.
* @param {WorkspaceSystemSettings} [params.systemSettings] - Global settings for the workspace.
* @param {Webhook[]} [params.webhooks] -
* @param {CreateIntent[]} [params.intents] - An array of objects defining the intents for the workspace.
* @param {CreateEntity[]} [params.entities] - An array of objects describing the entities for the workspace.
* @param {boolean} [params.append] - Whether the new data is to be appended to the existing data in the object. If
* **append**=`false`, elements included in the new data completely replace the corresponding existing elements,
* including all subelements. For example, if the new data for a workspace includes **entities** and
* **append**=`false`, all existing entities in the workspace are discarded and replaced with the new entities.
*
* If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in the new
* data collide with existing elements, the update request fails.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.updateWorkspaceAsync = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'name', 'description', 'language', 'dialogNodes', 'counterexamples', 'metadata', 'learningOptOut', 'systemSettings', 'webhooks', 'intents', 'entities', 'append', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'name': _params.name,
'description': _params.description,
'language': _params.language,
'dialog_nodes': _params.dialogNodes,
'counterexamples': _params.counterexamples,
'metadata': _params.metadata,
'learning_opt_out': _params.learningOptOut,
'system_settings': _params.systemSettings,
'webhooks': _params.webhooks,
'intents': _params.intents,
'entities': _params.entities,
};
var query = {
'version': this.version,
'append': _params.append,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateWorkspaceAsync');
var parameters = {
options: {
url: '/v1/workspaces_async/{workspace_id}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Export workspace asynchronously.
*
* Export the entire workspace asynchronously, including all workspace content.
*
* A successful call to this method only initiates an asynchronous export. The exported JSON data is not available
* until processing completes. After the initial request is submitted, you can continue to poll by calling the same
* request again and checking the value of the **status** property. When processing has completed, the request returns
* the exported JSON data. Remember that the usual rate limits apply.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {string} [params.sort] - Indicates how the returned workspace data will be sorted. Specify `sort=stable` to
* sort all workspace objects by unique identifier, in ascending alphabetical order.
* @param {boolean} [params.verbose] - Whether the response should include the `counts` property, which indicates how
* many of each component (such as intents and entities) the workspace contains.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Workspace>>}
*/
AssistantV1.prototype.exportWorkspaceAsync = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'includeAudit', 'sort', 'verbose', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
'sort': _params.sort,
'verbose': _params.verbose,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'exportWorkspaceAsync');
var parameters = {
options: {
url: '/v1/workspaces_async/{workspace_id}/export',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* intents
************************/
/**
* List intents.
*
* List the intents for a workspace.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned intents will be sorted. To reverse the sort order,
* prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.IntentCollection>>}
*/
AssistantV1.prototype.listIntents = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', '_export', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listIntents');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create intent.
*
* Create a new intent.
*
* If you want to create multiple intents with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The name of the intent. This string must conform to the following restrictions:
* - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters.
* - It cannot begin with the reserved prefix `sys-`.
* @param {string} [params.description] - The description of the intent. This string cannot contain carriage return,
* newline, or tab characters.
* @param {Example[]} [params.examples] - An array of user input examples for the intent.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Intent>>}
*/
AssistantV1.prototype.createIntent = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent'];
var _validParams = ['workspaceId', 'intent', 'description', 'examples', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'intent': _params.intent,
'description': _params.description,
'examples': _params.examples,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createIntent');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get intent.
*
* Get information about an intent, optionally including all intent content.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Intent>>}
*/
AssistantV1.prototype.getIntent = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent'];
var _validParams = ['workspaceId', 'intent', '_export', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getIntent');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update intent.
*
* Update an existing intent with new or modified data. You must provide component objects defining the content of the
* updated intent.
*
* If you want to update multiple intents with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {string} [params.newIntent] - The name of the intent. This string must conform to the following
* restrictions:
* - It can contain only Unicode alphanumeric, underscore, hyphen, and dot characters.
* - It cannot begin with the reserved prefix `sys-`.
* @param {string} [params.newDescription] - The description of the intent. This string cannot contain carriage
* return, newline, or tab characters.
* @param {Example[]} [params.newExamples] - An array of user input examples for the intent.
* @param {boolean} [params.append] - Whether the new data is to be appended to the existing data in the object. If
* **append**=`false`, elements included in the new data completely replace the corresponding existing elements,
* including all subelements. For example, if the new data for the intent includes **examples** and
* **append**=`false`, all existing examples for the intent are discarded and replaced with the new examples.
*
* If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in the new
* data collide with existing elements, the update request fails.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Intent>>}
*/
AssistantV1.prototype.updateIntent = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent'];
var _validParams = ['workspaceId', 'intent', 'newIntent', 'newDescription', 'newExamples', 'append', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'intent': _params.newIntent,
'description': _params.newDescription,
'examples': _params.newExamples,
};
var query = {
'version': this.version,
'append': _params.append,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateIntent');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete intent.
*
* Delete an intent from a workspace.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteIntent = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent'];
var _validParams = ['workspaceId', 'intent', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteIntent');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* examples
************************/
/**
* List user input examples.
*
* List the user input examples for an intent, optionally including contextual entity mentions.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned examples will be sorted. To reverse the sort order,
* prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.ExampleCollection>>}
*/
AssistantV1.prototype.listExamples = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent'];
var _validParams = ['workspaceId', 'intent', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listExamples');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}/examples',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create user input example.
*
* Add a new user input example to an intent.
*
* If you want to add multiple examples with a single API call, consider using the **[Update intent](#update-intent)**
* method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {string} params.text - The text of a user input example. This string must conform to the following
* restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {Mention[]} [params.mentions] - An array of contextual entity mentions.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Example>>}
*/
AssistantV1.prototype.createExample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent', 'text'];
var _validParams = ['workspaceId', 'intent', 'text', 'mentions', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'text': _params.text,
'mentions': _params.mentions,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createExample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}/examples',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get user input example.
*
* Get information about a user input example.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {string} params.text - The text of the user input example.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Example>>}
*/
AssistantV1.prototype.getExample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent', 'text'];
var _validParams = ['workspaceId', 'intent', 'text', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getExample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}/examples/{text}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update user input example.
*
* Update the text of a user input example.
*
* If you want to update multiple examples with a single API call, consider using the **[Update
* intent](#update-intent)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {string} params.text - The text of the user input example.
* @param {string} [params.newText] - The text of the user input example. This string must conform to the following
* restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {Mention[]} [params.newMentions] - An array of contextual entity mentions.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Example>>}
*/
AssistantV1.prototype.updateExample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent', 'text'];
var _validParams = ['workspaceId', 'intent', 'text', 'newText', 'newMentions', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'text': _params.newText,
'mentions': _params.newMentions,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateExample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}/examples/{text}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete user input example.
*
* Delete a user input example from an intent.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.intent - The intent name.
* @param {string} params.text - The text of the user input example.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteExample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'intent', 'text'];
var _validParams = ['workspaceId', 'intent', 'text', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'intent': _params.intent,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteExample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/intents/{intent}/examples/{text}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* counterexamples
************************/
/**
* List counterexamples.
*
* List the counterexamples for a workspace. Counterexamples are examples that have been marked as irrelevant input.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned counterexamples will be sorted. To reverse the sort
* order, prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.CounterexampleCollection>>}
*/
AssistantV1.prototype.listCounterexamples = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listCounterexamples');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/counterexamples',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create counterexample.
*
* Add a new counterexample to a workspace. Counterexamples are examples that have been marked as irrelevant input.
*
* If you want to add multiple counterexamples with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.text - The text of a user input marked as irrelevant input. This string must conform to the
* following restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Counterexample>>}
*/
AssistantV1.prototype.createCounterexample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'text'];
var _validParams = ['workspaceId', 'text', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'text': _params.text,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createCounterexample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/counterexamples',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get counterexample.
*
* Get information about a counterexample. Counterexamples are examples that have been marked as irrelevant input.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.text - The text of a user input counterexample (for example, `What are you wearing?`).
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Counterexample>>}
*/
AssistantV1.prototype.getCounterexample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'text'];
var _validParams = ['workspaceId', 'text', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getCounterexample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/counterexamples/{text}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update counterexample.
*
* Update the text of a counterexample. Counterexamples are examples that have been marked as irrelevant input.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.text - The text of a user input counterexample (for example, `What are you wearing?`).
* @param {string} [params.newText] - The text of a user input marked as irrelevant input. This string must conform to
* the following restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Counterexample>>}
*/
AssistantV1.prototype.updateCounterexample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'text'];
var _validParams = ['workspaceId', 'text', 'newText', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'text': _params.newText,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateCounterexample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/counterexamples/{text}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete counterexample.
*
* Delete a counterexample from a workspace. Counterexamples are examples that have been marked as irrelevant input.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.text - The text of a user input counterexample (for example, `What are you wearing?`).
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteCounterexample = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'text'];
var _validParams = ['workspaceId', 'text', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'text': _params.text,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteCounterexample');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/counterexamples/{text}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* entities
************************/
/**
* List entities.
*
* List the entities for a workspace.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned entities will be sorted. To reverse the sort order,
* prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EntityCollection>>}
*/
AssistantV1.prototype.listEntities = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', '_export', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listEntities');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create entity.
*
* Create a new entity, or enable a system entity.
*
* If you want to create multiple entities with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity. This string must conform to the following restrictions:
* - It can contain only Unicode alphanumeric, underscore, and hyphen characters.
* - If you specify an entity name beginning with the reserved prefix `sys-`, it must be the name of a system entity
* that you want to enable. (Any entity content specified with the request is ignored.).
* @param {string} [params.description] - The description of the entity. This string cannot contain carriage return,
* newline, or tab characters.
* @param {JsonObject} [params.metadata] - Any metadata related to the entity.
* @param {boolean} [params.fuzzyMatch] - Whether to use fuzzy matching for the entity.
* @param {CreateValue[]} [params.values] - An array of objects describing the entity values.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Entity>>}
*/
AssistantV1.prototype.createEntity = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', 'description', 'metadata', 'fuzzyMatch', 'values', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'entity': _params.entity,
'description': _params.description,
'metadata': _params.metadata,
'fuzzy_match': _params.fuzzyMatch,
'values': _params.values,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createEntity');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get entity.
*
* Get information about an entity, optionally including all entity content.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Entity>>}
*/
AssistantV1.prototype.getEntity = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', '_export', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getEntity');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update entity.
*
* Update an existing entity with new or modified data. You must provide component objects defining the content of the
* updated entity.
*
* If you want to update multiple entities with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} [params.newEntity] - The name of the entity. This string must conform to the following
* restrictions:
* - It can contain only Unicode alphanumeric, underscore, and hyphen characters.
* - It cannot begin with the reserved prefix `sys-`.
* @param {string} [params.newDescription] - The description of the entity. This string cannot contain carriage
* return, newline, or tab characters.
* @param {JsonObject} [params.newMetadata] - Any metadata related to the entity.
* @param {boolean} [params.newFuzzyMatch] - Whether to use fuzzy matching for the entity.
* @param {CreateValue[]} [params.newValues] - An array of objects describing the entity values.
* @param {boolean} [params.append] - Whether the new data is to be appended to the existing data in the entity. If
* **append**=`false`, elements included in the new data completely replace the corresponding existing elements,
* including all subelements. For example, if the new data for the entity includes **values** and **append**=`false`,
* all existing values for the entity are discarded and replaced with the new values.
*
* If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in the new
* data collide with existing elements, the update request fails.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Entity>>}
*/
AssistantV1.prototype.updateEntity = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', 'newEntity', 'newDescription', 'newMetadata', 'newFuzzyMatch', 'newValues', 'append', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'entity': _params.newEntity,
'description': _params.newDescription,
'metadata': _params.newMetadata,
'fuzzy_match': _params.newFuzzyMatch,
'values': _params.newValues,
};
var query = {
'version': this.version,
'append': _params.append,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateEntity');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete entity.
*
* Delete an entity from a workspace, or disable a system entity.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteEntity = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteEntity');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* mentions
************************/
/**
* List entity mentions.
*
* List mentions for a contextual entity. An entity mention is an occurrence of a contextual entity in the context of
* an intent user input example.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EntityMentionCollection>>}
*/
AssistantV1.prototype.listMentions = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', '_export', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listMentions');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/mentions',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* values
************************/
/**
* List entity values.
*
* List the values for an entity.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned entity values will be sorted. To reverse the sort
* order, prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.ValueCollection>>}
*/
AssistantV1.prototype.listValues = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity'];
var _validParams = ['workspaceId', 'entity', '_export', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listValues');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create entity value.
*
* Create a new value for an entity.
*
* If you want to create multiple entity values with a single API call, consider using the **[Update
* entity](#update-entity)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value. This string must conform to the following
* restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {JsonObject} [params.metadata] - Any metadata related to the entity value.
* @param {string} [params.type] - Specifies the type of entity value.
* @param {string[]} [params.synonyms] - An array of synonyms for the entity value. A value can specify either
* synonyms or patterns (depending on the value type), but not both. A synonym must conform to the following
* resrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {string[]} [params.patterns] - An array of patterns for the entity value. A value can specify either
* synonyms or patterns (depending on the value type), but not both. A pattern is a regular expression; for more
* information about how to specify a pattern, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based).
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Value>>}
*/
AssistantV1.prototype.createValue = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value'];
var _validParams = ['workspaceId', 'entity', 'value', 'metadata', 'type', 'synonyms', 'patterns', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'value': _params.value,
'metadata': _params.metadata,
'type': _params.type,
'synonyms': _params.synonyms,
'patterns': _params.patterns,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createValue');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get entity value.
*
* Get information about an entity value.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {boolean} [params._export] - Whether to include all element content in the returned data. If
* **export**=`false`, the returned data includes only information about the element itself. If **export**=`true`, all
* content, including subelements, is included.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Value>>}
*/
AssistantV1.prototype.getValue = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value'];
var _validParams = ['workspaceId', 'entity', 'value', '_export', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'export': _params._export,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getValue');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update entity value.
*
* Update an existing entity value with new or modified data. You must provide component objects defining the content
* of the updated entity value.
*
* If you want to update multiple entity values with a single API call, consider using the **[Update
* entity](#update-entity)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {string} [params.newValue] - The text of the entity value. This string must conform to the following
* restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {JsonObject} [params.newMetadata] - Any metadata related to the entity value.
* @param {string} [params.newType] - Specifies the type of entity value.
* @param {string[]} [params.newSynonyms] - An array of synonyms for the entity value. A value can specify either
* synonyms or patterns (depending on the value type), but not both. A synonym must conform to the following
* resrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {string[]} [params.newPatterns] - An array of patterns for the entity value. A value can specify either
* synonyms or patterns (depending on the value type), but not both. A pattern is a regular expression; for more
* information about how to specify a pattern, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-entities#entities-create-dictionary-based).
* @param {boolean} [params.append] - Whether the new data is to be appended to the existing data in the entity value.
* If **append**=`false`, elements included in the new data completely replace the corresponding existing elements,
* including all subelements. For example, if the new data for the entity value includes **synonyms** and
* **append**=`false`, all existing synonyms for the entity value are discarded and replaced with the new synonyms.
*
* If **append**=`true`, existing elements are preserved, and the new elements are added. If any elements in the new
* data collide with existing elements, the update request fails.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Value>>}
*/
AssistantV1.prototype.updateValue = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value'];
var _validParams = ['workspaceId', 'entity', 'value', 'newValue', 'newMetadata', 'newType', 'newSynonyms', 'newPatterns', 'append', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'value': _params.newValue,
'metadata': _params.newMetadata,
'type': _params.newType,
'synonyms': _params.newSynonyms,
'patterns': _params.newPatterns,
};
var query = {
'version': this.version,
'append': _params.append,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateValue');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete entity value.
*
* Delete a value from an entity.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteValue = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value'];
var _validParams = ['workspaceId', 'entity', 'value', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteValue');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* synonyms
************************/
/**
* List entity value synonyms.
*
* List the synonyms for an entity value.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned entity value synonyms will be sorted. To reverse
* the sort order, prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.SynonymCollection>>}
*/
AssistantV1.prototype.listSynonyms = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value'];
var _validParams = ['workspaceId', 'entity', 'value', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listSynonyms');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}/synonyms',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create entity value synonym.
*
* Add a new synonym to an entity value.
*
* If you want to create multiple synonyms with a single API call, consider using the **[Update
* entity](#update-entity)** or **[Update entity value](#update-entity-value)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {string} params.synonym - The text of the synonym. This string must conform to the following restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Synonym>>}
*/
AssistantV1.prototype.createSynonym = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value', 'synonym'];
var _validParams = ['workspaceId', 'entity', 'value', 'synonym', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'synonym': _params.synonym,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createSynonym');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}/synonyms',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get entity value synonym.
*
* Get information about a synonym of an entity value.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {string} params.synonym - The text of the synonym.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Synonym>>}
*/
AssistantV1.prototype.getSynonym = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value', 'synonym'];
var _validParams = ['workspaceId', 'entity', 'value', 'synonym', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
'synonym': _params.synonym,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getSynonym');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}/synonyms/{synonym}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update entity value synonym.
*
* Update an existing entity value synonym with new text.
*
* If you want to update multiple synonyms with a single API call, consider using the **[Update
* entity](#update-entity)** or **[Update entity value](#update-entity-value)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {string} params.synonym - The text of the synonym.
* @param {string} [params.newSynonym] - The text of the synonym. This string must conform to the following
* restrictions:
* - It cannot contain carriage return, newline, or tab characters.
* - It cannot consist of only whitespace characters.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.Synonym>>}
*/
AssistantV1.prototype.updateSynonym = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value', 'synonym'];
var _validParams = ['workspaceId', 'entity', 'value', 'synonym', 'newSynonym', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'synonym': _params.newSynonym,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
'synonym': _params.synonym,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateSynonym');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}/synonyms/{synonym}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete entity value synonym.
*
* Delete a synonym from an entity value.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.entity - The name of the entity.
* @param {string} params.value - The text of the entity value.
* @param {string} params.synonym - The text of the synonym.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteSynonym = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'entity', 'value', 'synonym'];
var _validParams = ['workspaceId', 'entity', 'value', 'synonym', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'entity': _params.entity,
'value': _params.value,
'synonym': _params.synonym,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteSynonym');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/entities/{entity}/values/{value}/synonyms/{synonym}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* dialogNodes
************************/
/**
* List dialog nodes.
*
* List the dialog nodes for a workspace.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {boolean} [params.includeCount] - Whether to include information about the number of records that satisfy
* the request, regardless of the page limit. If this parameter is `true`, the `pagination` object in the response
* includes the `total` property.
* @param {string} [params.sort] - The attribute by which returned dialog nodes will be sorted. To reverse the sort
* order, prefix the value with a minus sign (`-`).
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.DialogNodeCollection>>}
*/
AssistantV1.prototype.listDialogNodes = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'pageLimit', 'includeCount', 'sort', 'cursor', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'page_limit': _params.pageLimit,
'include_count': _params.includeCount,
'sort': _params.sort,
'cursor': _params.cursor,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listDialogNodes');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/dialog_nodes',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Create dialog node.
*
* Create a new dialog node.
*
* If you want to create multiple dialog nodes with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.dialogNode - The unique ID of the dialog node. This is an internal identifier used to refer
* to the dialog node from other dialog nodes and in the diagnostic information included with message responses.
*
* This string can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters.
* @param {string} [params.description] - The description of the dialog node. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.conditions] - The condition that will trigger the dialog node. This string cannot contain
* carriage return, newline, or tab characters.
* @param {string} [params.parent] - The unique ID of the parent dialog node. This property is omitted if the dialog
* node has no parent.
* @param {string} [params.previousSibling] - The unique ID of the previous sibling dialog node. This property is
* omitted if the dialog node has no previous sibling.
* @param {DialogNodeOutput} [params.output] - The output of the dialog node. For more information about how to
* specify dialog node output, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses).
* @param {DialogNodeContext} [params.context] - The context for the dialog node.
* @param {JsonObject} [params.metadata] - The metadata for the dialog node.
* @param {DialogNodeNextStep} [params.nextStep] - The next step to execute following this dialog node.
* @param {string} [params.title] - A human-readable name for the dialog node. If the node is included in
* disambiguation, this title is used to populate the **label** property of the corresponding suggestion in the
* `suggestion` response type (unless it is overridden by the **user_label** property). The title is also used to
* populate the **topic** property in the `connect_to_agent` response type.
*
* This string can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters.
* @param {string} [params.type] - How the dialog node is processed.
* @param {string} [params.eventName] - How an `event_handler` node is processed.
* @param {string} [params.variable] - The location in the dialog context where output is stored.
* @param {DialogNodeAction[]} [params.actions] - An array of objects describing any actions to be invoked by the
* dialog node.
* @param {string} [params.digressIn] - Whether this top-level dialog node can be digressed into.
* @param {string} [params.digressOut] - Whether this dialog node can be returned to after a digression.
* @param {string} [params.digressOutSlots] - Whether the user can digress to top-level nodes while filling out slots.
* @param {string} [params.userLabel] - A label that can be displayed externally to describe the purpose of the node
* to users. If set, this label is used to identify the node in disambiguation responses (overriding the value of the
* **title** property).
* @param {boolean} [params.disambiguationOptOut] - Whether the dialog node should be excluded from disambiguation
* suggestions. Valid only when **type**=`standard` or `frame`.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.DialogNode>>}
*/
AssistantV1.prototype.createDialogNode = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'dialogNode'];
var _validParams = ['workspaceId', 'dialogNode', 'description', 'conditions', 'parent', 'previousSibling', 'output', 'context', 'metadata', 'nextStep', 'title', 'type', 'eventName', 'variable', 'actions', 'digressIn', 'digressOut', 'digressOutSlots', 'userLabel', 'disambiguationOptOut', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'dialog_node': _params.dialogNode,
'description': _params.description,
'conditions': _params.conditions,
'parent': _params.parent,
'previous_sibling': _params.previousSibling,
'output': _params.output,
'context': _params.context,
'metadata': _params.metadata,
'next_step': _params.nextStep,
'title': _params.title,
'type': _params.type,
'event_name': _params.eventName,
'variable': _params.variable,
'actions': _params.actions,
'digress_in': _params.digressIn,
'digress_out': _params.digressOut,
'digress_out_slots': _params.digressOutSlots,
'user_label': _params.userLabel,
'disambiguation_opt_out': _params.disambiguationOptOut,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'createDialogNode');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/dialog_nodes',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Get dialog node.
*
* Get information about a dialog node.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.dialogNode - The dialog node ID (for example, `node_1_1479323581900`).
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.DialogNode>>}
*/
AssistantV1.prototype.getDialogNode = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'dialogNode'];
var _validParams = ['workspaceId', 'dialogNode', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'dialog_node': _params.dialogNode,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'getDialogNode');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Update dialog node.
*
* Update an existing dialog node with new or modified data.
*
* If you want to update multiple dialog nodes with a single API call, consider using the **[Update
* workspace](#update-workspace)** method instead.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.dialogNode - The dialog node ID (for example, `node_1_1479323581900`).
* @param {string} [params.newDialogNode] - The unique ID of the dialog node. This is an internal identifier used to
* refer to the dialog node from other dialog nodes and in the diagnostic information included with message responses.
*
* This string can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters.
* @param {string} [params.newDescription] - The description of the dialog node. This string cannot contain carriage
* return, newline, or tab characters.
* @param {string} [params.newConditions] - The condition that will trigger the dialog node. This string cannot
* contain carriage return, newline, or tab characters.
* @param {string} [params.newParent] - The unique ID of the parent dialog node. This property is omitted if the
* dialog node has no parent.
* @param {string} [params.newPreviousSibling] - The unique ID of the previous sibling dialog node. This property is
* omitted if the dialog node has no previous sibling.
* @param {DialogNodeOutput} [params.newOutput] - The output of the dialog node. For more information about how to
* specify dialog node output, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses).
* @param {DialogNodeContext} [params.newContext] - The context for the dialog node.
* @param {JsonObject} [params.newMetadata] - The metadata for the dialog node.
* @param {DialogNodeNextStep} [params.newNextStep] - The next step to execute following this dialog node.
* @param {string} [params.newTitle] - A human-readable name for the dialog node. If the node is included in
* disambiguation, this title is used to populate the **label** property of the corresponding suggestion in the
* `suggestion` response type (unless it is overridden by the **user_label** property). The title is also used to
* populate the **topic** property in the `connect_to_agent` response type.
*
* This string can contain only Unicode alphanumeric, space, underscore, hyphen, and dot characters.
* @param {string} [params.newType] - How the dialog node is processed.
* @param {string} [params.newEventName] - How an `event_handler` node is processed.
* @param {string} [params.newVariable] - The location in the dialog context where output is stored.
* @param {DialogNodeAction[]} [params.newActions] - An array of objects describing any actions to be invoked by the
* dialog node.
* @param {string} [params.newDigressIn] - Whether this top-level dialog node can be digressed into.
* @param {string} [params.newDigressOut] - Whether this dialog node can be returned to after a digression.
* @param {string} [params.newDigressOutSlots] - Whether the user can digress to top-level nodes while filling out
* slots.
* @param {string} [params.newUserLabel] - A label that can be displayed externally to describe the purpose of the
* node to users. If set, this label is used to identify the node in disambiguation responses (overriding the value of
* the **title** property).
* @param {boolean} [params.newDisambiguationOptOut] - Whether the dialog node should be excluded from disambiguation
* suggestions. Valid only when **type**=`standard` or `frame`.
* @param {boolean} [params.includeAudit] - Whether to include the audit properties (`created` and `updated`
* timestamps) in the response.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.DialogNode>>}
*/
AssistantV1.prototype.updateDialogNode = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'dialogNode'];
var _validParams = ['workspaceId', 'dialogNode', 'newDialogNode', 'newDescription', 'newConditions', 'newParent', 'newPreviousSibling', 'newOutput', 'newContext', 'newMetadata', 'newNextStep', 'newTitle', 'newType', 'newEventName', 'newVariable', 'newActions', 'newDigressIn', 'newDigressOut', 'newDigressOutSlots', 'newUserLabel', 'newDisambiguationOptOut', 'includeAudit', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var body = {
'dialog_node': _params.newDialogNode,
'description': _params.newDescription,
'conditions': _params.newConditions,
'parent': _params.newParent,
'previous_sibling': _params.newPreviousSibling,
'output': _params.newOutput,
'context': _params.newContext,
'metadata': _params.newMetadata,
'next_step': _params.newNextStep,
'title': _params.newTitle,
'type': _params.newType,
'event_name': _params.newEventName,
'variable': _params.newVariable,
'actions': _params.newActions,
'digress_in': _params.newDigressIn,
'digress_out': _params.newDigressOut,
'digress_out_slots': _params.newDigressOutSlots,
'user_label': _params.newUserLabel,
'disambiguation_opt_out': _params.newDisambiguationOptOut,
};
var query = {
'version': this.version,
'include_audit': _params.includeAudit,
};
var path = {
'workspace_id': _params.workspaceId,
'dialog_node': _params.dialogNode,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'updateDialogNode');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}',
method: 'POST',
body: body,
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
'Content-Type': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* Delete dialog node.
*
* Delete a dialog node from a workspace.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} params.dialogNode - The dialog node ID (for example, `node_1_1479323581900`).
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteDialogNode = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId', 'dialogNode'];
var _validParams = ['workspaceId', 'dialogNode', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
};
var path = {
'workspace_id': _params.workspaceId,
'dialog_node': _params.dialogNode,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteDialogNode');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/dialog_nodes/{dialog_node}',
method: 'DELETE',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* logs
************************/
/**
* List log events in a workspace.
*
* List the events from the log of a specific workspace.
*
* This method requires Manager access.
*
* **Note:** If you use the **cursor** parameter to retrieve results one page at a time, subsequent requests must be
* no more than 5 minutes apart. Any returned value for the **cursor** parameter becomes invalid after 5 minutes. For
* more information about using pagination, see [Pagination](#pagination).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.workspaceId - Unique identifier of the workspace.
* @param {string} [params.sort] - How to sort the returned log events. You can sort by **request_timestamp**. To
* reverse the sort order, prefix the parameter value with a minus sign (`-`).
* @param {string} [params.filter] - A cacheable parameter that limits the results to those matching the specified
* filter. For more information, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference).
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
*
* **Note:** If the API is not returning your data, try lowering the page_limit value.
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.LogCollection>>}
*/
AssistantV1.prototype.listLogs = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['workspaceId'];
var _validParams = ['workspaceId', 'sort', 'filter', 'pageLimit', 'cursor', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'sort': _params.sort,
'filter': _params.filter,
'page_limit': _params.pageLimit,
'cursor': _params.cursor,
};
var path = {
'workspace_id': _params.workspaceId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listLogs');
var parameters = {
options: {
url: '/v1/workspaces/{workspace_id}/logs',
method: 'GET',
qs: query,
path: path,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/**
* List log events in all workspaces.
*
* List the events from the logs of all workspaces in the service instance.
*
* **Note:** If you use the **cursor** parameter to retrieve results one page at a time, subsequent requests must be
* no more than 5 minutes apart. Any returned value for the **cursor** parameter becomes invalid after 5 minutes. For
* more information about using pagination, see [Pagination](#pagination).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.filter - A cacheable parameter that limits the results to those matching the specified
* filter. You must specify a filter query that includes a value for `language`, as well as a value for
* `request.context.system.assistant_id`, `workspace_id`, or `request.context.metadata.deployment`. These required
* filters must be specified using the exact match (`::`) operator. For more information, see the
* [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-filter-reference#filter-reference).
* @param {string} [params.sort] - How to sort the returned log events. You can sort by **request_timestamp**. To
* reverse the sort order, prefix the parameter value with a minus sign (`-`).
* @param {number} [params.pageLimit] - The number of records to return in each page of results.
* @param {string} [params.cursor] - A token identifying the page of results to retrieve.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.LogCollection>>}
*/
AssistantV1.prototype.listAllLogs = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['filter'];
var _validParams = ['filter', 'sort', 'pageLimit', 'cursor', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'filter': _params.filter,
'sort': _params.sort,
'page_limit': _params.pageLimit,
'cursor': _params.cursor,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'listAllLogs');
var parameters = {
options: {
url: '/v1/logs',
method: 'GET',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
/*************************
* userData
************************/
/**
* Delete labeled data.
*
* Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with
* the customer ID.
*
* You associate a customer ID with data by passing the `X-Watson-Metadata` header with a request that passes data.
* For more information about personal data and customer IDs, see [Information
* security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security).
*
* **Note:** This operation is intended only for deleting data associated with a single specific customer, not for
* deleting data associated with multiple customers or for any other purpose. For more information, see [Labeling and
* deleting data in Watson
* Assistant](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security-gdpr-wa).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.customerId - The customer ID for which all data is to be deleted.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<AssistantV1.Response<AssistantV1.EmptyObject>>}
*/
AssistantV1.prototype.deleteUserData = function (params) {
var _params = __assign({}, params);
var _requiredParams = ['customerId'];
var _validParams = ['customerId', 'headers'];
var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}
var query = {
'version': this.version,
'customer_id': _params.customerId,
};
var sdkHeaders = (0, common_1.getSdkHeaders)(AssistantV1.DEFAULT_SERVICE_NAME, 'v1', 'deleteUserData');
var parameters = {
options: {
url: '/v1/user_data',
method: 'DELETE',
qs: query,
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
}, _params.headers),
}),
};
return this.createRequest(parameters);
};
AssistantV1.DEFAULT_SERVICE_URL = 'https://api.us-south.assistant.watson.cloud.ibm.com';
AssistantV1.DEFAULT_SERVICE_NAME = 'conversation';
return AssistantV1;
}(ibm_cloud_sdk_core_1.BaseService));
/*************************
* interfaces
************************/
(function (AssistantV1) {
/** Constants for the `listWorkspaces` operation. */
var ListWorkspacesConstants;
(function (ListWorkspacesConstants) {
/** The attribute by which returned workspaces will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["NAME"] = "name";
Sort["UPDATED"] = "updated";
})(Sort = ListWorkspacesConstants.Sort || (ListWorkspacesConstants.Sort = {}));
})(ListWorkspacesConstants = AssistantV1.ListWorkspacesConstants || (AssistantV1.ListWorkspacesConstants = {}));
/** Constants for the `getWorkspace` operation. */
var GetWorkspaceConstants;
(function (GetWorkspaceConstants) {
/** Indicates how the returned workspace data will be sorted. This parameter is valid only if **export**=`true`. Specify `sort=stable` to sort all workspace objects by unique identifier, in ascending alphabetical order. */
var Sort;
(function (Sort) {
Sort["STABLE"] = "stable";
})(Sort = GetWorkspaceConstants.Sort || (GetWorkspaceConstants.Sort = {}));
})(GetWorkspaceConstants = AssistantV1.GetWorkspaceConstants || (AssistantV1.GetWorkspaceConstants = {}));
/** Constants for the `exportWorkspaceAsync` operation. */
var ExportWorkspaceAsyncConstants;
(function (ExportWorkspaceAsyncConstants) {
/** Indicates how the returned workspace data will be sorted. Specify `sort=stable` to sort all workspace objects by unique identifier, in ascending alphabetical order. */
var Sort;
(function (Sort) {
Sort["STABLE"] = "stable";
})(Sort = ExportWorkspaceAsyncConstants.Sort || (ExportWorkspaceAsyncConstants.Sort = {}));
})(ExportWorkspaceAsyncConstants = AssistantV1.ExportWorkspaceAsyncConstants || (AssistantV1.ExportWorkspaceAsyncConstants = {}));
/** Constants for the `listIntents` operation. */
var ListIntentsConstants;
(function (ListIntentsConstants) {
/** The attribute by which returned intents will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["INTENT"] = "intent";
Sort["UPDATED"] = "updated";
})(Sort = ListIntentsConstants.Sort || (ListIntentsConstants.Sort = {}));
})(ListIntentsConstants = AssistantV1.ListIntentsConstants || (AssistantV1.ListIntentsConstants = {}));
/** Constants for the `listExamples` operation. */
var ListExamplesConstants;
(function (ListExamplesConstants) {
/** The attribute by which returned examples will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["TEXT"] = "text";
Sort["UPDATED"] = "updated";
})(Sort = ListExamplesConstants.Sort || (ListExamplesConstants.Sort = {}));
})(ListExamplesConstants = AssistantV1.ListExamplesConstants || (AssistantV1.ListExamplesConstants = {}));
/** Constants for the `listCounterexamples` operation. */
var ListCounterexamplesConstants;
(function (ListCounterexamplesConstants) {
/** The attribute by which returned counterexamples will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["TEXT"] = "text";
Sort["UPDATED"] = "updated";
})(Sort = ListCounterexamplesConstants.Sort || (ListCounterexamplesConstants.Sort = {}));
})(ListCounterexamplesConstants = AssistantV1.ListCounterexamplesConstants || (AssistantV1.ListCounterexamplesConstants = {}));
/** Constants for the `listEntities` operation. */
var ListEntitiesConstants;
(function (ListEntitiesConstants) {
/** The attribute by which returned entities will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["ENTITY"] = "entity";
Sort["UPDATED"] = "updated";
})(Sort = ListEntitiesConstants.Sort || (ListEntitiesConstants.Sort = {}));
})(ListEntitiesConstants = AssistantV1.ListEntitiesConstants || (AssistantV1.ListEntitiesConstants = {}));
/** Constants for the `listValues` operation. */
var ListValuesConstants;
(function (ListValuesConstants) {
/** The attribute by which returned entity values will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["VALUE"] = "value";
Sort["UPDATED"] = "updated";
})(Sort = ListValuesConstants.Sort || (ListValuesConstants.Sort = {}));
})(ListValuesConstants = AssistantV1.ListValuesConstants || (AssistantV1.ListValuesConstants = {}));
/** Constants for the `createValue` operation. */
var CreateValueConstants;
(function (CreateValueConstants) {
/** Specifies the type of entity value. */
var Type;
(function (Type) {
Type["SYNONYMS"] = "synonyms";
Type["PATTERNS"] = "patterns";
})(Type = CreateValueConstants.Type || (CreateValueConstants.Type = {}));
})(CreateValueConstants = AssistantV1.CreateValueConstants || (AssistantV1.CreateValueConstants = {}));
/** Constants for the `updateValue` operation. */
var UpdateValueConstants;
(function (UpdateValueConstants) {
/** Specifies the type of entity value. */
var Type;
(function (Type) {
Type["SYNONYMS"] = "synonyms";
Type["PATTERNS"] = "patterns";
})(Type = UpdateValueConstants.Type || (UpdateValueConstants.Type = {}));
})(UpdateValueConstants = AssistantV1.UpdateValueConstants || (AssistantV1.UpdateValueConstants = {}));
/** Constants for the `listSynonyms` operation. */
var ListSynonymsConstants;
(function (ListSynonymsConstants) {
/** The attribute by which returned entity value synonyms will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["SYNONYM"] = "synonym";
Sort["UPDATED"] = "updated";
})(Sort = ListSynonymsConstants.Sort || (ListSynonymsConstants.Sort = {}));
})(ListSynonymsConstants = AssistantV1.ListSynonymsConstants || (AssistantV1.ListSynonymsConstants = {}));
/** Constants for the `listDialogNodes` operation. */
var ListDialogNodesConstants;
(function (ListDialogNodesConstants) {
/** The attribute by which returned dialog nodes will be sorted. To reverse the sort order, prefix the value with a minus sign (`-`). */
var Sort;
(function (Sort) {
Sort["DIALOG_NODE"] = "dialog_node";
Sort["UPDATED"] = "updated";
})(Sort = ListDialogNodesConstants.Sort || (ListDialogNodesConstants.Sort = {}));
})(ListDialogNodesConstants = AssistantV1.ListDialogNodesConstants || (AssistantV1.ListDialogNodesConstants = {}));
/** Constants for the `createDialogNode` operation. */
var CreateDialogNodeConstants;
(function (CreateDialogNodeConstants) {
/** How the dialog node is processed. */
var Type;
(function (Type) {
Type["STANDARD"] = "standard";
Type["EVENT_HANDLER"] = "event_handler";
Type["FRAME"] = "frame";
Type["SLOT"] = "slot";
Type["RESPONSE_CONDITION"] = "response_condition";
Type["FOLDER"] = "folder";
})(Type = CreateDialogNodeConstants.Type || (CreateDialogNodeConstants.Type = {}));
/** How an `event_handler` node is processed. */
var EventName;
(function (EventName) {
EventName["FOCUS"] = "focus";
EventName["INPUT"] = "input";
EventName["FILLED"] = "filled";
EventName["VALIDATE"] = "validate";
EventName["FILLED_MULTIPLE"] = "filled_multiple";
EventName["GENERIC"] = "generic";
EventName["NOMATCH"] = "nomatch";
EventName["NOMATCH_RESPONSES_DEPLETED"] = "nomatch_responses_depleted";
EventName["DIGRESSION_RETURN_PROMPT"] = "digression_return_prompt";
})(EventName = CreateDialogNodeConstants.EventName || (CreateDialogNodeConstants.EventName = {}));
/** Whether this top-level dialog node can be digressed into. */
var DigressIn;
(function (DigressIn) {
DigressIn["NOT_AVAILABLE"] = "not_available";
DigressIn["RETURNS"] = "returns";
DigressIn["DOES_NOT_RETURN"] = "does_not_return";
})(DigressIn = CreateDialogNodeConstants.DigressIn || (CreateDialogNodeConstants.DigressIn = {}));
/** Whether this dialog node can be returned to after a digression. */
var DigressOut;
(function (DigressOut) {
DigressOut["ALLOW_RETURNING"] = "allow_returning";
DigressOut["ALLOW_ALL"] = "allow_all";
DigressOut["ALLOW_ALL_NEVER_RETURN"] = "allow_all_never_return";
})(DigressOut = CreateDialogNodeConstants.DigressOut || (CreateDialogNodeConstants.DigressOut = {}));
/** Whether the user can digress to top-level nodes while filling out slots. */
var DigressOutSlots;
(function (DigressOutSlots) {
DigressOutSlots["NOT_ALLOWED"] = "not_allowed";
DigressOutSlots["ALLOW_RETURNING"] = "allow_returning";
DigressOutSlots["ALLOW_ALL"] = "allow_all";
})(DigressOutSlots = CreateDialogNodeConstants.DigressOutSlots || (CreateDialogNodeConstants.DigressOutSlots = {}));
})(CreateDialogNodeConstants = AssistantV1.CreateDialogNodeConstants || (AssistantV1.CreateDialogNodeConstants = {}));
/** Constants for the `updateDialogNode` operation. */
var UpdateDialogNodeConstants;
(function (UpdateDialogNodeConstants) {
/** How the dialog node is processed. */
var Type;
(function (Type) {
Type["STANDARD"] = "standard";
Type["EVENT_HANDLER"] = "event_handler";
Type["FRAME"] = "frame";
Type["SLOT"] = "slot";
Type["RESPONSE_CONDITION"] = "response_condition";
Type["FOLDER"] = "folder";
})(Type = UpdateDialogNodeConstants.Type || (UpdateDialogNodeConstants.Type = {}));
/** How an `event_handler` node is processed. */
var EventName;
(function (EventName) {
EventName["FOCUS"] = "focus";
EventName["INPUT"] = "input";
EventName["FILLED"] = "filled";
EventName["VALIDATE"] = "validate";
EventName["FILLED_MULTIPLE"] = "filled_multiple";
EventName["GENERIC"] = "generic";
EventName["NOMATCH"] = "nomatch";
EventName["NOMATCH_RESPONSES_DEPLETED"] = "nomatch_responses_depleted";
EventName["DIGRESSION_RETURN_PROMPT"] = "digression_return_prompt";
})(EventName = UpdateDialogNodeConstants.EventName || (UpdateDialogNodeConstants.EventName = {}));
/** Whether this top-level dialog node can be digressed into. */
var DigressIn;
(function (DigressIn) {
DigressIn["NOT_AVAILABLE"] = "not_available";
DigressIn["RETURNS"] = "returns";
DigressIn["DOES_NOT_RETURN"] = "does_not_return";
})(DigressIn = UpdateDialogNodeConstants.DigressIn || (UpdateDialogNodeConstants.DigressIn = {}));
/** Whether this dialog node can be returned to after a digression. */
var DigressOut;
(function (DigressOut) {
DigressOut["ALLOW_RETURNING"] = "allow_returning";
DigressOut["ALLOW_ALL"] = "allow_all";
DigressOut["ALLOW_ALL_NEVER_RETURN"] = "allow_all_never_return";
})(DigressOut = UpdateDialogNodeConstants.DigressOut || (UpdateDialogNodeConstants.DigressOut = {}));
/** Whether the user can digress to top-level nodes while filling out slots. */
var DigressOutSlots;
(function (DigressOutSlots) {
DigressOutSlots["NOT_ALLOWED"] = "not_allowed";
DigressOutSlots["ALLOW_RETURNING"] = "allow_returning";
DigressOutSlots["ALLOW_ALL"] = "allow_all";
})(DigressOutSlots = UpdateDialogNodeConstants.DigressOutSlots || (UpdateDialogNodeConstants.DigressOutSlots = {}));
})(UpdateDialogNodeConstants = AssistantV1.UpdateDialogNodeConstants || (AssistantV1.UpdateDialogNodeConstants = {}));
var CreateValue;
(function (CreateValue) {
var Constants;
(function (Constants) {
/** Specifies the type of entity value. */
var Type;
(function (Type) {
Type["SYNONYMS"] = "synonyms";
Type["PATTERNS"] = "patterns";
})(Type = Constants.Type || (Constants.Type = {}));
})(Constants = CreateValue.Constants || (CreateValue.Constants = {}));
})(CreateValue = AssistantV1.CreateValue || (AssistantV1.CreateValue = {}));
var DialogNode;
(function (DialogNode) {
var Constants;
(function (Constants) {
/** How the dialog node is processed. */
var Type;
(function (Type) {
Type["STANDARD"] = "standard";
Type["EVENT_HANDLER"] = "event_handler";
Type["FRAME"] = "frame";
Type["SLOT"] = "slot";
Type["RESPONSE_CONDITION"] = "response_condition";
Type["FOLDER"] = "folder";
})(Type = Constants.Type || (Constants.Type = {}));
/** How an `event_handler` node is processed. */
var EventName;
(function (EventName) {
EventName["FOCUS"] = "focus";
EventName["INPUT"] = "input";
EventName["FILLED"] = "filled";
EventName["VALIDATE"] = "validate";
EventName["FILLED_MULTIPLE"] = "filled_multiple";
EventName["GENERIC"] = "generic";
EventName["NOMATCH"] = "nomatch";
EventName["NOMATCH_RESPONSES_DEPLETED"] = "nomatch_responses_depleted";
EventName["DIGRESSION_RETURN_PROMPT"] = "digression_return_prompt";
})(EventName = Constants.EventName || (Constants.EventName = {}));
/** Whether this top-level dialog node can be digressed into. */
var DigressIn;
(function (DigressIn) {
DigressIn["NOT_AVAILABLE"] = "not_available";
DigressIn["RETURNS"] = "returns";
DigressIn["DOES_NOT_RETURN"] = "does_not_return";
})(DigressIn = Constants.DigressIn || (Constants.DigressIn = {}));
/** Whether this dialog node can be returned to after a digression. */
var DigressOut;
(function (DigressOut) {
DigressOut["ALLOW_RETURNING"] = "allow_returning";
DigressOut["ALLOW_ALL"] = "allow_all";
DigressOut["ALLOW_ALL_NEVER_RETURN"] = "allow_all_never_return";
})(DigressOut = Constants.DigressOut || (Constants.DigressOut = {}));
/** Whether the user can digress to top-level nodes while filling out slots. */
var DigressOutSlots;
(function (DigressOutSlots) {
DigressOutSlots["NOT_ALLOWED"] = "not_allowed";
DigressOutSlots["ALLOW_RETURNING"] = "allow_returning";
DigressOutSlots["ALLOW_ALL"] = "allow_all";
})(DigressOutSlots = Constants.DigressOutSlots || (Constants.DigressOutSlots = {}));
})(Constants = DialogNode.Constants || (DialogNode.Constants = {}));
})(DialogNode = AssistantV1.DialogNode || (AssistantV1.DialogNode = {}));
var DialogNodeAction;
(function (DialogNodeAction) {
var Constants;
(function (Constants) {
/** The type of action to invoke. */
var Type;
(function (Type) {
Type["CLIENT"] = "client";
Type["SERVER"] = "server";
Type["CLOUD_FUNCTION"] = "cloud_function";
Type["WEB_ACTION"] = "web_action";
Type["WEBHOOK"] = "webhook";
})(Type = Constants.Type || (Constants.Type = {}));
})(Constants = DialogNodeAction.Constants || (DialogNodeAction.Constants = {}));
})(DialogNodeAction = AssistantV1.DialogNodeAction || (AssistantV1.DialogNodeAction = {}));
var DialogNodeNextStep;
(function (DialogNodeNextStep) {
var Constants;
(function (Constants) {
/** What happens after the dialog node completes. The valid values depend on the node type: - The following values are valid for any node: - `get_user_input` - `skip_user_input` - `jump_to` - If the node is of type `event_handler` and its parent node is of type `slot` or `frame`, additional values are also valid: - if **event_name**=`filled` and the type of the parent node is `slot`: - `reprompt` - `skip_all_slots` - if **event_name**=`nomatch` and the type of the parent node is `slot`: - `reprompt` - `skip_slot` - `skip_all_slots` - if **event_name**=`generic` and the type of the parent node is `frame`: - `reprompt` - `skip_slot` - `skip_all_slots` If you specify `jump_to`, then you must also specify a value for the `dialog_node` property. */
var Behavior;
(function (Behavior) {
Behavior["GET_USER_INPUT"] = "get_user_input";
Behavior["SKIP_USER_INPUT"] = "skip_user_input";
Behavior["JUMP_TO"] = "jump_to";
Behavior["REPROMPT"] = "reprompt";
Behavior["SKIP_SLOT"] = "skip_slot";
Behavior["SKIP_ALL_SLOTS"] = "skip_all_slots";
})(Behavior = Constants.Behavior || (Constants.Behavior = {}));
/** Which part of the dialog node to process next. */
var Selector;
(function (Selector) {
Selector["CONDITION"] = "condition";
Selector["CLIENT"] = "client";
Selector["USER_INPUT"] = "user_input";
Selector["BODY"] = "body";
})(Selector = Constants.Selector || (Constants.Selector = {}));
})(Constants = DialogNodeNextStep.Constants || (DialogNodeNextStep.Constants = {}));
})(DialogNodeNextStep = AssistantV1.DialogNodeNextStep || (AssistantV1.DialogNodeNextStep = {}));
var LogMessage;
(function (LogMessage) {
var Constants;
(function (Constants) {
/** The severity of the log message. */
var Level;
(function (Level) {
Level["INFO"] = "info";
Level["ERROR"] = "error";
Level["WARN"] = "warn";
})(Level = Constants.Level || (Constants.Level = {}));
})(Constants = LogMessage.Constants || (LogMessage.Constants = {}));
})(LogMessage = AssistantV1.LogMessage || (AssistantV1.LogMessage = {}));
var LogMessageSource;
(function (LogMessageSource) {
var Constants;
(function (Constants) {
/** A string that indicates the type of dialog element that generated the error message. */
var Type;
(function (Type) {
Type["DIALOG_NODE"] = "dialog_node";
})(Type = Constants.Type || (Constants.Type = {}));
})(Constants = LogMessageSource.Constants || (LogMessageSource.Constants = {}));
})(LogMessageSource = AssistantV1.LogMessageSource || (AssistantV1.LogMessageSource = {}));
var ResponseGenericChannel;
(function (ResponseGenericChannel) {
var Constants;
(function (Constants) {
/** A channel for which the response is intended. **Note:** On IBM Cloud Pak for Data, only `chat` is supported. */
var Channel;
(function (Channel) {
Channel["CHAT"] = "chat";
Channel["FACEBOOK"] = "facebook";
Channel["INTERCOM"] = "intercom";
Channel["SLACK"] = "slack";
Channel["TEXT_MESSAGING"] = "text_messaging";
Channel["VOICE_TELEPHONY"] = "voice_telephony";
Channel["WHATSAPP"] = "whatsapp";
})(Channel = Constants.Channel || (Constants.Channel = {}));
})(Constants = ResponseGenericChannel.Constants || (ResponseGenericChannel.Constants = {}));
})(ResponseGenericChannel = AssistantV1.ResponseGenericChannel || (AssistantV1.ResponseGenericChannel = {}));
var RuntimeEntityInterpretation;
(function (RuntimeEntityInterpretation) {
var Constants;
(function (Constants) {
/** The precision or duration of a time range specified by a recognized `@sys-time` or `@sys-date` entity. */
var Granularity;
(function (Granularity) {
Granularity["DAY"] = "day";
Granularity["FORTNIGHT"] = "fortnight";
Granularity["HOUR"] = "hour";
Granularity["INSTANT"] = "instant";
Granularity["MINUTE"] = "minute";
Granularity["MONTH"] = "month";
Granularity["QUARTER"] = "quarter";
Granularity["SECOND"] = "second";
Granularity["WEEK"] = "week";
Granularity["WEEKEND"] = "weekend";
Granularity["YEAR"] = "year";
})(Granularity = Constants.Granularity || (Constants.Granularity = {}));
})(Constants = RuntimeEntityInterpretation.Constants || (RuntimeEntityInterpretation.Constants = {}));
})(RuntimeEntityInterpretation = AssistantV1.RuntimeEntityInterpretation || (AssistantV1.RuntimeEntityInterpretation = {}));
var RuntimeEntityRole;
(function (RuntimeEntityRole) {
var Constants;
(function (Constants) {
/** The relationship of the entity to the range. */
var Type;
(function (Type) {
Type["DATE_FROM"] = "date_from";
Type["DATE_TO"] = "date_to";
Type["NUMBER_FROM"] = "number_from";
Type["NUMBER_TO"] = "number_to";
Type["TIME_FROM"] = "time_from";
Type["TIME_TO"] = "time_to";
})(Type = Constants.Type || (Constants.Type = {}));
})(Constants = RuntimeEntityRole.Constants || (RuntimeEntityRole.Constants = {}));
})(RuntimeEntityRole = AssistantV1.RuntimeEntityRole || (AssistantV1.RuntimeEntityRole = {}));
var Value;
(function (Value) {
var Constants;
(function (Constants) {
/** Specifies the type of entity value. */
var Type;
(function (Type) {
Type["SYNONYMS"] = "synonyms";
Type["PATTERNS"] = "patterns";
})(Type = Constants.Type || (Constants.Type = {}));
})(Constants = Value.Constants || (Value.Constants = {}));
})(Value = AssistantV1.Value || (AssistantV1.Value = {}));
var Workspace;
(function (Workspace) {
var Constants;
(function (Constants) {
/** The current status of the workspace: - **Available**: The workspace is available and ready to process messages. - **Failed**: An asynchronous operation has failed. See the **status_errors** property for more information about the cause of the failure. - **Non Existent**: The workspace does not exist. - **Processing**: An asynchronous operation has not yet completed. - **Training**: The workspace is training based on new data such as intents or examples. */
var Status;
(function (Status) {
Status["AVAILABLE"] = "Available";
Status["FAILED"] = "Failed";
Status["NON_EXISTENT"] = "Non Existent";
Status["PROCESSING"] = "Processing";
Status["TRAINING"] = "Training";
Status["UNAVAILABLE"] = "Unavailable";
})(Status = Constants.Status || (Constants.Status = {}));
})(Constants = Workspace.Constants || (Workspace.Constants = {}));
})(Workspace = AssistantV1.Workspace || (AssistantV1.Workspace = {}));
var WorkspaceSystemSettingsDisambiguation;
(function (WorkspaceSystemSettingsDisambiguation) {
var Constants;
(function (Constants) {
/** The sensitivity of the disambiguation feature to intent detection uncertainty. Higher sensitivity means that the disambiguation feature is triggered more often and includes more choices. */
var Sensitivity;
(function (Sensitivity) {
Sensitivity["AUTO"] = "auto";
Sensitivity["HIGH"] = "high";
Sensitivity["MEDIUM_HIGH"] = "medium_high";
Sensitivity["MEDIUM"] = "medium";
Sensitivity["MEDIUM_LOW"] = "medium_low";
Sensitivity["LOW"] = "low";
})(Sensitivity = Constants.Sensitivity || (Constants.Sensitivity = {}));
})(Constants = WorkspaceSystemSettingsDisambiguation.Constants || (WorkspaceSystemSettingsDisambiguation.Constants = {}));
})(WorkspaceSystemSettingsDisambiguation = AssistantV1.WorkspaceSystemSettingsDisambiguation || (AssistantV1.WorkspaceSystemSettingsDisambiguation = {}));
var DialogNodeOutputGenericDialogNodeOutputResponseTypeOption;
(function (DialogNodeOutputGenericDialogNodeOutputResponseTypeOption) {
var Constants;
(function (Constants) {
/** The preferred type of control to display, if supported by the channel. */
var Preference;
(function (Preference) {
Preference["DROPDOWN"] = "dropdown";
Preference["BUTTON"] = "button";
})(Preference = Constants.Preference || (Constants.Preference = {}));
})(Constants = DialogNodeOutputGenericDialogNodeOutputResponseTypeOption.Constants || (DialogNodeOutputGenericDialogNodeOutputResponseTypeOption.Constants = {}));
})(DialogNodeOutputGenericDialogNodeOutputResponseTypeOption = AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeOption || (AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeOption = {}));
var DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill;
(function (DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill) {
var Constants;
(function (Constants) {
/** The type of the search query. */
var QueryType;
(function (QueryType) {
QueryType["NATURAL_LANGUAGE"] = "natural_language";
QueryType["DISCOVERY_QUERY_LANGUAGE"] = "discovery_query_language";
})(QueryType = Constants.QueryType || (Constants.QueryType = {}));
})(Constants = DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill.Constants || (DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill.Constants = {}));
})(DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill = AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill || (AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeSearchSkill = {}));
var DialogNodeOutputGenericDialogNodeOutputResponseTypeText;
(function (DialogNodeOutputGenericDialogNodeOutputResponseTypeText) {
var Constants;
(function (Constants) {
/** How a response is selected from the list, if more than one response is specified. */
var SelectionPolicy;
(function (SelectionPolicy) {
SelectionPolicy["SEQUENTIAL"] = "sequential";
SelectionPolicy["RANDOM"] = "random";
SelectionPolicy["MULTILINE"] = "multiline";
})(SelectionPolicy = Constants.SelectionPolicy || (Constants.SelectionPolicy = {}));
})(Constants = DialogNodeOutputGenericDialogNodeOutputResponseTypeText.Constants || (DialogNodeOutputGenericDialogNodeOutputResponseTypeText.Constants = {}));
})(DialogNodeOutputGenericDialogNodeOutputResponseTypeText = AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeText || (AssistantV1.DialogNodeOutputGenericDialogNodeOutputResponseTypeText = {}));
var RuntimeResponseGenericRuntimeResponseTypeOption;
(function (RuntimeResponseGenericRuntimeResponseTypeOption) {
var Constants;
(function (Constants) {
/** The preferred type of control to display. */
var Preference;
(function (Preference) {
Preference["DROPDOWN"] = "dropdown";
Preference["BUTTON"] = "button";
})(Preference = Constants.Preference || (Constants.Preference = {}));
})(Constants = RuntimeResponseGenericRuntimeResponseTypeOption.Constants || (RuntimeResponseGenericRuntimeResponseTypeOption.Constants = {}));
})(RuntimeResponseGenericRuntimeResponseTypeOption = AssistantV1.RuntimeResponseGenericRuntimeResponseTypeOption || (AssistantV1.RuntimeResponseGenericRuntimeResponseTypeOption = {}));
})(AssistantV1 || (AssistantV1 = {}));
module.exports = AssistantV1;