1 // Copyright 2018 Google LLC
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.v2beta1;
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.V2beta1";
26 option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
27 option java_multiple_files = true;
28 option java_outer_classname = "ContextProto";
29 option java_package = "com.google.cloud.dialogflow.v2beta1";
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.v2beta1.Sessions.DetectIntent] (or
41 // [StreamingDetectIntent][google.cloud.dialogflow.v2beta1.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: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
55 get: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
60 // Retrieves the specified context.
61 rpc GetContext(GetContextRequest) returns (Context) {
62 option (google.api.http) = {
63 get: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}"
65 get: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
71 rpc CreateContext(CreateContextRequest) returns (Context) {
72 option (google.api.http) = {
73 post: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
76 post: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
82 // Updates the specified context.
83 rpc UpdateContext(UpdateContextRequest) returns (Context) {
84 option (google.api.http) = {
85 patch: "/v2beta1/{context.name=projects/*/agent/sessions/*/contexts/*}"
88 patch: "/v2beta1/{context.name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
94 // Deletes the specified context.
95 rpc DeleteContext(DeleteContextRequest) returns (google.protobuf.Empty) {
96 option (google.api.http) = {
97 delete: "/v2beta1/{name=projects/*/agent/sessions/*/contexts/*}"
99 delete: "/v2beta1/{name=projects/*/agent/environments/*/users/*/sessions/*/contexts/*}"
104 // Deletes all active contexts in the specified session.
105 rpc DeleteAllContexts(DeleteAllContextsRequest)
106 returns (google.protobuf.Empty) {
107 option (google.api.http) = {
108 delete: "/v2beta1/{parent=projects/*/agent/sessions/*}/contexts"
109 additional_bindings {
110 delete: "/v2beta1/{parent=projects/*/agent/environments/*/users/*/sessions/*}/contexts"
116 // Represents a context.
118 // Required. The unique identifier of the context. Format:
119 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`,
120 // or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
121 // ID>/sessions/<Session ID>/contexts/<Context ID>`. The `Context ID` is
122 // always converted to lowercase. If `Environment ID` is not specified, we
123 // assume default 'draft' environment. If `User ID` is not specified, we
124 // assume default '-' user.
127 // Optional. The number of conversational query requests after which the
128 // context expires. If set to `0` (the default) the context expires
129 // immediately. Contexts expire automatically after 10 minutes even if there
130 // are no matching queries.
131 int32 lifespan_count = 2;
133 // Optional. The collection of parameters associated with this context.
134 // Refer to [this doc](https://dialogflow.com/docs/actions-and-parameters) for
136 google.protobuf.Struct parameters = 3;
139 // The request message for
140 // [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts].
141 message ListContextsRequest {
142 // Required. The session to list all contexts from.
143 // Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
144 // `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
145 // ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
146 // default 'draft' environment. If `User ID` is not specified, we assume
150 // Optional. The maximum number of items to return in a single page. By
151 // default 100 and at most 1000.
154 // Optional. The next_page_token value returned from a previous list request.
155 string page_token = 3;
158 // The response message for
159 // [Contexts.ListContexts][google.cloud.dialogflow.v2beta1.Contexts.ListContexts].
160 message ListContextsResponse {
161 // The list of contexts. There will be a maximum number of items
162 // returned based on the page_size field in the request.
163 repeated Context contexts = 1;
165 // Token to retrieve the next page of results, or empty if there are no
166 // more results in the list.
167 string next_page_token = 2;
170 // The request message for
171 // [Contexts.GetContext][google.cloud.dialogflow.v2beta1.Contexts.GetContext].
172 message GetContextRequest {
173 // Required. The name of the context. Format:
174 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
175 // or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
176 // ID>/sessions/<Session ID>/contexts/<Context ID>`. If `Environment ID` is
177 // not specified, we assume default 'draft' environment. If `User ID` is not
178 // specified, we assume default '-' user.
182 // The request message for
183 // [Contexts.CreateContext][google.cloud.dialogflow.v2beta1.Contexts.CreateContext].
184 message CreateContextRequest {
185 // Required. The session to create a context for.
186 // Format: `projects/<Project ID>/agent/sessions/<Session ID>` or
187 // `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
188 // ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
189 // default 'draft' environment. If `User ID` is not specified, we assume
193 // Required. The context to create.
197 // The request message for
198 // [Contexts.UpdateContext][google.cloud.dialogflow.v2beta1.Contexts.UpdateContext].
199 message UpdateContextRequest {
200 // Required. The context to update.
203 // Optional. The mask to control which fields get updated.
204 google.protobuf.FieldMask update_mask = 2;
207 // The request message for
208 // [Contexts.DeleteContext][google.cloud.dialogflow.v2beta1.Contexts.DeleteContext].
209 message DeleteContextRequest {
210 // Required. The name of the context to delete. Format:
211 // `projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>`
212 // or `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
213 // ID>/sessions/<Session ID>/contexts/<Context ID>`. If `Environment ID` is
214 // not specified, we assume default 'draft' environment. If `User ID` is not
215 // specified, we assume default '-' user.
219 // The request message for
220 // [Contexts.DeleteAllContexts][google.cloud.dialogflow.v2beta1.Contexts.DeleteAllContexts].
221 message DeleteAllContextsRequest {
222 // Required. The name of the session to delete all contexts from. Format:
223 // `projects/<Project ID>/agent/sessions/<Session ID>` or `projects/<Project
224 // ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
225 // ID>`. If `Environment ID` is not specified we assume default 'draft'
226 // environment. If `User ID` is not specified, we assume default '-' user.