Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Commit ba8d7d3

Browse files
feat: add support for flexible webhook (#523)
* feat: add support for flexible webhook docs: update synthesize speech configs's documentation PiperOrigin-RevId: 539265592 Source-Link: googleapis/googleapis@2f59906 Source-Link: https://github.com/googleapis/googleapis-gen/commit/b92963b88b826eafc045c886b04962b4cc29e8ef Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjkyOTYzYjg4YjgyNmVhZmMwNDVjODg2YjA0OTYyYjRjYzI5ZThlZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add support for flexible webhook docs: update synthesize speech configs's documentation PiperOrigin-RevId: 539265734 Source-Link: googleapis/googleapis@091bc8c Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca652d5e3b92aac32c1aa28589e0421c3e5b7bc5 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E2NTJkNWUzYjkyYWFjMzJjMWFhMjg1ODllMDQyMWMzZTViN2JjNSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 3228835 commit ba8d7d3

File tree

12 files changed

+255
-20
lines changed

12 files changed

+255
-20
lines changed

google/cloud/dialogflowcx_v3/types/audio_config.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,10 @@ class OutputAudioConfig(proto.Message):
460460
converting to the desired sample rate (which
461461
might result in worse audio quality).
462462
synthesize_speech_config (google.cloud.dialogflowcx_v3.types.SynthesizeSpeechConfig):
463-
Optional. Configuration of how speech should
464-
be synthesized.
463+
Optional. Configuration of how speech should be synthesized.
464+
If not specified,
465+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings]
466+
is applied.
465467
"""
466468

467469
audio_encoding: "OutputAudioEncoding" = proto.Field(
@@ -492,13 +494,17 @@ class TextToSpeechSettings(proto.Message):
492494
493495
These settings affect:
494496
495-
- The synthesize configuration used in `phone
496-
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__.
497+
- The `phone
498+
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__
499+
synthesize configuration set via
500+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings].
497501
498-
- You no longer need to specify
502+
- How speech is synthesized when invoking
503+
[session][google.cloud.dialogflow.cx.v3.Sessions] APIs.
504+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings]
505+
only applies if
499506
[OutputAudioConfig.synthesize_speech_config][google.cloud.dialogflow.cx.v3.OutputAudioConfig.synthesize_speech_config]
500-
when invoking API calls. Your agent will use the
501-
pre-configured options for speech synthesizing.
507+
is not specified.
502508
"""
503509

