dfcx-scrapi
dfcx-scrapi copied to clipboard
[BUG] update_webhook doesn't work properly when you pass a webhook_obj
Expected Behavior
Update the webhook in the target agent.
Current Behavior
Does not perform any action.
Possible Solution
based on https://github.com/googleapis/python-dialogflow-cx/blob/f2d12c53804dec7b236509aa29b200aebcc53c8a/google/cloud/dialogflowcx_v3beta1/types/webhook.py#L305-L308
we have to update the mask
only if the kwargs
pass to the function and not when we pass the webhook_obj
.
Steps to Reproduce
- Create a webhook in the agent.
- Pull the webhook using
list_webhooks
method indfcx_scrapi.core.webhoks.Webhooks
- Change an attribute of the webhook e.g.
timeout
from datetime import timedelta
my_webhook.timeout = timedelta(seconds=12)
- Update the webhook
webhook_instance.update_webhook(
webhook_id=my_webhook.name,
webhook_obj=my_webhook
)
Possible Implementation
mask = None
if kwargs:
... # existing code
mask = field_mask_pb2.FieldMask(paths=paths)
... # existing code
if mask:
request.update_mask = mask
... # existing code