How to use ibm-cloud-sdk-core - 10 common examples

To help you get started, we’ve selected a few ibm-cloud-sdk-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umple / umple / umpleonline / watson / node_modules / watson-developer-cloud / lib / synthesize-stream.js View on Github external
SynthesizeStream.prototype.initialize = function () {
        var options = this.options;
        var queryParams = pick(options, QUERY_PARAMS_ALLOWED);
        var queryString = ibm_cloud_sdk_core_1.qs.stringify(queryParams);
        var url = (options.url || 'wss://stream.watsonplatform.net/text-to-speech/api')
            .replace(/^http/, 'ws') +
            '/v1/synthesize?' +
            queryString;
        var socket = (this.socket = new w3cWebSocket(url, null, null, options.headers, null, { tlsOptions: { rejectUnauthorized: options.rejectUnauthorized } }));
        // use class context within arrow functions
        var self = this;
        socket.onopen = function () {
            var payload = pick(options, PAYLOAD_PARAMS_ALLOWED);
            socket.send(JSON.stringify(payload));
            /**
             * emitted once the WebSocket connection has been established
             * @event SynthesizeStream#open
             */
            self.emit('open');
        };
github watson-developer-cloud / node-sdk / natural-language-understanding / v1-generated.ts View on Github external
public analyze(params: NaturalLanguageUnderstandingV1.AnalyzeParams, callback?: NaturalLanguageUnderstandingV1.Callback): NodeJS.ReadableStream | void {
    const _params = extend({}, params);
    const _callback = (callback) ? callback : () => { /* noop */ };
    const requiredParams = ['features'];

    const missingParams = getMissingParams(_params, requiredParams);
    if (missingParams) {
      return _callback(missingParams);
    }

    const body = {
      'features': _params.features,
      'text': _params.text,
      'html': _params.html,
      'url': _params.url,
      'clean': _params.clean,
      'xpath': _params.xpath,
      'fallback_to_raw': _params.fallback_to_raw,
      'return_analyzed_text': _params.return_analyzed_text,
      'language': _params.language,
      'limit_text_characters': _params.limit_text_characters
    };
github watson-developer-cloud / node-sdk / natural-language-classifier / v1-generated.ts View on Github external
public deleteClassifier(params: NaturalLanguageClassifierV1.DeleteClassifierParams, callback?: NaturalLanguageClassifierV1.Callback): NodeJS.ReadableStream | void {
    const _params = extend({}, params);
    const _callback = (callback) ? callback : () => { /* noop */ };
    const requiredParams = ['classifier_id'];

    const missingParams = getMissingParams(_params, requiredParams);
    if (missingParams) {
      return _callback(missingParams);
    }

    const path = {
      'classifier_id': _params.classifier_id
    };

    const sdkHeaders = getSdkHeaders('natural_language_classifier', 'v1', 'deleteClassifier');
 
    const parameters = {
      options: {
        url: '/v1/classifiers/{classifier_id}',
        method: 'DELETE',
        path,
      },
github watson-developer-cloud / node-sdk / tone-analyzer / v3.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('tone_analyzer');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / visual-recognition / v3.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('watson_vision_combined');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / discovery / v2.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('discovery');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / compare-comply / v1.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('compare-comply');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / personality-insights / v3.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('personality_insights');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / assistant / v2.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('conversation');
    }
    super(options);
    // check if 'version' was provided
    if (typeof this.baseOptions.version === 'undefined') {
      throw new Error('Argument error: version was not specified');
    }
    this.baseOptions.qs.version = options.version;
  }
github watson-developer-cloud / node-sdk / text-to-speech / v1-generated.ts View on Github external
constructor(options: UserOptions) {
    // If the caller didn't supply an authenticator, construct one from external configuration.
    if (!options.authenticator) {
      options.authenticator = getAuthenticatorFromEnvironment('text_to_speech');
    }
    super(options);
  }