Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @module ibm-cloud-sdk-core
*/

export { BaseService } from './lib/base_service';
export { BaseService, UserOptions } from './lib/base_service';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are going to export UserOptions, should you not also export HeaderOptions?

export * from './auth';
export * from './lib/helper';
export { default as qs } from './lib/querystring';
Expand Down
18 changes: 12 additions & 6 deletions lib/base_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/


import extend = require('extend');
import { OutgoingHttpHeaders } from 'http';
import semver = require('semver');
Expand All @@ -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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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}
*/
Expand Down