xref: /aosp_15_r20/external/googleapis/google/actions/sdk/v2/interactionmodel/conditional_event.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.interactionmodel;
18
19import "google/actions/sdk/v2/interactionmodel/event_handler.proto";
20import "google/api/field_behavior.proto";
21
22option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel;interactionmodel";
23option java_multiple_files = true;
24option java_outer_classname = "ConditionalEventProto";
25option java_package = "com.google.actions.sdk.v2.interactionmodel";
26
27// Registers events that trigger as the result of a true condition.
28message ConditionalEvent {
29  // Required. Filter condition for this event to trigger. If condition is evaluated to
30  // true then the associated `handler` will be triggered.
31  // The following variable references are supported:
32  //   `$session` - To reference data in session storage.
33  //   `$user` - To reference data in user storage.
34  // The following boolean operators are supported (with examples):
35  //   `&&` - `session.params.counter > 0 && session.params.counter < 100`
36  //   `||` - `session.params.foo == "John" || session.params.counter == "Adam"`
37  //   `!`  - `!(session.params.counter == 5)`
38  // The following comparisons are supported:
39  //   `==`, `!=`, `<`, `>`, `<=`, `>=`
40  // The following list and string operators are supported (with examples):
41  //   `in`        - "Watermelon" in `session.params.fruitList`
42  //   `size`      - `size(session.params.fruitList) > 2`
43  //   `substring` - `session.params.fullName.contains("John")`
44  string condition = 1 [(google.api.field_behavior) = REQUIRED];
45
46  // Optional. Destination scene which the conversation should jump to when the associated
47  // condition is evaluated to true. The state of the current scene is destroyed
48  // on the transition.
49  string transition_to_scene = 2 [(google.api.field_behavior) = OPTIONAL];
50
51  // Optional. Event handler which is triggered when the associated condition is evaluated
52  // to `true`. Should execute before transitioning to the destination scene.
53  // Useful to generate Prompts in response to events.
54  EventHandler handler = 3 [(google.api.field_behavior) = OPTIONAL];
55}
56