504510
synthesize_speech_configs: MutableMapping[

google/cloud/dialogflowcx_v3/types/test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,8 @@ class TestRunDifference(proto.Message):
395395
type_ (google.cloud.dialogflowcx_v3.types.TestRunDifference.DiffType):
396396
The type of diff.
397397
description (str):
398-
A description of the diff, showing the actual
399-
output vs expected output.
398+
A human readable description of the diff,
399+
showing the actual output vs expected output.
400400
"""
401401

402402
class DiffType(proto.Enum):

google/cloud/dialogflowcx_v3/types/webhook.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,68 @@ class GenericWebService(proto.Message):
117117
-signkey example.com.key \
118118
-out example.com.crt \
119119
-extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
120+
webhook_type (google.cloud.dialogflowcx_v3.types.Webhook.GenericWebService.WebhookType):
121+
Optional. Type of the webhook.
122+
http_method (google.cloud.dialogflowcx_v3.types.Webhook.GenericWebService.HttpMethod):
123+
Optional. HTTP method for the flexible
124+
webhook calls. Standard webhook always uses
125+
POST.
126+
request_body (str):
127+
Optional. Defines a custom JSON object as
128+
request body to send to flexible webhook.
129+
parameter_mapping (MutableMapping[str, str]):
130+
Optional. Maps the values extracted from
131+
specific fields of the flexible webhook response
132+
into session parameters. - Key: session
133+
parameter name
134+
- Value: field path in the webhook response
120135
"""
121136

137+
class WebhookType(proto.Enum):
138+
r"""Represents the type of webhook configuration.
139+
140+
Values:
141+
WEBHOOK_TYPE_UNSPECIFIED (0):
142+
Default value. This value is unused.
143+
STANDARD (1):
144+
Represents a standard webhook.
145+
FLEXIBLE (2):
146+
Represents a flexible webhook.
147+
"""
148+
WEBHOOK_TYPE_UNSPECIFIED = 0
149+
STANDARD = 1
150+
FLEXIBLE = 2
151+
152+
class HttpMethod(proto.Enum):
153+
r"""HTTP method to use when calling webhooks.
154+
155+
Values:
156+
HTTP_METHOD_UNSPECIFIED (0):
157+
HTTP method not specified.
158+
POST (1):
159+
HTTP POST Method.
160+
GET (2):
161+
HTTP GET Method.
162+
HEAD (3):
163+
HTTP HEAD Method.
164+
PUT (4):
165+
HTTP PUT Method.
166+
DELETE (5):
167+
HTTP DELETE Method.
168+
PATCH (6):
169+
HTTP PATCH Method.
170+
OPTIONS (7):
171+
HTTP OPTIONS Method.
172+
"""
173+
HTTP_METHOD_UNSPECIFIED = 0
174+
POST = 1
175+
GET = 2
176+
HEAD = 3
177+
PUT = 4
178+
DELETE = 5
179+
PATCH = 6
180+
OPTIONS = 7
181+
122182
uri: str = proto.Field(
123183
proto.STRING,
124184
number=1,
@@ -140,6 +200,25 @@ class GenericWebService(proto.Message):
140200
proto.BYTES,
141201
number=5,
142202
)
203+
webhook_type: "Webhook.GenericWebService.WebhookType" = proto.Field(
204+
proto.ENUM,
205+
number=6,
206+
enum="Webhook.GenericWebService.WebhookType",
207+
)
208+
http_method: "Webhook.GenericWebService.HttpMethod" = proto.Field(
209+
proto.ENUM,
210+
number=7,
211+
enum="Webhook.GenericWebService.HttpMethod",
212+
)
213+
request_body: str = proto.Field(
214+
proto.STRING,
215+
number=8,
216+
)
217+
parameter_mapping: MutableMapping[str, str] = proto.MapField(
218+
proto.STRING,
219+
proto.STRING,
220+
number=9,
221+
)
143222

144223
class ServiceDirectoryConfig(proto.Message):
145224
r"""Represents configuration for a `Service

google/cloud/dialogflowcx_v3beta1/types/audio_config.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,10 @@ class OutputAudioConfig(proto.Message):
461461
converting to the desired sample rate (which
462462
might result in worse audio quality).
463463
synthesize_speech_config (google.cloud.dialogflowcx_v3beta1.types.SynthesizeSpeechConfig):
464-
Optional. Configuration of how speech should
465-
be synthesized.
464+
Optional. Configuration of how speech should be synthesized.
465+
If not specified,
466+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings]
467+
is applied.
466468
"""
467469

468470
audio_encoding: "OutputAudioEncoding" = proto.Field(
@@ -493,13 +495,18 @@ class TextToSpeechSettings(proto.Message):
493495
494496
These settings affect:
495497
496-
- The synthesize configuration used in `phone
497-
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__.
498+
- The `phone
499+
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__
500+
synthesize configuration set via
501+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings].
498502
499-
- You no longer need to specify
503+
- How speech is synthesized when invoking
504+
[session][google.cloud.dialogflow.cx.v3beta1.Sessions]
505+
APIs.
506+
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings]
507+
only applies if
500508
[OutputAudioConfig.synthesize_speech_config][google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.synthesize_speech_config]
501-
when invoking API calls. Your agent will use the
502-
pre-configured options for speech synthesizing.
509+
is not specified.
503510
"""
504511

505512
synthesize_speech_configs: MutableMapping[

google/cloud/dialogflowcx_v3beta1/types/test_case.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ class TestRunDifference(proto.Message):
397397
type_ (google.cloud.dialogflowcx_v3beta1.types.TestRunDifference.DiffType):
398398
The type of diff.
399399
description (str):
400-
A description of the diff, showing the actual
401-
output vs expected output.
400+
A human readable description of the diff,
401+
showing the actual output vs expected output.
402402
"""
403403

