def fetch_tabs()

in ees_microsoft_teams/microsoft_teams_user_messages.py [0:0]


    def fetch_tabs(self, chat_id, ids_list, start_time, end_time):
        """Fetches user chat tabs from the Microsoft Teams
        :param chat_id: Id of the chat
        :param ids_list: List of ids
        :param start_time: Starting time for fetching data
        :param end_time: Ending time for fetching data
        Returns:
            documents: Documents to be indexed in Workplace Search
        """
        try:
            documents = []
            tab_detail_response = self.client.get_user_chat_tabs(
                f"{constant.GRAPH_BASE_URL}/chats/{chat_id}/tabs",
                start_time, end_time, chat_id
            )

            if tab_detail_response:
                tab_schema = get_schema_fields("user_tabs", self.object_type_to_index)
                for tab in tab_detail_response:
                    tab_dict = {"type": USER_CHAT_TABS}
                    for ws_field, ms_fields in tab_schema.items():
                        tab_dict[ws_field] = tab[ms_fields]
                    tab_dict["url"] = tab["configuration"]["websiteUrl"]

                    tab_dict["_allow_permissions"] = []
                    if self.is_permission_sync_enabled:
                        tab_dict["_allow_permissions"] = [chat_id]
                    documents.append(tab_dict)
                    self.local_storage.insert_document_into_doc_id_storage(
                        ids_list, tab["id"], USER_CHAT_TABS, chat_id, ""
                    )
            return documents
        except Exception as exception:
            self.logger.exception(
                f"[Fail] Error while fetching user tabs from teams. Error: {exception}"
            )
            raise