watson-developer-cloud
Version:
Client library to use the IBM Watson Services
786 lines • 74 kB
TypeScript
/**
* 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 { AxiosResponse } from 'axios';
import { BaseService } from 'ibm-cloud-sdk-core';
import { FileObject } from 'ibm-cloud-sdk-core';
/**
* IBM Watson™ 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 document to HTML.
*
* Converts a document to HTML.
*
* @param {Object} params - The parameters to send to the service.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The document to convert.
* @param {string} params.filename - The filename for file.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.model] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
convertToHtml(params: CompareComplyV1.ConvertToHtmlParams, callback?: CompareComplyV1.Callback<CompareComplyV1.HTMLReturn>): Promise<any> | void;
/*************************
* elementClassification
************************/
/**
* Classify the elements of a document.
*
* Analyzes the structural and semantic elements of a document.
*
* @param {Object} params - The parameters to send to the service.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The document to classify.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.model] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
classifyElements(params: CompareComplyV1.ClassifyElementsParams, callback?: CompareComplyV1.Callback<CompareComplyV1.ClassifyReturn>): Promise<any> | void;
/*************************
* tables
************************/
/**
* Extract a document's tables.
*
* Analyzes the tables in a document.
*
* @param {Object} params - The parameters to send to the service.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.file - The document on which to run table extraction.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.model] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
extractTables(params: CompareComplyV1.ExtractTablesParams, callback?: CompareComplyV1.Callback<CompareComplyV1.TableReturn>): Promise<any> | void;
/*************************
* comparison
************************/
/**
* Compare two documents.
*
* Compares two input documents. Documents must be in the same format.
*
* @param {Object} params - The parameters to send to the service.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.file_1 - The first document to compare.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.file_2 - The second document to compare.
* @param {string} [params.file_1_content_type] - The content type of file_1.
* @param {string} [params.file_2_content_type] - The content type of file_2.
* @param {string} [params.file_1_label] - A text label for the first document.
* @param {string} [params.file_2_label] - A text label for the second document.
* @param {string} [params.model] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
compareDocuments(params: CompareComplyV1.CompareDocumentsParams, callback?: CompareComplyV1.Callback<CompareComplyV1.CompareReturn>): Promise<any> | 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 {Promise<any>|void}
*/
addFeedback(params: CompareComplyV1.AddFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackReturn>): Promise<any> | void;
/**
* Delete a specified feedback entry.
*
* Deletes a feedback entry with a specified `feedback_id`.
*
* @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] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
deleteFeedback(params: CompareComplyV1.DeleteFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackDeleted>): Promise<any> | void;
/**
* List a specified feedback entry.
*
* Lists a feedback entry with a specified `feedback_id`.
*
* @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] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
getFeedback(params: CompareComplyV1.GetFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.GetFeedback>): Promise<any> | void;
/**
* List the feedback in a document.
*
* Lists the feedback in a document.
*
* @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 {Promise<any>|void}
*/
listFeedback(params?: CompareComplyV1.ListFeedbackParams, callback?: CompareComplyV1.Callback<CompareComplyV1.FeedbackList>): Promise<any> | 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] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
createBatch(params: CompareComplyV1.CreateBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): Promise<any> | void;
/**
* Get information about a specific batch-processing job.
*
* Gets information about a batch-processing job 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 job whose information you want to retrieve.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getBatch(params: CompareComplyV1.GetBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): Promise<any> | void;
/**
* List submitted batch-processing jobs.
*
* Lists 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 {Promise<any>|void}
*/
listBatches(params?: CompareComplyV1.ListBatchesParams, callback?: CompareComplyV1.Callback<CompareComplyV1.Batches>): Promise<any> | void;
/**
* Update a pending or active batch-processing job.
*
* Updates a pending or active batch-processing job. You can rescan the input bucket to check for new documents or
* cancel a job.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.batch_id - The ID of the batch-processing job you want to update.
* @param {string} params.action - The action you want to perform on the specified batch-processing job.
* @param {string} [params.model] - The analysis model to be used by the service. For the **Element classification**
* and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 {Promise<any>|void}
*/
updateBatch(params: CompareComplyV1.UpdateBatchParams, callback?: CompareComplyV1.Callback<CompareComplyV1.BatchStatus>): Promise<any> | 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?: AxiosResponse<T>) => void;
/** The body of a service request that returns no response data. */
interface Empty {
}
/*************************
* request interfaces
************************/
/** Parameters for the `convertToHtml` operation. */
interface ConvertToHtmlParams {
/** The document to convert. */
file: NodeJS.ReadableStream | FileObject | Buffer;
/** The filename for file. */
filename: string;
/** The content type of file. */
file_content_type?: ConvertToHtmlConstants.FileContentType | string;
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: ConvertToHtmlConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `convertToHtml` operation. */
namespace ConvertToHtmlConstants {
/** 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"
}
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
CONTRACTS = "contracts",
TABLES = "tables"
}
}
/** Parameters for the `classifyElements` operation. */
interface ClassifyElementsParams {
/** The document to classify. */
file: NodeJS.ReadableStream | FileObject | Buffer;
/** The content type of file. */
file_content_type?: ClassifyElementsConstants.FileContentType | string;
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: ClassifyElementsConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `classifyElements` operation. */
namespace ClassifyElementsConstants {
/** 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"
}
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
CONTRACTS = "contracts",
TABLES = "tables"
}
}
/** Parameters for the `extractTables` operation. */
interface ExtractTablesParams {
/** The document on which to run table extraction. */
file: NodeJS.ReadableStream | FileObject | Buffer;
/** The content type of file. */
file_content_type?: ExtractTablesConstants.FileContentType | string;
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: ExtractTablesConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `extractTables` operation. */
namespace ExtractTablesConstants {
/** 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"
}
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
CONTRACTS = "contracts",
TABLES = "tables"
}
}
/** Parameters for the `compareDocuments` operation. */
interface CompareDocumentsParams {
/** The first document to compare. */
file_1: NodeJS.ReadableStream | FileObject | Buffer;
/** The second document to compare. */
file_2: NodeJS.ReadableStream | FileObject | Buffer;
/** The content type of file_1. */
file_1_content_type?: CompareDocumentsConstants.File1ContentType | string;
/** The content type of file_2. */
file_2_content_type?: CompareDocumentsConstants.File2ContentType | string;
/** A text label for the first document. */
file_1_label?: string;
/** A text label for the second document. */
file_2_label?: string;
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: CompareDocumentsConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `compareDocuments` operation. */
namespace CompareDocumentsConstants {
/** 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"
}
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
CONTRACTS = "contracts",
TABLES = "tables"
}
}
/** 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;
return_response?: boolean;
}
/** 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 **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: DeleteFeedbackConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `deleteFeedback` operation. */
namespace DeleteFeedbackConstants {
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
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 **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: GetFeedbackConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `getFeedback` operation. */
namespace GetFeedbackConstants {
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
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;
return_response?: boolean;
}
/** 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 **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: CreateBatchConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** 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 **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
CONTRACTS = "contracts",
TABLES = "tables"
}
}
/** Parameters for the `getBatch` operation. */
interface GetBatchParams {
/** The ID of the batch-processing job whose information you want to retrieve. */
batch_id: string;
headers?: Object;
return_response?: boolean;
}
/** Parameters for the `listBatches` operation. */
interface ListBatchesParams {
headers?: Object;
return_response?: boolean;
}
/** Parameters for the `updateBatch` operation. */
interface UpdateBatchParams {
/** The ID of the batch-processing job you want to update. */
batch_id: string;
/** The action you want to perform on the specified batch-processing job. */
action: UpdateBatchConstants.Action | string;
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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?: UpdateBatchConstants.Model | string;
headers?: Object;
return_response?: boolean;
}
/** Constants for the `updateBatch` operation. */
namespace UpdateBatchConstants {
/** The action you want to perform on the specified batch-processing job. */
enum Action {
RESCAN = "rescan",
CANCEL = "cancel"
}
/** The analysis model to be used by the service. For the **Element classification** and **Compare two documents** methods, the default is `contracts`. For the **Extract 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 Model {
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 aligned element is identical. Elements are considered identical despite minor differences such as leading punctuation, end-of-sentence punctuation, whitespace, the presence or absence of definite or indefinite articles, and others. */
identical_text?: boolean;
/** One or more hashed values that you can send to IBM to provide feedback or receive support. */
provenance_ids?: string[];
/** Indicates that the elements aligned are contractual clauses of significance. */
significant_elements?: boolean;
}
/** 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 {
/** The unique ID of the cell in the current table. */
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;
row_header_ids?: RowHeaderIds[];
row_header_texts?: RowHeaderTexts[];
row_header_texts_normalized?: RowHeaderTextsNormalized[];
column_header_ids?: ColumnHeaderIds[];
column_header_texts?: ColumnHeaderTexts[];
column_header_texts_normalized?: ColumnHeaderTextsNormalized[];
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[];
}
/** Information defining an element's subject matter. */
interface CategoryComparison {
/** The category of the associated element. */
label?: string;
}
/** The analysis of objects returned by the **Element classification** method. */
interface ClassifyReturn {
/** Basic information about the input document. */
document?: Document;
/** The analysis model used to classify the input document. For the **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 date or dates on which the document becomes effective. */
effective_dates?: EffectiveDates[];
/** The monetary amounts that identify the total amount of the contract that needs to be paid from one party to another. */
contract_amounts?: ContractAmts[];
/** The date or dates on which the document is to be terminated. */
termination_dates?: TerminationDates[];
/** The document's contract type or types as declared in the document. */
contract_type?: ContractType[];
}
/** An array of values, each being the `id` value of a column header that is applicable to the current cell. */
interface ColumnHeaderIds {
/** The `id` value of a column header. */
id?: string;
}
/** An array of values, each being the `text` value of a column header that is applicable to the current cell. */
interface ColumnHeaderTexts {
/** The `text` value of a column header. */
text?: 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`. */
interface ColumnHeaderTextsNormalized {
/** The normalized version of a column header text. */
text_normalized?: string;
}
/** Column-level cells, each applicable as a header to other cells in the same column as itself, of the current table. */
interface ColumnHeaders {
/** The unique ID of the cell in the current table. */
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 {
/** The analysis model used to compare the input document