xref: /aosp_15_r20/external/googleapis/google/actions/sdk/v2/webhook.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2020 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.actions.sdk.v2;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Worker
21*d5c09012SAndroid Build Coastguard Workeroption go_package = "google.golang.org/genproto/googleapis/actions/sdk/v2;sdk";
22*d5c09012SAndroid Build Coastguard Workeroption java_multiple_files = true;
23*d5c09012SAndroid Build Coastguard Workeroption java_outer_classname = "WebhookProto";
24*d5c09012SAndroid Build Coastguard Workeroption java_package = "com.google.actions.sdk.v2";
25*d5c09012SAndroid Build Coastguard Worker
26*d5c09012SAndroid Build Coastguard Worker// Metadata for different types of webhooks. If you're using
27*d5c09012SAndroid Build Coastguard Worker// `inlineCloudFunction`, your source code must be in a directory with the same
28*d5c09012SAndroid Build Coastguard Worker// name as the value for the `executeFunction` key.
29*d5c09012SAndroid Build Coastguard Worker// For example, a value of `my_webhook` for the`executeFunction` key would have
30*d5c09012SAndroid Build Coastguard Worker// a code structure like this:
31*d5c09012SAndroid Build Coastguard Worker//  - `/webhooks/my_webhook.yaml`
32*d5c09012SAndroid Build Coastguard Worker//  - `/webhooks/my_webhook/index.js`
33*d5c09012SAndroid Build Coastguard Worker//  - `/webhooks/my_webhook/package.json`
34*d5c09012SAndroid Build Coastguard Workermessage Webhook {
35*d5c09012SAndroid Build Coastguard Worker  // Declares the name of the webhoook handler. A webhook can have
36*d5c09012SAndroid Build Coastguard Worker  // multiple handlers registered. These handlers can be called from multiple
37*d5c09012SAndroid Build Coastguard Worker  // places in your Actions project.
38*d5c09012SAndroid Build Coastguard Worker  message Handler {
39*d5c09012SAndroid Build Coastguard Worker    // Required. Name of the handler. Must be unique across all handlers the Actions
40*d5c09012SAndroid Build Coastguard Worker    // project. You can check the name of this handler to invoke the correct
41*d5c09012SAndroid Build Coastguard Worker    // function in your fulfillment source code.
42*d5c09012SAndroid Build Coastguard Worker    string name = 1 [(google.api.field_behavior) = REQUIRED];
43*d5c09012SAndroid Build Coastguard Worker  }
44*d5c09012SAndroid Build Coastguard Worker
45*d5c09012SAndroid Build Coastguard Worker  // REST endpoint to notify if you're not using the inline editor.
46*d5c09012SAndroid Build Coastguard Worker  message HttpsEndpoint {
47*d5c09012SAndroid Build Coastguard Worker    // The HTTPS base URL for your fulfillment endpoint (HTTP is not supported).
48*d5c09012SAndroid Build Coastguard Worker    // Handler names are appended to the base URL path after a colon
49*d5c09012SAndroid Build Coastguard Worker    // (following the style guide in
50*d5c09012SAndroid Build Coastguard Worker    // https://cloud.google.com/apis/design/custom_methods).
51*d5c09012SAndroid Build Coastguard Worker    // For example a base URL of 'https://gactions.service.com/api' would
52*d5c09012SAndroid Build Coastguard Worker    // receive requests with URL 'https://gactions.service.com/api:{method}'.
53*d5c09012SAndroid Build Coastguard Worker    string base_url = 1;
54*d5c09012SAndroid Build Coastguard Worker
55*d5c09012SAndroid Build Coastguard Worker    // Map of HTTP parameters to be included in the POST request.
56*d5c09012SAndroid Build Coastguard Worker    map<string, string> http_headers = 2;
57*d5c09012SAndroid Build Coastguard Worker
58*d5c09012SAndroid Build Coastguard Worker    // Version of the protocol used by the endpoint. This is the protocol shared
59*d5c09012SAndroid Build Coastguard Worker    // by all fulfillment types and not specific to Google fulfillment type.
60*d5c09012SAndroid Build Coastguard Worker    int32 endpoint_api_version = 3;
61*d5c09012SAndroid Build Coastguard Worker  }
62*d5c09012SAndroid Build Coastguard Worker
63*d5c09012SAndroid Build Coastguard Worker  // Holds the metadata of an inline Cloud Function deployed from the
64*d5c09012SAndroid Build Coastguard Worker  // webhooks folder.
65*d5c09012SAndroid Build Coastguard Worker  message InlineCloudFunction {
66*d5c09012SAndroid Build Coastguard Worker    // The name of the Cloud Function entry point. The value of this field
67*d5c09012SAndroid Build Coastguard Worker    // should match the name of the method exported from the source code.
68*d5c09012SAndroid Build Coastguard Worker    string execute_function = 1;
69*d5c09012SAndroid Build Coastguard Worker  }
70*d5c09012SAndroid Build Coastguard Worker
71*d5c09012SAndroid Build Coastguard Worker  // List of handlers for this webhook.
72*d5c09012SAndroid Build Coastguard Worker  repeated Handler handlers = 1;
73*d5c09012SAndroid Build Coastguard Worker
74*d5c09012SAndroid Build Coastguard Worker  // Only one webhook type is supported.
75*d5c09012SAndroid Build Coastguard Worker  oneof webhook_type {
76*d5c09012SAndroid Build Coastguard Worker    // Custom webhook HTTPS endpoint.
77*d5c09012SAndroid Build Coastguard Worker    HttpsEndpoint https_endpoint = 2;
78*d5c09012SAndroid Build Coastguard Worker
79*d5c09012SAndroid Build Coastguard Worker    // Metadata for cloud function deployed from code in the webhooks folder.
80*d5c09012SAndroid Build Coastguard Worker    InlineCloudFunction inline_cloud_function = 3;
81*d5c09012SAndroid Build Coastguard Worker  }
82*d5c09012SAndroid Build Coastguard Worker}
83