Skip to content

Commit

Permalink
Fixes #276
Browse files Browse the repository at this point in the history
Feature: Add `language_code` support for `list_transition_route_groups`.
  • Loading branch information
hjosiah committed Jan 23, 2025
1 parent 49788d8 commit 5bbbf74
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/dfcx_scrapi/core/transition_route_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import logging
import time
from typing import Dict
from typing import Dict, List

import pandas as pd
from google.cloud.dialogflowcx_v3beta1 import services, types
Expand Down Expand Up @@ -44,6 +44,7 @@ def __init__(
route_group_id: str = None,
flow_id: str = None,
agent_id: str = None,
language_code: str = "en"
):
super().__init__(
creds_path=creds_path,
Expand All @@ -67,6 +68,7 @@ def __init__(
if agent_id:
self.agent_id = agent_id

self.language_code = language_code
self._get_agent_level_data_only = False

def _rg_temp_dict_update(self, temp_dict, element):
Expand Down Expand Up @@ -132,7 +134,9 @@ def get_route_groups_map(self, flow_id: str = None, reverse=False):
return pages_dict

@scrapi_base.api_call_counter_decorator
def list_transition_route_groups(self, flow_id: str = None):
def list_transition_route_groups(
self, flow_id: str = None, language_code: str = None
) -> List[types.TransitionRouteGroup]:
"""Exports List of all Route Groups in the specified CX Flow ID.
Args:
Expand All @@ -149,6 +153,12 @@ def list_transition_route_groups(self, flow_id: str = None):
)
request.parent = flow_id

# prefer method inputs over class level inputs
if language_code:
request.language_code = language_code
else:
request.language_code = self.language_code

client_options = self._set_region(flow_id)
client = services.transition_route_groups.TransitionRouteGroupsClient(
credentials=self.creds, client_options=client_options
Expand Down

0 comments on commit 5bbbf74

Please sign in to comment.