xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/v2/fulfillment.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 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.cloud.dialogflow.v2;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/protobuf/field_mask.proto";
24
25option cc_enable_arenas = true;
26option csharp_namespace = "Google.Cloud.Dialogflow.V2";
27option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
28option java_multiple_files = true;
29option java_outer_classname = "FulfillmentProto";
30option java_package = "com.google.cloud.dialogflow.v2";
31option objc_class_prefix = "DF";
32
33// Service for managing [Fulfillments][google.cloud.dialogflow.v2.Fulfillment].
34service Fulfillments {
35  option (google.api.default_host) = "dialogflow.googleapis.com";
36  option (google.api.oauth_scopes) =
37      "https://www.googleapis.com/auth/cloud-platform,"
38      "https://www.googleapis.com/auth/dialogflow";
39
40  // Retrieves the fulfillment.
41  rpc GetFulfillment(GetFulfillmentRequest) returns (Fulfillment) {
42    option (google.api.http) = {
43      get: "/v2/{name=projects/*/agent/fulfillment}"
44      additional_bindings {
45        get: "/v2/{name=projects/*/locations/*/agent/fulfillment}"
46      }
47    };
48    option (google.api.method_signature) = "name";
49  }
50
51  // Updates the fulfillment.
52  rpc UpdateFulfillment(UpdateFulfillmentRequest) returns (Fulfillment) {
53    option (google.api.http) = {
54      patch: "/v2/{fulfillment.name=projects/*/agent/fulfillment}"
55      body: "fulfillment"
56      additional_bindings {
57        patch: "/v2/{fulfillment.name=projects/*/locations/*/agent/fulfillment}"
58        body: "fulfillment"
59      }
60    };
61    option (google.api.method_signature) = "fulfillment,update_mask";
62  }
63}
64
65// By default, your agent responds to a matched intent with a static response.
66// As an alternative, you can provide a more dynamic response by using
67// fulfillment. When you enable fulfillment for an intent, Dialogflow responds
68// to that intent by calling a service that you define. For example, if an
69// end-user wants to schedule a haircut on Friday, your service can check your
70// database and respond to the end-user with availability information for
71// Friday.
72//
73// For more information, see the [fulfillment
74// guide](https://cloud.google.com/dialogflow/docs/fulfillment-overview).
75message Fulfillment {
76  option (google.api.resource) = {
77    type: "dialogflow.googleapis.com/Fulfillment"
78    pattern: "projects/{project}/agent/fulfillment"
79    pattern: "projects/{project}/locations/{location}/agent/fulfillment"
80  };
81
82  // Represents configuration for a generic web service.
83  // Dialogflow supports two mechanisms for authentications:
84  //
85  // - Basic authentication with username and password.
86  // - Authentication with additional authentication headers.
87  //
88  // More information could be found at:
89  // https://cloud.google.com/dialogflow/docs/fulfillment-configure.
90  message GenericWebService {
91    // Required. The fulfillment URI for receiving POST requests.
92    // It must use https protocol.
93    string uri = 1 [(google.api.field_behavior) = REQUIRED];
94
95    // Optional. The user name for HTTP Basic authentication.
96    string username = 2 [(google.api.field_behavior) = OPTIONAL];
97
98    // Optional. The password for HTTP Basic authentication.
99    string password = 3 [(google.api.field_behavior) = OPTIONAL];
100
101    // Optional. The HTTP request headers to send together with fulfillment
102    // requests.
103    map<string, string> request_headers = 4
104        [(google.api.field_behavior) = OPTIONAL];
105
106    // Optional. Indicates if generic web service is created through Cloud
107    // Functions integration. Defaults to false.
108    //
109    // is_cloud_function is deprecated. Cloud functions can be configured by
110    // its uri as a regular web service now.
111    bool is_cloud_function = 5
112        [deprecated = true, (google.api.field_behavior) = OPTIONAL];
113  }
114
115  // Whether fulfillment is enabled for the specific feature.
116  message Feature {
117    // The type of the feature.
118    enum Type {
119      // Feature type not specified.
120      TYPE_UNSPECIFIED = 0;
121
122      // Fulfillment is enabled for SmallTalk.
123      SMALLTALK = 1;
124    }
125
126    // The type of the feature that enabled for fulfillment.
127    Type type = 1;
128  }
129
130  // Required. The unique identifier of the fulfillment.
131  // Supported formats:
132  //
133  // - `projects/<Project ID>/agent/fulfillment`
134  // - `projects/<Project ID>/locations/<Location ID>/agent/fulfillment`
135  //
136  // This field is not used for Fulfillment in an Environment.
137  string name = 1 [(google.api.field_behavior) = REQUIRED];
138
139  // Optional. The human-readable name of the fulfillment, unique within the
140  // agent.
141  //
142  // This field is not used for Fulfillment in an Environment.
143  string display_name = 2 [(google.api.field_behavior) = OPTIONAL];
144
145  // Required. The fulfillment configuration.
146  oneof fulfillment {
147    // Configuration for a generic web service.
148    GenericWebService generic_web_service = 3;
149  }
150
151  // Optional. Whether fulfillment is enabled.
152  bool enabled = 4 [(google.api.field_behavior) = OPTIONAL];
153
154  // Optional. The field defines whether the fulfillment is enabled for certain
155  // features.
156  repeated Feature features = 5 [(google.api.field_behavior) = OPTIONAL];
157}
158
159// The request message for
160// [Fulfillments.GetFulfillment][google.cloud.dialogflow.v2.Fulfillments.GetFulfillment].
161message GetFulfillmentRequest {
162  // Required. The name of the fulfillment.
163  // Format: `projects/<Project ID>/agent/fulfillment`.
164  string name = 1 [
165    (google.api.field_behavior) = REQUIRED,
166    (google.api.resource_reference) = {
167      type: "dialogflow.googleapis.com/Fulfillment"
168    }
169  ];
170}
171
172// The request message for
173// [Fulfillments.UpdateFulfillment][google.cloud.dialogflow.v2.Fulfillments.UpdateFulfillment].
174message UpdateFulfillmentRequest {
175  // Required. The fulfillment to update.
176  Fulfillment fulfillment = 1 [(google.api.field_behavior) = REQUIRED];
177
178  // Required. The mask to control which fields get updated. If the mask is not
179  // present, all fields will be updated.
180  google.protobuf.FieldMask update_mask = 2
181      [(google.api.field_behavior) = REQUIRED];
182}
183