File tree Expand file tree Collapse file tree 14 files changed +43
-30
lines changed
natural-language-classifier Expand file tree Collapse file tree 14 files changed +43
-30
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import url = require('url');
20
20
21
21
class AuthorizationV1 extends BaseService {
22
22
name ;
23
- version ;
23
+ serviceVersion ;
24
24
static URL : string = 'https://stream.watsonplatform.net/authorization/api' ;
25
25
26
26
/**
@@ -73,6 +73,6 @@ class AuthorizationV1 extends BaseService {
73
73
}
74
74
75
75
AuthorizationV1 . prototype . name = 'authorization' ;
76
- AuthorizationV1 . prototype . version = 'v1' ;
76
+ AuthorizationV1 . prototype . serviceVersion = 'v1' ;
77
77
78
78
export = AuthorizationV1 ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { BaseService } from '../lib/base_service';
27
27
28
28
class ConversationV1 extends BaseService {
29
29
name : string ; // set by prototype to 'conversation'
30
- version : string ; // set by prototype to 'v1'
30
+ serviceVersion : string ; // set by prototype to 'v1'
31
31
32
32
static URL : string = 'https://gateway.watsonplatform.net/conversation/api' ;
33
33
@@ -2231,7 +2231,7 @@ class ConversationV1 extends BaseService {
2231
2231
}
2232
2232
2233
2233
ConversationV1 . prototype . name = 'conversation' ;
2234
- ConversationV1 . prototype . version = 'v1' ;
2234
+ ConversationV1 . prototype . serviceVersion = 'v1' ;
2235
2235
2236
2236
/*************************
2237
2237
* interfaces
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import { FileObject } from '../lib/helper';
25
25
26
26
class DialogV1 extends BaseService {
27
27
static URL : string = 'https://gateway.watsonplatform.net/dialog/api' ;
28
-
28
+
29
29
/**
30
30
* Construct a DialogV1 object.
31
31
*
@@ -298,7 +298,7 @@ class DialogV1 extends BaseService {
298
298
}
299
299
300
300
DialogV1 . prototype . name = 'dialog' ;
301
- DialogV1 . prototype . version = 'v1' ;
301
+ DialogV1 . prototype . serviceVersion = 'v1' ;
302
302
303
303
namespace DialogV1 {
304
304
/** Options for the `DialogV1` constructor. **/
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { FileObject } from '../lib/helper';
27
27
28
28
class DiscoveryV1 extends BaseService {
29
29
name : string ; // set by prototype to 'discovery'
30
- version : string ; // set by prototype to 'v1'
30
+ serviceVersion : string ; // set by prototype to 'v1'
31
31
32
32
static URL : string = 'https://gateway.watsonplatform.net/discovery/api' ;
33
33
@@ -1993,7 +1993,7 @@ class DiscoveryV1 extends BaseService {
1993
1993
}
1994
1994
1995
1995
DiscoveryV1 . prototype . name = 'discovery' ;
1996
- DiscoveryV1 . prototype . version = 'v1' ;
1996
+ DiscoveryV1 . prototype . serviceVersion = 'v1' ;
1997
1997
1998
1998
/*************************
1999
1999
* interfaces
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ const servicesByVersion = {};
52
52
Object . keys ( exports ) . forEach ( key => {
53
53
const Service = exports [ key ] ;
54
54
const name = Service . prototype . name ;
55
- const version = Service . prototype . version ;
55
+ const version = Service . prototype . serviceVersion ;
56
56
servicesByVersion [ name ] = servicesByVersion [ name ] || { } ;
57
57
servicesByVersion [ name ] [ version ] = Service ;
58
58
} ) ;
@@ -63,6 +63,15 @@ Object.keys(servicesByVersion).forEach(serviceName => {
63
63
configurable : true ,
64
64
writable : true ,
65
65
value : function ( options ) {
66
+
67
+ // eslint-disable-next-line no-console
68
+ console . warn (
69
+ 'WARNING: This method of instantiating the Watson services has been deprecated ' +
70
+ 'beginning with Version 3.0.0 of the Node SDK. Please refer to the Node SDK ' +
71
+ 'documentation for information on how to instantiate Watson services. This ' +
72
+ 'form of service instantiaion will be removed in a future release of the SDK.'
73
+ ) ;
74
+
66
75
options = options || { } ;
67
76
68
77
// previously, AlchemyAPI did not require a version to be specified
@@ -78,7 +87,11 @@ Object.keys(servicesByVersion).forEach(serviceName => {
78
87
) ;
79
88
}
80
89
81
- return new Service ( options ) ;
90
+ return new Service ( {
91
+ ...options ,
92
+ serviceVersion : options . version ,
93
+ version : options . version_date ,
94
+ } ) ;
82
95
}
83
96
} ) ;
84
97
} ) ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { FileObject } from '../lib/helper';
27
27
28
28
class LanguageTranslatorV2 extends BaseService {
29
29
name : string ; // set by prototype to 'language_translator'
30
- version : string ; // set by prototype to 'v2'
30
+ serviceVersion : string ; // set by prototype to 'v2'
31
31
32
32
static URL : string = 'https://gateway.watsonplatform.net/language-translator/api' ;
33
33
@@ -364,7 +364,7 @@ class LanguageTranslatorV2 extends BaseService {
364
364
}
365
365
366
366
LanguageTranslatorV2 . prototype . name = 'language_translator' ;
367
- LanguageTranslatorV2 . prototype . version = 'v2' ;
367
+ LanguageTranslatorV2 . prototype . serviceVersion = 'v2' ;
368
368
369
369
/*************************
370
370
* interfaces
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export class BaseService {
71
71
protected serviceDefaults : object ;
72
72
static URL : string ;
73
73
name : string ;
74
- version : string ;
74
+ serviceVersion : string ;
75
75
/**
76
76
* Internal base class that other services inherit from
77
77
* @param {UserOptions } options
@@ -143,7 +143,7 @@ export class BaseService {
143
143
. replace (
144
144
/ _ / g,
145
145
' '
146
- ) } ${ this . version . toUpperCase ( ) } unless use_unauthenticated is set`
146
+ ) } ${ this . serviceVersion . toUpperCase ( ) } unless use_unauthenticated is set`
147
147
) ;
148
148
} else if ( ! hasCredentials ( _options ) ) {
149
149
throw new Error (
@@ -152,7 +152,7 @@ export class BaseService {
152
152
. replace (
153
153
/ _ / g,
154
154
' '
155
- ) } ${ this . version . toUpperCase ( ) } unless use_unauthenticated is set`
155
+ ) } ${ this . serviceVersion . toUpperCase ( ) } unless use_unauthenticated is set`
156
156
) ;
157
157
}
158
158
if ( hasBasicCredentials ( _options ) ) {
@@ -213,7 +213,7 @@ export class BaseService {
213
213
}
214
214
/**
215
215
* Retrieve this service's credentials - useful for passing to the authorization service
216
- *
216
+ *
217
217
* Only returns a URL when token auth is used.
218
218
*
219
219
* @returns {Credentials }
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { FileObject } from '../lib/helper';
27
27
28
28
class NaturalLanguageClassifierV1 extends BaseService {
29
29
name : string ; // set by prototype to 'natural_language_classifier'
30
- version : string ; // set by prototype to 'v1'
30
+ serviceVersion : string ; // set by prototype to 'v1'
31
31
32
32
static URL : string = 'https://gateway.watsonplatform.net/natural-language-classifier/api' ;
33
33
@@ -270,7 +270,7 @@ class NaturalLanguageClassifierV1 extends BaseService {
270
270
}
271
271
272
272
NaturalLanguageClassifierV1 . prototype . name = 'natural_language_classifier' ;
273
- NaturalLanguageClassifierV1 . prototype . version = 'v1' ;
273
+ NaturalLanguageClassifierV1 . prototype . serviceVersion = 'v1' ;
274
274
275
275
/*************************
276
276
* interfaces
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class PersonalityInsightsV2 extends BaseService {
105
105
}
106
106
107
107
PersonalityInsightsV2 . prototype . name = 'personality_insights' ;
108
- PersonalityInsightsV2 . prototype . version = 'v2' ;
108
+ PersonalityInsightsV2 . prototype . serviceVersion = 'v2' ;
109
109
110
110
namespace PersonalityInsightsV2 {
111
111
export type Callback = (
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import { BaseService } from '../lib/base_service';
26
26
27
27
class PersonalityInsightsV3 extends BaseService {
28
28
name : string ; // set by prototype to 'personality_insights'
29
- version : string ; // set by prototype to 'v3'
29
+ serviceVersion : string ; // set by prototype to 'v3'
30
30
31
31
static URL : string = 'https://gateway.watsonplatform.net/personality-insights/api' ;
32
32
@@ -111,7 +111,7 @@ class PersonalityInsightsV3 extends BaseService {
111
111
}
112
112
113
113
PersonalityInsightsV3 . prototype . name = 'personality_insights' ;
114
- PersonalityInsightsV3 . prototype . version = 'v3' ;
114
+ PersonalityInsightsV3 . prototype . serviceVersion = 'v3' ;
115
115
116
116
/*************************
117
117
* interfaces
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ import { FileObject } from '../lib/helper';
28
28
29
29
class SpeechToTextV1 extends BaseService {
30
30
name : string ; // set by prototype to 'speech_to_text'
31
- version : string ; // set by prototype to 'v1'
31
+ serviceVersion : string ; // set by prototype to 'v1'
32
32
33
33
static URL : string = 'https://stream.watsonplatform.net/speech-to-text/api' ;
34
34
@@ -255,7 +255,7 @@ class SpeechToTextV1 extends BaseService {
255
255
} ;
256
256
return createRequest ( parameters , _callback ) ;
257
257
}
258
-
258
+
259
259
/*************************
260
260
* asynchronous
261
261
************************/
@@ -1700,7 +1700,7 @@ class SpeechToTextV1 extends BaseService {
1700
1700
}
1701
1701
1702
1702
SpeechToTextV1 . prototype . name = 'speech_to_text' ;
1703
- SpeechToTextV1 . prototype . version = 'v1' ;
1703
+ SpeechToTextV1 . prototype . serviceVersion = 'v1' ;
1704
1704
1705
1705
/*************************
1706
1706
* interfaces
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import { BaseService } from '../lib/base_service';
26
26
27
27
class TextToSpeechV1 extends BaseService {
28
28
name : string ; // set by prototype to 'text_to_speech'
29
- version : string ; // set by prototype to 'v1'
29
+ serviceVersion : string ; // set by prototype to 'v1'
30
30
31
31
static URL : string = 'https://stream.watsonplatform.net/text-to-speech/api' ;
32
32
@@ -663,7 +663,7 @@ class TextToSpeechV1 extends BaseService {
663
663
}
664
664
665
665
TextToSpeechV1 . prototype . name = 'text_to_speech' ;
666
- TextToSpeechV1 . prototype . version = 'v1' ;
666
+ TextToSpeechV1 . prototype . serviceVersion = 'v1' ;
667
667
668
668
/*************************
669
669
* interfaces
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import { BaseService } from '../lib/base_service';
26
26
27
27
class ToneAnalyzerV3 extends BaseService {
28
28
name : string ; // set by prototype to 'tone_analyzer'
29
- version : string ; // set by prototype to 'v3'
29
+ serviceVersion : string ; // set by prototype to 'v3'
30
30
31
31
static URL : string = 'https://gateway.watsonplatform.net/tone-analyzer/api' ;
32
32
@@ -154,7 +154,7 @@ class ToneAnalyzerV3 extends BaseService {
154
154
}
155
155
156
156
ToneAnalyzerV3 . prototype . name = 'tone_analyzer' ;
157
- ToneAnalyzerV3 . prototype . version = 'v3' ;
157
+ ToneAnalyzerV3 . prototype . serviceVersion = 'v3' ;
158
158
159
159
/*************************
160
160
* interfaces
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import { FileObject } from '../lib/helper';
27
27
28
28
class VisualRecognitionV3 extends BaseService {
29
29
name : string ; // set by prototype to 'visual_recognition'
30
- version : string ; // set by prototype to 'v3'
30
+ serviceVersion : string ; // set by prototype to 'v3'
31
31
32
32
static URL : string = 'https://gateway-a.watsonplatform.net/visual-recognition/api' ;
33
33
@@ -386,7 +386,7 @@ class VisualRecognitionV3 extends BaseService {
386
386
}
387
387
388
388
VisualRecognitionV3 . prototype . name = 'visual_recognition' ;
389
- VisualRecognitionV3 . prototype . version = 'v3' ;
389
+ VisualRecognitionV3 . prototype . serviceVersion = 'v3' ;
390
390
391
391
/*************************
392
392
* interfaces
You can’t perform that action at this time.
0 commit comments