UNPKG

@ibm-cloud/cloudant

Version:
745 lines 508 kB
/** * (C) Copyright IBM Corp. 2025. * * 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. */ import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; import { AbortSignal, SDKLogger, UserOptions } from 'ibm-cloud-sdk-core'; import { CloudantBaseService } from '../lib/cloudantBaseService'; /** * NoSQL database based on Apache CouchDB * * See: https://cloud.ibm.com/docs/services/Cloudant/ */ declare class CloudantV1 extends CloudantBaseService { static _logger: SDKLogger; static DEFAULT_SERVICE_URL: string; static DEFAULT_SERVICE_NAME: string; /************************* * Factory method ************************/ /** * Constructs an instance of CloudantV1 with passed in options and external configuration. * * @param {UserOptions} [options] - The parameters to send 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 * @param {string} [options.serviceUrl] - The base URL for the service * @returns {CloudantV1} */ static newInstance(options: UserOptions): CloudantV1; /** * Construct a CloudantV1 object. * * @param {Object} options - Options for the service. * @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 {Authenticator} options.authenticator - The Authenticator object used to authenticate requests to the service * @constructor * @returns {CloudantV1} */ constructor(options: UserOptions); /************************* * server ************************/ /** * Retrieve server instance information. * * When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response * includes a JSON structure that contains information about the server, including a welcome message and the server's * version. * * **Tip:** The authentication for this endpoint is only enforced when using IAM. * * @param {Object} [params] - The parameters to send to the service. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.ServerInformation>>} */ getServerInformation(params?: CloudantV1.GetServerInformationParams): Promise<CloudantV1.Response<CloudantV1.ServerInformation>>; /** * Retrieve provisioned throughput capacity information. * * View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the * target provisioned throughput capacity. * * @param {Object} [params] - The parameters to send to the service. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.CapacityThroughputInformation>>} */ getCapacityThroughputInformation(params?: CloudantV1.GetCapacityThroughputInformationParams): Promise<CloudantV1.Response<CloudantV1.CapacityThroughputInformation>>; /** * Update the target provisioned throughput capacity. * * Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the * current capacity asynchronously changes to meet the target capacity. * * @param {Object} params - The parameters to send to the service. * @param {number} params.blocks - A number of blocks of throughput units. A block consists of 100 reads/sec, 50 * writes/sec, and 5 global queries/sec of provisioned throughput capacity. Not available for some plans. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.CapacityThroughputInformation>>} */ putCapacityThroughputConfiguration(params: CloudantV1.PutCapacityThroughputConfigurationParams): Promise<CloudantV1.Response<CloudantV1.CapacityThroughputInformation>>; /** * Retrieve one or more UUIDs. * * Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that * provides a list of UUIDs. * * **Tip:** The authentication for this endpoint is only enforced when using IAM. * * @param {Object} [params] - The parameters to send to the service. * @param {number} [params.count] - Query parameter to specify the number of UUIDs to return. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.UuidsResult>>} */ getUuids(params?: CloudantV1.GetUuidsParams): Promise<CloudantV1.Response<CloudantV1.UuidsResult>>; /************************* * changes ************************/ /** * Retrieve change events for all databases. * * **This endpoint is not available in IBM Cloudant.** * * Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating * or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order * and might repeat changes. Polling modes for this method work like polling modes for the changes feed. * * @param {Object} [params] - The parameters to send to the service. * @param {boolean} [params.descending] - Query parameter to specify whether to return the documents in descending by * key order. * @param {string} [params.feed] - Query parameter to specify the changes feed type. * @param {number} [params.heartbeat] - Query parameter to specify the period in milliseconds after which an empty * line is sent in the results. Off by default and only applicable for * `continuous` and `eventsource` feeds. Overrides any timeout to keep the feed alive indefinitely. May also be `true` * to use a value of `60000`. * * **Note:** Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an * environment where idle network connections may break, `heartbeat` is not suitable as a keepalive mechanism. * Instead, consider one of the following options: * * Use the `timeout` parameter with a value that is compatible with your network environment. * * Switch to scheduled usage of one of the non-continuous changes feed types * (`normal` or `longpoll`). * * Use TCP keepalive. * @param {number} [params.limit] - Query parameter to specify the number of returned documents to limit the result * to. * @param {number} [params.timeout] - Query parameter to specify the maximum period in milliseconds to wait for a * change before the response is sent, even if there are no results. Only applicable for `longpoll` or `continuous` * feeds. Default value is specified by `httpd/changes_timeout` configuration option. Note that `60000` value is also * the default maximum timeout to prevent undetected dead connections. * @param {string} [params.since] - Query parameter to specify to start the results from the change immediately after * the given update sequence. Can be a valid update sequence or `now` value. Default is `0` i.e. all changes. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DbUpdates>>} * @deprecated this method is deprecated and may be removed in a future release */ getDbUpdates(params?: CloudantV1.GetDbUpdatesParams): Promise<CloudantV1.Response<CloudantV1.DbUpdates>>; /** * Query the database document changes feed. * * Requests the database changes feed in the same way as `GET /{db}/_changes` does. It is widely used with the * `filter` query parameter because it allows one to pass more information to the filter. * * ### Note * * Before using the changes feed read the * [FAQs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-faq-using-changes-feed) to understand the limitations and * appropriate use cases. * * If you need to pass parameters to dynamically change the filtered content use the `_selector` filter type for * better performance and compatibility. The SDKs have full support for change requests using selector filters, but * don't support passing parameters to design document filters. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {string[]} [params.docIds] - Schema for a list of document IDs. * @param {string[]} [params.fields] - JSON array that uses the field syntax. Use this parameter to specify which * fields of a document must be returned. If it is omitted or empty, the entire document is returned. * @param {JsonObject} [params.selector] - JSON object describing criteria used to select documents. The selector * specifies fields in the document, and provides an expression to evaluate with the field content or other data. * * The selector object must: * * Be structured as valid JSON. * * Contain a valid query expression. * * Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended * option if filtering on document attributes only. * * Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for * those fields. You can create more complex selector expressions by combining operators. * * Operators are identified by the use of a dollar sign `$` prefix in the name field. * * There are two core types of operators in the selector syntax: * * Combination operators: applied at the topmost level of selection. They are used to combine selectors. A * combination operator takes a single argument. The argument is either another selector, or an array of selectors. * * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For * instance, the basic `$eq` operator matches when the specified field contains a value that is equal to the supplied * argument. * * It is important for query performance to use appropriate selectors: * * Only equality operators such as `$eq`, `$gt`, `$gte`, `$lt`, and `$lte` (but not `$ne`) can be used as the basis * of a query. You should include at least one of these in a selector. * * Some operators such as `$not`, `$or`, `$in`, and `$regex` cannot be answered from an index. For query selectors * use these operators in conjunction with equality operators or create and use a partial index to reduce the number * of documents that will need to be scanned. * * See [the Cloudant Docs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-operators)for a list of all available * combination and conditional operators. * * For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-selector-syntax). * @param {string} [params.lastEventId] - Header parameter to specify the ID of the last events received by the server * on a previous connection. Overrides `since` query parameter. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.conflicts] - Query parameter to specify whether to include a list of conflicted revisions * in each returned document. Active only when `include_docs` is `true`. * @param {boolean} [params.descending] - Query parameter to specify whether to return the documents in descending by * key order. * @param {string} [params.feed] - Query parameter to specify the changes feed type. * @param {string} [params.filter] - Query parameter to specify a filter to emit only specific events from the changes * stream. * * The built-in filter types are: * * `_design` - Returns only changes to design documents. * * `_doc_ids` - Returns changes for documents with an ID matching one specified in * `doc_ids` request body parameter. (`POST` only) * * `_selector` - Returns changes for documents that match the `selector` * request body parameter. The selector syntax is the same as used for * `_find`. (`POST` only) * * `_view` - Returns changes for documents that match an existing map * function in the view specified by the query parameter `view`. * * Additionally, the value can be the name of a JS filter function from a design document. For example: * `design_doc/filtername`. * * **Note:** For better performance use the built-in `_selector`, `_design` or `_doc_ids` filters rather than JS based * `_view` or design document filters. If you need to pass values to change the filtered content use the `_selector` * filter type. * @param {number} [params.heartbeat] - Query parameter to specify the period in milliseconds after which an empty * line is sent in the results. Off by default and only applicable for * `continuous` and `eventsource` feeds. Overrides any timeout to keep the feed alive indefinitely. May also be `true` * to use a value of `60000`. * * **Note:** Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an * environment where idle network connections may break, `heartbeat` is not suitable as a keepalive mechanism. * Instead, consider one of the following options: * * Use the `timeout` parameter with a value that is compatible with your network environment. * * Switch to scheduled usage of one of the non-continuous changes feed types * (`normal` or `longpoll`). * * Use TCP keepalive. * @param {boolean} [params.includeDocs] - Query parameter to specify whether to include the full content of the * documents in the response. * @param {number} [params.limit] - Query parameter to specify the number of returned documents to limit the result * to. * @param {number} [params.seqInterval] - Query parameter to specify that the update seq should only be calculated * with every Nth result returned. When fetching changes in a batch, setting <code>seq_interval=&lt;batch * size&gt;</code>, where &lt;batch size&gt; is the number of results requested per batch, load can be reduced on the * source database as computing the seq value across many shards (especially in highly-sharded databases) is * expensive. * @param {string} [params.since] - Query parameter to specify to start the results from the change immediately after * the given update sequence. Can be a valid update sequence or `now` value. Default is `0` i.e. all changes. * @param {string} [params.style] - Query parameter to specify how many revisions are returned in the changes array. * The default, `main_only`, will only return the current "winning" revision; all_docs will return all leaf revisions * (including conflicts and deleted former conflicts). * @param {number} [params.timeout] - Query parameter to specify the maximum period in milliseconds to wait for a * change before the response is sent, even if there are no results. Only applicable for `longpoll` or `continuous` * feeds. Default value is specified by `httpd/changes_timeout` configuration option. Note that `60000` value is also * the default maximum timeout to prevent undetected dead connections. * @param {string} [params.view] - Query parameter to specify a view function as a filter. Documents pass the filter * if the view's map function emits at least one record for them. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.ChangesResult>>} */ postChanges(params: CloudantV1.PostChangesParams): Promise<CloudantV1.Response<CloudantV1.ChangesResult>>; /** * Query the database document changes feed as stream. * * Requests the database changes feed in the same way as `GET /{db}/_changes` does. It is widely used with the * `filter` query parameter because it allows one to pass more information to the filter. * * ### Note * * Before using the changes feed read the * [FAQs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-faq-using-changes-feed) to understand the limitations and * appropriate use cases. * * If you need to pass parameters to dynamically change the filtered content use the `_selector` filter type for * better performance and compatibility. The SDKs have full support for change requests using selector filters, but * don't support passing parameters to design document filters. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {string[]} [params.docIds] - Schema for a list of document IDs. * @param {string[]} [params.fields] - JSON array that uses the field syntax. Use this parameter to specify which * fields of a document must be returned. If it is omitted or empty, the entire document is returned. * @param {JsonObject} [params.selector] - JSON object describing criteria used to select documents. The selector * specifies fields in the document, and provides an expression to evaluate with the field content or other data. * * The selector object must: * * Be structured as valid JSON. * * Contain a valid query expression. * * Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended * option if filtering on document attributes only. * * Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for * those fields. You can create more complex selector expressions by combining operators. * * Operators are identified by the use of a dollar sign `$` prefix in the name field. * * There are two core types of operators in the selector syntax: * * Combination operators: applied at the topmost level of selection. They are used to combine selectors. A * combination operator takes a single argument. The argument is either another selector, or an array of selectors. * * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For * instance, the basic `$eq` operator matches when the specified field contains a value that is equal to the supplied * argument. * * It is important for query performance to use appropriate selectors: * * Only equality operators such as `$eq`, `$gt`, `$gte`, `$lt`, and `$lte` (but not `$ne`) can be used as the basis * of a query. You should include at least one of these in a selector. * * Some operators such as `$not`, `$or`, `$in`, and `$regex` cannot be answered from an index. For query selectors * use these operators in conjunction with equality operators or create and use a partial index to reduce the number * of documents that will need to be scanned. * * See [the Cloudant Docs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-operators)for a list of all available * combination and conditional operators. * * For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-selector-syntax). * @param {string} [params.lastEventId] - Header parameter to specify the ID of the last events received by the server * on a previous connection. Overrides `since` query parameter. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.conflicts] - Query parameter to specify whether to include a list of conflicted revisions * in each returned document. Active only when `include_docs` is `true`. * @param {boolean} [params.descending] - Query parameter to specify whether to return the documents in descending by * key order. * @param {string} [params.feed] - Query parameter to specify the changes feed type. * @param {string} [params.filter] - Query parameter to specify a filter to emit only specific events from the changes * stream. * * The built-in filter types are: * * `_design` - Returns only changes to design documents. * * `_doc_ids` - Returns changes for documents with an ID matching one specified in * `doc_ids` request body parameter. (`POST` only) * * `_selector` - Returns changes for documents that match the `selector` * request body parameter. The selector syntax is the same as used for * `_find`. (`POST` only) * * `_view` - Returns changes for documents that match an existing map * function in the view specified by the query parameter `view`. * * Additionally, the value can be the name of a JS filter function from a design document. For example: * `design_doc/filtername`. * * **Note:** For better performance use the built-in `_selector`, `_design` or `_doc_ids` filters rather than JS based * `_view` or design document filters. If you need to pass values to change the filtered content use the `_selector` * filter type. * @param {number} [params.heartbeat] - Query parameter to specify the period in milliseconds after which an empty * line is sent in the results. Off by default and only applicable for * `continuous` and `eventsource` feeds. Overrides any timeout to keep the feed alive indefinitely. May also be `true` * to use a value of `60000`. * * **Note:** Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an * environment where idle network connections may break, `heartbeat` is not suitable as a keepalive mechanism. * Instead, consider one of the following options: * * Use the `timeout` parameter with a value that is compatible with your network environment. * * Switch to scheduled usage of one of the non-continuous changes feed types * (`normal` or `longpoll`). * * Use TCP keepalive. * @param {boolean} [params.includeDocs] - Query parameter to specify whether to include the full content of the * documents in the response. * @param {number} [params.limit] - Query parameter to specify the number of returned documents to limit the result * to. * @param {number} [params.seqInterval] - Query parameter to specify that the update seq should only be calculated * with every Nth result returned. When fetching changes in a batch, setting <code>seq_interval=&lt;batch * size&gt;</code>, where &lt;batch size&gt; is the number of results requested per batch, load can be reduced on the * source database as computing the seq value across many shards (especially in highly-sharded databases) is * expensive. * @param {string} [params.since] - Query parameter to specify to start the results from the change immediately after * the given update sequence. Can be a valid update sequence or `now` value. Default is `0` i.e. all changes. * @param {string} [params.style] - Query parameter to specify how many revisions are returned in the changes array. * The default, `main_only`, will only return the current "winning" revision; all_docs will return all leaf revisions * (including conflicts and deleted former conflicts). * @param {number} [params.timeout] - Query parameter to specify the maximum period in milliseconds to wait for a * change before the response is sent, even if there are no results. Only applicable for `longpoll` or `continuous` * feeds. Default value is specified by `httpd/changes_timeout` configuration option. Note that `60000` value is also * the default maximum timeout to prevent undetected dead connections. * @param {string} [params.view] - Query parameter to specify a view function as a filter. Documents pass the filter * if the view's map function emits at least one record for them. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postChangesAsStream(params: CloudantV1.PostChangesAsStreamParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /************************* * databases ************************/ /** * Retrieve the HTTP headers for a database. * * Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the * response body is empty, using the HEAD method is a lightweight way to check if the database exists or not. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.EmptyObject>>} */ headDatabase(params: CloudantV1.HeadDatabaseParams): Promise<CloudantV1.Response<CloudantV1.EmptyObject>>; /** * Query a list of all database names in the instance. * * Query to retrieve a list of database names from the instance. * * @param {Object} [params] - The parameters to send to the service. * @param {boolean} [params.descending] - Query parameter to specify whether to return the documents in descending by * key order. * @param {string} [params.endKey] - Query parameter to specify to stop returning records when the specified key is * reached. String representation of any JSON type that matches the key type emitted by the view function. * @param {number} [params.limit] - Query parameter to specify the number of returned documents to limit the result * to. * @param {number} [params.skip] - Query parameter to specify the number of records before starting to return the * results. * @param {string} [params.startKey] - Query parameter to specify to start returning records from the specified key. * String representation of any JSON type that matches the key type emitted by the view function. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<string[]>>} */ getAllDbs(params?: CloudantV1.GetAllDbsParams): Promise<CloudantV1.Response<string[]>>; /** * Query information about multiple databases. * * This operation enables you to request information about multiple databases in a single request, instead of issuing * multiple `GET /{db}` requests. It returns a list that contains an information object for each database specified in * the request. * * @param {Object} params - The parameters to send to the service. * @param {string[]} params.keys - A list of database names. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DbsInfoResult[]>>} */ postDbsInfo(params: CloudantV1.PostDbsInfoParams): Promise<CloudantV1.Response<CloudantV1.DbsInfoResult[]>>; /** * Delete a database. * * Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, * the server responds with a 400 HTTP status code when the request URL includes a `?rev=` parameter. This response * suggests that a user wanted to delete a document but forgot to add the document ID to the URL. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.Ok>>} */ deleteDatabase(params: CloudantV1.DeleteDatabaseParams): Promise<CloudantV1.Response<CloudantV1.Ok>>; /** * Retrieve information about a database. * * Retrieve detailed information about the database. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DatabaseInformation>>} */ getDatabaseInformation(params: CloudantV1.GetDatabaseInformationParams): Promise<CloudantV1.Response<CloudantV1.DatabaseInformation>>; /** * Create a database. * * Create a new database with the requested properties. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {boolean} [params.partitioned] - Query parameter to specify whether to enable database partitions when * creating a database. * * Before using read the * [FAQs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-database-partitioning#partitioned-databases-database-partitioning) * to understand the limitations and appropriate use cases. * @param {number} [params.q] - The number of shards in the database. Each shard is a partition of the hash value * range. Cloudant recommends using the default value for most databases. However, if your database is expected to be * larger than 250 GB or have a lot of indexes, you may need to adjust the settings. In these cases, it's best to * reach out to IBM Cloudant customer support for guidance on how to meet your specific needs and requirements. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.Ok>>} */ putDatabase(params: CloudantV1.PutDatabaseParams): Promise<CloudantV1.Response<CloudantV1.Ok>>; /************************* * documents ************************/ /** * Retrieve the HTTP headers for the document. * * This method supports the same query arguments as the `GET /{db}/{docid}` method, but only the header information * (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for * the requested document, and the Content-Length specifies the length of the data if the document was requested in * full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {string} params.docId - Path parameter to specify the document ID. * @param {string} [params.ifNoneMatch] - Header parameter for a conditional HTTP request not matching an ETag. * @param {boolean} [params.latest] - Query parameter to specify whether to force retrieving latest leaf revision, no * matter what rev was requested. * @param {string} [params.rev] - Query parameter to specify a document revision. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.EmptyObject>>} */ headDocument(params: CloudantV1.HeadDocumentParams): Promise<CloudantV1.Response<CloudantV1.EmptyObject>>; /** * Create or modify a document in a database. * * Creates or modifies a document in the specified database by using the supplied JSON document. * * For creation, you may specify the document ID but you should not specify the revision. If you don't specify the * document ID, then the server generates an ID for your document. * * For modification, you must specify the document ID and a revision identifier in the JSON document. * * If your document ID includes the `_local/` or `_design/` prefix, then this operation creates or modifies a local or * a design document respectively. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {Document | NodeJS.ReadableStream | Buffer} params.document - HTTP request body for Document operations. * @param {string} [params.contentType] - The type of the input. * @param {string} [params.batch] - Query parameter to specify whether to store in batch mode. The server will respond * with a HTTP 202 Accepted response code immediately. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DocumentResult>>} */ postDocument(params: CloudantV1.PostDocumentParams): Promise<CloudantV1.Response<CloudantV1.DocumentResult>>; /** * Query a list of all documents in a database. * * Queries the primary index (all document IDs). The results that match the request body parameters are returned in a * JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no * request body parameters are specified, results for all documents in the database are returned. Optionally, document * content or additional metadata can be included in the response. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {boolean} [params.attEncodingInfo] - Parameter to specify whether to include the encoding information in * attachment stubs if the particular attachment is compressed. * @param {boolean} [params.attachments] - Parameter to specify whether to include attachments bodies in a response. * @param {boolean} [params.conflicts] - Parameter to specify whether to include a list of conflicted revisions in * each returned document. Active only when `include_docs` is `true`. * @param {boolean} [params.descending] - Parameter to specify whether to return the documents in descending by key * order. * @param {boolean} [params.includeDocs] - Parameter to specify whether to include the full content of the documents * in the response. * @param {boolean} [params.inclusiveEnd] - Parameter to specify whether the specified end key should be included in * the result. * @param {number} [params.limit] - Parameter to specify the number of returned documents to limit the result to. * @param {number} [params.skip] - Parameter to specify the number of records before starting to return the results. * @param {boolean} [params.updateSeq] - Parameter to specify whether to include in the response an update_seq value * indicating the sequence id of the database the view reflects. * @param {string} [params.endKey] - Schema for a document ID. * @param {string} [params.key] - Schema for a document ID. * @param {string[]} [params.keys] - Schema for a list of document IDs. * @param {string} [params.startKey] - Schema for a document ID. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.AllDocsResult>>} */ postAllDocs(params: CloudantV1.PostAllDocsParams): Promise<CloudantV1.Response<CloudantV1.AllDocsResult>>; /** * Query a list of all documents in a database as stream. * * Queries the primary index (all document IDs). The results that match the request body parameters are returned in a * JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no * request body parameters are specified, results for all documents in the database are returned. Optionally, document * content or additional metadata can be included in the response. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {boolean} [params.attEncodingInfo] - Parameter to specify whether to include the encoding information in * attachment stubs if the particular attachment is compressed. * @param {boolean} [params.attachments] - Parameter to specify whether to include attachments bodies in a response. * @param {boolean} [params.conflicts] - Parameter to specify whether to include a list of conflicted revisions in * each returned document. Active only when `include_docs` is `true`. * @param {boolean} [params.descending] - Parameter to specify whether to return the documents in descending by key * order. * @param {boolean} [params.includeDocs] - Parameter to specify whether to include the full content of the documents * in the response. * @param {boolean} [params.inclusiveEnd] - Parameter to specify whether the specified end key should be included in * the result. * @param {number} [params.limit] - Parameter to specify the number of returned documents to limit the result to. * @param {number} [params.skip] - Parameter to specify the number of records before starting to return the results. * @param {boolean} [params.updateSeq] - Parameter to specify whether to include in the response an update_seq value * indicating the sequence id of the database the view reflects. * @param {string} [params.endKey] - Schema for a document ID. * @param {string} [params.key] - Schema for a document ID. * @param {string[]} [params.keys] - Schema for a list of document IDs. * @param {string} [params.startKey] - Schema for a document ID. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postAllDocsAsStream(params: CloudantV1.PostAllDocsAsStreamParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /** * Multi-query the list of all documents in a database. * * Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of * result objects, one for each query, with a structure equivalent to that of a single `_all_docs` request. This * enables you to request multiple queries in a single request, in place of multiple `POST /{db}/_all_docs` requests. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {AllDocsQuery[]} params.queries - An array of query objects with fields for the parameters of each * individual view query to be executed. The field names and their meaning are the same as the query parameters of a * regular `/_all_docs` request. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.AllDocsQueriesResult>>} */ postAllDocsQueries(params: CloudantV1.PostAllDocsQueriesParams): Promise<CloudantV1.Response<CloudantV1.AllDocsQueriesResult>>; /** * Multi-query the list of all documents in a database as stream. * * Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of * result objects, one for each query, with a structure equivalent to that of a single `_all_docs` request. This * enables you to request multiple queries in a single request, in place of multiple `POST /{db}/_all_docs` requests. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {AllDocsQuery[]} params.queries - An array of query objects with fields for the parameters of each * individual view query to be executed. The field names and their meaning are the same as the query parameters of a * regular `/_all_docs` request. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postAllDocsQueriesAsStream(params: CloudantV1.PostAllDocsQueriesAsStreamParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /** * Bulk modify multiple documents in a database. * * The bulk document API allows you to create, update, and delete multiple documents at the same time within a single * request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch * the document structure and information. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {BulkDocs | NodeJS.ReadableStream | Buffer} params.bulkDocs - HTTP request body for postBulkDocs. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DocumentResult[]>>} */ postBulkDocs(params: CloudantV1.PostBulkDocsParams): Promise<CloudantV1.Response<CloudantV1.DocumentResult[]>>; /** * Bulk query revision information for multiple documents. * * Fetch specific revisions or revision histories for multiple documents in bulk as replicators do. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {BulkGetQueryDocument[]} params.docs - List of document items to get in bulk. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.latest] - Query parameter to specify whether to force retrieving latest leaf revision, no * matter what rev was requested. * @param {boolean} [params.revs] - Query parameter to specify whether to include a list of all known document * revisions. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.BulkGetResult>>} */ postBulkGet(params: CloudantV1.PostBulkGetParams): Promise<CloudantV1.Response<CloudantV1.BulkGetResult>>; /** * Bulk query revision information for multiple documents as mixed. * * Fetch specific revisions or revision histories for multiple documents in bulk as replicators do. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {BulkGetQueryDocument[]} params.docs - List of document items to get in bulk. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.latest] - Query parameter to specify whether to force retrieving latest leaf revision, no * matter what rev was requested. * @param {boolean} [params.revs] - Query parameter to specify whether to include a list of all known document * revisions. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postBulkGetAsMixed(params: CloudantV1.PostBulkGetAsMixedParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /** * Bulk query revision information for multiple documents as related. * * Fetch specific revisions or revision histories for multiple documents in bulk as replicators do. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {BulkGetQueryDocument[]} params.docs - List of document items to get in bulk. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.latest] - Query parameter to specify whether to force retrieving latest leaf revision, no * matter what rev was requested. * @param {boolean} [params.revs] - Query parameter to specify whether to include a list of all known document * revisions. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postBulkGetAsRelated(params: CloudantV1.PostBulkGetAsRelatedParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /** * Bulk query revision information for multiple documents as stream. * * Fetch specific revisions or revision histories for multiple documents in bulk as replicators do. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {BulkGetQueryDocument[]} params.docs - List of document items to get in bulk. * @param {boolean} [params.attachments] - Query parameter to specify whether to include attachments bodies in a * response. * @param {boolean} [params.attEncodingInfo] - Query parameter to specify whether to include the encoding information * in attachment stubs if the particular attachment is compressed. * @param {boolean} [params.latest] - Query parameter to specify whether to force retrieving latest leaf revision, no * matter what rev was requested. * @param {boolean} [params.revs] - Query parameter to specify whether to include a list of all known document * revisions. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<NodeJS.ReadableStream>>} */ postBulkGetAsStream(params: CloudantV1.PostBulkGetAsStreamParams): Promise<CloudantV1.Response<NodeJS.ReadableStream>>; /** * Delete a document. * * Marks the specified document as deleted by adding a `_deleted` field with the value `true`. Documents with this * field are not returned within requests anymore but stay in the database. You must supply the current (latest) * revision, either by using the `rev` parameter or by using the `If-Match` header to specify the revision. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {string} params.docId - Path parameter to specify the document ID. * @param {string} [params.ifMatch] - Header parameter for a conditional HTTP request matching an ETag. * @param {string} [params.batch] - Query parameter to specify whether to store in batch mode. The server will respond * with a HTTP 202 Accepted response code immediately. * @param {string} [params.rev] - Query parameter to specify a document revision. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise<CloudantV1.Response<CloudantV1.DocumentResult>>} */ deleteDocument(params: CloudantV1.DeleteDocumentParams): Promise<CloudantV1.Response<CloudantV1.DocumentResult>>; /** * Retrieve a document. * * Returns document with the specified `doc_id` from the specified database. Unless you request a specific revision, * the latest revision of the document is always returned. * * @param {Object} params - The parameters to send to the service. * @param {string} params.db - Path parameter to specify the database name. * @param {string} params.docId - Path parameter to specify the document ID. * @param {string} [params.ifNoneMatch] - Header