@ibm-cloud/cloudant
Version:
IBM Cloudant Node.js SDK
70 lines (69 loc) • 2.71 kB
TypeScript
/**
* © Copyright IBM Corporation 2020, 2024. 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.
*/
import { BaseService, UserOptions } from 'ibm-cloud-sdk-core';
/**
* Cloudant specific service that extends the base service functions.
*
* Cloudant Service make it available to use CouchDB specific Session authentication
* during service requests.
*/
export default abstract class CloudantBaseService extends BaseService {
timeout: number;
/**
* Configuration values to use Cloudant service.
* @param {Authenticator} userOptions.authenticator CouchdbSessionAuthenticator object can be used
* to authenticate requests to the service.
* @param {string} [userOptions.jar] A Cookie Jar. Enabled by default if there is no custom one.
*/
constructor(userOptions: UserOptions);
private addErrorTransformers;
getTimeout(): number;
/**
* Set the service URL to send requests to and
* use the new service URL for CouchDB Session Authentication
* to claim session token from.
*
* @param {string} url The base URL for the service.
*/
setServiceUrl(url: string): void;
/**
* Configure the service using external configuration
* Cloudant specific extensions:
* - Apply the new base service options on CouchdbSessionAuthenticator.
*
* @param {string} serviceName The name of the service. Will be used to read from external
* configuration.
*/
protected configureService(serviceName: string): void;
/**
* Turn request body compression on or off.
* Cloudant specific extensions:
* - Apply the gzip compression option on CouchdbSessionAuthenticator.
*
* @param {boolean} setting Will turn it on if 'true', off if 'false'.
*/
setEnableGzipCompression(setting: boolean): void;
/**
* In case of CouchdbSessionAuthenticator
* the service options should be applied on it.
*/
private configureSessionAuthenticator;
/**
* Extend createRequest to handle document and attachment validation.
*/
protected createRequest(parameters: any): Promise<any>;
private static setDefaultAgentsIfUnset;
}