Skip to content

Commit 14f4235

Browse files
jaromieeeabloemert
authored andcommitted
updated get_file_list method for folder support (#955)
* updated get_file_list method for folder support * Update atlassian/bitbucket/__init__.py Co-authored-by: Arnold Bloemert <abloemert@gmail.com> * fix black error * Update atlassian/bitbucket/__init__.py Co-authored-by: Arnold Bloemert <abloemert@gmail.com> Co-authored-by: Arnold Bloemert <abloemert@gmail.com>
1 parent 15e15b2 commit 14f4235

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

atlassian/bitbucket/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2166,20 +2166,31 @@ def create_code_insights_report(
21662166
data.update(report_params)
21672167
return self.put(url, data=data)
21682168

2169-
def get_file_list(self, project_key, repository_slug, query=None, start=0, limit=None):
2169+
def get_file_list(
2170+
self,
2171+
project_key,
2172+
repository_slug,
2173+
sub_folder=None,
2174+
query=None,
2175+
start=0,
2176+
limit=None,
2177+
):
21702178
"""
21712179
Retrieve a page of files from particular directory of a repository.
21722180
The search is done recursively, so all files from any sub-directory of the specified directory will be returned.
21732181
The authenticated user must have REPO_READ permission for the specified repository to call this resource.
21742182
:param start:
21752183
:param project_key:
21762184
:param repository_slug:
2185+
:param sub_folder: a sub folder in the target repository to list the files from.
21772186
:param query: the commit ID or ref (e.g. a branch or tag) to list the files at.
21782187
If not specified the default branch will be used instead.
21792188
:param limit: OPTIONAL
21802189
:return:
21812190
"""
21822191
url = "{}/files".format(self._url_repo(project_key, repository_slug))
2192+
if sub_folder:
2193+
url = "{}/{}".format(url, sub_folder.lstrip("/"))
21832194
params = {}
21842195
if query:
21852196
params["at"] = query

0 commit comments

Comments
 (0)