UNPKG

ibm-watson

Version:
3,268 lines • 167 kB
"use strict";
/**
 * (C) Copyright IBM Corp. 2019, 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");
/**
 * IBM Watson&reg; Discovery is a cognitive search and content analytics engine that you can add to applications to
 * identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and
 * unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual
 * filtering of results.
 *
 * API Version: 2.0
 * See: https://cloud.ibm.com/docs/discovery-data
 */
var DiscoveryV2 = /** @class */ (function (_super) {
    __extends(DiscoveryV2, _super);
    /**
     * Construct a DiscoveryV2 object.
     *
     * @param {Object} options - Options for the service.
     * @param {string} options.version - Release date of the version of the API you want to use. Specify dates in
     * YYYY-MM-DD format. The current version is `2023-03-31`.
     * @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 {DiscoveryV2}
     */
    function DiscoveryV2(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 = DiscoveryV2.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;
    }
    /*************************
     * projects
     ************************/
    /**
     * List projects.
     *
     * Lists existing projects for this instance.
     *
     * @param {Object} [params] - The parameters to send to the service.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListProjectsResponse>>}
     */
    DiscoveryV2.prototype.listProjects = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = [];
        var _validParams = ['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 sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listProjects');
        var parameters = {
            options: {
                url: '/v2/projects',
                method: 'GET',
                qs: query,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Create a project.
     *
     * Create a new project for this instance.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.name - The human readable name of this project.
     * @param {string} params.type - The type of project.
     *
     * The `content_intelligence` type is a *Document Retrieval for Contracts* project and the `other` type is a *Custom*
     * project.
     *
     * The `content_mining` and `content_intelligence` types are available with Premium plan managed deployments and
     * installed deployments only.
     *
     * The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed instances only.
     * @param {DefaultQueryParams} [params.defaultQueryParameters] - Default query parameters for this project.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
     */
    DiscoveryV2.prototype.createProject = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['name', 'type'];
        var _validParams = ['name', 'type', 'defaultQueryParameters', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'name': _params.name,
            'type': _params.type,
            'default_query_parameters': _params.defaultQueryParameters,
        };
        var query = {
            'version': this.version,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createProject');
        var parameters = {
            options: {
                url: '/v2/projects',
                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 project.
     *
     * Get details on the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
     */
    DiscoveryV2.prototype.getProject = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getProject');
        var parameters = {
            options: {
                url: '/v2/projects/{project_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 a project.
     *
     * Update the specified project's name.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} [params.name] - The new name to give this project.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ProjectDetails>>}
     */
    DiscoveryV2.prototype.updateProject = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', 'name', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'name': _params.name,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateProject');
        var parameters = {
            options: {
                url: '/v2/projects/{project_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 a project.
     *
     * Deletes the specified project.
     *
     * **Important:** Deleting a project deletes everything that is part of the specified project, including all
     * collections.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteProject = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteProject');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * List fields.
     *
     * Gets a list of the unique fields (and their types) stored in the specified collections.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string[]} [params.collectionIds] - Comma separated list of the collection IDs. If this parameter is not
     * specified, all collections in the project are used.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListFieldsResponse>>}
     */
    DiscoveryV2.prototype.listFields = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', 'collectionIds', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var query = {
            'version': this.version,
            'collection_ids': _params.collectionIds,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listFields');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/fields',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * collections
     ************************/
    /**
     * List collections.
     *
     * Lists existing collections for the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListCollectionsResponse>>}
     */
    DiscoveryV2.prototype.listCollections = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listCollections');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections',
                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 a collection.
     *
     * Create a new collection in the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.name - The name of the collection.
     * @param {string} [params.description] - A description of the collection.
     * @param {string} [params.language] - The language of the collection. For a list of supported languages, see the
     * [product documentation](/docs/discovery-data?topic=discovery-data-language-support).
     * @param {boolean} [params.ocrEnabled] - If set to `true`, optical character recognition (OCR) is enabled. For more
     * information, see [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
     * @param {CollectionEnrichment[]} [params.enrichments] - An array of enrichments that are applied to this collection.
     * To get a list of enrichments that are available for a project, use the [List enrichments](#listenrichments) method.
     *
     * If no enrichments are specified when the collection is created, the default enrichments for the project type are
     * applied. For more information about project default settings, see the [product
     * documentation](/docs/discovery-data?topic=discovery-data-project-defaults).
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
     */
    DiscoveryV2.prototype.createCollection = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'name'];
        var _validParams = ['projectId', 'name', 'description', 'language', 'ocrEnabled', 'enrichments', '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,
            'ocr_enabled': _params.ocrEnabled,
            'enrichments': _params.enrichments,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createCollection');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections',
                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 collection details.
     *
     * Get details about the specified collection.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
     */
    DiscoveryV2.prototype.getCollection = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getCollection');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_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 a collection.
     *
     * Updates the specified collection's name, description, enrichments, and configuration.
     *
     * If you apply normalization rules to data in an existing collection, you must initiate reprocessing of the
     * collection. To do so, from the *Manage fields* page in the product user interface, temporarily change the data type
     * of a field to enable the reprocess button. Change the data type of the field back to its original value, and then
     * click **Apply changes and reprocess**.
     *
     * To remove a configuration that applies JSON normalization operations as part of the conversion phase of ingestion,
     * specify an empty `json_normalizations` object (`[]`) in the request.
     *
     * To remove a configuration that applies JSON normalization operations after enrichments are applied, specify an
     * empty `normalizations` object (`[]`) in the request.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} [params.name] - The new name of the collection.
     * @param {string} [params.description] - The new description of the collection.
     * @param {boolean} [params.ocrEnabled] - If set to `true`, optical character recognition (OCR) is enabled. For more
     * information, see [Optical character recognition](/docs/discovery-data?topic=discovery-data-collections#ocr).
     * @param {CollectionEnrichment[]} [params.enrichments] - An array of enrichments that are applied to this collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.CollectionDetails>>}
     */
    DiscoveryV2.prototype.updateCollection = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'name', 'description', 'ocrEnabled', 'enrichments', '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,
            'ocr_enabled': _params.ocrEnabled,
            'enrichments': _params.enrichments,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateCollection');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_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 a collection.
     *
     * Deletes the specified collection from the project. All documents stored in the specified collection and not shared
     * is also deleted.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteCollection = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteCollection');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * documents
     ************************/
    /**
     * List documents.
     *
     * Lists the documents in the specified collection. The list includes only the document ID of each document and
     * returns information for up to 10,000 documents.
     *
     * **Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and
     * from IBM Cloud-managed instances.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {number} [params.count] - The maximum number of documents to return. Up to 1,000 documents are returned by
     * default. The maximum number allowed is 10,000.
     * @param {string} [params.status] - Filters the documents to include only documents with the specified ingestion
     * status. The options include:
     *
     * * `available`: Ingestion is finished and the document is indexed.
     *
     * * `failed`: Ingestion is finished, but the document is not indexed because of an error.
     *
     * * `pending`: The document is uploaded, but the ingestion process is not started.
     *
     * * `processing`: Ingestion is in progress.
     *
     * You can specify one status value or add a comma-separated list of more than one status value. For example,
     * `available,failed`.
     * @param {boolean} [params.hasNotices] - If set to `true`, only documents that have notices, meaning documents for
     * which warnings or errors were generated during the ingestion, are returned. If set to `false`, only documents that
     * don't have notices are returned. If unspecified, no filter based on notices is applied.
     *
     * Notice details are not available in the result, but you can use the [Query collection
     * notices](#querycollectionnotices) method to find details by adding the parameter
     * `query=notices.document_id:{document-id}`.
     * @param {boolean} [params.isParent] - If set to `true`, only parent documents, meaning documents that were split
     * during the ingestion process and resulted in two or more child documents, are returned. If set to `false`, only
     * child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.
     *
     * CSV files, for example, are split into separate documents per line and JSON files are split into separate documents
     * per object.
     * @param {string} [params.parentDocumentId] - Filters the documents to include only child documents that were
     * generated when the specified parent document was processed.
     * @param {string} [params.sha256] - Filters the documents to include only documents with the specified SHA-256 hash.
     * Format the hash as a hexadecimal string.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListDocumentsResponse>>}
     */
    DiscoveryV2.prototype.listDocuments = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'count', 'status', 'hasNotices', 'isParent', 'parentDocumentId', 'sha256', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var query = {
            'version': this.version,
            'count': _params.count,
            'status': _params.status,
            'has_notices': _params.hasNotices,
            'is_parent': _params.isParent,
            'parent_document_id': _params.parentDocumentId,
            'sha256': _params.sha256,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listDocuments');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/documents',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Add a document.
     *
     * Add a document to a collection with optional metadata.
     *
     * Returns immediately after the system has accepted the document for processing.
     *
     * Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.
     *
     *  * For a list of supported file types, see the [product
     * documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
     *
     *  * You must provide document content, metadata, or both. If the request is missing both document content and
     * metadata, it is rejected.
     *
     *   * You can set the **Content-Type** parameter on the **file** part to indicate the media type of the document. If
     * the **Content-Type** parameter is missing or is one of the generic media types (for example,
     * `application/octet-stream`), then the service attempts to automatically detect the document's media type.
     *
     *  *  If the document is uploaded to a collection that shares its data with another collection, the
     * **X-Watson-Discovery-Force** header must be set to `true`.
     *
     *  * In curl requests only, you can assign an ID to a document that you add by appending the ID to the endpoint
     * (`/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}`). If a document already exists
     * with the specified ID, it is replaced.
     *
     * For more information about how certain file types and field names are handled when a file is added to a collection,
     * see the [product documentation](/docs/discovery-data?topic=discovery-data-index-overview#field-name-limits).
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {NodeJS.ReadableStream | Buffer} [params.file] - **Add a document**: The content of the document to ingest.
     * For the supported file types and maximum supported file size limits when adding a document, see [the
     * documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
     *
     * **Analyze a document**: The content of the document to analyze but not ingest. Only the `application/json` content
     * type is supported by the Analyze API. For maximum supported file size limits, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-analyzeapi#analyzeapi-limits).
     * @param {string} [params.filename] - The filename for file.
     * @param {string} [params.fileContentType] - The content type of file.
     * @param {string} [params.metadata] - Add information about the file that you want to include in the response.
     *
     * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
     *
     * Example:
     *
     *  ```
     *  {
     *   "filename": "favorites2.json",
     *   "file_type": "json"
     *  }.
     * @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
     * even if the data for that collection is shared with other collections.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>}
     */
    DiscoveryV2.prototype.addDocument = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'file', 'filename', 'fileContentType', 'metadata', 'xWatsonDiscoveryForce', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'file': {
                data: _params.file,
                filename: _params.filename,
                contentType: _params.fileContentType,
            },
            'metadata': _params.metadata,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'addDocument');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/documents',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                    'X-Watson-Discovery-Force': _params.xWatsonDiscoveryForce,
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Get document details.
     *
     * Get details about a specific document, whether the document is added by uploading a file or by crawling an external
     * data source.
     *
     * **Note**: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances, and
     * from IBM Cloud-managed instances.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} params.documentId - The ID of the document.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentDetails>>}
     */
    DiscoveryV2.prototype.getDocument = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'documentId'];
        var _validParams = ['projectId', 'collectionId', 'documentId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
            'document_id': _params.documentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getDocument');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/documents/{document_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 a document.
     *
     * Replace an existing document or add a document with a specified document ID. Starts ingesting a document with
     * optional metadata.
     *
     * Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.
     *
     * If the document is uploaded to a collection that shares its data with another collection, the
     * **X-Watson-Discovery-Force** header must be set to `true`.
     *
     * **Notes:**
     *
     *  * Uploading a new document with this method automatically replaces any existing document stored with the same
     * document ID.
     *
     *  * If an uploaded document is split into child documents during ingestion, all existing child documents are
     * overwritten, even if the updated version of the document has fewer child documents.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} params.documentId - The ID of the document.
     * @param {NodeJS.ReadableStream | Buffer} [params.file] - **Add a document**: The content of the document to ingest.
     * For the supported file types and maximum supported file size limits when adding a document, see [the
     * documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
     *
     * **Analyze a document**: The content of the document to analyze but not ingest. Only the `application/json` content
     * type is supported by the Analyze API. For maximum supported file size limits, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-analyzeapi#analyzeapi-limits).
     * @param {string} [params.filename] - The filename for file.
     * @param {string} [params.fileContentType] - The content type of file.
     * @param {string} [params.metadata] - Add information about the file that you want to include in the response.
     *
     * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
     *
     * Example:
     *
     *  ```
     *  {
     *   "filename": "favorites2.json",
     *   "file_type": "json"
     *  }.
     * @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
     * even if the data for that collection is shared with other collections.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentAccepted>>}
     */
    DiscoveryV2.prototype.updateDocument = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'documentId'];
        var _validParams = ['projectId', 'collectionId', 'documentId', 'file', 'filename', 'fileContentType', 'metadata', 'xWatsonDiscoveryForce', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'file': {
                data: _params.file,
                filename: _params.filename,
                contentType: _params.fileContentType,
            },
            'metadata': _params.metadata,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
            'document_id': _params.documentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateDocument');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                    'X-Watson-Discovery-Force': _params.xWatsonDiscoveryForce,
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Delete a document.
     *
     * Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the
     * collection permanently. If you delete a document that was added by crawling an external data source, the document
     * will be added again with the next scheduled crawl of the data source. The delete function removes the document from
     * the collection, not from the external data source.
     *
     * **Note:** Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete
     * a subdocument, and then repeat the action that created it, the deleted document is added back in to your
     * collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead.
     * You can get the document ID of the original document from the `parent_document_id` of the subdocument result.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} params.documentId - The ID of the document.
     * @param {boolean} [params.xWatsonDiscoveryForce] - When `true`, the uploaded document is added to the collection
     * even if the data for that collection is shared with other collections.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DeleteDocumentResponse>>}
     */
    DiscoveryV2.prototype.deleteDocument = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'documentId'];
        var _validParams = ['projectId', 'collectionId', 'documentId', 'xWatsonDiscoveryForce', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
            'document_id': _params.documentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteDocument');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'X-Watson-Discovery-Force': _params.xWatsonDiscoveryForce,
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * queries
     ************************/
    /**
     * Query a project.
     *
     * Search your data by submitting queries that are written in natural language or formatted in the Discovery Query
     * Language. For more information, see the [Discovery
     * documentation](/docs/discovery-data?topic=discovery-data-query-concepts). The default query parameters differ by
     * project type. For more information about the project default settings, see the [Discovery
     * documentation](/docs/discovery-data?topic=discovery-data-query-defaults). See [the Projects API
     * documentation](#create-project) for details about how to set custom default query settings.
     *
     * The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000
     * characters in English.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string[]} [params.collectionIds] - A comma-separated list of collection IDs to be queried against.
     * @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
     * specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
     * relevance. When used with the **aggregation**, **query**, or **natural_language_query** parameters, the **filter**
     * parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
     * @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
     * matching documents in your data set with full enrichments and full text, and with the most relevant documents
     * listed first. Use a query search when you want to find the most relevant search results. You can use this parameter
     * or the **natural_language_query** parameter to specify the query input, but not both.
     * @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
     * training data and natural language understanding. You can use this parameter or the **query** parameter to specify
     * the query input, but not both. To filter the results based on criteria you specify, include the **filter**
     * parameter in the request.
     * @param {string} [params.aggregation] - An aggregation search that returns an exact answer by combining query search
     * with filters. Useful for applications to build lists, tables, and time series. For more information about the
     * supported types of aggregations, see the [Discovery
     * documentation](/docs/discovery-data?topic=discovery-data-query-aggregations).
     * @param {number} [params.count] - Number of results to return.
     * @param {string[]} [params._return] - A list of the fields in the document hierarchy to return. You can specify both
     * root-level (`text`) and nested (`extracted_metadata.filename`) fields. If this parameter is an empty list, then all
     * fields are returned.
     * @param {number} [params.offset] - The number of query results to skip at the beginning. Consider that the `count`
     * is set to 10 (the default value) and the total number of results that are returned is 100. In this case, the
     * following examples show the returned results for different `offset` values:
     *
     *  * If `offset` is set to 95, it returns the last 5 results.
     *
     *  * If `offset` is set to 10, it returns the second batch of 10 results.
     *
     *  * If `offset` is set to 100 or more, it returns empty results.
     * @param {string} [params.sort] - A comma-separated list of fields in the document to sort on. You can optionally
     * specify a sort direction by prefixing the field with `-` for descending or `+` for ascending. Ascending is the
     * default sort direction if no prefix is specified.
     * @param {boolean} [params.highlight] - When `true`, a highlight field is returned for each result that contains
     * fields that match the query. The matching query terms are emphasized with surrounding `<em></em>` tags. This
     * parameter is ignored if **passages.enabled** and **passages.per_document** are `true`, in which case passages are
     * returned for each document instead of highlights.
     * @param {boolean} [params.spellingSuggestions] - When `true` and the **natural_language_query** parameter is used,
     * the **natural_language_query** parameter is spell checked. The most likely correction is returned in the
     * **suggested_query** field of the response (if one exists).
     * @param {QueryLargeTableResults} [params.tableResults] - Configuration for table retrieval.
     * @param {QueryLargeSuggestedRefinements} [params.suggestedRefinements] - Configuration for suggested refinements.
     *
     * **Note**: The **suggested_refinements** parameter that identified dynamic facets from the data is deprecated.
     * @param {QueryLargePassages} [params.passages] - Configuration for passage retrieval.
     * @param {QueryLargeSimilar} [params.similar] - Finds results from documents that are similar to documents of
     * interest. Use this parameter to add a *More like these* function to your search. You can include this parameter
     * with or without a **query**, **filter** or **natural_language_query** parameter.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryResponse>>}
     */
    DiscoveryV2.prototype.query = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', 'collectionIds', 'filter', 'query', 'naturalLanguageQuery', 'aggregation', 'count', '_return', 'offset', 'sort', 'highlight', 'spellingSuggestions', 'tableResults', 'suggestedRefinements', 'passages', 'similar', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'collection_ids': _params.collectionIds,
            'filter': _params.filter,
            'query': _params.query,
            'natural_language_query': _params.naturalLanguageQuery,
            'aggregation': _params.aggregation,
            'count': _params.count,
            'return': _params._return,
            'offset': _params.offset,
            'sort': _params.sort,
            'highlight': _params.highlight,
            'spelling_suggestions': _params.spellingSuggestions,
            'table_results': _params.tableResults,
            'suggested_refinements': _params.suggestedRefinements,
            'passages': _params.passages,
            'similar': _params.similar,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'query');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/query',
                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 Autocomplete Suggestions.
     *
     * Returns completion query suggestions for the specified prefix.
     *
     * Suggested words are based on terms from the project documents. Suggestions are not based on terms from the
     * project's search history, and the project does not learn from previous user choices.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.prefix - The prefix to use for autocompletion. For example, the prefix `Ho` could
     * autocomplete to `hot`, `housing`, or `how`.
     * @param {string[]} [params.collectionIds] - Comma separated list of the collection IDs. If this parameter is not
     * specified, all collections in the project are used.
     * @param {string} [params.field] - The field in the result documents that autocompletion suggestions are identified
     * from.
     * @param {number} [params.count] - The number of autocompletion suggestions to return.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Completions>>}
     */
    DiscoveryV2.prototype.getAutocompletion = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'prefix'];
        var _validParams = ['projectId', 'prefix', 'collectionIds', 'field', 'count', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var query = {
            'version': this.version,
            'prefix': _params.prefix,
            'collection_ids': _params.collectionIds,
            'field': _params.field,
            'count': _params.count,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getAutocompletion');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/autocompletion',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Query collection notices.
     *
     * Finds collection-level notices (errors and warnings) that are generated when documents are ingested.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
     * specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
     * relevance. When used with the `aggregation`, `query`, or `natural_language_query` parameters, the `filter`
     * parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
     * @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
     * matching documents in your data set with full enrichments and full text, and with the most relevant documents
     * listed first. You can use this parameter or the **natural_language_query** parameter to specify the query input,
     * but not both.
     * @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
     * natural language understanding. You can use this parameter or the **query** parameter to specify the query input,
     * but not both. To filter the results based on criteria you specify, include the **filter** parameter in the request.
     * @param {number} [params.count] - Number of results to return. The maximum for the **count** and **offset** values
     * together in any one query is **10,000**.
     * @param {number} [params.offset] - The number of query results to skip at the beginning. For example, if the total
     * number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the
     * **count** and **offset** values together in any one query is **10000**.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>}
     */
    DiscoveryV2.prototype.queryCollectionNotices = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'filter', 'query', 'naturalLanguageQuery', 'count', 'offset', '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,
            'query': _params.query,
            'natural_language_query': _params.naturalLanguageQuery,
            'count': _params.count,
            'offset': _params.offset,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'queryCollectionNotices');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/notices',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Query project notices.
     *
     * Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy
     * training.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} [params.filter] - Searches for documents that match the Discovery Query Language criteria that is
     * specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by
     * relevance. When used with the `aggregation`, `query`, or `natural_language_query` parameters, the `filter`
     * parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values.
     * @param {string} [params.query] - A query search that is written in the Discovery Query Language and returns all
     * matching documents in your data set with full enrichments and full text, and with the most relevant documents
     * listed first. You can use this parameter or the **natural_language_query** parameter to specify the query input,
     * but not both.
     * @param {string} [params.naturalLanguageQuery] - A natural language query that returns relevant documents by using
     * natural language understanding. You can use this parameter or the **query** parameter to specify the query input,
     * but not both. To filter the results based on criteria you specify, include the **filter** parameter in the request.
     * @param {number} [params.count] - Number of results to return. The maximum for the **count** and **offset** values
     * together in any one query is **10,000**.
     * @param {number} [params.offset] - The number of query results to skip at the beginning. For example, if the total
     * number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the
     * **count** and **offset** values together in any one query is **10000**.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.QueryNoticesResponse>>}
     */
    DiscoveryV2.prototype.queryNotices = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', 'filter', 'query', 'naturalLanguageQuery', 'count', 'offset', '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,
            'query': _params.query,
            'natural_language_query': _params.naturalLanguageQuery,
            'count': _params.count,
            'offset': _params.offset,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'queryNotices');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/notices',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * queryModifications
     ************************/
    /**
     * Get a custom stop words list.
     *
     * Returns the custom stop words list that is used by the collection. For information about the default stop words
     * lists that are applied to queries, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-stopwords).
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>}
     */
    DiscoveryV2.prototype.getStopwordList = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getStopwordList');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/stopwords',
                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 a custom stop words list.
     *
     * Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a
     * query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot
     * contain more than 1 million characters.
     *
     * A default stop words list is used by all collections. The default list is applied both at indexing time and at
     * query time. A custom stop words list that you add is used at query time only.
     *
     * The custom stop words list augments the default stop words list; you cannot remove stop words. For information
     * about the default stop words lists per language, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-stopwords).
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string[]} [params.stopwords] - List of stop words.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.StopWordList>>}
     */
    DiscoveryV2.prototype.createStopwordList = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'stopwords', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'stopwords': _params.stopwords,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createStopwordList');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/stopwords',
                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 a custom stop words list.
     *
     * Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list
     * is deleted, the default stop words list is used.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteStopwordList = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteStopwordList');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/stopwords',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Get the expansion list.
     *
     * Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty
     * expansions array is returned.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>}
     */
    DiscoveryV2.prototype.listExpansions = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listExpansions');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/expansions',
                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 or update an expansion list.
     *
     * Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for
     * key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the
     * scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {Expansion[]} params.expansions - An array of query expansion definitions.
     *
     *  Each object in the **expansions** array represents a term or set of terms that will be expanded into other terms.
     * Each expansion object can be configured as `bidirectional` or `unidirectional`.
     *
     * * **Bidirectional**: Each entry in the `expanded_terms` list expands to include all expanded terms. For example, a
     * query for `ibm` expands to `ibm OR international business machines OR big blue`.
     *
     * * **Unidirectional**: The terms in `input_terms` in the query are replaced by the terms in `expanded_terms`. For
     * example, a query for the often misused term `on premise` is converted to `on premises OR on-premises` and does not
     * contain the original term. If you want an input term to be included in the query, then repeat the input term in the
     * expanded terms list.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Expansions>>}
     */
    DiscoveryV2.prototype.createExpansions = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'expansions'];
        var _validParams = ['projectId', 'collectionId', 'expansions', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'expansions': _params.expansions,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createExpansions');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/expansions',
                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 the expansion list.
     *
     * Removes the expansion information for this collection. To disable query expansion for a collection, delete the
     * expansion list.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteExpansions = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteExpansions');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/expansions',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * componentSettings
     ************************/
    /**
     * List component settings.
     *
     * Returns default configuration settings for components.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ComponentSettingsResponse>>}
     */
    DiscoveryV2.prototype.getComponentSettings = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getComponentSettings');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/component_settings',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * trainingData
     ************************/
    /**
     * List training queries.
     *
     * List the training queries for the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuerySet>>}
     */
    DiscoveryV2.prototype.listTrainingQueries = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listTrainingQueries');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Delete training queries.
     *
     * Removes all training queries for the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteTrainingQueries = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteTrainingQueries');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Create a training query.
     *
     * Add a query to the training data for this project. The query can contain a filter and natural language query.
     *
     * **Note**: You cannot apply relevancy training to a `content_mining` project type.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.naturalLanguageQuery - The natural text query that is used as the training query.
     * @param {TrainingExample[]} params.examples - Array of training examples.
     * @param {string} [params.filter] - The filter used on the collection before the **natural_language_query** is
     * applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top
     * 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries
     * that are submitted at runtime for optimal ranking results.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>}
     */
    DiscoveryV2.prototype.createTrainingQuery = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'naturalLanguageQuery', 'examples'];
        var _validParams = ['projectId', 'naturalLanguageQuery', 'examples', 'filter', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'natural_language_query': _params.naturalLanguageQuery,
            'examples': _params.examples,
            'filter': _params.filter,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createTrainingQuery');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries',
                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 a training data query.
     *
     * Get details for a specific training data query, including the query string and all examples.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.queryId - The ID of the query used for training.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>}
     */
    DiscoveryV2.prototype.getTrainingQuery = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'queryId'];
        var _validParams = ['projectId', 'queryId', '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 = {
            'project_id': _params.projectId,
            'query_id': _params.queryId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getTrainingQuery');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries/{query_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 a training query.
     *
     * Updates an existing training query and its examples. You must resubmit all of the examples with the update request.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.queryId - The ID of the query used for training.
     * @param {string} params.naturalLanguageQuery - The natural text query that is used as the training query.
     * @param {TrainingExample[]} params.examples - Array of training examples.
     * @param {string} [params.filter] - The filter used on the collection before the **natural_language_query** is
     * applied. Only specify a filter if the documents that you consider to be most relevant are not included in the top
     * 100 results when you submit test queries. If you specify a filter during training, apply the same filter to queries
     * that are submitted at runtime for optimal ranking results.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.TrainingQuery>>}
     */
    DiscoveryV2.prototype.updateTrainingQuery = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'queryId', 'naturalLanguageQuery', 'examples'];
        var _validParams = ['projectId', 'queryId', 'naturalLanguageQuery', 'examples', 'filter', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var body = {
            'natural_language_query': _params.naturalLanguageQuery,
            'examples': _params.examples,
            'filter': _params.filter,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'query_id': _params.queryId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateTrainingQuery');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries/{query_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 a training data query.
     *
     * Removes details from a training data query, including the query string and all examples.
     *
     * To delete an example, use the *Update a training query* method and omit the example that you want to delete from
     * the example set.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.queryId - The ID of the query used for training.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteTrainingQuery = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'queryId'];
        var _validParams = ['projectId', 'queryId', '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 = {
            'project_id': _params.projectId,
            'query_id': _params.queryId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteTrainingQuery');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/training_data/queries/{query_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * enrichments
     ************************/
    /**
     * List enrichments.
     *
     * Lists the enrichments available to this project. The *Part of Speech* and *Sentiment of Phrases* enrichments might
     * be listed, but are reserved for internal use only.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Enrichments>>}
     */
    DiscoveryV2.prototype.listEnrichments = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listEnrichments');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/enrichments',
                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 an enrichment.
     *
     * Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project,
     * use the [Collections API](/apidocs/discovery-data#createcollection).
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {CreateEnrichment} params.enrichment - Information about a specific enrichment.
     * @param {NodeJS.ReadableStream | Buffer} [params.file] - The enrichment file to upload. Expected file types per
     * enrichment are as follows:
     *
     * * CSV for `dictionary` and `sentence_classifier` (the training data CSV file to upload).
     *
     * * PEAR for `uima_annotator` and `rule_based` (Explorer)
     *
     * * ZIP for `watson_knowledge_studio_model` and `rule_based` (Studio Advanced Rule Editor).
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Enrichment>>}
     */
    DiscoveryV2.prototype.createEnrichment = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'enrichment'];
        var _validParams = ['projectId', 'enrichment', 'file', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'enrichment': _params.enrichment,
            'file': {
                data: _params.file,
                contentType: 'application/octet-stream',
            },
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createEnrichment');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/enrichments',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Get enrichment.
     *
     * Get details about a specific enrichment.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.enrichmentId - The Universally Unique Identifier (UUID) of the enrichment.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Enrichment>>}
     */
    DiscoveryV2.prototype.getEnrichment = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'enrichmentId'];
        var _validParams = ['projectId', 'enrichmentId', '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 = {
            'project_id': _params.projectId,
            'enrichment_id': _params.enrichmentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getEnrichment');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/enrichments/{enrichment_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 an enrichment.
     *
     * Updates an existing enrichment's name and description.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.enrichmentId - The Universally Unique Identifier (UUID) of the enrichment.
     * @param {string} params.name - A new name for the enrichment.
     * @param {string} [params.description] - A new description for the enrichment.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.Enrichment>>}
     */
    DiscoveryV2.prototype.updateEnrichment = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'enrichmentId', 'name'];
        var _validParams = ['projectId', 'enrichmentId', 'name', 'description', '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,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'enrichment_id': _params.enrichmentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateEnrichment');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/enrichments/{enrichment_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 an enrichment.
     *
     * Deletes an existing enrichment from the specified project.
     *
     * **Note:** Only enrichments that have been manually created can be deleted.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.enrichmentId - The Universally Unique Identifier (UUID) of the enrichment.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteEnrichment = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'enrichmentId'];
        var _validParams = ['projectId', 'enrichmentId', '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 = {
            'project_id': _params.projectId,
            'enrichment_id': _params.enrichmentId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteEnrichment');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/enrichments/{enrichment_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * batches
     ************************/
    /**
     * List batches.
     *
     * A batch is a set of documents that are ready for enrichment by an external application. After you apply a webhook
     * enrichment to a collection, and then process or upload documents to the collection, Discovery creates a batch with
     * a unique **batch_id**.
     *
     *  To start, you must register your external application as a **webhook** type by using the [Create enrichment
     * API](/apidocs/discovery-data#createenrichment) method.
     *
     * Use the List batches API to get the following:
     *
     *  * Notified batches that are not yet pulled by the external enrichment application.
     *
     *  * Batches that are pulled, but not yet pushed to Discovery by the external enrichment application.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.ListBatchesResponse>>}
     */
    DiscoveryV2.prototype.listBatches = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listBatches');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/batches',
                method: 'GET',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Pull batches.
     *
     * Pull a batch of documents from Discovery for enrichment by an external application. Ensure to include the
     * `Accept-Encoding: gzip` header in this method to get the file. You can also implement retry logic when calling this
     * method to avoid any network errors.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} params.batchId - The Universally Unique Identifier (UUID) of the document batch that is being
     * requested from Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.PullBatchesResponse>>}
     */
    DiscoveryV2.prototype.pullBatches = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'batchId'];
        var _validParams = ['projectId', 'collectionId', 'batchId', '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 = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
            'batch_id': _params.batchId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'pullBatches');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_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);
    };
    /**
     * Push batches.
     *
     * Push a batch of documents to Discovery after annotation by an external application. You can implement retry logic
     * when calling this method to avoid any network errors.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {string} params.batchId - The Universally Unique Identifier (UUID) of the document batch that is being
     * requested from Discovery.
     * @param {NodeJS.ReadableStream | Buffer} [params.file] - A compressed newline-delimited JSON (NDJSON), which is a
     * JSON file with one row of data per line. For example, `{batch_id}.ndjson.gz`. For more information, see [Binary
     * attachment in the push batches
     * method](/docs/discovery-data?topic=discovery-data-external-enrichment#binary-attachment-push-batches).
     *
     * There is no limitation on the name of the file because Discovery does not use the name for processing. The list of
     * features in the document is specified in the `features` object.
     * @param {string} [params.filename] - The filename for file.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<boolean>>}
     */
    DiscoveryV2.prototype.pushBatches = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId', 'batchId'];
        var _validParams = ['projectId', 'collectionId', 'batchId', 'file', 'filename', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'file': {
                data: _params.file,
                filename: _params.filename,
                contentType: 'application/octet-stream',
            },
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
            'batch_id': _params.batchId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'pushBatches');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/batches/{batch_id}',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * documentClassifiers
     ************************/
    /**
     * List document classifiers.
     *
     * Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document
     * classifier.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifiers>>}
     */
    DiscoveryV2.prototype.listDocumentClassifiers = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId'];
        var _validParams = ['projectId', '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 = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listDocumentClassifiers');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers',
                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 a document classifier.
     *
     * Create a document classifier. You can use the API to create a document classifier in any project type. After you
     * create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the
     * Collections API to apply the enrichment to a collection in the project.
     *
     * **Note:** This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or
     * Enterprise plan instances.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {NodeJS.ReadableStream | Buffer} params.trainingData - The training data CSV file to upload. The CSV file
     * must have headers. The file must include a field that contains the text you want to classify and a field that
     * contains the classification labels that you want to use to classify your data. If you want to specify multiple
     * values in a single field, use a semicolon as the value separator. For a sample file, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-cm-doc-classifier).
     * @param {CreateDocumentClassifier} params.classifier - An object that manages the settings and data that is required
     * to train a document classification model.
     * @param {NodeJS.ReadableStream | Buffer} [params.testData] - The CSV with test data to upload. The column values in
     * the test file must be the same as the column values in the training data file. If no test data is provided, the
     * training data is split into two separate groups of training and test data.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifier>>}
     */
    DiscoveryV2.prototype.createDocumentClassifier = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'trainingData', 'classifier'];
        var _validParams = ['projectId', 'trainingData', 'classifier', 'testData', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'training_data': {
                data: _params.trainingData,
                contentType: 'text/csv',
            },
            'classifier': _params.classifier,
            'test_data': {
                data: _params.testData,
                contentType: 'text/csv',
            },
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createDocumentClassifier');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Get a document classifier.
     *
     * Get details about a specific document classifier.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifier>>}
     */
    DiscoveryV2.prototype.getDocumentClassifier = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId'];
        var _validParams = ['projectId', 'classifierId', '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 = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getDocumentClassifier');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_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 a document classifier.
     *
     * Update the document classifier name or description, update the training data, or add or update the test data.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {UpdateDocumentClassifier} params.classifier - An object that contains a new name or description for a
     * document classifier, updated training data, or new or updated test data.
     * @param {NodeJS.ReadableStream | Buffer} [params.trainingData] - The training data CSV file to upload. The CSV file
     * must have headers. The file must include a field that contains the text you want to classify and a field that
     * contains the classification labels that you want to use to classify your data. If you want to specify multiple
     * values in a single column, use a semicolon as the value separator. For a sample file, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-cm-doc-classifier).
     * @param {NodeJS.ReadableStream | Buffer} [params.testData] - The CSV with test data to upload. The column values in
     * the test file must be the same as the column values in the training data file. If no test data is provided, the
     * training data is split into two separate groups of training and test data.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifier>>}
     */
    DiscoveryV2.prototype.updateDocumentClassifier = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId', 'classifier'];
        var _validParams = ['projectId', 'classifierId', 'classifier', 'trainingData', 'testData', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'classifier': _params.classifier,
            'training_data': {
                data: _params.trainingData,
                contentType: 'text/csv',
            },
            'test_data': {
                data: _params.testData,
                contentType: 'text/csv',
            },
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateDocumentClassifier');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                }, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /**
     * Delete a document classifier.
     *
     * Deletes an existing document classifier from the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteDocumentClassifier = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId'];
        var _validParams = ['projectId', 'classifierId', '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 = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteDocumentClassifier');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * documentClassifierModels
     ************************/
    /**
     * List document classifier models.
     *
     * Get a list of the document classifier models in a project. Returns only the name and model ID of each document
     * classifier model.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifierModels>>}
     */
    DiscoveryV2.prototype.listDocumentClassifierModels = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId'];
        var _validParams = ['projectId', 'classifierId', '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 = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'listDocumentClassifierModels');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}/models',
                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 a document classifier model.
     *
     * Create a document classifier model by training a model that uses the data and classifier settings defined in the
     * specified document classifier.
     *
     * **Note:** This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or
     * Enterprise plan instances.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {string} params.name - The name of the document classifier model.
     * @param {string} [params.description] - A description of the document classifier model.
     * @param {number} [params.learningRate] - A tuning parameter in an optimization algorithm that determines the step
     * size at each iteration of the training process. It influences how much of any newly acquired information overrides
     * the existing information, and therefore is said to represent the speed at which a machine learning model learns.
     * The default value is `0.1`.
     * @param {number[]} [params.l1RegularizationStrengths] - Avoids overfitting by shrinking the coefficient of less
     * important features to zero, which removes some features altogether. You can specify many values for hyper-parameter
     * optimization. The default value is `[0.000001]`.
     * @param {number[]} [params.l2RegularizationStrengths] - A method you can apply to avoid overfitting your model on
     * the training data. You can specify many values for hyper-parameter optimization. The default value is `[0.000001]`.
     * @param {number} [params.trainingMaxSteps] - Maximum number of training steps to complete. This setting is useful if
     * you need the training process to finish in a specific time frame to fit into an automated process. The default
     * value is ten million.
     * @param {number} [params.improvementRatio] - Stops the training run early if the improvement ratio is not met by the
     * time the process reaches a certain point. The default value is `0.00001`.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifierModel>>}
     */
    DiscoveryV2.prototype.createDocumentClassifierModel = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId', 'name'];
        var _validParams = ['projectId', 'classifierId', 'name', 'description', 'learningRate', 'l1RegularizationStrengths', 'l2RegularizationStrengths', 'trainingMaxSteps', 'improvementRatio', '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,
            'learning_rate': _params.learningRate,
            'l1_regularization_strengths': _params.l1RegularizationStrengths,
            'l2_regularization_strengths': _params.l2RegularizationStrengths,
            'training_max_steps': _params.trainingMaxSteps,
            'improvement_ratio': _params.improvementRatio,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'createDocumentClassifierModel');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}/models',
                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 a document classifier model.
     *
     * Get details about a specific document classifier model.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {string} params.modelId - The Universally Unique Identifier (UUID) of the classifier model.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifierModel>>}
     */
    DiscoveryV2.prototype.getDocumentClassifierModel = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId', 'modelId'];
        var _validParams = ['projectId', 'classifierId', 'modelId', '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 = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
            'model_id': _params.modelId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'getDocumentClassifierModel');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_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 a document classifier model.
     *
     * Update the document classifier model name or description.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {string} params.modelId - The Universally Unique Identifier (UUID) of the classifier model.
     * @param {string} [params.name] - A new name for the enrichment.
     * @param {string} [params.description] - A new description for the enrichment.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.DocumentClassifierModel>>}
     */
    DiscoveryV2.prototype.updateDocumentClassifierModel = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId', 'modelId'];
        var _validParams = ['projectId', 'classifierId', 'modelId', 'name', 'description', '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,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
            'model_id': _params.modelId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'updateDocumentClassifierModel');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_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 a document classifier model.
     *
     * Deletes an existing document classifier model from the specified project.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.classifierId - The Universally Unique Identifier (UUID) of the classifier.
     * @param {string} params.modelId - The Universally Unique Identifier (UUID) of the classifier model.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.prototype.deleteDocumentClassifierModel = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'classifierId', 'modelId'];
        var _validParams = ['projectId', 'classifierId', 'modelId', '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 = {
            'project_id': _params.projectId,
            'classifier_id': _params.classifierId,
            'model_id': _params.modelId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteDocumentClassifierModel');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/document_classifiers/{classifier_id}/models/{model_id}',
                method: 'DELETE',
                qs: query,
                path: path,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    /*************************
     * analyze
     ************************/
    /**
     * Analyze a document.
     *
     * Process a document and return it for realtime use. Supports JSON files only.
     *
     * The file is not stored in the collection, but is processed according to the collection's configuration settings. To
     * get results, enrichments must be applied to a field in the collection that also exists in the file that you want to
     * analyze. For example, to analyze text in a `Quote` field, you must apply enrichments to the `Quote` field in the
     * collection configuration. Then, when you analyze the file, the text in the `Quote` field is analyzed and results
     * are written to a field named `enriched_Quote`.
     *
     * Submit a request against only one collection at a time. Remember, the documents in the collection are not
     * significant. It is the enrichments that are defined for the collection that matter. If you submit requests to
     * several collections, then several models are initiated at the same time, which can cause request failures.
     *
     * **Note:** This method is supported with Enterprise plan deployments and installed deployments only.
     *
     * @param {Object} params - The parameters to send to the service.
     * @param {string} params.projectId - The Universally Unique Identifier (UUID) of the project. This information can be
     * found from the *Integrate and Deploy* page in Discovery.
     * @param {string} params.collectionId - The Universally Unique Identifier (UUID) of the collection.
     * @param {NodeJS.ReadableStream | Buffer} [params.file] - **Add a document**: The content of the document to ingest.
     * For the supported file types and maximum supported file size limits when adding a document, see [the
     * documentation](/docs/discovery-data?topic=discovery-data-collections#supportedfiletypes).
     *
     * **Analyze a document**: The content of the document to analyze but not ingest. Only the `application/json` content
     * type is supported by the Analyze API. For maximum supported file size limits, see [the product
     * documentation](/docs/discovery-data?topic=discovery-data-analyzeapi#analyzeapi-limits).
     * @param {string} [params.filename] - The filename for file.
     * @param {string} [params.fileContentType] - The content type of file.
     * @param {string} [params.metadata] - Add information about the file that you want to include in the response.
     *
     * The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.
     *
     * Example:
     *
     *  ```
     *  {
     *   "filename": "favorites2.json",
     *   "file_type": "json"
     *  }.
     * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
     * @returns {Promise<DiscoveryV2.Response<DiscoveryV2.AnalyzedDocument>>}
     */
    DiscoveryV2.prototype.analyzeDocument = function (params) {
        var _params = __assign({}, params);
        var _requiredParams = ['projectId', 'collectionId'];
        var _validParams = ['projectId', 'collectionId', 'file', 'filename', 'fileContentType', 'metadata', 'headers'];
        var _validationErrors = (0, ibm_cloud_sdk_core_1.validateParams)(_params, _requiredParams, _validParams);
        if (_validationErrors) {
            return Promise.reject(_validationErrors);
        }
        var formData = {
            'file': {
                data: _params.file,
                filename: _params.filename,
                contentType: _params.fileContentType,
            },
            'metadata': _params.metadata,
        };
        var query = {
            'version': this.version,
        };
        var path = {
            'project_id': _params.projectId,
            'collection_id': _params.collectionId,
        };
        var sdkHeaders = (0, common_1.getSdkHeaders)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'analyzeDocument');
        var parameters = {
            options: {
                url: '/v2/projects/{project_id}/collections/{collection_id}/analyze',
                method: 'POST',
                qs: query,
                path: path,
                formData: formData
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {
                    'Accept': 'application/json',
                    'Content-Type': 'multipart/form-data',
                }, _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](/docs/discovery-data?topic=discovery-data-information-security#information-security).
     *
     * **Note:** This method is only supported on IBM Cloud instances of Discovery.
     *
     * @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<DiscoveryV2.Response<DiscoveryV2.EmptyObject>>}
     */
    DiscoveryV2.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)(DiscoveryV2.DEFAULT_SERVICE_NAME, 'v2', 'deleteUserData');
        var parameters = {
            options: {
                url: '/v2/user_data',
                method: 'DELETE',
                qs: query,
            },
            defaultOptions: extend(true, {}, this.baseOptions, {
                headers: extend(true, sdkHeaders, {}, _params.headers),
            }),
        };
        return this.createRequest(parameters);
    };
    DiscoveryV2.DEFAULT_SERVICE_URL = 'https://api.us-south.discovery.watson.cloud.ibm.com';
    DiscoveryV2.DEFAULT_SERVICE_NAME = 'discovery';
    return DiscoveryV2;
}(ibm_cloud_sdk_core_1.BaseService));
/*************************
 * interfaces
 ************************/
