diff --git a/atlassian/confluence.py b/atlassian/confluence.py index 499d2ab34..c108526f5 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -85,6 +85,33 @@ def get_page_child_by_type(self, page_id, type='page', start=None, limit=None): return response.get('results') + def get_child_title_list(self, page_id, type='page', start=None, limit=None): + """ + Find a list of Child title + :param page_id: A string containing the id of the type content container. + :param type: + :param start: OPTIONAL: The start point of the collection to return. Default: None (0). + :param limit: OPTIONAL: how many items should be returned after the start index. Default: Site limit 200. + :return: + """ + child_page = self.get_page_child_by_type(page_id, type, start, limit) + child_title_list = [child['title'] for child in child_page] + return child_title_list + + def get_child_id_list(self, page_id, type='page', start=None, limit=None): + """ + Find a list of Child id + :param page_id: A string containing the id of the type content container. + :param type: + :param start: OPTIONAL: The start point of the collection to return. Default: None (0). + :param limit: OPTIONAL: how many items should be returned after the start index. Default: Site limit 200. + :return: + """ + child_page = self.get_page_child_by_type(page_id, type, start, limit) + child_id_list = [child['id'] for child in child_page] + return child_id_list + + def get_child_pages(self, page_id): """ Get child pages for the provided page_id @@ -117,6 +144,21 @@ def get_parent_content_id(self, page_id): log.error(e) return parent_content_id + def get_parent_content_title(self, page_id): + """ + Provide parent content title from page id + :type page_id: str + :return: + """ + parent_content_title = None + try: + parent_content_title = ( + (self.get_page_by_id(page_id=page_id, expand='ancestors').get('ancestors') or {})[-1].get( + 'title') or None) + except Exception as e: + log.error(e) + return parent_content_title + def get_page_space(self, page_id): """ Provide space key from content id