UNPKG

watson-developer-cloud

Version:

Client library to use the IBM Watson Services and AlchemyAPI

772 lines 71.5 kB
/** * Copyright 2018 IBM All Rights Reserved. * * 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. */ /// <reference types="node" /> import { RequestResponse } from 'request'; import { BaseService } from '../lib/base_service'; import { FileObject } from '../lib/helper'; /** * IBM Watson&trade; Compare and Comply analyzes governing documents to provide details about critical aspects of the documents. */ declare class CompareComplyV1 extends BaseService { static URL: string; name: string; serviceVersion: string; /** * Construct a CompareComplyV1 object. * * @param {Object} options - Options for the service. * @param {string} options.version - The API version date to use with the service, in "YYYY-MM-DD" format. Whenever the API is changed in a backwards incompatible way, a new minor version of the API is released. The service uses the API version for the date you specify, or the most recent version before that date. Note that you should not programmatically specify the current date at runtime, in case the API has been updated since your application's release. Instead, specify a version date that is compatible with your application, and don't change it until your application is ready for a later version. * @param {string} [options.url] - The base url to use when contacting the service (e.g. 'https://gateway.watsonplatform.net/compare-comply/api'). The base url may differ between Bluemix regions. * @param {string} [options.iam_access_token] - An IAM access token fully managed by the application. Responsibility falls on the application to refresh the token, either before it expires or reactively upon receiving a 401 from the service, as any requests made with an expired token will fail. * @param {string} [options.iam_apikey] - An API key that can be used to request IAM tokens. If this API key is provided, the SDK will manage the token and handle the refreshing. * @param {string} [options.iam_url] - An optional URL for the IAM service API. Defaults to 'https://iam.bluemix.net/identity/token'. * @param {boolean} [options.use_unauthenticated] - Set to `true` to avoid including an authorization header. This option may be useful for requests that are proxied. * @param {Object} [options.headers] - Default headers that shall be included with every request to the service. * @param {boolean} [options.headers.X-Watson-Learning-Opt-Out] - Set to `true` to opt-out of data collection. By default, all IBM Watson services log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public. If you are concerned with protecting the privacy of users' personal information or otherwise do not want your requests to be logged, you can opt out of logging. * @constructor * @returns {CompareComplyV1} * @throws {Error} */ constructor(options: CompareComplyV1.Options); /************************* * hTMLConversion ************************/ /** * Convert file to HTML. * * Convert an uploaded file to HTML. * * @param {Object} params - The parameters to send to the service. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The file to convert. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {string} [params.file_content_type] - The content type of file. * @param {string} [params.filename] - The filename for file. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ convertToHtml(params: CompareComplyV1.ConvertToHtmlParams, callback?: CompareComplyV1.Callback<CompareComplyV1.HTMLReturn>): NodeJS.ReadableStream | void; /************************* * elementClassification ************************/ /** * Classify the elements of a document. * * Analyze an uploaded file's structural and semantic elements. * * @param {Object} params - The parameters to send to the service. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The file to classify. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {string} [params.file_content_type] - The content type of file. * @param {string} [params.filename] - The filename for file. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ classifyElements(params: CompareComplyV1.ClassifyElementsParams, callback?: CompareComplyV1.Callback<CompareComplyV1.ClassifyReturn>): NodeJS.ReadableStream | void; /************************* * tables ************************/ /** * Extract a document's tables. * * Extract and analyze an uploaded file's tables. * * @param {Object} params - The parameters to send to the service. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The file on which to run table extraction. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {string} [params.file_content_type] - The content type of file. * @param {string} [params.filename] - The filename for file. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ extractTables(params: CompareComplyV1.ExtractTablesParams, callback?: CompareComplyV1.Callback<CompareComplyV1.TableReturn>): NodeJS.ReadableStream | void; /************************* * comparison ************************/ /** * Compare two documents. * * Compare two uploaded input files. Uploaded files must be in the same file format. * * @param {Object} params - The parameters to send to the service. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.file_1 - The first file to compare. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.file_2 - The second file to compare. * @param {string} [params.file_1_label] - A text label for the first file. * @param {string} [params.file_2_label] - A text label for the second file. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {string} [params.file_1_content_type] - The content type of file_1. * @param {string} [params.file_1_filename] - The filename for file_1. * @param {string} [params.file_2_content_type] - The content type of file_2. * @param {string} [params.file_2_filename] - The filename for file_2. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ compareDocuments(params: CompareComplyV1.CompareDocumentsParams, callback?: CompareComplyV1.Callback<CompareComplyV1.CompareReturn>): NodeJS.ReadableStream | void; /************************* * feedback ************************/ /** * Add feedback. * * Adds feedback in the form of _labels_ from a subject-matter expert (SME) to a governing document. * **Important:** Feedback is not immediately incorporated into the training model, nor is it guaranteed to be * incorporated at a later date. Instead, submitted feedback is used to suggest future updates to the training model. * * @param {Object} params - The parameters to send to the service. * @param {FeedbackDataInput} params.feedback_data - Feedback data for submission. * @param {string} [params.user_id] - An optional string identifying the user. * @param {string} [params.comment] - An optional comment on or description of the feedback. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ addFeedback(params: CompareComplyV1.AddFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackReturn>): NodeJS.ReadableStream | void; /** * Deletes a specified feedback entry. * * @param {Object} params - The parameters to send to the service. * @param {string} params.feedback_id - A string that specifies the feedback entry to be deleted from the document. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ deleteFeedback(params: CompareComplyV1.DeleteFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackDeleted>): NodeJS.ReadableStream | void; /** * List a specified feedback entry. * * @param {Object} params - The parameters to send to the service. * @param {string} params.feedback_id - A string that specifies the feedback entry to be included in the output. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ getFeedback(params: CompareComplyV1.GetFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.GetFeedback>): NodeJS.ReadableStream | void; /** * List the feedback in documents. * * @param {Object} [params] - The parameters to send to the service. * @param {string} [params.feedback_type] - An optional string that filters the output to include only feedback with * the specified feedback type. The only permitted value is `element_classification`. * @param {string} [params.before] - An optional string in the format `YYYY-MM-DD` that filters the output to include * only feedback that was added before the specified date. * @param {string} [params.after] - An optional string in the format `YYYY-MM-DD` that filters the output to include * only feedback that was added after the specified date. * @param {string} [params.document_title] - An optional string that filters the output to include only feedback from * the document with the specified `document_title`. * @param {string} [params.model_id] - An optional string that filters the output to include only feedback with the * specified `model_id`. The only permitted value is `contracts`. * @param {string} [params.model_version] - An optional string that filters the output to include only feedback with * the specified `model_version`. * @param {string} [params.category_removed] - An optional string in the form of a comma-separated list of categories. * If this is specified, the service filters the output to include only feedback that has at least one category from * the list removed. * @param {string} [params.category_added] - An optional string in the form of a comma-separated list of categories. * If this is specified, the service filters the output to include only feedback that has at least one category from * the list added. * @param {string} [params.category_not_changed] - An optional string in the form of a comma-separated list of * categories. If this is specified, the service filters the output to include only feedback that has at least one * category from the list unchanged. * @param {string} [params.type_removed] - An optional string of comma-separated `nature`:`party` pairs. If this is * specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from * the list removed. * @param {string} [params.type_added] - An optional string of comma-separated `nature`:`party` pairs. If this is * specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from * the list removed. * @param {string} [params.type_not_changed] - An optional string of comma-separated `nature`:`party` pairs. If this * is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair * from the list unchanged. * @param {number} [params.page_limit] - An optional integer specifying the number of documents that you want the * service to return. * @param {string} [params.cursor] - An optional string that returns the set of documents after the previous set. Use * this parameter with the `page_limit` parameter. * @param {string} [params.sort] - An optional comma-separated list of fields in the document to sort on. You can * optionally specify the sort direction by prefixing the value of the field with `-` for descending order or `+` for * ascending order (the default). Currently permitted sorting fields are `created`, `user_id`, and `document_title`. * @param {boolean} [params.include_total] - An optional boolean value. If specified as `true`, the `pagination` * object in the output includes a value called `total` that gives the total count of feedback created. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ listFeedback(params?: CompareComplyV1.ListFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackList>): NodeJS.ReadableStream | void; /************************* * batches ************************/ /** * Submit a batch-processing request. * * Run Compare and Comply methods over a collection of input documents. * **Important:** Batch processing requires the use of the [IBM Cloud Object Storage * service](https://cloud.ibm.com/docs/services/cloud-object-storage/about-cos.html#about-ibm-cloud-object-storage). * The use of IBM Cloud Object Storage with Compare and Comply is discussed at [Using batch * processing](https://cloud.ibm.com/docs/services/compare-comply/batching.html#before-you-batch). * * @param {Object} params - The parameters to send to the service. * @param {string} params._function - The Compare and Comply method to run across the submitted input documents. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.input_credentials_file - A JSON file containing the input * Cloud Object Storage credentials. At a minimum, the credentials must enable `READ` permissions on the bucket * defined by the `input_bucket_name` parameter. * @param {string} params.input_bucket_location - The geographical location of the Cloud Object Storage input bucket * as listed on the **Endpoint** tab of your Cloud Object Storage instance; for example, `us-geo`, `eu-geo`, or * `ap-geo`. * @param {string} params.input_bucket_name - The name of the Cloud Object Storage input bucket. * @param {NodeJS.ReadableStream|FileObject|Buffer} params.output_credentials_file - A JSON file that lists the Cloud * Object Storage output credentials. At a minimum, the credentials must enable `READ` and `WRITE` permissions on the * bucket defined by the `output_bucket_name` parameter. * @param {string} params.output_bucket_location - The geographical location of the Cloud Object Storage output bucket * as listed on the **Endpoint** tab of your Cloud Object Storage instance; for example, `us-geo`, `eu-geo`, or * `ap-geo`. * @param {string} params.output_bucket_name - The name of the Cloud Object Storage output bucket. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {string} [params.input_credentials_filename] - The filename for input_credentials_file. * @param {string} [params.output_credentials_filename] - The filename for output_credentials_file. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ createBatch(params: CompareComplyV1.CreateBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): NodeJS.ReadableStream | void; /** * Get information about a specific batch-processing request. * * Get information about a batch-processing request with a specified ID. * * @param {Object} params - The parameters to send to the service. * @param {string} params.batch_id - The ID of the batch-processing request whose information you want to retrieve. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ getBatch(params: CompareComplyV1.GetBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): NodeJS.ReadableStream | void; /** * List submitted batch-processing jobs. * * List the batch-processing jobs submitted by users. * * @param {Object} [params] - The parameters to send to the service. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ listBatches(params?: CompareComplyV1.ListBatchesParams, callback?: CompareComplyV1.Callback<CompareComplyV1.Batches>): NodeJS.ReadableStream | void; /** * Update a pending or active batch-processing request. * * Update a pending or active batch-processing request. You can rescan the input bucket to check for new documents or * cancel a request. * * @param {Object} params - The parameters to send to the service. * @param {string} params.batch_id - The ID of the batch-processing request you want to update. * @param {string} params.action - The action you want to perform on the specified batch-processing request. * @param {string} [params.model_id] - The analysis model to be used by the service. For the * `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, * the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in * batch-processing requests. * @param {Object} [params.headers] - Custom request headers * @param {Function} [callback] - The callback that handles the response. * @returns {NodeJS.ReadableStream|void} */ updateBatch(params: CompareComplyV1.UpdateBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): NodeJS.ReadableStream | void; } /************************* * interfaces ************************/ declare namespace CompareComplyV1 { /** Options for the `CompareComplyV1` constructor. */ type Options = { version: string; url?: string; iam_access_token?: string; iam_apikey?: string; iam_url?: string; username?: string; password?: string; use_unauthenticated?: boolean; headers?: object; }; /** The callback for a service request. */ type Callback<T> = (error: any, body?: T, response?: RequestResponse) => void; /** The body of a service request that returns no response data. */ interface Empty { } /************************* * request interfaces ************************/ /** Parameters for the `convertToHtml` operation. */ interface ConvertToHtmlParams { /** The file to convert. */ file: NodeJS.ReadableStream | FileObject | Buffer; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: ConvertToHtmlConstants.ModelId | string; /** The content type of file. */ file_content_type?: ConvertToHtmlConstants.FileContentType | string; /** The filename for file. */ filename?: string; headers?: Object; } /** Constants for the `convertToHtml` operation. */ namespace ConvertToHtmlConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } /** The content type of file. */ enum FileContentType { APPLICATION_PDF = "application/pdf", APPLICATION_MSWORD = "application/msword", APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", IMAGE_BMP = "image/bmp", IMAGE_GIF = "image/gif", IMAGE_JPEG = "image/jpeg", IMAGE_PNG = "image/png", IMAGE_TIFF = "image/tiff", TEXT_PLAIN = "text/plain" } } /** Parameters for the `classifyElements` operation. */ interface ClassifyElementsParams { /** The file to classify. */ file: NodeJS.ReadableStream | FileObject | Buffer; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: ClassifyElementsConstants.ModelId | string; /** The content type of file. */ file_content_type?: ClassifyElementsConstants.FileContentType | string; /** The filename for file. */ filename?: string; headers?: Object; } /** Constants for the `classifyElements` operation. */ namespace ClassifyElementsConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } /** The content type of file. */ enum FileContentType { APPLICATION_PDF = "application/pdf", APPLICATION_MSWORD = "application/msword", APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", IMAGE_BMP = "image/bmp", IMAGE_GIF = "image/gif", IMAGE_JPEG = "image/jpeg", IMAGE_PNG = "image/png", IMAGE_TIFF = "image/tiff" } } /** Parameters for the `extractTables` operation. */ interface ExtractTablesParams { /** The file on which to run table extraction. */ file: NodeJS.ReadableStream | FileObject | Buffer; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: ExtractTablesConstants.ModelId | string; /** The content type of file. */ file_content_type?: ExtractTablesConstants.FileContentType | string; /** The filename for file. */ filename?: string; headers?: Object; } /** Constants for the `extractTables` operation. */ namespace ExtractTablesConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } /** The content type of file. */ enum FileContentType { APPLICATION_PDF = "application/pdf", APPLICATION_MSWORD = "application/msword", APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", IMAGE_BMP = "image/bmp", IMAGE_GIF = "image/gif", IMAGE_JPEG = "image/jpeg", IMAGE_PNG = "image/png", IMAGE_TIFF = "image/tiff", TEXT_PLAIN = "text/plain" } } /** Parameters for the `compareDocuments` operation. */ interface CompareDocumentsParams { /** The first file to compare. */ file_1: NodeJS.ReadableStream | FileObject | Buffer; /** The second file to compare. */ file_2: NodeJS.ReadableStream | FileObject | Buffer; /** A text label for the first file. */ file_1_label?: string; /** A text label for the second file. */ file_2_label?: string; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: CompareDocumentsConstants.ModelId | string; /** The content type of file_1. */ file_1_content_type?: CompareDocumentsConstants.File1ContentType | string; /** The filename for file_1. */ file_1_filename?: string; /** The content type of file_2. */ file_2_content_type?: CompareDocumentsConstants.File2ContentType | string; /** The filename for file_2. */ file_2_filename?: string; headers?: Object; } /** Constants for the `compareDocuments` operation. */ namespace CompareDocumentsConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } /** The content type of file_1. */ enum File1ContentType { APPLICATION_PDF = "application/pdf", APPLICATION_JSON = "application/json", APPLICATION_MSWORD = "application/msword", APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", IMAGE_BMP = "image/bmp", IMAGE_GIF = "image/gif", IMAGE_JPEG = "image/jpeg", IMAGE_PNG = "image/png", IMAGE_TIFF = "image/tiff" } /** The content type of file_2. */ enum File2ContentType { APPLICATION_PDF = "application/pdf", APPLICATION_JSON = "application/json", APPLICATION_MSWORD = "application/msword", APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", IMAGE_BMP = "image/bmp", IMAGE_GIF = "image/gif", IMAGE_JPEG = "image/jpeg", IMAGE_PNG = "image/png", IMAGE_TIFF = "image/tiff" } } /** Parameters for the `addFeedback` operation. */ interface AddFeedbackParams { /** Feedback data for submission. */ feedback_data: FeedbackDataInput; /** An optional string identifying the user. */ user_id?: string; /** An optional comment on or description of the feedback. */ comment?: string; headers?: Object; } /** Parameters for the `deleteFeedback` operation. */ interface DeleteFeedbackParams { /** A string that specifies the feedback entry to be deleted from the document. */ feedback_id: string; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: DeleteFeedbackConstants.ModelId | string; headers?: Object; } /** Constants for the `deleteFeedback` operation. */ namespace DeleteFeedbackConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } } /** Parameters for the `getFeedback` operation. */ interface GetFeedbackParams { /** A string that specifies the feedback entry to be included in the output. */ feedback_id: string; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: GetFeedbackConstants.ModelId | string; headers?: Object; } /** Constants for the `getFeedback` operation. */ namespace GetFeedbackConstants { /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } } /** Parameters for the `listFeedback` operation. */ interface ListFeedbackParams { /** An optional string that filters the output to include only feedback with the specified feedback type. The only permitted value is `element_classification`. */ feedback_type?: string; /** An optional string in the format `YYYY-MM-DD` that filters the output to include only feedback that was added before the specified date. */ before?: string; /** An optional string in the format `YYYY-MM-DD` that filters the output to include only feedback that was added after the specified date. */ after?: string; /** An optional string that filters the output to include only feedback from the document with the specified `document_title`. */ document_title?: string; /** An optional string that filters the output to include only feedback with the specified `model_id`. The only permitted value is `contracts`. */ model_id?: string; /** An optional string that filters the output to include only feedback with the specified `model_version`. */ model_version?: string; /** An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list removed. */ category_removed?: string; /** An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list added. */ category_added?: string; /** An optional string in the form of a comma-separated list of categories. If this is specified, the service filters the output to include only feedback that has at least one category from the list unchanged. */ category_not_changed?: string; /** An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed. */ type_removed?: string; /** An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list removed. */ type_added?: string; /** An optional string of comma-separated `nature`:`party` pairs. If this is specified, the service filters the output to include only feedback that has at least one `nature`:`party` pair from the list unchanged. */ type_not_changed?: string; /** An optional integer specifying the number of documents that you want the service to return. */ page_limit?: number; /** An optional string that returns the set of documents after the previous set. Use this parameter with the `page_limit` parameter. */ cursor?: string; /** An optional comma-separated list of fields in the document to sort on. You can optionally specify the sort direction by prefixing the value of the field with `-` for descending order or `+` for ascending order (the default). Currently permitted sorting fields are `created`, `user_id`, and `document_title`. */ sort?: string; /** An optional boolean value. If specified as `true`, the `pagination` object in the output includes a value called `total` that gives the total count of feedback created. */ include_total?: boolean; headers?: Object; } /** Parameters for the `createBatch` operation. */ interface CreateBatchParams { /** The Compare and Comply method to run across the submitted input documents. */ _function: CreateBatchConstants.Function | string; /** A JSON file containing the input Cloud Object Storage credentials. At a minimum, the credentials must enable `READ` permissions on the bucket defined by the `input_bucket_name` parameter. */ input_credentials_file: NodeJS.ReadableStream | FileObject | Buffer; /** The geographical location of the Cloud Object Storage input bucket as listed on the **Endpoint** tab of your Cloud Object Storage instance; for example, `us-geo`, `eu-geo`, or `ap-geo`. */ input_bucket_location: string; /** The name of the Cloud Object Storage input bucket. */ input_bucket_name: string; /** A JSON file that lists the Cloud Object Storage output credentials. At a minimum, the credentials must enable `READ` and `WRITE` permissions on the bucket defined by the `output_bucket_name` parameter. */ output_credentials_file: NodeJS.ReadableStream | FileObject | Buffer; /** The geographical location of the Cloud Object Storage output bucket as listed on the **Endpoint** tab of your Cloud Object Storage instance; for example, `us-geo`, `eu-geo`, or `ap-geo`. */ output_bucket_location: string; /** The name of the Cloud Object Storage output bucket. */ output_bucket_name: string; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: CreateBatchConstants.ModelId | string; /** The filename for input_credentials_file. */ input_credentials_filename?: string; /** The filename for output_credentials_file. */ output_credentials_filename?: string; headers?: Object; } /** Constants for the `createBatch` operation. */ namespace CreateBatchConstants { /** The Compare and Comply method to run across the submitted input documents. */ enum Function { HTML_CONVERSION = "html_conversion", ELEMENT_CLASSIFICATION = "element_classification", TABLES = "tables" } /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } } /** Parameters for the `getBatch` operation. */ interface GetBatchParams { /** The ID of the batch-processing request whose information you want to retrieve. */ batch_id: string; headers?: Object; } /** Parameters for the `listBatches` operation. */ interface ListBatchesParams { headers?: Object; } /** Parameters for the `updateBatch` operation. */ interface UpdateBatchParams { /** The ID of the batch-processing request you want to update. */ batch_id: string; /** The action you want to perform on the specified batch-processing request. */ action: UpdateBatchConstants.Action | string; /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ model_id?: UpdateBatchConstants.ModelId | string; headers?: Object; } /** Constants for the `updateBatch` operation. */ namespace UpdateBatchConstants { /** The action you want to perform on the specified batch-processing request. */ enum Action { RESCAN = "rescan", CANCEL = "cancel" } /** The analysis model to be used by the service. For the `/v1/element_classification` and `/v1/comparison` methods, the default is `contracts`. For the `/v1/tables` method, the default is `tables`. These defaults apply to the standalone methods as well as to the methods' use in batch-processing requests. */ enum ModelId { CONTRACTS = "contracts", TABLES = "tables" } } /************************* * model interfaces ************************/ /** A party's address. */ interface Address { /** A string listing the address. */ text?: string; /** The numeric location of the identified element in the document, represented with two integers labeled `begin` and `end`. */ location?: Location; } /** AlignedElement. */ interface AlignedElement { /** Identifies two elements that semantically align between the compared documents. */ element_pair?: ElementPair[]; /** Specifies whether the text is identical. */ identical_text?: boolean; /** Indicates that the elements aligned are contractual clauses of significance. */ significant_elements?: boolean; /** One or more hashed values that you can send to IBM to provide feedback or receive support. */ provenance_ids?: string[]; } /** List of document attributes. */ interface Attribute { /** The type of attribute. */ type?: string; /** The text associated with the attribute. */ text?: string; /** The numeric location of the identified element in the document, represented with two integers labeled `begin` and `end`. */ location?: Location; } /** The batch-request status. */ interface BatchStatus { /** The method to be run against the documents. Possible values are `html_conversion`, `element_classification`, and `tables`. */ _function?: string; /** The geographical location of the Cloud Object Storage input bucket as listed on the **Endpoint** tab of your COS instance; for example, `us-geo`, `eu-geo`, or `ap-geo`. */ input_bucket_location?: string; /** The name of the Cloud Object Storage input bucket. */ input_bucket_name?: string; /** The geographical location of the Cloud Object Storage output bucket as listed on the **Endpoint** tab of your COS instance; for example, `us-geo`, `eu-geo`, or `ap-geo`. */ output_bucket_location?: string; /** The name of the Cloud Object Storage output bucket. */ output_bucket_name?: string; /** The unique identifier for the batch request. */ batch_id?: string; /** Document counts. */ document_counts?: DocCounts; /** The status of the batch request. */ status?: string; /** The creation time of the batch request. */ created?: string; /** The time of the most recent update to the batch request. */ updated?: string; } /** The results of a successful `GET /v1/batches` request. */ interface Batches { /** A list of the status of all batch requests. */ batches?: BatchStatus[]; } /** Cells that are not table header, column header, or row header cells. */ interface BodyCells { /** A string value in the format `columnHeader-x-y`, where `x` and `y` are the begin and end offsets of this column header cell in the input document. */ cell_id?: string; /** The numeric location of the identified element in the document, represented with two integers labeled `begin` and `end`. */ location?: Location; /** The textual contents of this cell from the input document without associated markup content. */ text?: string; /** The `begin` index of this cell's `row` location in the current table. */ row_index_begin?: number; /** The `end` index of this cell's `row` location in the current table. */ row_index_end?: number; /** The `begin` index of this cell's `column` location in the current table. */ column_index_begin?: number; /** The `end` index of this cell's `column` location in the current table. */ column_index_end?: number; /** An array of values, each being the `id` value of a row header that is applicable to this body cell. */ row_header_ids?: string[]; /** An array of values, each being the `text` value of a row header that is applicable to this body cell. */ row_header_texts?: string[]; /** If you provide customization input, the normalized version of the row header texts according to the customization; otherwise, the same value as `row_header_texts`. */ row_header_texts_normalized?: string[]; /** An array of values, each being the `id` value of a column header that is applicable to the current cell. */ column_header_ids?: string[]; /** An array of values, each being the `text` value of a column header that is applicable to the current cell. */ column_header_texts?: string[]; /** If you provide customization input, the normalized version of the column header texts according to the customization; otherwise, the same value as `column_header_texts`. */ column_header_texts_normalized?: string[]; attributes?: Attribute[]; } /** Information defining an element's subject matter. */ interface Category { /** The category of the associated element. */ label?: string; /** One or more hashed values that you can send to IBM to provide feedback or receive support. */ provenance_ids?: string[]; } /** The analysis of objects returned by the `/v1/element_classification` method. */ interface ClassifyReturn { /** Basic information about the input document. */ document?: Document; /** The analysis model used to classify the input document. For the `/v1/element_classification` method, the only valid value is `contracts`. */ model_id?: string; /** The version of the analysis model identified by the value of the `model_id` key. */ model_version?: string; /** Document elements identified by the service. */ elements?: Element[]; /** Definition of tables identified in the input document. */ tables?: Tables[]; /** The structure of the input document. */ document_structure?: DocStructure; /** Definitions of the parties identified in the input document. */ parties?: Parties[]; /** The effective dates of the input document. */ effective_dates?: EffectiveDates[]; /** The monetary amounts identified in the input document. */ contract_amounts?: ContractAmts[]; /** The input document's termination dates. */ termination_dates?: TerminationDates[]; } /** Column-level cells, each applicable as a header to other cells in the same column as itself, of the current table. */ interface ColumnHeaders { /** A string value in the format `columnHeader-x-y`, where `x` and `y` are the begin and end offsets of this column header cell in the input document. */ cell_id?: string; /** The location of the column header cell in the current table as defined by its `begin` and `end` offsets, respectfully, in the input document. */ location?: Object; /** The textual contents of this cell from the input document without associated markup content. */ text?: string; /** If you provide customization input, the normalized version of the cell text according to the customization; otherwise, the same value as `text`. */ text_normalized?: string; /** The `begin` index of this cell's `row` location in the current table. */ row_index_begin?: number; /** The `end` index of this cell's `row` location in the current table. */ row_index_end?: number; /** The `begin` index of this cell's `column` location in the current table. */ column_index_begin?: number; /** The `end` index of this cell's `column` location in the current table. */ column_index_end?: number; } /** The comparison of the two submitted documents. */ interface CompareReturn { /** Information about the documents being compared. */ documents?: Document[]; /** A list of pairs of eleme