in ees_microsoft_teams/microsoft_teams_client.py [0:0]
def get_user_chat_tabs(self, next_url, start_time, end_time, chat_id):
""" Get user chat tabs from the Microsoft Teams with the support of pagination and filtration.
:param next_url: URL to invoke Graph API call
:param start_time: Starting time to fetch user chats tabs
:param end_time: Ending time to fetch user chat tabs
:param chat_id: Chat ID to fetch user chat tabs
"""
response_list = {"value": []}
try:
response_json = self.get(url=next_url, object_type=constant.USER_CHAT_TABS)
if response_json:
# Filter response based on dateAdded
response_value = response_json.get("value")
if response_value:
for tab in response_value:
date_added = tab.get("configuration").get("dateAdded")
if not date_added:
response_list["value"].append(tab)
elif start_time <= date_added <= end_time:
response_list["value"].append(tab)
next_url = response_json.get("@odata.nextLink")
if not next_url:
next_url = None
except Exception as unknown_exception:
self.logger.exception(
f"Error while fetching the Microsoft User Chats Tabs. Error: {unknown_exception}"
)
parsed_response = get_data_from_http_response(
logger=self.logger,
response=response_list,
error_message=f"Could not fetch the User Chats Tabs from Microsoft Teams for chat id: {chat_id}",
exception_message=f"Error while fetching the User Chats Tabs from Microsoft Teams for chat id: {chat_id}",
)
return parsed_response