Skip to content

Commit 3042c9a

Browse files
committed
support wdc 3.7.0 and add tests for access_token param
1 parent 54395ff commit 3042c9a

File tree

10 files changed

+11126
-2751
lines changed

10 files changed

+11126
-2751
lines changed

examples/package-lock.json

Lines changed: 8027 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,21 @@
66
"start": "node server.js",
77
"postinstall": "bower install"
88
},
9-
"cacheDirectories": ["node_modules", "static/bower_components"],
9+
"cacheDirectories": [
10+
"node_modules",
11+
"static/bower_components"
12+
],
1013
"dependencies": {
1114
"bower": "^1.8.0",
1215
"defaults": "^1.0.3",
13-
"dotenv": "^4.0.0",
16+
"dotenv": "^6.0.0",
1417
"express": "^4.13.3",
1518
"express-browserify": "^1.0.2",
1619
"express-rate-limit": "^2.6.0",
1720
"express-secure-only": "^0.2.1",
1821
"object.assign": "^4.0.4",
19-
"vcap_services": "^0.3.4",
20-
"watson-developer-cloud": "^2.18.0",
22+
"vcap_services": "^0.4.0",
23+
"watson-developer-cloud": "^3.7.0",
2124
"watson-speech": "*",
2225
"webpack": "^3.5.5",
2326
"webpack-dev-middleware": "^1.10.0",

examples/server.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
const express = require('express');
2222
const app = express();
23-
const watson = require('watson-developer-cloud');
23+
const AuthorizationV1 = require('watson-developer-cloud/authorization/v1');
24+
const SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1');
25+
const TextToSpeechV1 = require('watson-developer-cloud/text-to-speech/v1');
2426
const vcapServices = require('vcap_services');
2527
const expressBrowserify = require('express-browserify');
2628
const webpackDevMiddleware = require('webpack-dev-middleware');
@@ -82,7 +84,7 @@ app.use(
8284
// **Warning**: these endpoints should probably be guarded with additional authentication & authorization for production use
8385

8486
// speech to text token endpoint
85-
var sttAuthService = new watson.AuthorizationV1(
87+
var sttAuthService = new AuthorizationV1(
8688
Object.assign(
8789
{
8890
username: process.env.SPEECH_TO_TEXT_USERNAME, // or hard-code credentials here
@@ -94,7 +96,7 @@ var sttAuthService = new watson.AuthorizationV1(
9496
app.use('/api/speech-to-text/token', function(req, res) {
9597
sttAuthService.getToken(
9698
{
97-
url: watson.SpeechToTextV1.URL
99+
url: SpeechToTextV1.URL
98100
},
99101
function(err, token) {
100102
if (err) {
@@ -108,7 +110,7 @@ app.use('/api/speech-to-text/token', function(req, res) {
108110
});
109111

110112
// text to speech token endpoint
111-
var ttsAuthService = new watson.AuthorizationV1(
113+
var ttsAuthService = new AuthorizationV1(
112114
Object.assign(
113115
{
114116
username: process.env.TEXT_TO_SPEECH_USERNAME, // or hard-code credentials here
@@ -120,7 +122,7 @@ var ttsAuthService = new watson.AuthorizationV1(
120122
app.use('/api/text-to-speech/token', function(req, res) {
121123
ttsAuthService.getToken(
122124
{
123-
url: watson.TextToSpeechV1.URL
125+
url: TextToSpeechV1.URL
124126
},
125127
function(err, token) {
126128
if (err) {

0 commit comments

Comments
 (0)