conditional_event.proto 2.6 KB

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