Skip to content

Array Query Params #592

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

Merged
merged 5 commits into from
Dec 14, 2017
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
1 change: 1 addition & 0 deletions dialog/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ namespace DialogV1 {
dialog_id: string;
/** A client ID obtained from /dialog. **/
client_id: string;
name: string | Array<string>;
}

export interface UpdateProfileParams {
Expand Down
7 changes: 2 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export import NaturalLanguageClassifierV1 = require('./natural-language-classifi

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

export import PersonalityInsightsV2 = require('./personality-insights/v2');

export import PersonalityInsightsV3 = require('./personality-insights/v3');

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

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

// js service files need to be imported this way as
// a hack to supress compiler warnings about using
// a .js file with the es6 import construct
export const PersonalityInsightsV2 = require('./personality-insights/v2');

// adding shim constructors for backwards compatibility

// 2-d map of snake_case service names & version => constructor function
Expand Down
8 changes: 8 additions & 0 deletions lib/requestwrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ export function createRequest(parameters, _callback) {

// Query params
if (options.qs && Object.keys(options.qs).length > 0) {
// dialog doesn't like qs params joined with a `,`
if (!parameters.defaultOptions.url.match(/dialog\/api/)) {
Object.keys(options.qs).forEach(
key =>
Array.isArray(options.qs[key]) &&
(options.qs[key] = options.qs[key].join(','))
);
}
options.useQuerystring = true;
}

Expand Down