404404
class DiffType(proto.Enum):

google/cloud/dialogflowcx_v3beta1/types/webhook.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,68 @@ class GenericWebService(proto.Message):
117117
-signkey example.com.key \
118118
-out example.com.crt \
119119
-extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
120+
webhook_type (google.cloud.dialogflowcx_v3beta1.types.Webhook.GenericWebService.WebhookType):
121+
Optional. Type of the webhook.
122+
http_method (google.cloud.dialogflowcx_v3beta1.types.Webhook.GenericWebService.HttpMethod):
123+
Optional. HTTP method for the flexible
124+
webhook calls. Standard webhook always uses
125+
POST.
126+
request_body (str):
127+
Optional. Defines a custom JSON object as
128+
request body to send to flexible webhook.
129+
parameter_mapping (MutableMapping[str, str]):
130+
Optional. Maps the values extracted from
131+
specific fields of the flexible webhook response
132+
into session parameters. - Key: session
133+
parameter name
134+
- Value: field path in the webhook response
120135
"""
121136

137+
class WebhookType(proto.Enum):
138+
r"""Represents the type of webhook configuration.
139+
140+
Values:
141+
WEBHOOK_TYPE_UNSPECIFIED (0):
142+
Default value. This value is unused.
143+
STANDARD (1):
144+
Represents a standard webhook.
145+
FLEXIBLE (2):
146+
Represents a flexible webhook.
147+
"""
148+
WEBHOOK_TYPE_UNSPECIFIED = 0
149+
STANDARD = 1
150+
FLEXIBLE = 2
151+
152+
class HttpMethod(proto.Enum):
153+
r"""HTTP method to use when calling webhooks.
154+
155+
Values:
156+
HTTP_METHOD_UNSPECIFIED (0):
157+
HTTP method not specified.
158+
POST (1):
159+
HTTP POST Method.
160+
GET (2):
161+
HTTP GET Method.
162+
HEAD (3):
163+
HTTP HEAD Method.
164+
PUT (4):
165+
HTTP PUT Method.
166+
DELETE (5):
167+
HTTP DELETE Method.
168+
PATCH (6):
169+
HTTP PATCH Method.
170+
OPTIONS (7):
171+
HTTP OPTIONS Method.
172+
"""
173+
HTTP_METHOD_UNSPECIFIED = 0
174+
POST = 1
175+
GET = 2
176+
HEAD = 3
177+
PUT = 4
178+
DELETE = 5
179+
PATCH = 6
180+
OPTIONS = 7
181+
122182
uri: str = proto.Field(
123183
proto.STRING,
124184
number=1,
@@ -140,6 +200,25 @@ class GenericWebService(proto.Message):
140200
proto.BYTES,
141201
number=5,
142202
)
203+
webhook_type: "Webhook.GenericWebService.WebhookType" = proto.Field(
204+
proto.ENUM,
205+
number=6,
206+
enum="Webhook.GenericWebService.WebhookType",
207+
)
208+
http_method: "Webhook.GenericWebService.HttpMethod" = proto.Field(
209+
proto.ENUM,
210+
number=7,
211+
enum="Webhook.GenericWebService.HttpMethod",
212+
)
213+
request_body: str = proto.Field(
214+
proto.STRING,
215+
number=8,
216+
)
217+
parameter_mapping: MutableMapping[str, str] = proto.MapField(
218+
proto.STRING,
219+
proto.STRING,
220+
number=9,
221+
)
143222

144223
class ServiceDirectoryConfig(proto.Message):
145224
r"""Represents configuration for a `Service

samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-dialogflow-cx",
11-
"version": "1.21.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.dialogflow.cx.v3beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-dialogflow-cx",
11-
"version": "1.21.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

tests/unit/gapic/dialogflowcx_v3/test_environments.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3966,6 +3966,10 @@ def test_create_environment_rest(request_type):
39663966
b"allowed_ca_certs_blob1",
39673967
b"allowed_ca_certs_blob2",
39683968
],
3969+
"webhook_type": 1,
3970+
"http_method": 1,
3971+
"request_body": "request_body_value",
3972+
"parameter_mapping": {},
39693973
},
39703974
"service_directory": {
39713975
"service": "service_value",
@@ -4184,6 +4188,10 @@ def test_create_environment_rest_bad_request(
41844188
b"allowed_ca_certs_blob1",
41854189
b"allowed_ca_certs_blob2",
41864190
],
4191+
"webhook_type": 1,
4192+
"http_method": 1,
4193+
"request_body": "request_body_value",
4194+
"parameter_mapping": {},
41874195
},
41884196
"service_directory": {
41894197
"service": "service_value",
@@ -4316,6 +4324,10 @@ def test_update_environment_rest(request_type):
43164324
b"allowed_ca_certs_blob1",
43174325
b"allowed_ca_certs_blob2",
43184326
],
4327+
"webhook_type": 1,
4328+
"http_method": 1,
4329+
"request_body": "request_body_value",
4330+
"parameter_mapping": {},
43194331
},
43204332
"service_directory": {
43214333
"service": "service_value",
@@ -4535,6 +4547,10 @@ def test_update_environment_rest_bad_request(
45354547
b"allowed_ca_certs_blob1",
45364548
b"allowed_ca_certs_blob2",
45374549
],
4550+
"webhook_type": 1,
4551+
"http_method": 1,
4552+
"request_body": "request_body_value",
4553+
"parameter_mapping": {},
45384554
},
45394555
"service_directory": {
45404556
"service": "service_value",

tests/unit/gapic/dialogflowcx_v3/test_webhooks.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,10 @@ def test_create_webhook_rest(request_type):
26832683
"password": "password_value",
26842684
"request_headers": {},
26852685
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
2686+
"webhook_type": 1,
2687+
"http_method": 1,
2688+
"request_body": "request_body_value",
2689+
"parameter_mapping": {},
26862690
},
26872691
"service_directory": {"service": "service_value", "generic_web_service": {}},
26882692
"timeout": {"seconds": 751, "nanos": 543},
@@ -2884,6 +2888,10 @@ def test_create_webhook_rest_bad_request(
28842888
"password": "password_value",
28852889
"request_headers": {},
28862890
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
2891+
"webhook_type": 1,
2892+
"http_method": 1,
2893+
"request_body": "request_body_value",
2894+
"parameter_mapping": {},
28872895
},
28882896
"service_directory": {"service": "service_value", "generic_web_service": {}},
28892897
"timeout": {"seconds": 751, "nanos": 543},
@@ -2995,6 +3003,10 @@ def test_update_webhook_rest(request_type):
29953003
"password": "password_value",
29963004
"request_headers": {},
29973005
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
3006+
"webhook_type": 1,
3007+
"http_method": 1,
3008+
"request_body": "request_body_value",
3009+
"parameter_mapping": {},
29983010
},
29993011
"service_directory": {"service": "service_value", "generic_web_service": {}},
30003012
"timeout": {"seconds": 751, "nanos": 543},
@@ -3189,6 +3201,10 @@ def test_update_webhook_rest_bad_request(
31893201
"password": "password_value",
31903202
"request_headers": {},
31913203
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
3204+
"webhook_type": 1,
3205+
"http_method": 1,
3206+
"request_body": "request_body_value",
3207+
"parameter_mapping": {},
31923208
},
31933209
"service_directory": {"service": "service_value", "generic_web_service": {}},
31943210
"timeout": {"seconds": 751, "nanos": 543},

0 commit comments

Comments
 (0)