Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(urls): update deprecated watsonplatform.net urls #182

Merged
merged 1 commit into from
Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/TEXT-TO-SPEECH.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ where the max length is around 1000 characters after the token is accounted for.
Options:

- text - the text to speak
- url - the Watson Text to Speech API URL (defaults to https://stream.watsonplatform.net/text-to-speech/api)
- url - the Watson Text to Speech API URL (defaults to https://api.us-south.text-to-speech.watson.cloud.ibm.com)
- voice - the desired playback voice's name - see .getVoices(). Note that the voices are language-specific.
- customization_id - GUID of a custom voice model - omit to use the voice with no customization.
- autoPlay - set to false to prevent the audio from automatically playing
Expand Down
4 changes: 2 additions & 2 deletions examples/.env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Replace this if you are using a region specific service
SPEECH_TO_TEXT_URL=https://stream.watsonplatform.net/speech-to-text/api
SPEECH_TO_TEXT_URL=https://api.us-south.speech-to-text.watson.cloud.ibm.com
# If your using IAM API keys use this and do not input credentials:
SPEECH_TO_TEXT_IAM_APIKEY=<Your API key>

# Replace this if you are using a region specific service
TEXT_TO_SPEECH_URL=https://stream.watsonplatform.net/text-to-speech/api
TEXT_TO_SPEECH_URL=https://api.us-south.text-to-speech.watson.cloud.ibm.com
# If your using IAM API keys use this and do not input credentials:
TEXT_TO_SPEECH_IAM_APIKEY=<Your API key>
6 changes: 3 additions & 3 deletions speech-to-text/get-models.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

```js
[{
"url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/en-UK_BroadbandModel",
"url": "https://api.us-south.speech-to-text.watson.cloud.ibm.com/v1/models/en-UK_BroadbandModel",
"rate": 16000,
"name": "en-UK_BroadbandModel",
"language": "en-UK",
Expand All @@ -37,7 +37,7 @@

* @todo define format in @return statement
* @param {Object} options
* @param {String} options.url=https://stream.watsonplatform.net/speech-to-text/api URL for Watson Speech to Text API
* @param {String} options.url=https://api.us-south.speech-to-text.watson.cloud.ibm.com URL for Watson Speech to Text API
* @param {String} options.token auth token for CF services
* @param {String} options.accessToken IAM access token for RC services
* @return {Promise<T>}
Expand All @@ -52,7 +52,7 @@ module.exports = function getModels(options) {
accept: 'application/json'
}
};
var url = options.url || 'https://stream.watsonplatform.net/speech-to-text/api';
var url = options.url || 'https://api.us-south.speech-to-text.watson.cloud.ibm.com';
if (options.accessToken) {
url = url + '/v1/models?access_token=' + options.accessToken;
} else {
Expand Down
2 changes: 1 addition & 1 deletion speech-to-text/recognize-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var fetch = require('nodeify-fetch'); // like regular fetch, but with an extra m
* (e.g. from a file <input>, a dragdrop target, or an ajax request)
*
* @param {Object} options - Also passed to {MediaElementAudioStream} and to {RecognizeStream}
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] - Base URL for a service instance
* @param {String} [options.url='wss://api.us-south.speech-to-text.watson.cloud.ibm.com'] - Base URL for a service instance
* @param {String} options.token - Auth Token for CF services - see https://github.com/watson-developer-cloud/node-sdk#authorization
* @param {String} options.accessToken - IAM Access Token for RC services - see https://github.com/watson-developer-cloud/node-sdk#authorization
* @param {Blob|FileString} options.file - String url or the raw audio data as a Blob or File instance to be transcribed (and optionally played). Playback may not with with Blob or File on mobile Safari.
Expand Down
2 changes: 1 addition & 1 deletion speech-to-text/recognize-microphone.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var bitBucket = new Writable({
* @param {Object} options - Also passed to {RecognizeStream}, and {FormatStream} when applicable
* @param {String} options.token - Auth Token for CF services - see https://github.com/watson-developer-cloud/node-sdk#authorization
* @param {String} options.accessToken - IAM Access Token for RC services - see https://github.com/watson-developer-cloud/node-sdk#authorization
* @param {String} [options.url='wss://stream.watsonplatform.net/speech-to-text/api'] - Base URL for a service instance
* @param {String} [options.url='wss://api.us-south.speech-to-text.watson.cloud.ibm.com'] - Base URL for a service instance
* @param {Boolean} [options.format=true] - pipe the text through a FormatStream which performs light formatting. Also controls smart_formatting option unless explicitly set.
* @param {Boolean} [options.keepMicrophone=false] - keeps an internal reference to the microphone stream to reuse in subsequent calls (prevents multiple permissions dialogs in firefox)
* @param {String|DOMElement} [options.outputElement] pipe the text to a [WriteableElementStream](WritableElementStream.html) targeting the specified element. Also defaults objectMode to true to enable interim results.
Expand Down
4 changes: 2 additions & 2 deletions speech-to-text/recognize-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var qs = require('../util/querystring.js');
* Note that the WebSocket connection is not established until the first chunk of data is recieved. This allows for auto-detection of content type (for wav/flac/opus audio).
*
* @param {Options} options
* @param {string} [options.url] - Base url for service (default='wss://stream.watsonplatform.net/speech-to-text/api')
* @param {string} [options.url] - Base url for service (default='wss://api.us-south.speech-to-text.watson.cloud.ibm.com')
* @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)
* @param {boolean} [options.readableObjectMode] - Emit `result` objects instead of string Buffers for the `data` events. Does not affect input (which must be binary)
* @param {boolean} [options.objectMode] - Alias for readableObjectMode
Expand Down Expand Up @@ -158,7 +158,7 @@ RecognizeStream.prototype.initialize = function() {
}
var queryString = qs.stringify(queryParams);

var url = (options.url || 'wss://stream.watsonplatform.net/speech-to-text/api').replace(/^http/, 'ws') + '/v1/recognize?' + queryString;
var url = (options.url || 'wss://api.us-south.speech-to-text.watson.cloud.ibm.com').replace(/^http/, 'ws') + '/v1/recognize?' + queryString;

// process opening payload params
var openingMessageParamsAllowed = [
Expand Down
6 changes: 3 additions & 3 deletions text-to-speech/get-voices.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"language": "en-US",
"customizable": true,
"gender": "male",
"url": "https://stream.watsonplatform.net/text-to-speech/api/v1/voices/en-US_MichaelVoice",
"url": "https://api.us-south.text-to-speech.watson.cloud.ibm.com/v1/voices/en-US_MichaelVoice",
"description": "Michael: American English male voice."
},
//...
Expand All @@ -38,7 +38,7 @@

* @todo define format in @return statement
* @param {Object} options
* @param {String} options.url=https://stream.watsonplatform.net/text-to-speech/api URL for Watson Text to Speech API
* @param {String} options.url=https://api.us-south.text-to-speech.watson.cloud.ibm.com URL for Watson Text to Speech API
* @param {String} options.token auth token for CF services
* @param {String} options.accessToken IAM access token for RC services
* @return {Promise.<T>}
Expand All @@ -53,7 +53,7 @@ module.exports = function getVoices(options) {
accept: 'application/json'
}
};
var url = options.url || 'https://stream.watsonplatform.net/text-to-speech/api';
var url = options.url || 'https://api.us-south.text-to-speech.watson.cloud.ibm.com';
if (options.accessToken) {
url = url + '/v1/voices?access_token=' + options.accessToken;
} else {
Expand Down
4 changes: 2 additions & 2 deletions text-to-speech/synthesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var qs = require('../util/querystring.js');
* Creates and returns a HTML5 `<audio>` element
*
* @param {Object} options
* @param {String} options.url=https://stream.watsonplatform.net/text-to-speech/api URL for Watson Text to Speech API
* @param {String} options.url=https://api.us-south.text-to-speech.watson.cloud.ibm.com URL for Watson Text to Speech API
* @param {String} [options.token] - Auth token for CF services
* @param {String} options.accessToken - IAM Access Token for RC services
* @param {String} options.text text to speak
Expand All @@ -48,7 +48,7 @@ module.exports = function synthesize(options) {
options.watsonToken = options.token;
delete options.token;
}
var url = options.url || 'https://stream.watsonplatform.net/text-to-speech/api';
var url = options.url || 'https://api.us-south.text-to-speech.watson.cloud.ibm.com';
var audio = options.element || new Audio();
audio.crossOrigin = 'anonymous';
var queryParamsAllowed = ['voice', 'X-Watson-Learning-Opt-Out', 'text', 'watson-token', 'access_token', 'accept', 'customization_id'];
Expand Down