Skip to content

Commit 9165802

Browse files
authored
[Confluence] get_all_spaces extend parameters (#690)
* Update confluence.py Changed return of get_all_spaces to be able to paginate it and use start and limit params * Update confluence.py * Update confluence.py
1 parent a2d1fb8 commit 9165802

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

atlassian/confluence.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,12 +758,14 @@ def get_all_templates_from_space(self, space, start=0, limit=20, expand=None):
758758

759759
return response.get("results") or []
760760

761-
def get_all_spaces(self, start=0, limit=500, expand=None):
761+
def get_all_spaces(self, start=0, limit=500, expand=None, space_type=None, space_status=None):
762762
"""
763763
Get all spaces with provided limit
764764
:param start: OPTIONAL: The start point of the collection to return. Default: None (0).
765765
:param limit: OPTIONAL: The limit of the number of pages to return, this may be restricted by
766766
fixed system limits. Default: 500
767+
:param space_type: OPTIONAL: Filter the list of spaces returned by type (global, personal)
768+
:param space_status: OPTIONAL: Filter the list of spaces returned by status (current, archived)
767769
:param expand: OPTIONAL: additional info, e.g. metadata, icon, description, homepage
768770
"""
769771
url = "rest/api/space"
@@ -774,7 +776,11 @@ def get_all_spaces(self, start=0, limit=500, expand=None):
774776
params["limit"] = limit
775777
if expand:
776778
params["expand"] = expand
777-
return (self.get(url, params=params) or {}).get("results")
779+
if space_type:
780+
params["type"] = space_type
781+
if space_status:
782+
params["status"] = space_status
783+
return self.get(url, params=params)
778784

779785
def add_comment(self, page_id, text):
780786
"""

0 commit comments

Comments
 (0)