Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions dialogflow/set_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

# [START dialogflow_set_agent_sample]

from google.cloud.dialogflow_v2 import Agent, AgentsClient
from google.cloud.dialogflow_v2 import Agent, AgentsClient, SetAgentRequest
import google.protobuf.field_mask_pb2


def set_agent(project_id, display_name):
Expand All @@ -30,9 +30,13 @@ def set_agent(project_id, display_name):
time_zone="America/Los_Angeles",
)

response = agents_client.set_agent(request={"agent": agent})

return response
update_mask = google.protobuf.field_mask_pb2.FieldMask()
update_mask.FromJsonString('displayName,defaultLanguageCode,timeZone')

request = SetAgentRequest(
agent=agent,
update_mask=update_mask,
)

return agents_client.set_agent(request=request)
# [END dialogflow_set_agent_sample]