You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: change all websocket method parameters to lower camel case (#941)
* add types for WebSocket Stream class constructor options
* warn user when a parameter is passed in that matches the service option but not the user option
BREAKING CHANGE: All parameters have been converted to their lower camel case version.
BREAKING CHANGE: Support for the `token` parameter has been removed
BREAKING CHANGE: Support for the `customization_id` parameter has been removed
BREAKING CHANGE: Method `setAuthorizationHeaderToken` has been removed from the WebSocket Stream classes
Copy file name to clipboardExpand all lines: UPGRADE-5.0.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,3 +8,12 @@ _Note: If migrating from a version less than 4.0, also see the [v4 migration gui
8
8
## Breaking changes
9
9
### Support for Node v6 and v8 dropped
10
10
The SDK no longer supports Node versions 6 and 8, as reflected in the `engines` property in the package.json file. Version 6 reached end of life in April 2019 and Version 8 reaches end of life on 31 December 2019.
11
+
12
+
### WebSocket Methods
13
+
- All parameters are now lower camel case
14
+
- Support for the `token` parameter has been removed
15
+
- Support for the `customization_id` parameter has been removed
16
+
- Method `setAuthorizationHeaderToken` has been removed from the WebSocket Stream classes. It now exists as a shared function called `setAuthorizationHeader` in `lib/websocket-utils.ts`.
17
+
18
+
#### RecognizeStream
19
+
-`RecognizeStream.readableObjectMode` will always be a Boolean value - before, it could have been `undefined`. This is to align with the new convention in Node 12.
@@ -67,24 +77,23 @@ class SynthesizeStream extends Readable {
67
77
*
68
78
* Note that the WebSocket connection is not established until the first chunk of data is recieved. This allows for IAM token request management by the SDK.
69
79
*
70
-
* @param {Object} options
71
-
* @param {String} options.text - The text that us to be synthesized. Provide plain text or text that is annotated with SSML. SSML input can include the SSML <mark> element. Pass a maximum of 5 KB of text.
72
-
* @param {String} options.accept - The requested audio format (MIME type) of the audio.
73
-
* @param {String[]} [options.timings] - An array that specifies whether the service is to return word timing information for all strings of the input text
74
-
* @param {String} [options.voice='en-US_MichaelVoice'] - The voice that is to be used for the synthesis.
75
-
* @param {String} [options.customization_id] - The customization ID (GUID) of a custom voice model that is to be used for the synthesis.
76
-
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] base URL for service
* @param {String} [options.access_token] - IAM auth token
79
-
* @param {Object} [options.headers] - Only works in Node.js, not in browsers. Allows for custom headers to be set, including an Authorization header (preventing the need for auth tokens)
80
-
* @param {Boolean} [options.x-watson-learning-opt-out=false] - set to true to opt-out of allowing Watson to use this request to improve it's services
81
-
* @param {String} [options.x-watson-metadata] - Associates a customer ID with data that is passed over the connection.
82
-
* @param {IamTokenManagerV1} [options.token_manager] - Token manager for authenticating with IAM
83
-
* @param {Boolean} [options.rejectUnauthorized] - If true, disable SSL verification for the WebSocket connection
84
-
*
80
+
* @param {Options} options
81
+
* @param {string} [options.url] - Base url for service (default='wss://stream.watsonplatform.net/speech-to-text/api')
82
+
* @param {OutgoingHttpHeaders} [options.headers] - Only works in Node.js, not in browsers. Allows for custom headers to be set, including an Authorization header (preventing the need for auth tokens)
83
+
* @param {any} [options.tokenManager] - Token manager for authenticating with IAM
84
+
* @param {boolean} [options.rejectUnauthorized] - If false, disable SSL verification for the WebSocket connection (default=true)
85
+
* @param {string} options.text - The text that us to be synthesized
86
+
* @param {string} options.accept - The requested format (MIME type) of the audio
87
+
* @param {string[]} [options.timings] - An array that specifies whether the service is to return word timing information for all strings of the input text
88
+
* @param {string} [options.accessToken] - Bearer token to put in query string
* @param {string} [options.voice] - The voice to use for the synthesis (default='en-US_MichaelVoice')
91
+
* @param {string} [options.customizationId] - The customization ID (GUID) of a custom voice model that is to be used for the synthesis
92
+
* @param {boolean} [options.xWatsonLearningOptOut] - Indicates whether IBM can use data that is sent over the connection to improve the service for future users (default=false)
93
+
* @param {string} [options.xWatsonMetadata] - Associates a customer ID with all data that is passed over the connection. The parameter accepts the argument customer_id={id}, where {id} is a random or generic string that is to be associated with the data
85
94
* @constructor
86
95
*/
87
-
constructor(options){
96
+
constructor(options: Options){
88
97
super(options);
89
98
this.options=options;
90
99
this.initialized=false;
@@ -93,9 +102,19 @@ class SynthesizeStream extends Readable {
0 commit comments