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

Commit

Permalink
feat: add support for flexible webhook (#523)
Browse files Browse the repository at this point in the history
* feat: add support for flexible webhook
docs: update synthesize speech configs's documentation

PiperOrigin-RevId: 539265592

Source-Link: googleapis/googleapis@2f59906

Source-Link: googleapis/googleapis-gen@b92963b
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: googleapis/googleapis-gen@ca652d5
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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jun 13, 2023
1 parent 3228835 commit ba8d7d3
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 20 deletions.
20 changes: 13 additions & 7 deletions google/cloud/dialogflowcx_v3/types/audio_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,10 @@ class OutputAudioConfig(proto.Message):
converting to the desired sample rate (which
might result in worse audio quality).
synthesize_speech_config (google.cloud.dialogflowcx_v3.types.SynthesizeSpeechConfig):
Optional. Configuration of how speech should
be synthesized.
Optional. Configuration of how speech should be synthesized.
If not specified,
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings]
is applied.
"""

audio_encoding: "OutputAudioEncoding" = proto.Field(
Expand Down Expand Up @@ -492,13 +494,17 @@ class TextToSpeechSettings(proto.Message):
These settings affect:
- The synthesize configuration used in `phone
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__.
- The `phone
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__
synthesize configuration set via
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings].
- You no longer need to specify
- How speech is synthesized when invoking
[session][google.cloud.dialogflow.cx.v3.Sessions] APIs.
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings]
only applies if
[OutputAudioConfig.synthesize_speech_config][google.cloud.dialogflow.cx.v3.OutputAudioConfig.synthesize_speech_config]
when invoking API calls. Your agent will use the
pre-configured options for speech synthesizing.
is not specified.
"""

