dialogflow / dialogflow-nodejs-client

Node.js SDK for Dialogflow
Apache License 2.0
659 stars 287 forks source link

[Question] Typescript textRequest contexts are limited to one #110

Open leomongeg opened 6 years ago

leomongeg commented 6 years ago

Quick question,

why the contexts are limited to one in the interface QueryRequestOptions definition:

    /**
     * Base query request options.
     * See details at https://docs.api.ai/docs/query
     */
    interface QueryRequestOptions extends RequestOptions {
        timezone?: string;
        resetContexts?: boolean;
        sessionId: string;
        contexts?: [any]; // Forced to be an array of one element
        entities?: [any];
        version?: string;
        requestSource?: string;
        originalRequest?: any;
    }

As you can see the contexts are limited to be an array of one element and the API allows more than one context in the query request:

Name Type Description Required
contexts Array Array of additional context objects. Should be sent via a POST /query request. Contexts sent in a query are activated before the query. See Contexts. Optional

There is a reason for that?

Kind Regards, Leonardo Monge García.