Skip to content

Commit

Permalink
delete_agent updated
Browse files Browse the repository at this point in the history
  • Loading branch information
MRyderOC authored Nov 21, 2023
1 parent 623398f commit 4860b5a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/dfcx_scrapi/core/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,20 +505,21 @@ def update_agent(
return response

@scrapi_base.api_call_counter_decorator
def delete_agent(self, agent_id: str) -> str:
def delete_agent(self, agent_id: str = None, obj: types.Agent = None):
"""Deletes the specified Dialogflow CX Agent.
Args:
agent_id: CX Agent ID string in the following format
projects/<PROJECT ID>/locations/<LOCATION ID>/agents/<AGENT ID>
Returns:
String "Agent '(agent_id)' successfully deleted."
obj: (Optional) a CX Agent object of types.Agent
"""
if not agent_id:
agent_id = self.agent_id

if obj:
agent_id = obj.name

client_options = self._set_region(agent_id)
client = services.agents.AgentsClient(
credentials=self.creds, client_options=client_options
)
credentials=self.creds, client_options=client_options)
client.delete_agent(name=agent_id)

return "Agent '{agent_id}' successfully deleted."

0 comments on commit 4860b5a

Please sign in to comment.