Skip to content

Commit

Permalink
chore: apply handwritten changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dpopp07 committed Sep 19, 2018
1 parent 737e212 commit fb7025a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion language-translator/v2-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { getMissingParams } from '../lib/helper';
import { FileObject } from '../lib/helper';

/**
* --- Language Translator v3 is [available](https://www.ibm.com/watson/developercloud/language-translator/api/v3/). See the [migration guide](https://console.bluemix.net/docs/services/language-translator/migrating.html). --- IBM Watson™ Language Translator translates text from one language to another. The service offers multiple domain-specific models that you can customize based on your unique terminology and language. Use Language Translator to take news from across the globe and present it in your language, communicate with your customers in their own language, and more.
* @deprecated Language Translator v3 is [available](https://www.ibm.com/watson/developercloud/language-translator/api/v3/). See the [migration guide](https://console.bluemix.net/docs/services/language-translator/migrating.html). --- IBM Watson™ Language Translator translates text from one language to another. The service offers multiple domain-specific models that you can customize based on your unique terminology and language. Use Language Translator to take news from across the globe and present it in your language, communicate with your customers in their own language, and more.
*/

class LanguageTranslatorV2 extends BaseService {
Expand Down
49 changes: 38 additions & 11 deletions visual-recognition/v3-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ class VisualRecognitionV3 extends BaseService {
*
* Encode special characters in the file name in UTF-8.
* @param {string} [params.classname_positive_examples_filename] - The filename for classname_positive_examples.
*
* Specify the filename by appending `_positive_examples_filename` to the class name. For example,
* the filename parameter for `goldenretriever_positive_examples` would be `goldenretriever_positive_examples_filename`
*
* @param {string} [params.negative_examples_filename] - The filename for negative_examples.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
Expand All @@ -241,16 +245,14 @@ class VisualRecognitionV3 extends BaseService {
public createClassifier(params: VisualRecognitionV3.CreateClassifierParams, callback?: VisualRecognitionV3.Callback<VisualRecognitionV3.Classifier>): NodeJS.ReadableStream | void {
const _params = extend({}, params);
const _callback = (callback) ? callback : () => { /* noop */ };
const requiredParams = ['name', 'classname_positive_examples'];
const positiveExampleClasses = Object.keys(_params).filter(key => {
return key.match(/^.+positive_examples$/);
}) || ['<classname>_positive_examples'];
const requiredParams = ['name', ...positiveExampleClasses];
const missingParams = getMissingParams(_params, requiredParams);
if (missingParams) {
return _callback(missingParams);
}
if (_params.classname_positive_examples && !_params.classname_positive_examples_filename) {
console.warn(
'WARNING: `classname_positive_examples_filename` should be provided if `classname_positive_examples` is not null. This will be REQUIRED in the next major release.'
);
}
if (_params.negative_examples && !_params.negative_examples_filename) {
console.warn(
'WARNING: `negative_examples_filename` should be provided if `negative_examples` is not null. This will be REQUIRED in the next major release.'
Expand All @@ -269,6 +271,18 @@ class VisualRecognitionV3 extends BaseService {
contentType: 'application/octet-stream'
}
};
positiveExampleClasses.forEach(positiveExampleClass => {
if (!_params[`${positiveExampleClass}_filename`]) {
console.warn(
`WARNING: \`${positiveExampleClass}_filename\` should be provided if \`${positiveExampleClass}\` is not null. This will be REQUIRED in the next major release.`
);
}
formData[positiveExampleClass] = {
data: _params[positiveExampleClass],
filename: _params[`${positiveExampleClass}_filename`],
contentType: 'application/octet-stream',
};
});
const parameters = {
options: {
url: '/v3/classifiers',
Expand Down Expand Up @@ -424,6 +438,9 @@ class VisualRecognitionV3 extends BaseService {
*
* Encode special characters in the file name in UTF-8.
* @param {string} [params.classname_positive_examples_filename] - The filename for classname_positive_examples.
*
* Specify the filename by appending `_positive_examples_filename` to the class name. For example,
* the filename parameter for `goldenretriever_positive_examples` would be `goldenretriever_positive_examples_filename`
* @param {string} [params.negative_examples_filename] - The filename for negative_examples.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
Expand All @@ -432,16 +449,14 @@ class VisualRecognitionV3 extends BaseService {
public updateClassifier(params: VisualRecognitionV3.UpdateClassifierParams, callback?: VisualRecognitionV3.Callback<VisualRecognitionV3.Classifier>): NodeJS.ReadableStream | void {
const _params = extend({}, params);
const _callback = (callback) ? callback : () => { /* noop */ };
const positiveExampleClasses = Object.keys(_params).filter(key => {
return key.match(/^.+positive_examples$/);
});
const requiredParams = ['classifier_id'];
const missingParams = getMissingParams(_params, requiredParams);
if (missingParams) {
return _callback(missingParams);
}
if (_params.classname_positive_examples && !_params.classname_positive_examples_filename) {
console.warn(
'WARNING: `classname_positive_examples_filename` should be provided if `classname_positive_examples` is not null. This will be REQUIRED in the next major release.'
);
}
if (_params.negative_examples && !_params.negative_examples_filename) {
console.warn(
'WARNING: `negative_examples_filename` should be provided if `negative_examples` is not null. This will be REQUIRED in the next major release.'
Expand All @@ -462,6 +477,18 @@ class VisualRecognitionV3 extends BaseService {
const path = {
'classifier_id': _params.classifier_id
};
positiveExampleClasses.forEach(positiveExampleClass => {
if (!_params[`${positiveExampleClass}_filename`]) {
console.warn(
`WARNING: \`${positiveExampleClass}_filename\` should be provided if \`${positiveExampleClass}\` is not null. This will be REQUIRED in the next major release.`
);
}
formData[positiveExampleClass] = {
data: _params[positiveExampleClass],
filename: _params[`${positiveExampleClass}_filename`],
contentType: 'application/octet-stream',
};
});
const parameters = {
options: {
url: '/v3/classifiers/{classifier_id}',
Expand Down

0 comments on commit fb7025a

Please sign in to comment.