Skip to content

Commit f9ba2d3

Browse files
Gonchik TsymzhitovGonchik Tsymzhitov
authored andcommitted
Provide 2 methods with semantic correct naming
1 parent 78b39b4 commit f9ba2d3

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

atlassian/confluence.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,40 @@ def get_page_space(self, page_id):
104104
"""
105105
return ((self.get_page_by_id(page_id, expand='space') or {}).get('space') or {}).get('key')
106106

107-
def get_page_by_title(self, space, title, expand=None):
107+
def get_pages_by_title(self, space, title, start=0, limit=200, expand=None):
108108
"""
109-
Returns the list of labels on a piece of Content.
109+
Provide pages by title search
110110
:param space: Space key
111111
:param title: Title of the page
112+
:param start: OPTIONAL: The start point of the collection to return. Default: None (0).
113+
:param limit: OPTIONAL: The limit of the number of labels to return, this may be restricted by
114+
fixed system limits. Default: 200.
115+
:param expand: OPTIONAL: expand e.g. history
116+
:return: The JSON data returned from searched results the content endpoint, or the results of the
117+
callback. Will raise requests.HTTPError on bad input, potentially.
118+
If it has IndexError then return the None.
119+
"""
120+
return self.get_page_by_title(space, title, start, limit, expand)
121+
122+
def get_page_by_title(self, space, title, start=0, limit=1, expand=None):
123+
"""
124+
Returns the first page on a piece of Content.
125+
:param space: Space key
126+
:param title: Title of the page
127+
:param start: OPTIONAL: The start point of the collection to return. Default: None (0).
128+
:param limit: OPTIONAL: The limit of the number of labels to return, this may be restricted by
129+
fixed system limits. Default: 1.
112130
:param expand: OPTIONAL: expand e.g. history
113131
:return: The JSON data returned from searched results the content endpoint, or the results of the
114132
callback. Will raise requests.HTTPError on bad input, potentially.
115133
If it has IndexError then return the None.
116134
"""
117135
url = 'rest/api/content'
118-
params = {
119-
'start': '0',
120-
'limit': '1'
121-
}
136+
params = {}
137+
if start is not None:
138+
params['start'] = int(start)
139+
if limit is not None:
140+
params['limit'] = int(limit)
122141
if expand is not None:
123142
params['expand'] = expand
124143
if space is not None:

0 commit comments

Comments
 (0)