Skip to content

Commit c2accad

Browse files
committed
Removing Question and Answer service
It was sunset a while back. I also changed the watson.message_resonance and .question_and_answer properties to be non-enumerable so that they will still throw a clear error if you try to use them, but don't show up in docs or a list of the avaliable services. Fixes watson-developer-cloud#215
1 parent 20901fe commit c2accad

File tree

5 files changed

+14
-331
lines changed

5 files changed

+14
-331
lines changed

README.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ APIs and SDKs that use cognitive computing to solve complex problems.
2929
* [Language Translation](#language-translation)
3030
* [Natural Language Classifier](#natural-language-classifier)
3131
* [Personality Insights](#personality-insights)
32-
* [Question and Answer](#question-and-answer)
3332
* [Relationship Extraction](#relationship-extraction)
3433
* [Retrieve and Rank](#retrieve-and-rank)
3534
* [Speech to Text](#speech-to-text)
@@ -388,29 +387,6 @@ personality_insights.profile({
388387

389388
**Note:** Don't forget to update the `text` variable!
390389

391-
### Question and Answer
392-
Ask a healthcare-related question of the
393-
[Question and Answer][question_and_answer] service.
394-
395-
```javascript
396-
var watson = require('watson-developer-cloud');
397-
398-
var question_and_answer_healthcare = watson.question_and_answer({
399-
username: '<username>',
400-
password: '<password>',
401-
version: 'v1-beta',
402-
dataset: 'healthcare' /* The dataset can be specified when creating
403-
* the service or when calling it */
404-
});
405-
406-
question_and_answer_healthcare.ask({
407-
text: 'What is HIV?'}, function (err, response) {
408-
if (err)
409-
console.log('error:', err);
410-
else
411-
console.log(JSON.stringify(response, null, 2));
412-
});
413-
```
414390

415391
### Relationship Extraction
416392
Analyze an English news article and get the relationships between sentence
@@ -706,7 +682,6 @@ This library is licensed under Apache 2.0. Full license text is available in
706682
See [CONTRIBUTING](https://github.com/watson-developer-cloud/node-sdk/blob/master/.github/CONTRIBUTING.md).
707683
708684
709-
[question_and_answer]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/qaapi/
710685
[personality_insights]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/personality-insights/
711686
[concept_expansion]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/glimpseapi/
712687
[relationship_extraction]: http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/sireapi/

examples/question_and_answer.v1-beta.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/index.js

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ function createServiceAPI(serviceName) {
106106
if (serviceName === 'search') {
107107
throw new Error('The search service has been replaced by retrieve_and_rank');
108108
}
109-
if (serviceName === 'message_resonance') {
110-
throw new Error('The message_resonance service is no longer available');
111-
}
112-
if (serviceName === 'question_and_answer') {
113-
console.log('The question_and_answer service is deprecated'); // eslint-disable-line no-console
114-
}
115-
116109
if (serviceName === 'tone_analyzer' && path.basename(version) === 'v1') {
117110
throw new Error('tone_analyzer v1 has been replaced by v2-experimental');
118111
}
@@ -147,13 +140,6 @@ var watson = {
147140
*/
148141
concept_expansion: createServiceAPI('concept_expansion'),
149142

150-
/**
151-
* @function
152-
* @param {{}} options
153-
* @returns {QuestionAndAnswer}
154-
*/
155-
question_and_answer: createServiceAPI('question_and_answer'),
156-
157143
/**
158144
* @function
159145
* @param {{}} options
@@ -268,14 +254,6 @@ var watson = {
268254
*/
269255
search: createServiceAPI('search'),
270256

271-
/**
272-
* @function
273-
* @param {{}} options
274-
* @returns {MessageResonance}
275-
* @deprecated
276-
*/
277-
message_resonance: createServiceAPI('message_resonance'),
278-
279257
// alchemy
280258
/**
281259
* @function
@@ -296,9 +274,21 @@ var watson = {
296274
* @param {{}} options
297275
* @returns {AlchemyDataNews}
298276
*/
299-
alchemy_data_news: createServiceAPI('alchemy_data_news')
277+
alchemy_data_news: createServiceAPI('alchemy_data_news'),
300278
};
301279

302-
280+
// removed services
281+
// we don't want these services listed (so non-enumerable), but we do want a clear error message
282+
// if old code happens to try using one
283+
['message_resonance', 'question_and_answer'].forEach(function(serviceName) {
284+
Object.defineProperty(watson, serviceName, {
285+
enumerable: false,
286+
configurable: true,
287+
writable: true,
288+
value: function() {
289+
throw new Error('The ' + serviceName + ' service is no longer available');
290+
}
291+
});
292+
});
303293

304294
module.exports = watson;

services/question_and_answer/v1-beta.js

Lines changed: 0 additions & 107 deletions
This file was deleted.

test/test.question_and_answer.v1-beta.js

Lines changed: 0 additions & 156 deletions
This file was deleted.

0 commit comments

Comments
 (0)