in ees_microsoft_teams/microsoft_teams_client.py [0:0]
def get_user_chats(self, next_url):
""" Get user chats from the Microsoft Teams with the support of pagination and filtration.
:param next_url: URL to invoke Graph API call
"""
response_list = {"value": []}
is_calling_first_time = True
while next_url:
try:
query = self.query_builder.get_query_for_user_chats().strip()
if is_calling_first_time:
url = f"{next_url}{query}"
is_calling_first_time = False
else:
url = next_url
response_json = self.get(url=url, object_type=constant.CHATS)
response_list["value"].extend(response_json.get("value"))
next_url = response_json.get("@odata.nextLink")
if not next_url or next_url == url:
next_url = None
except Exception as unknown_exception:
self.logger.exception(
f"Error while fetching user chats from the Microsoft Teams. Error: {unknown_exception}"
)
parsed_response = get_data_from_http_response(
logger=self.logger,
response=response_list,
error_message="Could not fetch the User Chats from Microsoft Teams",
exception_message="Error while fetching the User Chats from Microsoft Teams",
)
return parsed_response