1 // Copyright 2018 Google Inc.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
17 package google.cloud.dialogflow.v2;
19 import "google/api/annotations.proto";
20 import "google/protobuf/empty.proto";
21 import "google/protobuf/field_mask.proto";
22 import "google/protobuf/struct.proto";
24 option cc_enable_arenas = true;
25 option csharp_namespace = "Google.Cloud.Dialogflow.V2";
26 option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflow";
27 option java_multiple_files = true;
28 option java_outer_classname = "ContextProto";
29 option java_package = "com.google.cloud.dialogflow.v2";
30 option objc_class_prefix = "DF";
32 // A context represents additional information included with user input or with
33 // an intent returned by the Dialogflow API. Contexts are helpful for
34 // differentiating user input which may be vague or have a different meaning
35 // depending on additional details from your application such as user setting
36 // and preferences, previous user input, where the user is in your application,
37 // geographic location, and so on.
39 // You can include contexts as input parameters of a
40 // [DetectIntent][google.cloud.dialogflow.v2.Sessions.DetectIntent] (or
41 // [StreamingDetectIntent][google.cloud.dialogflow.v2.Sessions.StreamingDetectIntent])
42 // request, or as output contexts included in the returned intent. Contexts
43 // expire when an intent is matched, after the number of `DetectIntent` requests
44 // specified by the `lifespan_count` parameter, or after 10 minutes if no
45 // intents are matched for a `DetectIntent` request.
47 // For more information about contexts, see the
48 // [Dialogflow documentation](https://dialogflow.com/docs/contexts).
50 // Returns the list of all contexts in the specified session.
51 rpc ListContexts(ListContextsRequest) returns (ListContextsResponse) {
52 option (google.api.http) = {
53 get: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
57 // Retrieves the specified context.
58 rpc GetContext(GetContextRequest) returns (Context) {
59 option (google.api.http) = {
60 get: "/v2/{name=projects/*/agent/sessions/*/contexts/*}"
65 rpc CreateContext(CreateContextRequest) returns (Context) {
66 option (google.api.http) = {
67 post: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
72 // Updates the specified context.
73 rpc UpdateContext(UpdateContextRequest) returns (Context) {
74 option (google.api.http) = {
75 patch: "/v2/{context.name=projects/*/agent/sessions/*/contexts/*}"
80 // Deletes the specified context.
81 rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) {
82 option (google.api.http) = {
83 delete: "/v2/{name=projects/*/agent/sessions/*/contexts/*}"
87 // Deletes all active contexts in the specified session.
88 rpc DeleteAllContexts(DeleteAllContextsRequest)
89 returns (google.protobuf.Empty) {
90 option (google.api.http) = {
91 delete: "/v2/{parent=projects/*/agent/sessions/*}/contexts"
96 // Represents a context.
98 // Required. The unique identifier of the context. Format:
99 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
102 // Optional. The number of conversational query requests after which the
103 // context expires. If set to `0` (the default) the context expires
104 // immediately. Contexts expire automatically after 10 minutes even if there
105 // are no matching queries.
106 int32 lifespan_count = 2;
108 // Optional. The collection of parameters associated with this context.
109 // Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for
111 google.protobuf.Struct parameters = 3;
114 // The request message for
115 // [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
116 message ListContextsRequest {
117 // Required. The session to list all contexts from.
118 // Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
121 // Optional. The maximum number of items to return in a single page. By
122 // default 100 and at most 1000.
125 // Optional. The next_page_token value returned from a previous list request.
126 string page_token = 3;
129 // The response message for
130 // [Contexts.ListContexts][google.cloud.dialogflow.v2.Contexts.ListContexts].
131 message ListContextsResponse {
132 // The list of contexts. There will be a maximum number of items
133 // returned based on the page_size field in the request.
134 repeated Context contexts = 1;
136 // Token to retrieve the next page of results, or empty if there are no
137 // more results in the list.
138 string next_page_token = 2;
141 // The request message for
142 // [Contexts.GetContext][google.cloud.dialogflow.v2.Contexts.GetContext].
143 message GetContextRequest {
144 // Required. The name of the context. Format:
145 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
149 // The request message for
150 // [Contexts.CreateContext][google.cloud.dialogflow.v2.Contexts.CreateContext].
151 message CreateContextRequest {
152 // Required. The session to create a context for.
153 // Format: `projects/<Project ID>/agent/sessions/<Session ID>`.
156 // Required. The context to create.
160 // The request message for
161 // [Contexts.UpdateContext][google.cloud.dialogflow.v2.Contexts.UpdateContext].
162 message UpdateContextRequest {
163 // Required. The context to update.
166 // Optional. The mask to control which fields get updated.
167 google.protobuf.FieldMask update_mask = 2;
170 // The request message for
171 // [Contexts.DeleteContext][google.cloud.dialogflow.v2.Contexts.DeleteContext].
172 message DeleteContextRequest {
173 // Required. The name of the context to delete. Format:
174 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`.
178 // The request message for
179 // [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2.Contexts.DeleteAllContexts].
180 message DeleteAllContextsRequest {
181 // Required. The name of the session to delete all contexts from. Format:
182 // `projects/<Project ID>/agent/sessions/<Session ID>`.