Skip to content

Commit 54e1e7c

Browse files
authored
Merge pull request watson-developer-cloud#592 from watson-developer-cloud/array-query-params
Array Query Params
2 parents 84f9305 + 19a6049 commit 54e1e7c

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

dialog/v1.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ namespace DialogV1 {
379379
dialog_id: string;
380380
/** A client ID obtained from /dialog. **/
381381
client_id: string;
382+
name: string | Array<string>;
382383
}
383384

384385
export interface UpdateProfileParams {

index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export import NaturalLanguageClassifierV1 = require('./natural-language-classifi
3232

3333
export import NaturalLanguageUnderstandingV1 = require('./natural-language-understanding/v1');
3434

35+
export import PersonalityInsightsV2 = require('./personality-insights/v2');
36+
3537
export import PersonalityInsightsV3 = require('./personality-insights/v3');
3638

3739
export import SpeechToTextV1 = require('./speech-to-text/v1');
@@ -42,11 +44,6 @@ export import ToneAnalyzerV3 = require('./tone-analyzer/v3');
4244

4345
export import VisualRecognitionV3 = require('./visual-recognition/v3');
4446

45-
// js service files need to be imported this way as
46-
// a hack to supress compiler warnings about using
47-
// a .js file with the es6 import construct
48-
export const PersonalityInsightsV2 = require('./personality-insights/v2');
49-
5047
// adding shim constructors for backwards compatibility
5148

5249
// 2-d map of snake_case service names & version => constructor function

lib/requestwrapper.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ export function createRequest(parameters, _callback) {
225225

226226
// Query params
227227
if (options.qs && Object.keys(options.qs).length > 0) {
228+
// dialog doesn't like qs params joined with a `,`
229+
if (!parameters.defaultOptions.url.match(/dialog\/api/)) {
230+
Object.keys(options.qs).forEach(
231+
key =>
232+
Array.isArray(options.qs[key]) &&
233+
(options.qs[key] = options.qs[key].join(','))
234+
);
235+
}
228236
options.useQuerystring = true;
229237
}
230238

0 commit comments

Comments
 (0)