Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
};
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,
},
return new Promise((resolve, reject) => {
const missingParams = getMissingParams(_params, requiredParams);
if (missingParams) {
if (_callback) {
_callback(missingParams);
return resolve();
}
return reject(missingParams);
}
const query = {
'action': _params.action,
'model': _params.model
};
const path = {
'batch_id': _params.batchId
};
return new Promise((resolve, reject) => {
const missingParams = getMissingParams(_params, requiredParams);
if (missingParams) {
if (_callback) {
_callback(missingParams);
return resolve();
}
return reject(missingParams);
}
const query = {
'filter': _params.filter,
'query': _params.query,
'natural_language_query': _params.naturalLanguageQuery,
'aggregation': _params.aggregation,
'count': _params.count,
'return': _params._return,
'offset': _params.offset,
NaturalLanguageClassifierV1.prototype.classify = function (params, callback) {
var _params = extend({}, params);
var _callback = (callback) ? callback : function () { };
var requiredParams = ['classifier_id', 'text'];
var missingParams = ibm_cloud_sdk_core_2.getMissingParams(_params, requiredParams);
if (missingParams) {
return _callback(missingParams);
}
var body = {
'text': _params.text
};
var path = {
'classifier_id': _params.classifier_id
};
var sdkHeaders = common_1.getSdkHeaders('natural_language_classifier', 'v1', 'classify');
var parameters = {
options: {
url: '/v1/classifiers/{classifier_id}/classify',
method: 'POST',
json: true,
body: body,
LanguageTranslatorV3.prototype.createModel = function (params, callback) {
var _params = extend({}, params);
var _callback = (callback) ? callback : function () { };
var requiredParams = ['base_model_id'];
var missingParams = ibm_cloud_sdk_core_2.getMissingParams(_params, requiredParams);
if (missingParams) {
return _callback(missingParams);
}
var formData = {
'forced_glossary': {
data: _params.forced_glossary,
filename: _params.forced_glossary_filename,
contentType: 'application/octet-stream'
},
'parallel_corpus': {
data: _params.parallel_corpus,
filename: _params.parallel_corpus_filename,
contentType: 'application/octet-stream'
}
};
var query = {
SpeechToTextV1.prototype.observeResult = function (params, callback) {
var missingParams = ibm_cloud_sdk_core_1.getMissingParams(params, [
'session_id',
'cookie_session'
]);
if (missingParams) {
callback(missingParams);
return;
}
var serviceUrl = [
this._options.url,
'/v1/sessions/',
params.session_id,
'/observe_result'
].join('');
var parts = url_1.parse(serviceUrl);
var options = {
agent: false,
AssistantV2.prototype.createSession = function (params, callback) {
var _params = extend({}, params);
var _callback = (callback) ? callback : function () { };
var requiredParams = ['assistant_id'];
var missingParams = ibm_cloud_sdk_core_2.getMissingParams(_params, requiredParams);
if (missingParams) {
return _callback(missingParams);
}
var path = {
'assistant_id': _params.assistant_id
};
var sdkHeaders = common_1.getSdkHeaders('conversation', 'v2', 'createSession');
var parameters = {
options: {
url: '/v2/assistants/{assistant_id}/sessions',
method: 'POST',
path: path,
},
defaultOptions: extend(true, {}, this._options, {
headers: extend(true, sdkHeaders, {
'Accept': 'application/json',
ConversationV1.prototype.updateIntent = function (params, callback) {
if (params &&
(params.new_intent ||
params.new_description ||
params.new_examples ||
(params.intent && !params.old_intent))) {
return _super.prototype.updateIntent.call(this, params, callback);
}
var requiredParams = ['workspace_id', 'old_intent', 'intent'];
var missingParams = ibm_cloud_sdk_core_1.getMissingParams(params, requiredParams);
if (missingParams) {
return callback(missingParams);
}
var newParams = extend({}, params);
newParams.intent = params.old_intent;
newParams.new_intent = params.intent;
newParams.new_description = params.description;
newParams.new_examples = params.examples;
return _super.prototype.updateIntent.call(this, newParams, callback);
};
ConversationV1.prototype.getExamples = function (params, callback) {
updateCounterExample(params, callback) {
if (params && (params.new_text || (params.text && !params.old_text))) {
return super.updateCounterexample(params, callback);
}
const requiredParams = ['workspace_id', 'old_text', 'text'];
const missingParams = getMissingParams(params, requiredParams);
if (missingParams) { return callback(missingParams); }
const newParams = extend({}, params);
newParams.text = params.old_text;
newParams.new_text = params.text;
return super.updateCounterexample(newParams, callback);
}