From 127d1017c2da6e6e4f2547be8cceb27a54b86651 Mon Sep 17 00:00:00 2001 From: Dustin Popp Date: Mon, 23 Sep 2019 14:13:22 -0500 Subject: [PATCH] feat: export `UserOptions` interface from the BaseService --- index.ts | 2 +- lib/base_service.ts | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/index.ts b/index.ts index f1ccc6a8c..c09f124e0 100644 --- a/index.ts +++ b/index.ts @@ -18,7 +18,7 @@ * @module ibm-cloud-sdk-core */ -export { BaseService } from './lib/base_service'; +export { BaseService, UserOptions } from './lib/base_service'; export * from './auth'; export * from './lib/helper'; export { default as qs } from './lib/querystring'; diff --git a/lib/base_service.ts b/lib/base_service.ts index a8c1bc51d..242353417 100644 --- a/lib/base_service.ts +++ b/lib/base_service.ts @@ -14,6 +14,7 @@ * limitations under the License. */ + import extend = require('extend'); import { OutgoingHttpHeaders } from 'http'; import semver = require('semver'); @@ -23,12 +24,18 @@ import { stripTrailingSlash } from './helper'; import { RequestWrapper } from './requestwrapper'; export interface UserOptions { - url?: string; // deprecated + /** The Authenticator object used to authenticate requests to the service */ + authenticator?: AuthenticatorInterface; + /** The base url to use when contacting the service. The base url may differ between IBM Cloud regions. */ serviceUrl?: string; - version?: string; + /** Default headers that shall be included with every request to the service. */ headers?: OutgoingHttpHeaders; + /** The API version date to use with the service, in "YYYY-MM-DD" format. */ + version?: string; + /** Set to `true` to allow unauthorized requests - not recommended for production use. */ disableSslVerification?: boolean; - authenticator?: AuthenticatorInterface; + /** Deprecated. Use `serviceUrl` instead. */ + url?: string; /** Allow additional request config parameters */ [propName: string]: any; } @@ -48,8 +55,7 @@ export class BaseService { /** * Internal base class that other services inherit from * @param {UserOptions} options - * @param {HeaderOptions} [options.headers] - * @param {boolean} [options.headers.X-Watson-Learning-Opt-Out=false] - opt-out of data collection + * @param {OutgoingHttpHeaders} [options.headers] * @param {string} [options.url] - override default service base url * @private * @abstract @@ -142,7 +148,7 @@ export class BaseService { * - array: each element of the array is sent as a separate form part using any special processing as described above * @param {Object} parameters.defaultOptions * @param {string} parameters.defaultOptions.serviceUrl - the base URL of the service - * @param {HeaderOptions} parameters.defaultOptions.headers - additional headers to be passed on the request. + * @param {OutgoingHttpHeaders} parameters.defaultOptions.headers - additional headers to be passed on the request. * @param {Function} callback - callback function to pass the response back to * @returns {ReadableStream|undefined} */