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