synthesize_speech_configs: MutableMapping[
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/dialogflowcx_v3/types/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ class TestRunDifference(proto.Message):
type_ (google.cloud.dialogflowcx_v3.types.TestRunDifference.DiffType):
The type of diff.
description (str):
A description of the diff, showing the actual
output vs expected output.
A human readable description of the diff,
showing the actual output vs expected output.
"""

class DiffType(proto.Enum):
Expand Down
79 changes: 79 additions & 0 deletions google/cloud/dialogflowcx_v3/types/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,68 @@ class GenericWebService(proto.Message):
-signkey example.com.key \
-out example.com.crt \
-extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
webhook_type (google.cloud.dialogflowcx_v3.types.Webhook.GenericWebService.WebhookType):
Optional. Type of the webhook.
http_method (google.cloud.dialogflowcx_v3.types.Webhook.GenericWebService.HttpMethod):
Optional. HTTP method for the flexible
webhook calls. Standard webhook always uses
POST.
request_body (str):
Optional. Defines a custom JSON object as
request body to send to flexible webhook.
parameter_mapping (MutableMapping[str, str]):
Optional. Maps the values extracted from
specific fields of the flexible webhook response
into session parameters. - Key: session
parameter name
- Value: field path in the webhook response
"""

class WebhookType(proto.Enum):
r"""Represents the type of webhook configuration.
Values:
WEBHOOK_TYPE_UNSPECIFIED (0):
Default value. This value is unused.
STANDARD (1):
Represents a standard webhook.
FLEXIBLE (2):
Represents a flexible webhook.
"""
WEBHOOK_TYPE_UNSPECIFIED = 0
STANDARD = 1
FLEXIBLE = 2

class HttpMethod(proto.Enum):
r"""HTTP method to use when calling webhooks.
Values:
HTTP_METHOD_UNSPECIFIED (0):
HTTP method not specified.
POST (1):
HTTP POST Method.
GET (2):
HTTP GET Method.
HEAD (3):
HTTP HEAD Method.
PUT (4):
HTTP PUT Method.
DELETE (5):
HTTP DELETE Method.
PATCH (6):
HTTP PATCH Method.
OPTIONS (7):
HTTP OPTIONS Method.
"""
HTTP_METHOD_UNSPECIFIED = 0
POST = 1
GET = 2
HEAD = 3
PUT = 4
DELETE = 5
PATCH = 6
OPTIONS = 7

uri: str = proto.Field(
proto.STRING,
number=1,
Expand All @@ -140,6 +200,25 @@ class GenericWebService(proto.Message):
proto.BYTES,
number=5,
)
webhook_type: "Webhook.GenericWebService.WebhookType" = proto.Field(
proto.ENUM,
number=6,
enum="Webhook.GenericWebService.WebhookType",
)
http_method: "Webhook.GenericWebService.HttpMethod" = proto.Field(
proto.ENUM,
number=7,
enum="Webhook.GenericWebService.HttpMethod",
)
request_body: str = proto.Field(
proto.STRING,
number=8,
)
parameter_mapping: MutableMapping[str, str] = proto.MapField(
proto.STRING,
proto.STRING,
number=9,
)

class ServiceDirectoryConfig(proto.Message):
r"""Represents configuration for a `Service
Expand Down
21 changes: 14 additions & 7 deletions google/cloud/dialogflowcx_v3beta1/types/audio_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ class OutputAudioConfig(proto.Message):
converting to the desired sample rate (which
might result in worse audio quality).
synthesize_speech_config (google.cloud.dialogflowcx_v3beta1.types.SynthesizeSpeechConfig):
Optional. Configuration of how speech should
be synthesized.
Optional. Configuration of how speech should be synthesized.
If not specified,
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings]
is applied.
"""

audio_encoding: "OutputAudioEncoding" = proto.Field(
Expand Down Expand Up @@ -493,13 +495,18 @@ class TextToSpeechSettings(proto.Message):
These settings affect:
- The synthesize configuration used in `phone
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__.
- The `phone
gateway <https://cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway>`__
synthesize configuration set via
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings].
- You no longer need to specify
- How speech is synthesized when invoking
[session][google.cloud.dialogflow.cx.v3beta1.Sessions]
APIs.
[Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3beta1.Agent.text_to_speech_settings]
only applies if
[OutputAudioConfig.synthesize_speech_config][google.cloud.dialogflow.cx.v3beta1.OutputAudioConfig.synthesize_speech_config]
when invoking API calls. Your agent will use the
pre-configured options for speech synthesizing.
is not specified.
"""

synthesize_speech_configs: MutableMapping[
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/dialogflowcx_v3beta1/types/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,8 @@ class TestRunDifference(proto.Message):
type_ (google.cloud.dialogflowcx_v3beta1.types.TestRunDifference.DiffType):
The type of diff.
description (str):
A description of the diff, showing the actual
output vs expected output.
A human readable description of the diff,
showing the actual output vs expected output.
"""

class DiffType(proto.Enum):
Expand Down
79 changes: 79 additions & 0 deletions google/cloud/dialogflowcx_v3beta1/types/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,68 @@ class GenericWebService(proto.Message):
-signkey example.com.key \
-out example.com.crt \
-extfile <(printf "\nsubjectAltName='DNS:www.example.com'")
webhook_type (google.cloud.dialogflowcx_v3beta1.types.Webhook.GenericWebService.WebhookType):
Optional. Type of the webhook.
http_method (google.cloud.dialogflowcx_v3beta1.types.Webhook.GenericWebService.HttpMethod):
Optional. HTTP method for the flexible
webhook calls. Standard webhook always uses
POST.
request_body (str):
Optional. Defines a custom JSON object as
request body to send to flexible webhook.
parameter_mapping (MutableMapping[str, str]):
Optional. Maps the values extracted from
specific fields of the flexible webhook response
into session parameters. - Key: session
parameter name
- Value: field path in the webhook response
"""

class WebhookType(proto.Enum):
r"""Represents the type of webhook configuration.
Values:
WEBHOOK_TYPE_UNSPECIFIED (0):
Default value. This value is unused.
STANDARD (1):
Represents a standard webhook.
FLEXIBLE (2):
Represents a flexible webhook.
"""
WEBHOOK_TYPE_UNSPECIFIED = 0
STANDARD = 1
FLEXIBLE = 2

class HttpMethod(proto.Enum):
r"""HTTP method to use when calling webhooks.
Values:
HTTP_METHOD_UNSPECIFIED (0):
HTTP method not specified.
POST (1):
HTTP POST Method.
GET (2):
HTTP GET Method.
HEAD (3):
HTTP HEAD Method.
PUT (4):
HTTP PUT Method.
DELETE (5):
HTTP DELETE Method.
PATCH (6):
HTTP PATCH Method.
OPTIONS (7):
HTTP OPTIONS Method.
"""
HTTP_METHOD_UNSPECIFIED = 0
POST = 1
GET = 2
HEAD = 3
PUT = 4
DELETE = 5
PATCH = 6
OPTIONS = 7

uri: str = proto.Field(
proto.STRING,
number=1,
Expand All @@ -140,6 +200,25 @@ class GenericWebService(proto.Message):
proto.BYTES,
number=5,
)
webhook_type: "Webhook.GenericWebService.WebhookType" = proto.Field(
proto.ENUM,
number=6,
enum="Webhook.GenericWebService.WebhookType",
)
http_method: "Webhook.GenericWebService.HttpMethod" = proto.Field(
proto.ENUM,
number=7,
enum="Webhook.GenericWebService.HttpMethod",
)
request_body: str = proto.Field(
proto.STRING,
number=8,
)
parameter_mapping: MutableMapping[str, str] = proto.MapField(
proto.STRING,
proto.STRING,
number=9,
)

class ServiceDirectoryConfig(proto.Message):
r"""Represents configuration for a `Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
"version": "1.21.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dialogflow-cx",
"version": "1.21.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/gapic/dialogflowcx_v3/test_environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -3966,6 +3966,10 @@ def test_create_environment_rest(request_type):
b"allowed_ca_certs_blob1",
b"allowed_ca_certs_blob2",
],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {
"service": "service_value",
Expand Down Expand Up @@ -4184,6 +4188,10 @@ def test_create_environment_rest_bad_request(
b"allowed_ca_certs_blob1",
b"allowed_ca_certs_blob2",
],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {
"service": "service_value",
Expand Down Expand Up @@ -4316,6 +4324,10 @@ def test_update_environment_rest(request_type):
b"allowed_ca_certs_blob1",
b"allowed_ca_certs_blob2",
],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {
"service": "service_value",
Expand Down Expand Up @@ -4535,6 +4547,10 @@ def test_update_environment_rest_bad_request(
b"allowed_ca_certs_blob1",
b"allowed_ca_certs_blob2",
],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {
"service": "service_value",
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/gapic/dialogflowcx_v3/test_webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,10 @@ def test_create_webhook_rest(request_type):
"password": "password_value",
"request_headers": {},
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {"service": "service_value", "generic_web_service": {}},
"timeout": {"seconds": 751, "nanos": 543},
Expand Down Expand Up @@ -2884,6 +2888,10 @@ def test_create_webhook_rest_bad_request(
"password": "password_value",
"request_headers": {},
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {"service": "service_value", "generic_web_service": {}},
"timeout": {"seconds": 751, "nanos": 543},
Expand Down Expand Up @@ -2995,6 +3003,10 @@ def test_update_webhook_rest(request_type):
"password": "password_value",
"request_headers": {},
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {"service": "service_value", "generic_web_service": {}},
"timeout": {"seconds": 751, "nanos": 543},
Expand Down Expand Up @@ -3189,6 +3201,10 @@ def test_update_webhook_rest_bad_request(
"password": "password_value",
"request_headers": {},
"allowed_ca_certs": [b"allowed_ca_certs_blob1", b"allowed_ca_certs_blob2"],
"webhook_type": 1,
"http_method": 1,
"request_body": "request_body_value",
"parameter_mapping": {},
},
"service_directory": {"service": "service_value", "generic_web_service": {}},
"timeout": {"seconds": 751, "nanos": 543},
Expand Down
Loading

0 comments on commit ba8d7d3

Please sign in to comment.