xref: /aosp_15_r20/external/googleapis/google/actions/sdk/v2/actions_testing.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2020 Google LLC
2//
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
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
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.
14
15syntax = "proto3";
16
17package google.actions.sdk.v2;
18
19import "google/actions/sdk/v2/conversation/intent.proto";
20import "google/actions/sdk/v2/conversation/prompt/content/canvas.proto";
21import "google/actions/sdk/v2/conversation/prompt/prompt.proto";
22import "google/actions/sdk/v2/event_logs.proto";
23import "google/api/annotations.proto";
24import "google/api/client.proto";
25import "google/api/field_behavior.proto";
26import "google/protobuf/empty.proto";
27import "google/type/latlng.proto";
28
29option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk";
30option java_multiple_files = true;
31option java_outer_classname = "ActionsTestingProto";
32option java_package = "com.google.actions.sdk.v2";
33
34// Actions Testing API which allows developers to run automated tests.
35service ActionsTesting {
36  option (google.api.default_host) = "actions.googleapis.com";
37
38  // Plays one round of the conversation.
39  rpc SendInteraction(SendInteractionRequest) returns (SendInteractionResponse) {
40    option (google.api.http) = {
41      post: "/v2/{project=projects/*}:sendInteraction"
42      body: "*"
43    };
44  }
45
46  // Finds the intents that match a given query.
47  rpc MatchIntents(MatchIntentsRequest) returns (MatchIntentsResponse) {
48    option (google.api.http) = {
49      post: "/v2/{project=projects/*}:matchIntents"
50      body: "*"
51    };
52    option (google.api.method_signature) = "project,query,locale";
53  }
54
55  // Sets the Web & App Activity control on a service account.
56  //
57  // It is necessary to have this setting enabled in order to use call Actions.
58  // The setting is originally disabled for service accounts, and it is
59  // preserved until set to a different value. This means it only needs to be
60  // enabled once per account (and not necessarily once per test), unless it is
61  // later disabled.
62  //
63  // Returns an error if the caller is not a service account. User accounts can
64  // change this setting via the Activity Controls page. See
65  // https://support.google.com/websearch/answer/54068.
66  rpc SetWebAndAppActivityControl(SetWebAndAppActivityControlRequest) returns (google.protobuf.Empty) {
67    option (google.api.http) = {
68      post: "/v2:setWebAndAppActivityControl"
69      body: "*"
70    };
71    option (google.api.method_signature) = "enabled";
72  }
73}
74
75// Request for playing a round of the conversation.
76message SendInteractionRequest {
77  // Required. The project being tested, indicated by the Project ID.
78  // Format: projects/{project}
79  string project = 1 [(google.api.field_behavior) = REQUIRED];
80
81  // Required. Input provided by the user.
82  UserInput input = 2 [(google.api.field_behavior) = REQUIRED];
83
84  // Required. Properties of the device used for interacting with the Action.
85  DeviceProperties device_properties = 3 [(google.api.field_behavior) = REQUIRED];
86
87  // Opaque token that must be passed as received from SendInteractionResponse
88  // on the previous interaction. This can be left unset in order to start a new
89  // conversation, either as the first interaction of a testing session or to
90  // abandon a previous conversation and start a new one.
91  string conversation_token = 4;
92}
93
94// User input provided on a conversation round.
95message UserInput {
96  // Indicates the input source, typed query or voice query.
97  enum InputType {
98    // Unspecified input source.
99    INPUT_TYPE_UNSPECIFIED = 0;
100
101    // Query from a GUI interaction.
102    TOUCH = 1;
103
104    // Voice query.
105    VOICE = 2;
106
107    // Typed query.
108    KEYBOARD = 3;
109
110    // The action was triggered by a URL link.
111    URL = 4;
112  }
113
114  // Content of the input sent by the user.
115  string query = 1;
116
117  // Type of the input.
118  InputType type = 2;
119}
120
121// Properties of device relevant to a conversation round.
122message DeviceProperties {
123  // Possible surfaces used to interact with the Action.
124  // Additional values may be included in the future.
125  enum Surface {
126    // Default value. This value is unused.
127    SURFACE_UNSPECIFIED = 0;
128
129    // Speaker (e.g. Google Home).
130    SPEAKER = 1;
131
132    // Phone.
133    PHONE = 2;
134
135    // Allo Chat.
136    ALLO = 3;
137
138    // Smart Display Device.
139    SMART_DISPLAY = 4;
140
141    // KaiOS.
142    KAI_OS = 5;
143  }
144
145  // Surface used for interacting with the Action.
146  Surface surface = 1;
147
148  // Device location such as latitude, longitude, and formatted address.
149  Location location = 2;
150
151  // Locale as set on the device.
152  // The format should follow BCP 47: https://tools.ietf.org/html/bcp47
153  // Examples: en, en-US, es-419 (more examples at
154  // https://tools.ietf.org/html/bcp47#appendix-A).
155  string locale = 3;
156
157  // Time zone as set on the device.
158  // The format should follow the IANA Time Zone Database, e.g.
159  // "America/New_York": https://www.iana.org/time-zones
160  string time_zone = 4;
161}
162
163// Container that represents a location.
164message Location {
165  // Geo coordinates.
166  // Requires the [DEVICE_PRECISE_LOCATION]
167  // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] permission.
168  google.type.LatLng coordinates = 1;
169
170  // Display address, e.g., "1600 Amphitheatre Pkwy, Mountain View, CA 94043".
171  // Requires the [DEVICE_PRECISE_LOCATION]
172  // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] permission.
173  string formatted_address = 2;
174
175  // Zip code.
176  // Requires the [DEVICE_PRECISE_LOCATION]
177  // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] or
178  // [DEVICE_COARSE_LOCATION]
179  // [google.actions.v2.Permission.DEVICE_COARSE_LOCATION] permission.
180  string zip_code = 3;
181
182  // City.
183  // Requires the [DEVICE_PRECISE_LOCATION]
184  // [google.actions.v2.Permission.DEVICE_PRECISE_LOCATION] or
185  // [DEVICE_COARSE_LOCATION]
186  // [google.actions.v2.Permission.DEVICE_COARSE_LOCATION] permission.
187  string city = 4;
188}
189
190// Response to a round of the conversation.
191message SendInteractionResponse {
192  // Output provided to the user.
193  Output output = 1;
194
195  // Diagnostics information that explains how the request was handled.
196  Diagnostics diagnostics = 2;
197
198  // Opaque token to be set on SendInteractionRequest on the next RPC call in
199  // order to continue the same conversation.
200  string conversation_token = 3;
201}
202
203// User-visible output to the conversation round.
204message Output {
205  // Spoken response sent to user as a plain string.
206  string text = 1;
207
208  // Speech content produced by the Action. This may include markup elements
209  // such as SSML.
210  repeated string speech = 2;
211
212  // Interactive Canvas content.
213  google.actions.sdk.v2.conversation.Canvas canvas = 3;
214
215  // State of the prompt at the end of the conversation round.
216  // More information about the prompt:
217  // https://developers.google.com/assistant/conversational/prompts
218  google.actions.sdk.v2.conversation.Prompt actions_builder_prompt = 4;
219}
220
221// Diagnostics information related to the conversation round.
222message Diagnostics {
223  // List of events with details about processing of the conversation round
224  // throughout the stages of the Actions Builder interaction model.
225  // Populated for Actions Builder & Actions SDK apps only.
226  repeated ExecutionEvent actions_builder_events = 1;
227}
228
229// Request for finding matching intents.
230message MatchIntentsRequest {
231  // Required. The project being tested, indicated by the Project ID.
232  // Format: projects/{project}
233  string project = 1 [(google.api.field_behavior) = REQUIRED];
234
235  // Required. User query as plain text.
236  string query = 2 [(google.api.field_behavior) = REQUIRED];
237
238  // Required. Locale to use to evaluate the query, such as "en".
239  // The format should follow BCP 47: https://tools.ietf.org/html/bcp47
240  // See the list of supported languages in
241  // https://developers.google.com/assistant/console/languages-locales
242  string locale = 3 [(google.api.field_behavior) = REQUIRED];
243}
244
245// Response for finding matching intents.
246message MatchIntentsResponse {
247  // Intents matched, ordered from most to least relevant. Only the first
248  // 50 matches are returned.
249  repeated google.actions.sdk.v2.conversation.Intent matched_intents = 1;
250}
251
252// Request for setting Web & App Activity preferences.
253message SetWebAndAppActivityControlRequest {
254  // Whether the setting should be set to an enabled or disabled state.
255  bool enabled = 1;
256}
257