(function (DiscoveryV2) {
    /** Constants for the `createProject` operation. */
    var CreateProjectConstants;
    (function (CreateProjectConstants) {
        /** The type of project. The `content_intelligence` type is a *Document Retrieval for Contracts* project and the `other` type is a *Custom* project. The `content_mining` and `content_intelligence` types are available with Premium plan managed deployments and installed deployments only. The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed instances only. */
        var Type;
        (function (Type) {
            Type["INTELLIGENT_DOCUMENT_PROCESSING"] = "intelligent_document_processing";
            Type["DOCUMENT_RETRIEVAL"] = "document_retrieval";
            Type["CONVERSATIONAL_SEARCH"] = "conversational_search";
            Type["CONTENT_INTELLIGENCE"] = "content_intelligence";
            Type["CONTENT_MINING"] = "content_mining";
            Type["OTHER"] = "other";
        })(Type = CreateProjectConstants.Type || (CreateProjectConstants.Type = {}));
    })(CreateProjectConstants = DiscoveryV2.CreateProjectConstants || (DiscoveryV2.CreateProjectConstants = {}));
    /** Constants for the `addDocument` operation. */
    var AddDocumentConstants;
    (function (AddDocumentConstants) {
        /** The content type of file. */
        var FileContentType;
        (function (FileContentType) {
            FileContentType["APPLICATION_JSON"] = "application/json";
            FileContentType["APPLICATION_MSWORD"] = "application/msword";
            FileContentType["APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            FileContentType["APPLICATION_PDF"] = "application/pdf";
            FileContentType["TEXT_HTML"] = "text/html";
            FileContentType["APPLICATION_XHTML_XML"] = "application/xhtml+xml";
        })(FileContentType = AddDocumentConstants.FileContentType || (AddDocumentConstants.FileContentType = {}));
    })(AddDocumentConstants = DiscoveryV2.AddDocumentConstants || (DiscoveryV2.AddDocumentConstants = {}));
    /** Constants for the `updateDocument` operation. */
    var UpdateDocumentConstants;
    (function (UpdateDocumentConstants) {
        /** The content type of file. */
        var FileContentType;
        (function (FileContentType) {
            FileContentType["APPLICATION_JSON"] = "application/json";
            FileContentType["APPLICATION_MSWORD"] = "application/msword";
            FileContentType["APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            FileContentType["APPLICATION_PDF"] = "application/pdf";
            FileContentType["TEXT_HTML"] = "text/html";
            FileContentType["APPLICATION_XHTML_XML"] = "application/xhtml+xml";
        })(FileContentType = UpdateDocumentConstants.FileContentType || (UpdateDocumentConstants.FileContentType = {}));
    })(UpdateDocumentConstants = DiscoveryV2.UpdateDocumentConstants || (DiscoveryV2.UpdateDocumentConstants = {}));
    /** Constants for the `analyzeDocument` operation. */
    var AnalyzeDocumentConstants;
    (function (AnalyzeDocumentConstants) {
        /** The content type of file. */
        var FileContentType;
        (function (FileContentType) {
            FileContentType["APPLICATION_JSON"] = "application/json";
            FileContentType["APPLICATION_MSWORD"] = "application/msword";
            FileContentType["APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            FileContentType["APPLICATION_PDF"] = "application/pdf";
            FileContentType["TEXT_HTML"] = "text/html";
            FileContentType["APPLICATION_XHTML_XML"] = "application/xhtml+xml";
        })(FileContentType = AnalyzeDocumentConstants.FileContentType || (AnalyzeDocumentConstants.FileContentType = {}));
    })(AnalyzeDocumentConstants = DiscoveryV2.AnalyzeDocumentConstants || (DiscoveryV2.AnalyzeDocumentConstants = {}));
    var CollectionDetailsSmartDocumentUnderstanding;
    (function (CollectionDetailsSmartDocumentUnderstanding) {
        var Constants;
        (function (Constants) {
            /** Specifies the type of Smart Document Understanding (SDU) model that is enabled for the collection. The following types of models are supported: * `custom`: A user-trained model is applied. * `pre_trained`: A pretrained model is applied. This type of model is applied automatically to *Document Retrieval for Contracts* projects. * `text_extraction`: An SDU model that extracts text and metadata from the content. This model is enabled in collections by default regardless of the types of documents in the collection (as long as the service plan supports SDU models). You can apply user-trained or pretrained models to collections from the *Identify fields* page of the product user interface. For more information, see [the product documentation](/docs/discovery-data?topic=discovery-data-configuring-fields). */
            var Model;
            (function (Model) {
                Model["CUSTOM"] = "custom";
                Model["PRE_TRAINED"] = "pre_trained";
                Model["TEXT_EXTRACTION"] = "text_extraction";
            })(Model = Constants.Model || (Constants.Model = {}));
        })(Constants = CollectionDetailsSmartDocumentUnderstanding.Constants || (CollectionDetailsSmartDocumentUnderstanding.Constants = {}));
    })(CollectionDetailsSmartDocumentUnderstanding = DiscoveryV2.CollectionDetailsSmartDocumentUnderstanding || (DiscoveryV2.CollectionDetailsSmartDocumentUnderstanding = {}));
    var ComponentSettingsAggregation;
    (function (ComponentSettingsAggregation) {
        var Constants;
        (function (Constants) {
            /** Type of visualization to use when rendering the aggregation. */
            var VisualizationType;
            (function (VisualizationType) {
                VisualizationType["AUTO"] = "auto";
                VisualizationType["FACET_TABLE"] = "facet_table";
                VisualizationType["WORD_CLOUD"] = "word_cloud";
                VisualizationType["MAP"] = "map";
            })(VisualizationType = Constants.VisualizationType || (Constants.VisualizationType = {}));
        })(Constants = ComponentSettingsAggregation.Constants || (ComponentSettingsAggregation.Constants = {}));
    })(ComponentSettingsAggregation = DiscoveryV2.ComponentSettingsAggregation || (DiscoveryV2.ComponentSettingsAggregation = {}));
    var CreateEnrichment;
    (function (CreateEnrichment) {
        var Constants;
        (function (Constants) {
            /** The type of this enrichment. The following types are supported: * `classifier`: Creates a document classifier enrichment from a document classifier model that you create by using the [Document classifier API](/apidocs/discovery-data#createdocumentclassifier). **Note**: A text classifier enrichment can be created only from the product user interface. * `dictionary`: Creates a custom dictionary enrichment that you define in a CSV file. * `regular_expression`: Creates a custom regular expression enrichment from regex syntax that you specify in the request. * `rule_based`: Creates an enrichment from an advanced rules model that is created and exported as a ZIP file from Watson Knowledge Studio. * `uima_annotator`: Creates an enrichment from a custom UIMA text analysis model that is defined in a PEAR file created in one of the following ways: * Watson Explorer Content Analytics Studio. **Note**: Supported in IBM Cloud Pak for Data instances only. * Rule-based model that is created in Watson Knowledge Studio. * `watson_knowledge_studio_model`: Creates an enrichment from a Watson Knowledge Studio machine learning model that is defined in a ZIP file. * `webhook`: Connects to an external enrichment application by using a webhook. * `sentence_classifier`: Use sentence classifier to classify sentences in your documents. This feature is available in IBM Cloud-managed instances only. The sentence classifier feature is beta functionality. Beta features are not supported by the SDKs. */
            var Type;
            (function (Type) {
                Type["CLASSIFIER"] = "classifier";
                Type["DICTIONARY"] = "dictionary";
                Type["REGULAR_EXPRESSION"] = "regular_expression";
                Type["UIMA_ANNOTATOR"] = "uima_annotator";
                Type["RULE_BASED"] = "rule_based";
                Type["WATSON_KNOWLEDGE_STUDIO_MODEL"] = "watson_knowledge_studio_model";
                Type["WEBHOOK"] = "webhook";
                Type["SENTENCE_CLASSIFIER"] = "sentence_classifier";
            })(Type = Constants.Type || (Constants.Type = {}));
        })(Constants = CreateEnrichment.Constants || (CreateEnrichment.Constants = {}));
    })(CreateEnrichment = DiscoveryV2.CreateEnrichment || (DiscoveryV2.CreateEnrichment = {}));
    var DeleteDocumentResponse;
    (function (DeleteDocumentResponse) {
        var Constants;
        (function (Constants) {
            /** Status of the document. A deleted document has the status deleted. */
            var Status;
            (function (Status) {
                Status["DELETED"] = "deleted";
            })(Status = Constants.Status || (Constants.Status = {}));
        })(Constants = DeleteDocumentResponse.Constants || (DeleteDocumentResponse.Constants = {}));
    })(DeleteDocumentResponse = DiscoveryV2.DeleteDocumentResponse || (DiscoveryV2.DeleteDocumentResponse = {}));
    var DocumentAccepted;
    (function (DocumentAccepted) {
        var Constants;
        (function (Constants) {
            /** Status of the document in the ingestion process. A status of `processing` is returned for documents that are ingested with a *version* date before `2019-01-01`. The `pending` status is returned for all others. */
            var Status;
            (function (Status) {
                Status["PROCESSING"] = "processing";
                Status["PENDING"] = "pending";
            })(Status = Constants.Status || (Constants.Status = {}));
        })(Constants = DocumentAccepted.Constants || (DocumentAccepted.Constants = {}));
    })(DocumentAccepted = DiscoveryV2.DocumentAccepted || (DiscoveryV2.DocumentAccepted = {}));
    var DocumentClassifierModel;
    (function (DocumentClassifierModel) {
        var Constants;
        (function (Constants) {
            /** The status of the training run. */
            var Status;
            (function (Status) {
                Status["TRAINING"] = "training";
                Status["AVAILABLE"] = "available";
                Status["FAILED"] = "failed";
            })(Status = Constants.Status || (Constants.Status = {}));
        })(Constants = DocumentClassifierModel.Constants || (DocumentClassifierModel.Constants = {}));
    })(DocumentClassifierModel = DiscoveryV2.DocumentClassifierModel || (DiscoveryV2.DocumentClassifierModel = {}));
    var DocumentDetails;
    (function (DocumentDetails) {
        var Constants;
        (function (Constants) {
            /** The status of the ingestion of the document. The possible values are: * `available`: Ingestion is finished and the document is indexed. * `failed`: Ingestion is finished, but the document is not indexed because of an error. * `pending`: The document is uploaded, but the ingestion process is not started. * `processing`: Ingestion is in progress. */
            var Status;
            (function (Status) {
                Status["AVAILABLE"] = "available";
                Status["FAILED"] = "failed";
                Status["PENDING"] = "pending";
                Status["PROCESSING"] = "processing";
            })(Status = Constants.Status || (Constants.Status = {}));
        })(Constants = DocumentDetails.Constants || (DocumentDetails.Constants = {}));
    })(DocumentDetails = DiscoveryV2.DocumentDetails || (DiscoveryV2.DocumentDetails = {}));
    var Enrichment;
    (function (Enrichment) {
        var Constants;
        (function (Constants) {
            /** The type of this enrichment. */
            var Type;
            (function (Type) {
                Type["PART_OF_SPEECH"] = "part_of_speech";
                Type["SENTIMENT"] = "sentiment";
                Type["NATURAL_LANGUAGE_UNDERSTANDING"] = "natural_language_understanding";
                Type["DICTIONARY"] = "dictionary";
                Type["REGULAR_EXPRESSION"] = "regular_expression";
                Type["UIMA_ANNOTATOR"] = "uima_annotator";
                Type["RULE_BASED"] = "rule_based";
                Type["WATSON_KNOWLEDGE_STUDIO_MODEL"] = "watson_knowledge_studio_model";
                Type["CLASSIFIER"] = "classifier";
                Type["WEBHOOK"] = "webhook";
                Type["SENTENCE_CLASSIFIER"] = "sentence_classifier";
            })(Type = Constants.Type || (Constants.Type = {}));
        })(Constants = Enrichment.Constants || (Enrichment.Constants = {}));
    })(Enrichment = DiscoveryV2.Enrichment || (DiscoveryV2.Enrichment = {}));
    var Field;
    (function (Field) {
        var Constants;
        (function (Constants) {
            /** The type of the field. */
            var Type;
            (function (Type) {
                Type["NESTED"] = "nested";
                Type["STRING"] = "string";
                Type["DATE"] = "date";
                Type["LONG"] = "long";
                Type["INTEGER"] = "integer";
                Type["SHORT"] = "short";
                Type["BYTE"] = "byte";
                Type["DOUBLE"] = "double";
                Type["FLOAT"] = "float";
                Type["BOOLEAN"] = "boolean";
                Type["BINARY"] = "binary";
            })(Type = Constants.Type || (Constants.Type = {}));
        })(Constants = Field.Constants || (Field.Constants = {}));
    })(Field = DiscoveryV2.Field || (DiscoveryV2.Field = {}));
    var Notice;
    (function (Notice) {
        var Constants;
        (function (Constants) {
            /** Severity level of the notice. */
            var Severity;
            (function (Severity) {
                Severity["WARNING"] = "warning";
                Severity["ERROR"] = "error";
            })(Severity = Constants.Severity || (Constants.Severity = {}));
        })(Constants = Notice.Constants || (Notice.Constants = {}));
    })(Notice = DiscoveryV2.Notice || (DiscoveryV2.Notice = {}));
    var ProjectDetails;
    (function (ProjectDetails) {
        var Constants;
        (function (Constants) {
            /** The type of project. The `content_intelligence` type is a *Document Retrieval for Contracts* project and the `other` type is a *Custom* project. The `content_mining` and `content_intelligence` types are available with Premium plan managed deployments and installed deployments only. The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed instances only. */
            var Type;
            (function (Type) {
                Type["INTELLIGENT_DOCUMENT_PROCESSING"] = "intelligent_document_processing";
                Type["DOCUMENT_RETRIEVAL"] = "document_retrieval";
                Type["CONVERSATIONAL_SEARCH"] = "conversational_search";
                Type["CONTENT_MINING"] = "content_mining";
                Type["CONTENT_INTELLIGENCE"] = "content_intelligence";
                Type["OTHER"] = "other";
            })(Type = Constants.Type || (Constants.Type = {}));
        })(Constants = ProjectDetails.Constants || (ProjectDetails.Constants = {}));
    })(ProjectDetails = DiscoveryV2.ProjectDetails || (DiscoveryV2.ProjectDetails = {}));
    var ProjectListDetails;
    (function (ProjectListDetails) {
        var Constants;
        (function (Constants) {
            /** The type of project. The `content_intelligence` type is a *Document Retrieval for Contracts* project and the `other` type is a *Custom* project. The `content_mining` and `content_intelligence` types are available with Premium plan managed deployments and installed deployments only. The Intelligent Document Processing (IDP) project type is available from IBM Cloud-managed instances only. */
            var Type;
            (function (Type) {
                Type["INTELLIGENT_DOCUMENT_PROCESSING"] = "intelligent_document_processing";
                Type["DOCUMENT_RETRIEVAL"] = "document_retrieval";
                Type["CONVERSATIONAL_SEARCH"] = "conversational_search";
                Type["CONTENT_MINING"] = "content_mining";
                Type["CONTENT_INTELLIGENCE"] = "content_intelligence";
                Type["OTHER"] = "other";
            })(Type = Constants.Type || (Constants.Type = {}));
        })(Constants = ProjectListDetails.Constants || (ProjectListDetails.Constants = {}));
    })(ProjectListDetails = DiscoveryV2.ProjectListDetails || (DiscoveryV2.ProjectListDetails = {}));
    var QueryResultMetadata;
    (function (QueryResultMetadata) {
        var Constants;
        (function (Constants) {
            /** The document retrieval source that produced this search result. */
            var DocumentRetrievalSource;
            (function (DocumentRetrievalSource) {
                DocumentRetrievalSource["SEARCH"] = "search";
                DocumentRetrievalSource["CURATION"] = "curation";
            })(DocumentRetrievalSource = Constants.DocumentRetrievalSource || (Constants.DocumentRetrievalSource = {}));
        })(Constants = QueryResultMetadata.Constants || (QueryResultMetadata.Constants = {}));
    })(QueryResultMetadata = DiscoveryV2.QueryResultMetadata || (DiscoveryV2.QueryResultMetadata = {}));
    var RetrievalDetails;
    (function (RetrievalDetails) {
        var Constants;
        (function (Constants) {
            /** Identifies the document retrieval strategy used for this query. `relevancy_training` indicates that the results were returned using a relevancy trained model. **Note**: In the event of trained collections being queried, but the trained model is not used to return results, the **document_retrieval_strategy** is listed as `untrained`. */
            var DocumentRetrievalStrategy;
            (function (DocumentRetrievalStrategy) {
                DocumentRetrievalStrategy["UNTRAINED"] = "untrained";
                DocumentRetrievalStrategy["RELEVANCY_TRAINING"] = "relevancy_training";
            })(DocumentRetrievalStrategy = Constants.DocumentRetrievalStrategy || (Constants.DocumentRetrievalStrategy = {}));
        })(Constants = RetrievalDetails.Constants || (RetrievalDetails.Constants = {}));
    })(RetrievalDetails = DiscoveryV2.RetrievalDetails || (DiscoveryV2.RetrievalDetails = {}));
})(DiscoveryV2 || (DiscoveryV2 = {}));
module.exports = DiscoveryV2;