webhook.proto 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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;
  16. import "google/api/field_behavior.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk";
  18. option java_multiple_files = true;
  19. option java_outer_classname = "WebhookProto";
  20. option java_package = "com.google.actions.sdk.v2";
  21. // Metadata for different types of webhooks. If you're using
  22. // `inlineCloudFunction`, your source code must be in a directory with the same
  23. // name as the value for the `executeFunction` key.
  24. // For example, a value of `my_webhook` for the`executeFunction` key would have
  25. // a code structure like this:
  26. // - `/webhooks/my_webhook.yaml`
  27. // - `/webhooks/my_webhook/index.js`
  28. // - `/webhooks/my_webhook/package.json`
  29. message Webhook {
  30. // Declares the name of the webhoook handler. A webhook can have
  31. // multiple handlers registered. These handlers can be called from multiple
  32. // places in your Actions project.
  33. message Handler {
  34. // Required. Name of the handler. Must be unique across all handlers the Actions
  35. // project. You can check the name of this handler to invoke the correct
  36. // function in your fulfillment source code.
  37. string name = 1 [(google.api.field_behavior) = REQUIRED];
  38. }
  39. // REST endpoint to notify if you're not using the inline editor.
  40. message HttpsEndpoint {
  41. // The HTTPS base URL for your fulfillment endpoint (HTTP is not supported).
  42. // Handler names are appended to the base URL path after a colon
  43. // (following the style guide in
  44. // https://cloud.google.com/apis/design/custom_methods).
  45. // For example a base URL of 'https://gactions.service.com/api' would
  46. // receive requests with URL 'https://gactions.service.com/api:{method}'.
  47. string base_url = 1;
  48. // Map of HTTP parameters to be included in the POST request.
  49. map<string, string> http_headers = 2;
  50. // Version of the protocol used by the endpoint. This is the protocol shared
  51. // by all fulfillment types and not specific to Google fulfillment type.
  52. int32 endpoint_api_version = 3;
  53. }
  54. // Holds the metadata of an inline Cloud Function deployed from the
  55. // webhooks folder.
  56. message InlineCloudFunction {
  57. // The name of the Cloud Function entry point. The value of this field
  58. // should match the name of the method exported from the source code.
  59. string execute_function = 1;
  60. }
  61. // List of handlers for this webhook.
  62. repeated Handler handlers = 1;
  63. // Only one webhook type is supported.
  64. oneof webhook_type {
  65. // Custom webhook HTTPS endpoint.
  66. HttpsEndpoint https_endpoint = 2;
  67. // Metadata for cloud function deployed from code in the webhooks folder.
  68. InlineCloudFunction inline_cloud_function = 3;
  69. }
  70. }